|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
What a serial device needs from the transport under it. More...
#include <SerialLink.hpp>
Public Types | |
| using | ChunkCallback = std::function<void(std::span<const uint8_t> bytes)> |
| using | StateCallback = std::function<void(EndpointState previous, EndpointState current)> |
| using | TimerToken = uint64_t |
Public Member Functions | |
| virtual size_t | backlog () const =0 |
| Bytes accepted by write() and not yet sent. | |
| virtual void | cancel_post (TimerToken token)=0 |
| Cancel a timer. | |
| virtual void | close ()=0 |
| Close the port. | |
| virtual bool | open (const std::string &path, const SerialLineSettings &line)=0 |
Open the port at path with line. | |
| virtual TimerToken | post_after (std::chrono::milliseconds delay, std::function< void()> callback)=0 |
Run callback once after delay on the link's thread. | |
| virtual bool | send_break ()=0 |
| virtual void | set_chunk_callback (ChunkCallback callback)=0 |
| virtual bool | set_control_lines (std::optional< bool > dtr, std::optional< bool > rts)=0 |
| Set DTR and RTS, each optional so one can change alone. | |
| virtual void | set_state_callback (StateCallback callback)=0 |
| virtual EndpointState | state () const =0 |
| virtual bool | write (std::span< const uint8_t > bytes)=0 |
| virtual | ~ISerialLink ()=default |
What a serial device needs from the transport under it.
One link is one port. Both callbacks run on the link's own thread and never concurrently with each other or with a timer, and both must be set before open(). write() returns whether the bytes were accepted for sending, not delivered.
Definition at line 15 of file SerialLink.hpp.