Expand description
Implementation of the Time Synchronization cluster.
§Cluster-shape selection — endpoint-side, via Options
Each Matter feature (TIME_ZONE, NTP_CLIENT, NTP_SERVER,
TIME_SYNC_CLIENT) is mirrored 1:1 by a bit in the Options
bitflags type, consumed by the cluster const-generic fn which
returns the matching Cluster<'static> metadata.
The shape is picked endpoint-side, on the clusters! /
root_endpoint! macros — e.g. clusters!(eth, time_sync(time_zone, ntp_client); …) — not on the handler. TimeSyncHandler itself
is non-generic and its Self::CLUSTER
is pinned to the empty-options shape; only CLUSTER.id is
actually consulted by the dispatcher, and the per-attribute /
per-command dispatch is driven by what the endpoint advertises.
Spec invariant carried over independently of features: TimeSource
is opted in even in the empty-options shape so the Matter test
harness’s has_attribute(TimeSource) gate on TC_TIMESYNC_2_1
matches and the test runs rather than skipping.
§Pluggable data source — [TimeSync]
The cluster’s mandatory members (UTCTime, Granularity,
TimeSource, and the SetUTCTime command) are handled by
TimeSyncHandler directly against the Matter-wide
Last-Known-Good UTC Time
state — they require no implementor input.
[TimeSync] only carries the feature-gated members
(TIME_ZONE / NTP_CLIENT / NTP_SERVER / TIME_SYNC_CLIENT).
Every method has a “no value” default so impl TimeSync for ()
is a fully usable no-op provider; implementors only override the
methods matching the options they advertised.
Modules§
- client
- Time Synchronization initiator-side client (Matter Core spec).
Structs§
- DSTOffset
Entry - One DST-offset entry yielded by [
TimeSync::dst_offset] via the visitor callback. - DSTOffset
Struct - DSTOffset
Struct Array Builder - DSTOffset
Struct Builder - DSTStatus
- DSTStatus
Array Builder - DSTStatus
Builder - DSTTable
Empty - DSTTable
Empty Array Builder - DSTTable
Empty Builder - Fabric
Scoped Trusted Time Source Struct - Fabric
Scoped Trusted Time Source Struct Array Builder - Fabric
Scoped Trusted Time Source Struct Builder - Feature
- Handler
Adaptor - The handler adaptor for the cluster-specific handler. This adaptor implements the generic
rs-matterhandler trait. - Handler
Async Adaptor - The handler adaptor for the cluster-specific handler. This adaptor implements the generic
rs-matterhandler trait. - Missing
Trusted Time Source - Missing
Trusted Time Source Array Builder - Missing
Trusted Time Source Builder - Options
- Cluster-shape selectors for the
TimeSyncHandler. Each bit turns on exactly one MatterFeature— there are no independent-optional toggles on this cluster, so the mapping is 1:1. - Rtc
- Last-Known-Good UTC Time tracking for the device (Matter Core spec).
- SetDST
Offset Request - SetDST
Offset Request Array Builder - SetDST
Offset Request Builder - SetDefaultNTP
Request - SetDefaultNTP
Request Array Builder - SetDefaultNTP
Request Builder - SetTime
Zone Request - SetTime
Zone Request Array Builder - SetTime
Zone Request Builder - SetTime
Zone Response - SetTime
Zone Response Array Builder - SetTime
Zone Response Builder - SetTime
Zone Response Handle - Single-shot handle wrapping the [
InvokeRespChunk] of aSetTimeZoneResponseresponse. Holds the exchange’s RX buffer alive;response()parses the embeddedCommandDataIBinto a borrowedSetTimeZoneResponse. The trailingStatusResponse(Success)is sent when the caller.complete().await?s the handle. - SetTrusted
Time Source Request - SetTrusted
Time Source Request Array Builder - SetTrusted
Time Source Request Builder - SetUTC
Time Request - SetUTC
Time Request Array Builder - SetUTC
Time Request Builder - Time
Failure - Time
Failure Array Builder - Time
Failure Builder - Time
Sync Handler - Handler for the Time Synchronization Matter cluster.
- Time
Synchronization Attr Reads View - Cluster-scoped view onto an
crate::im::AttrPathArrayBuilderfor theTimeSynchronizationcluster. Each method pushes oneAttrPath(cluster ID baked in) and returnsSelffor chaining;.end()closes the underlying array. Attribute names that would collide with the view’s own inherent methods (seeRESERVED_VIEW_METHOD_NAMESin the codegen) get anattr_prefix. - Time
Synchronization Attr Responses View - Cluster-scoped response view onto a
crate::im::ReportDataRespfor theTimeSynchronizationcluster. Each method returns an iterator of(EndptId, Result<T, Error>)over the entries inattr_reportswhose path matches that attribute. Attribute names that would collide with the view’s own inherent methods (seeRESERVED_VIEW_METHOD_NAMESin the codegen) get anattr_prefix. - Time
Synchronization Attr Writes View - Cluster-scoped view onto an
crate::im::AttrDataArrayBuilderfor theTimeSynchronizationcluster. Scalar-valued attrs push and returnSelffor chaining; struct/list-valued attrs return the codegen-emitted typed value builder (whose parent chain bypasses the view — close back to the array via Data + AttrData.end()?s)..end()closes the wrapped array. Attribute names that would collide with the view’s own inherent methods (seeRESERVED_VIEW_METHOD_NAMESin the codegen) get anattr_prefix. - Time
Synchronization Client View - Per-exchange view onto the
TimeSynchronizationcluster’s client operations. Returned byTimeSynchronizationClient::time_synchronization. Each method consumes the view (and therefore the underlyingcrate::transport::exchange::Exchange) — one exchange is one IM transaction. - Time
Synchronization CmdRequests View - Cluster-scoped view onto a
crate::im::CmdDataArrayBuilderfor theTimeSynchronizationcluster. Empty-request commands push and returnSelf; parameterized commands return the codegen-emitted typed request builder (whose parent chain bypasses the view — close back to the array via Data + CmdData.end()?s)..end()closes the wrapped array. Command names that would collide with the view’s own inherent methods (seeRESERVED_VIEW_METHOD_NAMESin the codegen — currentlyend, which the WebRTC cluster uses) get acmd_prefix. - Time
Synchronization CmdResponses View - Cluster-scoped response view onto a
crate::im::InvokeRespfor theTimeSynchronizationcluster. Each method returns an iterator of(EndptId, Result<R, Error>)over the entries ininvoke_responseswhose path matches that command. Command names that would collide with the view’s own inherent methods (seeRESERVED_VIEW_METHOD_NAMESin the codegen) get acmd_prefix. - Time
Synchronization Write Responses View - Cluster-scoped write-status view onto a
crate::im::WriteRespfor theTimeSynchronizationcluster. Each method returns an iterator of(EndptId, Result<(), Error>)over the entries inwrite_responseswhose path matches that attribute. Attribute names that would collide with the view’s own inherent methods (seeRESERVED_VIEW_METHOD_NAMESin the codegen) get anattr_prefix. - Time
Zone Entry - One time-zone entry yielded by [
TimeSync::time_zone] via the visitor callback. The lifetime'ais the borrow of the implementor’s internal storage for the duration of the visit, sonamecan point straight into the implementor’s table without copying. - Time
Zone Status - Time
Zone Status Array Builder - Time
Zone Status Builder - Time
Zone Store - A concrete [
TimeSync] provider implementing theTIME_ZONEfeature’s storage and validation: theTimeZone/DSTOffsetlists with all the Matter Core spec constraint checks onSetTimeZone/SetDSTOffset. - Time
Zone Struct - Time
Zone Struct Array Builder - Time
Zone Struct Builder - Trusted
Time Source - Persisted Trusted Time Source descriptor (Matter Core spec).
Records which fabric configured the source so that fabric removal can
clear it and emit
MissingTrustedTimeSource. - Trusted
Time Source Data - Snapshot of the device’s currently-configured trusted time source.
Returned by [
TimeSync::trusted_time_source] wrapped in aNullable. - Trusted
Time Source Struct - Trusted
Time Source Struct Array Builder - Trusted
Time Source Struct Builder
Enums§
- Attribute
Id - The attribute IDs for the cluster.
- Command
Id - The command IDs for the cluster.
- Command
Response Id - The command response IDs for the cluster.
- DSTOffset
Struct Tag - DSTStatus
Tag - DSTTable
Empty Tag - EventId
- The event IDs for the cluster.
- Fabric
Scoped Trusted Time Source Struct Tag - Granularity
Enum - Missing
Trusted Time Source Tag - SetDST
Offset Request Tag - SetDefaultNTP
Request Tag - SetTime
Zone Request Tag - SetTime
Zone Response Tag - SetTrusted
Time Source Request Tag - SetUTC
Time Request Tag - Status
Code - Time
Failure Tag - Time
Source Enum - Time
Zone Database Enum - Time
Zone Status Tag - Time
Zone Struct Tag - Trusted
Time Source Struct Tag - UtcTime
- An enum describing the current UTC timestamp the real-time clock is aware of.
Constants§
- FULL_
CLUSTER - The cluster metadata. By default, all cluster attributes, commands and events are allowed, and the revision is the latest one. Use
Cluster::with_*to reconfigure. - TIME_
ZONE_ NAME_ MAX - Maximum byte length of a
TimeZoneStruct::name(spec constraint 0..=64).
Traits§
- Cluster
Async Handler - The handler trait for the cluster.
- Cluster
Handler - The handler trait for the cluster.
- NtpClient
- Data provider for the
NTP_CLIENTfeature. - NtpServer
- Data provider for the
NTP_SERVERfeature. - Time
Synchronization Attr Reads - IM-client extension trait for the
TimeSynchronizationcluster’s attribute reads.usethis trait to call.time_synchronization_read()on ancrate::im::AttrPathArrayBuilder; the returnedTimeSynchronizationAttrReadsViewexposes one method per attribute (cluster-prefix-free)..end()on the view closes the wrapped array. - Time
Synchronization Attr Responses - IM-client extension trait for extracting
TimeSynchronization-cluster attribute reports out of a genericcrate::im::ReportDataResp.usethis trait to call.time_synchronization_read_resp()on aReportDataResp; the returnedTimeSynchronizationAttrResponsesViewexposes one iterator method per attribute (scalar, string, struct and list alike), each yielding(EndptId, Result<T, Error>). The item type borrows the response, so string/struct/list attributes come back asUtf8Str<'a>/OctetStr<'a>, the codegen struct wrapperFoo<'a>, orTLVArray<'a, _>respectively. - Time
Synchronization Attr Writes - IM-client extension trait for the
TimeSynchronizationcluster’s attribute writes.usethis trait to call.time_synchronization_write()on ancrate::im::AttrDataArrayBuilder; the returnedTimeSynchronizationAttrWritesViewexposes one method per writable attribute (cluster-prefix-free)..end()on the view closes the wrapped array. - Time
Synchronization Client - Single-shot IM-client convenience trait for the
TimeSynchronizationcluster.usethis trait to call.time_synchronization()on ancrate::transport::exchange::Exchange; the returnedTimeSynchronizationClientViewexposes one method per command and per attribute. Scalar attributes get a by-value<attr>_read(endpoint); non-scalar ones (string/octet/struct/list, whose value borrows the response) get<attr>_read_with(endpoint, |v| …), which hands the borrowed value to the closure and returns its owned result. The cluster ID, command/attribute ID, request opcode, retransmit loop, response-chunk iteration, and status-only handling are all baked in. DefaultSuccess commands returnResult<(), Error>and drain the response internally; response-bearing commands returnResult<<RespStruct>Handle<'a>, Error>— the handle keeps the RX buffer alive so the caller can read the borrowed response via.response()?before.complete().await?ing the exchange. - Time
Synchronization CmdRequests - IM-client extension trait for the
TimeSynchronizationcluster’s commands.usethis trait to call.time_synchronization_inv()on acrate::im::CmdDataArrayBuilder; the returnedTimeSynchronizationCmdRequestsViewexposes one method per command (cluster-prefix-free)..end()on the view closes the wrapped array. - Time
Synchronization CmdResponses - IM-client extension trait for extracting
TimeSynchronization-cluster command responses out of a genericcrate::im::InvokeResp.usethis trait to call.time_synchronization_inv_resp()on anInvokeResp; the returnedTimeSynchronizationCmdResponsesViewexposes one iterator method per command, each yielding(EndptId, Result<<Output>, Error>)— seecrate::im::InvokeResp::responses/crate::im::InvokeResp::statusesfor the per-entry semantics. - Time
Synchronization Write Responses - IM-client extension trait for extracting
TimeSynchronization-cluster per-attribute write statuses out of a genericcrate::im::WriteResp.usethis trait to call.time_synchronization_write_resp()on aWriteResp; the returnedTimeSynchronizationWriteResponsesViewexposes one iterator method per writable attribute, each yielding(EndptId, Result<(), Error>). - Time
Zones - Pluggable data source for the feature-gated members of the Time
Synchronization cluster (
TIME_ZONE/NTP_CLIENT/NTP_SERVER).
Functions§
- cluster
- Compute the
Cluster<'static>metadata for a TimeSync handler advertising the features encoded inOPTS(theOptions::bitsvalue). See theOptionsflags for the per-bit detail.