Expand description
Matter Interaction Model (IM) message framing — Matter Core Spec §10.
Builders for the IM message envelopes the wire carries
(InvokeRequestMessage, ReadRequestMessage, WriteRequestMessage,
SubscribeRequestMessage, StatusResponseMessage)
and parsers for the responses (InvokeResponseMessage,
ReportDataMessage, WriteResponseMessage, SubscribeResponseMessage).
Callers supply already-encoded cluster TLV payloads (e.g. from
matter-clusters codecs) and compose them with the concrete paths in
path.
Scope: single- and multi-command invoke (the latter via
build_invoke_request_batch / parse_invoke_response_batch with CommandRef
— the controller-side verb + MaxPathsPerInvoke gating are deferred until a
batch-capable device exists), concrete and wildcard read paths, events
(event paths/filters in ReadRequest and SubscribeRequest, EventReportIB
parsing), timed write/invoke (the TimedRequest message + the
TimedRequest flag), no chunked writes (deferred to the ACL/groups work).
Lifted from matter-commissioning in M7.1 (the M6.6 design kept this
module free of state-machine dependencies for exactly this move).
Byte-parity with matter.js is enforced by tests/im_byte_parity.rs
against fixtures captured via cargo xtask capture-im.
Re-exports§
pub use error::ImError;pub use event::EventFilter;pub use event::EventPath;pub use event::EventPriority;pub use event::EventReport;pub use event::EventReportItem;pub use event::EventTimestamp;pub use invoke::build_invoke_request;pub use invoke::build_invoke_request_batch;pub use invoke::build_invoke_request_group;pub use invoke::build_invoke_request_timed;pub use invoke::parse_invoke_response;pub use invoke::parse_invoke_response_batch;pub use invoke::InvokeResponse;pub use invoke::InvokeResponseEntry;pub use invoke_server::build_invoke_response_command;pub use invoke_server::build_invoke_response_status;pub use invoke_server::parse_invoke_request;pub use invoke_server::InvokedCommand;pub use invoke_server::ParsedInvokeRequest;pub use path::AttributePath;pub use path::CommandPath;pub use path::ReadPath;pub use read::build_read_request;pub use read::build_read_request_full;pub use read::build_read_request_paths;pub use read::parse_report_data;pub use read::AttributeReportItem;pub use read::ReportData;pub use read::ReportOp;pub use status::parse_status_response;pub use status::ImStatus;pub use subscription::build_status_response;pub use subscription::build_subscribe_request;pub use subscription::parse_subscribe_response;pub use subscription::SubscribeRequest;pub use subscription::SubscribeResponse;pub use timed::build_timed_request;pub use write::build_list_write_chunks;pub use write::build_write_request;pub use write::build_write_request_timed;pub use write::parse_write_response;pub use write::AttributeWriteRequest;
Modules§
- error
- Error type for Interaction Model framing.
- event
- Matter event paths, filters, and reports —
EventPathIB/EventFilterIB/EventDataIB/EventReportIB(Matter §10.6 / Appendix A). - invoke
InvokeRequestMessage/InvokeResponseMessageframing — Matter §10.7.- invoke_
server - Server-side
Invokeframing — the inverse ofcrate::invoke’s client codecs. A controller never had to read an inboundInvokeRequestMessageor write anInvokeResponseMessage; an OTA Provider (M9-F) does both. - path
- Concrete IM paths:
CommandPathIBandAttributePathIB— Matter Appendix A.6. - read
ReadRequestMessage/ReportDataMessageframing — Matter §10.6.- status
- Interaction Model status codes — Matter Core Spec §8.10 (Status Codes).
- subscription
SubscribeRequestMessage/SubscribeResponseMessage/StatusResponseMessageframing — Matter §10.6 (subscription interaction).- timed
TimedRequestMessageframing — Matter §8.7 (timed interactions).- write
WriteRequestMessage/WriteResponseMessageframing — Matter §10.6.
Structs§
- Report
Accumulator - Accumulates attribute reports across chunked
ReportDatamessages and produces the final concrete(path, value)set.
Constants§
- DEFAULT_
MAX_ BYTES - Default ceiling on the estimated total in-memory byte size of accumulated values.
- DEFAULT_
MAX_ ELEMENTS - Default ceiling on the number of distinct accumulated attribute elements.
- IM_
REVISION - Interaction Model protocol revision emitted at context tag
0xFFin every top-level IM message. Confirmed against the matter.js byte-parity fixture (seetests/im_byte_parity.rs); bump only when a captured fixture proves matter.js changed it.
Functions§
- expect_
message_ struct - Assert the reader’s first element is an anonymous message struct and consume its start.
- read_
container_ members - Reader positioned just after a container start: consume to its matching
end, returning the members as
(tag, value)pairs (for List/Structure). Calling this with the reader in any other position yields anerror::ImErroror misattributed members — never a panic or UB. - read_
container_ value - Reader positioned just after a container start (of
kind): read the whole sub-tree into aValue. Calling this with the reader in any other position yields anerror::ImErroror misattributed members — never a panic or UB. - skip_
container - Reader positioned just after a container start: discard the whole
sub-tree (used to skip fields we do not consume). Calling this with the
reader in any other position yields an
error::ImErroror misattributed members — never a panic or UB.