|
| IHdlcLinkLayer (void *buffer, int size) |
|
bool | begin (on_frame_read_cb_t onReadCb, on_frame_send_cb_t onSendCb, void *udata) override |
| The method initializes the link layer protocol, and connects custom callbacks to link layer. More...
|
|
void | end () override |
| Stops link layer protocol.
|
|
bool | put (void *buf, int size, uint32_t timeout) override |
| Puts new data for sending over the link layer. More...
|
|
void | flushTx () override |
| Flush tx operation if possible.
|
|
hdlc_crc_t | getCrc () |
|
void | setCrc (hdlc_crc_t crc) |
|
void | setBuffer (void *buffer, int size) |
|
virtual void | runRx ()=0 |
| Runs rx part of the protocol. More...
|
|
virtual void | runTx ()=0 |
| Runs tx part of the protocol. More...
|
|
void | setTimeout (uint32_t timeout) |
| Sets timeout of Rx/Tx operations in milliseconds for the link layer protocol. More...
|
|
uint32_t | getTimeout () |
| Returns current timeout of Rx/Tx operations.
|
|
int | getMtu () |
| Returns current mtu for the link layer protocol in bytes.
|
|
void | setMtu (int mtu) |
| Set protocol mtu (maximum transmission unit) payload. More...
|
|
virtual | ~ILinkLayer ()=default |
| Default virtual destructor.
|
|
|
int | parseData (const uint8_t *data, int size) |
|
int | getData (uint8_t *data, int size) |
|
◆ begin()
The method initializes the link layer protocol, and connects custom callbacks to link layer.
Once the new frame is received, onReadCb will be called, once frame is sent onSendCb will be called.
- Parameters
-
onReadCb | callback to call when a frame is received. Remember that processing must be as quick as possible |
onSendCb | callback to call when a frame is sent. |
udata | user defined data, will be passed to callbacks |
- Returns
- true if successful, false is initialization error happened.
Implements tinyproto::ILinkLayer.
Reimplemented in tinyproto::SerialHdlcLink.
◆ put()
bool tinyproto::IHdlcLinkLayer::put |
( |
void * |
buf, |
|
|
int |
size, |
|
|
uint32_t |
timeout |
|
) |
| |
|
overridevirtual |
Puts new data for sending over the link layer.
- Parameters
-
buf | pointer to the buffer with the data |
size | size of the data in the buffer |
timeout | timeout in milliseconds to wait for operation to complete |
- Returns
- true if the data is successfully put to the queue, false if timeout happened or error
Implements tinyproto::ILinkLayer.
The documentation for this class was generated from the following files: