Module frame

Module frame 

Source
Expand description

ULCP frame grammar.

A frame is a one-byte header, a one-byte command identifier, and a command-defined payload. Frame length is provided by the framing layer (see crate::hdlc for asynchronous serial links).

Structs§

Frame
A parsed frame borrowing its payload from the input.
FrameWriter
Incremental frame builder over a caller-provided buffer.
Header
Validated frame header byte.
MultiEntries
Iterator over the entries of a CMD_PROP_MULTI_SET or CMD_PROP_ARE payload.
MultiEntry
One entry of a CMD_PROP_MULTI_SET or CMD_PROP_ARE payload.
MultiGetKeys
Iterator over the property identifiers of a CMD_PROP_MULTI_GET payload.
PropPayload
Payload of CMD_PROP_GET, CMD_PROP_SET, and CMD_PROP_IS.
StreamPayload
Payload of CMD_STR_SEND and CMD_STR_RECV.

Enums§

Cmd
Command identifiers defined by the minimal and full specs.
ParseError
WriteError

Constants§

HEADER_FLG_MASK
Mask of the two most significant header bits (the FLG field).
HEADER_FLG_PATTERN
Required value of the FLG field (0b10 in the top two bits).
HEADER_RESERVED_MASK
Mask of the three reserved header bits, which must be zero.
HEADER_TID_MASK
Mask of the three-bit transaction identifier.
TID_MAX
Largest usable transaction identifier.
TID_UNSOLICITED
TID reserved for unsolicited commands and stream traffic.

Functions§

ble_clear_bonds
Encode a CMD_BLE_CLEAR_BONDS frame (no payload). The device answers once the bonds are gone, which over Bluetooth is the last thing the sender hears before it is dropped.
clear
Encode a CMD_CLEAR frame (no payload).
entry_len
Space a multi-property entry occupies, its length prefix included.
factory_reset
Encode a CMD_FACTORY_RESET frame (no payload). The device erases all mutable state and reboots without replying.
last_status
Encode a CMD_PROP_IS frame carrying PROP_LAST_STATUS.
nop
Encode a CMD_NOP frame.
prop_are
Begin a CMD_PROP_ARE frame, to which the caller appends entries with FrameWriter::write_entry and FrameWriter::write_status_entry.
prop_get
Encode a CMD_PROP_GET frame.
prop_insert
Encode a CMD_PROP_INSERT frame. item is one item in the property’s item form, with no length prefix.
prop_inserted
Encode a CMD_PROP_INSERTED frame. digest is the inserted item in the property’s digest form — never in a form containing key material.
prop_is
Encode a CMD_PROP_IS frame.
prop_multi_get
Encode a CMD_PROP_MULTI_GET frame: the property identifiers one after another, with no delimiters.
prop_multi_set
Encode a CMD_PROP_MULTI_SET frame from key and value pairs.
prop_remove
Encode a CMD_PROP_REMOVE frame. selector is the property’s documented item selector, with no length prefix.
prop_removed
Encode a CMD_PROP_REMOVED frame. digest is the removed item in the property’s digest form.
prop_set
Encode a CMD_PROP_SET frame.
queue_drain
Encode a CMD_QUEUE_DRAIN frame (no payload).
reboot
Encode a CMD_REBOOT frame (no payload). The device restarts without replying, keeping everything it has persisted.
reset
Encode a CMD_RST frame.
restore
Encode a CMD_RESTORE frame (no payload).
save
Encode a CMD_SAVE frame (no payload).
str_recv
Encode a CMD_STR_RECV frame. Always uses TID zero.
str_send
Encode a CMD_STR_SEND frame.