Skip to main content

SceneClusterHandler

Trait SceneClusterHandler 

Source
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§

Source

const CLUSTER_ID: u32

The Matter cluster ID this impl handles.

Required Methods§

Source

fn endpoint_id(&self) -> u16

Endpoint this handler instance is installed on. Used to skip clusters not on the StoreScene / RecallScene target endpoint.

Source

fn capture<P>( &self, avp_array: AttributeValuePairStructArrayBuilder<P>, ) -> Result<AttributeValuePairStructArrayBuilder<P>, Error>

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.

Source

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
  • ctxHandlerContext for subscriber notification (crate::dm::AttrChangeNotifier::notify_attr_changed) and persistence (HandlerContext::kv). Impls MUST NOT call ctx.handler() from inside apply — recursion-limit pathology, by design.
  • avp_list — the captured scenable AVPs from AddScene / StoreScene.
  • transition_time_ms — effective transition time (RecallScene request override, falling back to the stored per-scene value).

Provided Methods§

Source

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 &T

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.

Source§

const CLUSTER_ID: u32 = T::CLUSTER_ID

Source§

fn endpoint_id(&self) -> u16

Source§

fn is_scenable_attribute(attribute_id: u32) -> bool

Source§

fn capture<P>( &self, avp_array: AttributeValuePairStructArrayBuilder<P>, ) -> Result<AttributeValuePairStructArrayBuilder<P>, Error>

Source§

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>

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.

Source§

impl<H, OH, LH> SceneClusterHandler for ColorControlHandler<'_, H, OH, LH>

Source§

impl<H, OH> SceneClusterHandler for LevelControlHandler<'_, H, OH>

Scenes Management integration for the LevelControl cluster. The only scenable attribute is CurrentLevel; apply routes through MoveToLevel with the scene’s transition time.