Protocol
Binary protocol message IDs.
Mirrors omnitiles/src/protocol/messages.rs — keep these in sync with the
firmware. Packet format:
[START_BYTE] [msg_id] [payload…] [checksum]
checksum is the 8-bit sum of msg_id and all payload bytes.
- class omnitiles.protocol.messages.MessageId(*values)[source]
Bases:
IntEnumProtocol message identifiers.
- M1_EXTEND = 48
- M1_RETRACT = 49
- M1_BRAKE = 50
- M1_SET_POSITION = 51
- M2_EXTEND = 64
- M2_RETRACT = 65
- M2_BRAKE = 66
- M2_SET_POSITION = 67
- PING = 80
- TELEMETRY = 96
- BASE_VELOCITY = 112
- BASE_BRAKE = 113
Packet encoding for outbound commands.
- omnitiles.protocol.packet.checksum(msg_id, payload=b'')[source]
Return the 8-bit protocol checksum for a message.
The checksum is
(msg_id + sum(payload)) & 0xFF.- Parameters:
msg_id (
int)payload (
bytes)
- Return type:
int
- omnitiles.protocol.packet.encode(msg_id, payload=b'')[source]
Encode a command packet.
- Parameters:
msg_id (
int|MessageId) – Message identifier. AcceptsMessageIdor a raw int.payload (
bytes|Iterable[int]) – Zero or more payload bytes.
- Return type:
bytes- Returns:
A
bytesobject[START_BYTE, msg_id, *payload, checksum]ready to be written to a transport.
Stateful parser for inbound telemetry frames.
- class omnitiles.protocol.parser.StreamParser[source]
Bases:
objectFeed BLE notification bytes in, get
Telemetryframes out.The parser maintains an internal byte buffer and hunts for
0xA5 0x60packets. Because telemetry packets don’t carry an explicit length byte, the parser identifies variants by total length and validates the checksum. Invalid/corrupt frames are silently skipped.