|
TinyRobotics
|
Wrapper class that can turn any Stream into a thread save implementation. This is done by adding a Mutex to the Stream. The read and write operations are buffered and the access to the stream is protected by the Mutex. More...
#include <SynchronizedStream.h>


Public Member Functions | |
| SynchronizedStream (Stream &stream, MutexBase &mutex) | |
| int | read () override |
| int | peek () override |
| size_t | write (uint8_t data) override |
| int | available () override |
| int | availableForWrite () override |
| void | setBufferSize (int size) |
| Defines the size of the internal buffers. | |
Protected Attributes | |
| Stream * | p_stream = nullptr |
| MutexBase * | p_mutex = nullptr |
| SingleBuffer< uint8_t > | read_buffer |
| SingleBuffer< uint8_t > | write_buffer |
Wrapper class that can turn any Stream into a thread save implementation. This is done by adding a Mutex to the Stream. The read and write operations are buffered and the access to the stream is protected by the Mutex.