Expand description
Layer 2: sans-I/O session state machine.
Owns the sync counter, the outbound queue, and the inbound ASCII line
parser. Callers drive it with feed / poll_outbound / poll_event /
tick, plumbing the bytes through any I/O of their choice.
§Lifecycle
- Caller writes the ASCII trigger
b"M28B1\n"to the device. - Caller calls
Session::connect, drainspoll_outbound, writes those bytes to the device. - Caller reads bytes from the device and pushes them via
Session::feed. - Caller drains
Session::poll_eventuntilEvent::Syncedis observed — the device has acknowledged the SYNC and reported its block size and protocol version. - Caller calls
Session::sendfor each subsequent binary packet, pumpingpoll_outbound/feed/poll_eventas before, callingSession::tickperiodically so retransmits fire on timeout.
§Concurrency model
Mirrors the Python reference: only one packet is in flight at a time.
Calls to Session::send while a packet is in flight are queued FIFO
and dispatched as each ack arrives.
Structs§
- Session
- Sans-I/O session driver.
Enums§
- Event
- Things the session emits to the caller as parsed bytes arrive.