pub struct TimeSyncHandler<'a> { /* private fields */ }Expand description
Handler for the Time Synchronization Matter cluster.
Borrows a &dyn TimeSync data provider for the lifetime 'a and
forwards every non-builtin attribute read / command invoke to it.
The handler is not parameterized by cluster shape:
Self::CLUSTER is pinned to the
empty-options form and only its id is consulted by the
dispatcher. The on-wire shape — which optional attributes /
commands / features are advertised — is decided by the cluster
metadata supplied on the endpoint side (e.g. clusters!(eth, time_sync(time_zone, ntp_client); …)); per-attribute dispatch
follows the endpoint’s metadata, so the handler answers exactly
what the endpoint exposes.
Implementations§
Source§impl<'a> TimeSyncHandler<'a>
impl<'a> TimeSyncHandler<'a>
Sourcepub const fn new(dataver: Dataver) -> TimeSyncHandler<'a>
pub const fn new(dataver: Dataver) -> TimeSyncHandler<'a>
Create a handler with no feature providers: only the always-mandatory
members (UTCTime / Granularity / TimeSource / SetUTCTime, plus
the TIME_SYNC_CLIENT state), all served from the Matter-wide RTC.
Sourcepub const fn new_with_time_zone(
dataver: Dataver,
store: &'a TimeZoneStore,
) -> TimeSyncHandler<'a>
pub const fn new_with_time_zone( dataver: Dataver, store: &'a TimeZoneStore, ) -> TimeSyncHandler<'a>
Create a handler backed by a TimeZoneStore - the batteries-included
TIME_ZONE feature shape: SetTimeZone/SetDSTOffset validation and
storage, transition events driven by the Handler::run impl, and
persistence of the lists under TIME_ZONE_KEY.
Sourcepub const fn with_time_zones(
self,
time_zones: &'a dyn TimeZones,
) -> TimeSyncHandler<'a>
pub const fn with_time_zones( self, time_zones: &'a dyn TimeZones, ) -> TimeSyncHandler<'a>
Provide a custom TimeZones implementation.
Sourcepub const fn with_ntp_client(
self,
ntp_client: &'a dyn NtpClient,
) -> TimeSyncHandler<'a>
pub const fn with_ntp_client( self, ntp_client: &'a dyn NtpClient, ) -> TimeSyncHandler<'a>
Provide an NtpClient implementation.
Sourcepub const fn with_ntp_server(
self,
ntp_server: &'a dyn NtpServer,
) -> TimeSyncHandler<'a>
pub const fn with_ntp_server( self, ntp_server: &'a dyn NtpServer, ) -> TimeSyncHandler<'a>
Provide an NtpServer implementation.
Sourcepub const fn adapt(self) -> HandlerAdaptor<TimeSyncHandler<'a>>
pub const fn adapt(self) -> HandlerAdaptor<TimeSyncHandler<'a>>
Adapt the handler instance to the generic rs-matter Handler trait.
Trait Implementations§
Source§impl<'a> Clone for TimeSyncHandler<'a>
impl<'a> Clone for TimeSyncHandler<'a>
Source§fn clone(&self) -> TimeSyncHandler<'a>
fn clone(&self) -> TimeSyncHandler<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ClusterHandler for TimeSyncHandler<'_>
impl ClusterHandler for TimeSyncHandler<'_>
fn dataver(&self) -> u32
fn dataver_changed(&self)
async fn run(&self, ctx: impl HandlerContext) -> Result<(), Error>
fn utc_time( &self, ctx: impl ReadContext, ) -> Result<Maybe<u64, AsNullable>, Error>
fn granularity(&self, ctx: impl ReadContext) -> Result<GranularityEnum, Error>
fn time_source(&self, ctx: impl ReadContext) -> Result<TimeSourceEnum, Error>
fn trusted_time_source<P>(
&self,
ctx: impl ReadContext,
builder: NullableBuilder<P, TrustedTimeSourceStructBuilder<P>>,
) -> Result<P, Error>where
P: TLVBuilderParent,
fn default_ntp<P>(
&self,
_ctx: impl ReadContext,
builder: NullableBuilder<P, Utf8StrBuilder<P>>,
) -> Result<P, Error>where
P: TLVBuilderParent,
fn supports_dns_resolve(&self, _ctx: impl ReadContext) -> Result<bool, Error>
fn ntp_server_available(&self, _ctx: impl ReadContext) -> Result<bool, Error>
fn time_zone<P>(
&self,
_ctx: impl ReadContext,
builder: ArrayAttributeRead<TimeZoneStructArrayBuilder<P>, TimeZoneStructBuilder<P>>,
) -> Result<P, Error>where
P: TLVBuilderParent,
fn dst_offset<P>(
&self,
_ctx: impl ReadContext,
builder: ArrayAttributeRead<DSTOffsetStructArrayBuilder<P>, DSTOffsetStructBuilder<P>>,
) -> Result<P, Error>where
P: TLVBuilderParent,
fn local_time( &self, ctx: impl ReadContext, ) -> Result<Maybe<u64, AsNullable>, Error>
fn time_zone_database( &self, _ctx: impl ReadContext, ) -> Result<TimeZoneDatabaseEnum, Error>
fn time_zone_list_max_size(&self, _ctx: impl ReadContext) -> Result<u8, Error>
fn dst_offset_list_max_size(&self, _ctx: impl ReadContext) -> Result<u8, Error>
fn handle_set_utc_time( &self, ctx: impl InvokeContext, request: SetUTCTimeRequest<'_>, ) -> Result<(), Error>
fn handle_set_trusted_time_source( &self, ctx: impl InvokeContext, request: SetTrustedTimeSourceRequest<'_>, ) -> Result<(), Error>
fn handle_set_time_zone<P>(
&self,
ctx: impl InvokeContext,
request: SetTimeZoneRequest<'_>,
response: SetTimeZoneResponseBuilder<P>,
) -> Result<P, Error>where
P: TLVBuilderParent,
fn handle_set_dst_offset( &self, ctx: impl InvokeContext, request: SetDSTOffsetRequest<'_>, ) -> Result<(), Error>
fn handle_set_default_ntp( &self, _ctx: impl InvokeContext, request: SetDefaultNTPRequest<'_>, ) -> Result<(), Error>
fn lifecycle( &self, _ctx: impl HandlerContext, _op: LifecycleOp, ) -> Result<(), Error>
Auto Trait Implementations§
impl<'a> !Freeze for TimeSyncHandler<'a>
impl<'a> !RefUnwindSafe for TimeSyncHandler<'a>
impl<'a> !Send for TimeSyncHandler<'a>
impl<'a> !Sync for TimeSyncHandler<'a>
impl<'a> !UnwindSafe for TimeSyncHandler<'a>
impl<'a> Unpin for TimeSyncHandler<'a>
impl<'a> UnsafeUnpin for TimeSyncHandler<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more