Expand description
General block transfer (IEC 62056-5-3, 7.3.13): a transport-independent mechanism that carries any (partial) xDLMS APDU in blocks.
E0 | block-control | block-number | block-number-ack | block-data
^ LB|ST|window ^ u16 ^ u16 (acked) ^ A-XDR octet-stringThe block-control octet holds the last-block flag (bit 7), the streaming flag (bit 6) and the window size (bits 5..0).
send and receive drive this codec over any
crate::transport::DataLinkLayer, transparently segmenting an oversized
xDLMS APDU into blocks (and reassembling them on the other end) — an
alternative to the service-specific WITH-DATABLOCK block transfer that
also covers APDU types WITH-DATABLOCK does not, such as DataNotification
and EventNotificationRequest.
Structs§
- General
Block Transfer - A general-block-transfer APDU.
Constants§
- DEFAULT_
BLOCK_ SIZE - Default overall block size (including the header) used when a session enables GBT without specifying one explicitly.
- GENERAL_
BLOCK_ TRANSFER - General-block-transfer APDU tag (
[224]). - HEADER_
MAX - Octets reserved for the GBT header (tag, control, block numbers, and a worst-case long-form length) when budgeting a block’s payload size from an overall frame-size limit.
- LAST_
BLOCK 🔒 - STREAMING 🔒
- WINDOW_
MASK 🔒
Functions§
- applies_
to_ apdu - Returns whether general block transfer applies to this APDU’s service (IEC 62056-5-3 §9.3, Table): GET/SET/ACTION requests and responses, plus DataNotification and EventNotificationRequest.
- read_
block 🔒 - Reads one frame from
linkand decodes it as a general-block-transfer APDU. - receive
- Reassembles a general-block-transfer sequence starting from
first, the already-received first frame (typically the result of the caller’s ownlink.receive_apdu()used to detect theGENERAL_BLOCK_TRANSFERtag), reading further blocks fromlinkas needed. Handles out-of-order and duplicate blocks by requesting retransmission / acking-and-discarding. - send
- Segments
apduinto general-block-transfer blocks of at mostblock_payload_maxoctets each and sends them overlink. In confirmed mode (window > 0), waits for an ack-only GBT frame after each window of blocks and retransmits from the first block the peer has not acknowledged if it reports a gap; withwindow == 0(unconfirmed) orstreaming, no ack is awaited until the caller separately reads a reply. - send_
ack 🔒 - Sends an ack-only general-block-transfer frame (no payload): confirms
receipt up to
block_number_ackand grantswindowfurther blocks.