pub fn build_list_write_chunks(
path: AttributePath,
element_tlvs: &[Vec<u8>],
budget: usize,
timed: bool,
) -> Vec<Vec<u8>>Expand description
Build one or more WriteRequestMessages that write element_tlvs (each a
pre-encoded anonymous-tagged list element) to path as a list, splitting
across messages so each stays within budget unencrypted bytes.
Chunk 0 is a ReplaceAll (path without ListIndex; Data = an array of
the elements that fit). Remaining elements are emitted as AppendItem IBs
(path with ListIndex=null).
When the write fits a single message, the result is one ReplaceAll with
MoreChunkedMessages (ctx3) omitted entirely — byte-identical to
build_write_request(&[AttributeWriteRequest{path, value_tlv: <the full array encoded>}]).
When the write spans multiple messages, MoreChunkedMessages is encoded
explicitly on every chunk: true on all but the last, and an explicit
false on the last. This is required for chip interop: chip’s
WriteHandler::ProcessWriteRequest (connectedhomeip
src/app/WriteHandler.cpp:649-656) initializes its parsed
MoreChunkedMessages from the previous chunk’s stored state before
attempting to read the field, so an absent field on the final chunk
silently inherits true from chunk N-1 and the device never considers the
write transaction finished. Only the single-message (no-chunking) shape
omits the field, matching build_write_request.
An empty element_tlvs yields a single empty-array ReplaceAll.