pub struct LevelControl<'a, H: LevelControlHooks, O: OnOffState = NoOnOff> { /* private fields */ }Expand description
Level Control, with the device’s hooks and whatever On/Off cluster shares the endpoint.
Implementations§
Source§impl<'a, H: LevelControlHooks> LevelControl<'a, H, NoOnOff>
impl<'a, H: LevelControlHooks> LevelControl<'a, H, NoOnOff>
Source§impl<'a, H: LevelControlHooks, O: OnOffState> LevelControl<'a, H, O>
impl<'a, H: LevelControlHooks, O: OnOffState> LevelControl<'a, H, O>
Sourcepub const WITH_ALL_OPTIONAL: Optional<'static>
pub const WITH_ALL_OPTIONAL: Optional<'static>
Everything §1.6.6 leaves to the product.
Sourcepub const WITH_RANGE: Optional<'static>
pub const WITH_RANGE: Optional<'static>
Just the two range attributes, which a lighting device type requires.
Sourcepub fn with_on_off(hooks: &'a H, on_off: &'a O, feature_map: u32) -> Self
pub fn with_on_off(hooks: &'a H, on_off: &'a O, feature_map: u32) -> Self
A cluster coupled to the On/Off cluster on_off on the same endpoint.
Sourcepub fn with_range(self, min_level: u8, max_level: u8) -> Self
pub fn with_range(self, min_level: u8, max_level: u8) -> Self
The same cluster over a narrower range (§1.6.6.4, §1.6.6.5).
Only for a device without the Lighting feature: with it, the specification fixes the
range at 1..=254, and a lighting device that narrowed it would report a MinLevel its
own device type forbids.
Sourcepub const fn with_frequency(self, min: u16, max: u16) -> Self
pub const fn with_frequency(self, min: u16, max: u16) -> Self
The same cluster with the Frequency feature’s range (§1.6.6.7, §1.6.6.8).
Sourcepub fn conforming(
feature_map: u32,
optional: &Optional<'_>,
) -> Result<Conforming<14, 9, 0, 0>>
pub fn conforming( feature_map: u32, optional: &Optional<'_>, ) -> Result<Conforming<14, 9, 0, 0>>
The descriptor for an instance, derived from the specification’s tables.
Sourcepub fn start(&self, previous: Option<u8>)
pub fn start(&self, previous: Option<u8>)
§1.6.6.15’s start-up behaviour.
StartUpCurrentLevel | what CurrentLevel becomes |
|---|---|
| 0 | the minimum the device permits |
| null | previous — what it was before the power cut |
| anything else | that value |
previous is the device’s to remember; this cluster persists nothing. A device that
stores nothing passes None, which is the null level — honest for a lamp that does not
know how bright it was.
Sourcepub fn remaining_time(&self) -> u16
pub fn remaining_time(&self) -> u16
RemainingTime (§1.6.6.3), in tenths of a second.
Sourcepub fn options(&self) -> OptionsBitmap
pub fn options(&self) -> OptionsBitmap
Options (§1.6.6.9).
Sourcepub fn on_level(&self) -> Option<u8>
pub fn on_level(&self) -> Option<u8>
OnLevel (§1.6.6.11) — the level an On command restores, or null for none.
Sourcepub fn set_on_level(&self, level: Option<u8>)
pub fn set_on_level(&self, level: Option<u8>)
Sets OnLevel without a write interaction, for a device with a fixed one.
Sourcepub fn set_start_up_level(&self, level: Option<u8>)
pub fn set_start_up_level(&self, level: Option<u8>)
Sets StartUpCurrentLevel (§1.6.6.15) without a write interaction.
Sourcepub fn wake_at(&self) -> Option<Instant>
pub fn wake_at(&self) -> Option<Instant>
When LevelControl::poll next has something to do.
None while nothing is moving, which is the ordinary case — a lamp sitting at a level
needs no clock, and an intermittently connected device can sleep.
Source§impl<H: LevelControlHooks, O: OnOffState> LevelControl<'_, H, O>
impl<H: LevelControlHooks, O: OnOffState> LevelControl<'_, H, O>
Sourcepub fn on_off_changed(&self, on: bool, stored: Option<u8>, now: Instant)
pub fn on_off_changed(&self, on: bool, stored: Option<u8>, now: Instant)
§1.6.4.1.1’s coupling, for a device that wants it.
Called by the product from its own OnOffHooks::set, because §1.6.4.1 makes the whole
dependency optional: “dependencies MAY be introduced between them. Facilities are
provided to introduce dependencies if required.”
On. Temporarily store CurrentLevel. Set CurrentLevel to the minimum level allowed for the device. Change CurrentLevel to OnLevel, or to the stored level if OnLevel is not defined, over the time period OnOffTransitionTime.
stored is the level to return to — what the device remembers from before it was
switched off. The specification’s own note is the reason it is a parameter: “If another
of these commands is received, before the transition is completed, the originally
stored CurrentLevel SHALL be preserved and restored”, and only the device knows which
value that is across a power cut.
Trait Implementations§
Source§impl<H: LevelControlHooks, O: OnOffState> Cluster for LevelControl<'_, H, O>
So a tuple of clusters can dispatch to it by id.
impl<H: LevelControlHooks, O: OnOffState> Cluster for LevelControl<'_, H, O>
So a tuple of clusters can dispatch to it by id.
Source§impl<H: LevelControlHooks, O: OnOffState> ClusterHandler for LevelControl<'_, H, O>
impl<H: LevelControlHooks, O: OnOffState> ClusterHandler for LevelControl<'_, H, O>
Source§fn read(
&self,
resolved: &Resolved<'_>,
_ctx: &InteractionContext<'_>,
w: &mut TlvWriter<'_>,
tag: Tag,
) -> Result<(), Status>
fn read( &self, resolved: &Resolved<'_>, _ctx: &InteractionContext<'_>, w: &mut TlvWriter<'_>, tag: Tag, ) -> Result<(), Status>
Source§fn write(
&self,
resolved: &Resolved<'_>,
data: &[u8],
_op: WriteOp,
_ctx: &InteractionContext<'_>,
) -> Result<(), Status>
fn write( &self, resolved: &Resolved<'_>, data: &[u8], _op: WriteOp, _ctx: &InteractionContext<'_>, ) -> Result<(), Status>
data — the encoded TLV element, tag included — into the attribute. Read more