Skip to main content

Crate matter_interaction

Crate matter_interaction 

Source
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 / InvokeResponseMessage framing — Matter §10.7.
invoke_server
Server-side Invoke framing — the inverse of crate::invoke’s client codecs. A controller never had to read an inbound InvokeRequestMessage or write an InvokeResponseMessage; an OTA Provider (M9-F) does both.
path
Concrete IM paths: CommandPathIB and AttributePathIB — Matter Appendix A.6.
read
ReadRequestMessage / ReportDataMessage framing — Matter §10.6.
status
Interaction Model status codes — Matter Core Spec §8.10 (Status Codes).
subscription
SubscribeRequestMessage / SubscribeResponseMessage / StatusResponseMessage framing — Matter §10.6 (subscription interaction).
timed
TimedRequestMessage framing — Matter §8.7 (timed interactions).
write
WriteRequestMessage / WriteResponseMessage framing — Matter §10.6.

Structs§

ReportAccumulator
Accumulates attribute reports across chunked ReportData messages 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 0xFF in every top-level IM message. Confirmed against the matter.js byte-parity fixture (see tests/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 an error::ImError or 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 a Value. Calling this with the reader in any other position yields an error::ImError or 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::ImError or misattributed members — never a panic or UB.