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§
const MIN_LEVEL: u8
const MAX_LEVEL: u8
const FASTEST_RATE: u8
const CLUSTER: Cluster<'static>
Required Methods§
Sourcefn set_device_level(&self, level: u8) -> Result<Option<u8>, ()>
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.
Sourcefn current_level(&self) -> Option<u8>
fn current_level(&self) -> Option<u8>
Raw current_level getter. This value should persist across reboots.
Sourcefn set_current_level(&self, level: Option<u8>)
fn set_current_level(&self, level: Option<u8>)
Raw current_level setter. This value should persist across reboots.
Provided Methods§
Sourcefn start_up_current_level(&self) -> Result<Option<u8>, Error>
fn start_up_current_level(&self) -> Result<Option<u8>, Error>
Raw start_up_current_level getter. This value should persist across reboots.
Sourcefn set_start_up_current_level(&self, _value: Option<u8>) -> Result<(), Error>
fn set_start_up_current_level(&self, _value: Option<u8>) -> Result<(), Error>
Raw start_up_current_level setter. This value should persist across reboots.
Sourcefn run<F>(&self, _notify: F) -> impl Future<Output = ()>where
F: Fn(OutOfBandMessage),
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".