pub trait SceneClusterHandler {
const CLUSTER_ID: u32;
// Required methods
fn endpoint_id(&self) -> u16;
fn capture<P>(
&self,
avp_array: AttributeValuePairStructArrayBuilder<P>,
) -> Result<AttributeValuePairStructArrayBuilder<P>, Error>
where P: TLVBuilderParent;
fn apply<C>(
&self,
ctx: &C,
avp_list: &TLVContainer<'_, AttributeValuePairStruct<'_>, ArrayContainer>,
transition_time_ms: u32,
) -> impl Future<Output = Result<(), Error>>
where C: HandlerContext;
// Provided method
fn is_scenable_attribute(_attribute_id: u32) -> bool { ... }
}Expand description
Per-cluster scene capture + apply trait. Implemented directly on
the cluster’s handler type (e.g. OnOffHandler) so the same
&handler the application registers in the data-model chain can
also be registered in the scenes registry — no separate wrapper,
no IM round-trip, no TLV serde.
Back-direction (a scenable attribute mutated, so SceneValid may
need to flip) goes through SceneInvalidator, implemented by
ScenesState.
Required Associated Constants§
Sourceconst CLUSTER_ID: u32
const CLUSTER_ID: u32
The Matter cluster ID this impl handles.
Required Methods§
Sourcefn endpoint_id(&self) -> u16
fn endpoint_id(&self) -> u16
Endpoint this handler instance is installed on. Used to skip
clusters not on the StoreScene / RecallScene target endpoint.
Sourcefn capture<P>(
&self,
avp_array: AttributeValuePairStructArrayBuilder<P>,
) -> Result<AttributeValuePairStructArrayBuilder<P>, Error>where
P: TLVBuilderParent,
fn capture<P>(
&self,
avp_array: AttributeValuePairStructArrayBuilder<P>,
) -> Result<AttributeValuePairStructArrayBuilder<P>, Error>where
P: TLVBuilderParent,
Emit AVP entries for this cluster’s scenable state into
avp_array. Use AttributeValuePairStructArrayBuilder::push_u8
/ AttributeValuePairStructArrayBuilder::push_u16 for a
one-line per-attribute API.
Sourcefn apply<C>(
&self,
ctx: &C,
avp_list: &TLVContainer<'_, AttributeValuePairStruct<'_>, ArrayContainer>,
transition_time_ms: u32,
) -> impl Future<Output = Result<(), Error>>where
C: HandlerContext,
fn apply<C>(
&self,
ctx: &C,
avp_list: &TLVContainer<'_, AttributeValuePairStruct<'_>, ArrayContainer>,
transition_time_ms: u32,
) -> impl Future<Output = Result<(), Error>>where
C: HandlerContext,
Apply captured AVPs to the cluster’s internal state. Async
because some clusters (LevelControl) kick off transition
tasks; sync-only impls can return core::future::ready.
§Arguments
ctx—HandlerContextfor subscriber notification (crate::dm::AttrChangeNotifier::notify_attr_changed) and persistence (HandlerContext::kv). Impls MUST NOT callctx.handler()from insideapply— recursion-limit pathology, by design.avp_list— the captured scenable AVPs fromAddScene/StoreScene.transition_time_ms— effective transition time (RecallScenerequest override, falling back to the stored per-scene value).
Provided Methods§
Sourcefn is_scenable_attribute(_attribute_id: u32) -> bool
fn is_scenable_attribute(_attribute_id: u32) -> bool
True if attribute_id is a scenable attribute of this cluster
per the Matter Core Spec. AddScene rejects EFS payloads that
reference non-scenable attributes.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T> SceneClusterHandler for &Twhere
T: SceneClusterHandler + ?Sized,
Lets the application pass &handler into the scenes registry
without moving it (the same &handler is also kept in the
data-model chain). Delegates every method through the reference.
impl<T> SceneClusterHandler for &Twhere
T: SceneClusterHandler + ?Sized,
Lets the application pass &handler into the scenes registry
without moving it (the same &handler is also kept in the
data-model chain). Delegates every method through the reference.
const CLUSTER_ID: u32 = T::CLUSTER_ID
fn endpoint_id(&self) -> u16
fn is_scenable_attribute(attribute_id: u32) -> bool
fn capture<P>(
&self,
avp_array: AttributeValuePairStructArrayBuilder<P>,
) -> Result<AttributeValuePairStructArrayBuilder<P>, Error>where
P: TLVBuilderParent,
async fn apply<C>(
&self,
ctx: &C,
avp_list: &TLVContainer<'_, AttributeValuePairStruct<'_>, ArrayContainer>,
transition_time_ms: u32,
) -> Result<(), Error>where
C: HandlerContext,
Implementors§
Source§impl<H, LH> SceneClusterHandler for OnOffHandler<'_, H, LH>where
H: OnOffHooks,
LH: LevelControlHooks,
Scenes Management integration for the OnOff cluster. The only
scenable attribute is OnOff; apply routes through set_on /
set_off rather than an attribute write.
impl<H, LH> SceneClusterHandler for OnOffHandler<'_, H, LH>where
H: OnOffHooks,
LH: LevelControlHooks,
Scenes Management integration for the OnOff cluster. The only
scenable attribute is OnOff; apply routes through set_on /
set_off rather than an attribute write.
const CLUSTER_ID: u32
Source§impl<H, OH, LH> SceneClusterHandler for ColorControlHandler<'_, H, OH, LH>
impl<H, OH, LH> SceneClusterHandler for ColorControlHandler<'_, H, OH, LH>
const CLUSTER_ID: u32
Source§impl<H, OH> SceneClusterHandler for LevelControlHandler<'_, H, OH>where
H: LevelControlHooks,
OH: OnOffHooks,
Scenes Management integration for the LevelControl cluster. The
only scenable attribute is CurrentLevel; apply routes through
MoveToLevel with the scene’s transition time.
impl<H, OH> SceneClusterHandler for LevelControlHandler<'_, H, OH>where
H: LevelControlHooks,
OH: OnOffHooks,
Scenes Management integration for the LevelControl cluster. The
only scenable attribute is CurrentLevel; apply routes through
MoveToLevel with the scene’s transition time.