48 Server(
size_t buffer_length);
只读原始数据视图 / Immutable raw data view
微秒时间戳 / Microsecond timestamp
红黑树的泛型数据节点,继承自 BaseNode (Generic data node for Red-Black Tree, inheriting from BaseNode).
红黑树实现,支持泛型键和值,并提供线程安全操作 (Red-Black Tree implementation supporting generic keys and values with thread...
可写原始数据视图 / Mutable raw data view
将字节流解析成 packet 并发布到已注册 topic 的状态机 / State machine that parses byte streams into packets and publishes...
size_t ParseDataRaw(ConstRawData data, bool from_callback, bool in_isr)
ParseData*() 的共享实现 / Shared implementation behind ParseData*()
RBTree< uint32_t > topic_map_
void Register(TopicHandle topic)
注册一个可接收 packet 的 topic / Register one topic that may receive parsed packets
void ResetParser()
清空当前包的解析上下文并回到找起点状态 / Clear the current packet parsing context and return to the start-search state
size_t ParseData(ConstRawData data)
在普通上下文里喂入一批新字节 / Feed one new byte batch in normal context
QueueBase queue_
输入字节 FIFO。Input byte FIFO.
ParseResult
一次 payload 阶段处理结果 / Result of one payload-stage handling step
@ DROPPED
当前包被丢弃。Current packet is dropped.
@ NEED_MORE
当前包还没收全。Current packet is still incomplete.
@ DELIVERED
当前包已发布。Current packet is delivered.
size_t ParseDataFromCallback(ConstRawData data, bool in_isr)
在回调/ISR 路径里喂入一批新字节 / Feed one new byte batch in callback/ISR path
TopicHandle current_topic_
当前包命中的目标 topic。Target topic matched by the current packet.
MicrosecondTimestamp current_timestamp_
uint32_t data_len_
当前包头声明的 payload 长度。Payload length declared by the current header.
bool ReadHeader()
在已对齐前缀后继续读取并校验完整头部 / Read and validate the full header after the prefix is aligned
Status
parser 当前所在阶段 / Current stage of the parser
@ WAIT_START
正在找下一包前缀。Searching for the next packet prefix.
bool SyncToPacketStart()
把输入流同步到下一条 packet 起点 / Synchronize the input stream to the next packet start
Server(size_t buffer_length)
构造 parser 并分配内部暂存队列 / Construct the parser and allocate its internal staging queue
Status status_
当前 parser 阶段。Current parser stage.
ParseResult ReadPayload(bool from_callback, bool in_isr)
读取当前包的 payload 和尾 CRC,并在成功时发布 / Read the payload and trailing CRC of the current packet and publish i...