Incremental receiver for the SLIP-like MsgPack framing used on the bridge serial link.
More...
#include <msgpack_serial_framing.hpp>
|
| | MsgPackFrameReceiver (char *buffer, uint16_t capacity) noexcept |
| | Construct one incremental MsgPack frame receiver around caller-owned storage.
|
| |
| void | reset () noexcept |
| | Forget the current receive state and return to the idle state.
|
| |
| void | resetIfIdle (uint32_t nowMs, uint32_t idleTimeoutMs) noexcept |
| | Drop a partially received frame that has been silent for too long.
|
| |
| auto | consumeByte (uint8_t byte, uint32_t nowMs) -> MsgPackFrameConsumeResult |
| | Feed one raw serial byte into the framed MsgPack receiver.
|
| |
| auto | frameData () const -> const uint8_t * |
| | Return the beginning of the completed payload buffer.
|
| |
| auto | frameLength () const -> uint16_t |
| | Return the current payload length assembled by the receiver.
|
| |
Incremental receiver for the SLIP-like MsgPack framing used on the bridge serial link.
◆ MsgPackFrameReceiver()
| lsh::core::transport::MsgPackFrameReceiver::MsgPackFrameReceiver |
( |
char * |
buffer, |
|
|
uint16_t |
capacity |
|
) |
| |
|
noexcept |
Construct one incremental MsgPack frame receiver around caller-owned storage.
- Parameters
-
| buffer | destination storage used for the deframed payload bytes. |
| capacity | maximum number of payload bytes that fit in buffer. |
◆ consumeByte()
Feed one raw serial byte into the framed MsgPack receiver.
The transport format is END + escaped(payload) + END. The receiver therefore understands only the delimiter and the two escaped reserved bytes; the payload itself remains pure MsgPack.
- Parameters
-
| byte | raw serial byte just read from the UART. |
| nowMs | current real-time tick in milliseconds. |
- Returns
- MsgPackFrameConsumeResult describing whether a frame became ready or one malformed frame has just been dropped.
◆ frameData()
| auto lsh::core::transport::MsgPackFrameReceiver::frameData |
( |
| ) |
const -> const uint8_t * |
Return the beginning of the completed payload buffer.
- Returns
- const std::uint8_t * pointer to the first deframed payload byte.
◆ frameLength()
| auto lsh::core::transport::MsgPackFrameReceiver::frameLength |
( |
| ) |
const -> uint16_t |
Return the current payload length assembled by the receiver.
- Returns
- std::uint16_t number of valid payload bytes currently stored in
frameBuffer.
◆ reset()
| void lsh::core::transport::MsgPackFrameReceiver::reset |
( |
| ) |
|
|
noexcept |
Forget the current receive state and return to the idle state.
The destination buffer content is left untouched because callers trust only the first frameLength() bytes after FrameComplete.
◆ resetIfIdle()
| void lsh::core::transport::MsgPackFrameReceiver::resetIfIdle |
( |
uint32_t |
nowMs, |
|
|
uint32_t |
idleTimeoutMs |
|
) |
| |
|
noexcept |
Drop a partially received frame that has been silent for too long.
This timeout is only a housekeeping guard for truncated frames. It is not part of the framing itself and never defines frame boundaries.
- Parameters
-
| nowMs | current real-time tick in milliseconds. |
| idleTimeoutMs | maximum allowed silence while one frame is in progress. |
The documentation for this class was generated from the following files: