Skip to main content

LevelControlHooks

Trait LevelControlHooks 

Source
pub trait LevelControlHooks {
    const MIN_LEVEL: u8;
    const MAX_LEVEL: u8;
    const FASTEST_RATE: u8;
    const CLUSTER: Cluster<'static>;

    // Required methods
    fn set_device_level(&self, level: u8) -> Result<Option<u8>, ()>;
    fn current_level(&self) -> Option<u8>;
    fn set_current_level(&self, level: Option<u8>);

    // Provided methods
    fn start_up_current_level(&self) -> Result<Option<u8>, Error> { ... }
    fn set_start_up_current_level(
        &self,
        _value: Option<u8>,
    ) -> Result<(), Error> { ... }
    fn run<F>(&self, _notify: F) -> impl Future<Output = ()>
       where F: Fn(OutOfBandMessage) { ... }
}

Required Associated Constants§

Required Methods§

Source

fn set_device_level(&self, level: u8) -> Result<Option<u8>, ()>

Implements the business logic for setting the level of the device. Returns the level the device was set to. If this method returns Err, the LevelControlHandler will represent this as an error with ImStatusCode of Failure. Note: The above is the only responsibility of this method. There is no need to update Matter attributes.

Source

fn current_level(&self) -> Option<u8>

Raw current_level getter. This value should persist across reboots.

Source

fn set_current_level(&self, level: Option<u8>)

Raw current_level setter. This value should persist across reboots.

Provided Methods§

Source

fn start_up_current_level(&self) -> Result<Option<u8>, Error>

Raw start_up_current_level getter. This value should persist across reboots.

Source

fn set_start_up_current_level(&self, _value: Option<u8>) -> Result<(), Error>

Raw start_up_current_level setter. This value should persist across reboots.

Source

fn run<F>(&self, _notify: F) -> impl Future<Output = ()>
where F: Fn(OutOfBandMessage),

Background task for out-of-band notifications to the handler.

This future MUST NOT return. Implementers should either loop forever or await core::future::pending::<()>(), so the SDK’s task does not observe a completed future.

§Panics

The SDK will panic if this method returns.

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

Source§

const MIN_LEVEL: u8 = T::MIN_LEVEL

Source§

const MAX_LEVEL: u8 = T::MAX_LEVEL

Source§

const FASTEST_RATE: u8 = T::FASTEST_RATE

Source§

const CLUSTER: Cluster<'static> = T::CLUSTER

Source§

fn set_device_level(&self, level: u8) -> Result<Option<u8>, ()>

Source§

fn current_level(&self) -> Option<u8>

Source§

fn set_current_level(&self, level: Option<u8>)

Source§

fn start_up_current_level(&self) -> Result<Option<u8>, Error>

Source§

fn set_start_up_current_level(&self, value: Option<u8>) -> Result<(), Error>

Source§

fn run<F>(&self, notify: F) -> impl Future<Output = ()>
where F: Fn(OutOfBandMessage),

Implementors§