Skip to main content

LightState

Struct LightState 

Source
pub struct LightState {
    pub on: bool,
    pub brightness: u8,
    pub color_mode: ColorMode,
    pub hue: u8,
    pub saturation: u8,
    pub color_x: u16,
    pub color_y: u16,
    pub color_temp_mireds: u16,
    /* private fields */
}
Expand description

Complete light state machine.

Fields§

§on: bool§brightness: u8§color_mode: ColorMode§hue: u8§saturation: u8§color_x: u16§color_y: u16§color_temp_mireds: u16

Implementations§

Source§

impl LightState

Source

pub fn new(output: Box<dyn LightOutput>) -> Self

Source

pub fn new_powered_on(output: Box<dyn LightOutput>) -> Self

Create a state machine that starts physically on.

Source

pub fn light_snapshot(&self) -> LightSnapshot

The complete raw state, as delivered to LightOutput::state_update.

Source

pub fn scene_snapshot(&self) -> SceneState

Capture all light attributes that this firmware supports in Zigbee scenes.

Source

pub fn apply_scene_state(&mut self, scene: &SceneState)

Source

pub fn apply_scene_state_with_transition( &mut self, scene: &SceneState, transition_time_tenths: u16, )

Source

pub fn apply_command(&mut self, cmd: &LightCommand)

Source

pub fn start_transition( &mut self, brightness: Option<u8>, color_x: Option<u16>, color_y: Option<u16>, color_temp: Option<u16>, hue: Option<u8>, saturation: Option<u8>, transition_time_tenths: u16, )

Source

pub fn transition_step_interval_ms(&self) -> u16

Source

pub fn transition_active(&self) -> bool

Source

pub fn identify_active(&self) -> bool

Source

pub fn step_identify(&mut self) -> bool

Advance one identify blink half-cycle (~500 ms). Returns true if more blinks remain and the caller should schedule another 500 ms alarm.

Source

pub fn step_transition(&mut self) -> bool

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.