Message

Enum Message 

Source
pub enum Message {
Show 44 variants GetService, StateService { port: u32, service: Service, }, GetHostInfo, StateHostInfo { signal: f32, tx: u32, rx: u32, reserved: i16, }, GetHostFirmware, StateHostFirmware { build: u64, reserved: u64, version: u32, }, GetWifiInfo, StateWifiInfo { signal: f32, tx: u32, rx: u32, reserved: i16, }, GetWifiFirmware, StateWifiFirmware { build: u64, reserved: u64, version: u32, }, GetPower, SetPower { level: PowerLevel, }, StatePower { level: PowerLevel, }, GetLabel, SetLabel { label: LifxString, }, StateLabel { label: LifxString, }, GetVersion, StateVersion { vendor: u32, product: u32, version: u32, }, GetInfo, StateInfo { time: u64, uptime: u64, downtime: u64, }, Acknowledgement { seq: u8, }, GetLocation, SetLocation { location: LifxIdent, label: LifxString, updated_at: u64, }, StateLocation { location: LifxIdent, label: LifxString, updated_at: u64, }, GetGroup, SetGroup { group: LifxIdent, label: LifxString, updated_at: u64, }, StateGroup { group: LifxIdent, label: LifxString, updated_at: u64, }, EchoRequest { payload: EchoPayload, }, EchoResponse { payload: EchoPayload, }, LightGet, LightSetColor { reserved: u8, color: HSBK, duration: u32, }, SetWaveform { reserved: u8, transient: bool, color: HSBK, period: u32, cycles: f32, skew_ratio: i16, waveform: Waveform, }, LightState { color: HSBK, reserved: i16, power: PowerLevel, label: LifxString, reserved2: u64, }, LightGetPower, LightSetPower { level: u16, duration: u32, }, LightStatePower { level: u16, }, SetWaveformOptional { reserved: u8, transient: bool, color: HSBK, period: u32, cycles: f32, skew_ratio: i16, waveform: Waveform, set_hue: bool, set_saturation: bool, set_brightness: bool, set_kelvin: bool, }, LightGetInfrared, LightStateInfrared { brightness: u16, }, LightSetInfrared { brightness: u16, }, SetColorZones { start_index: u8, end_index: u8, color: HSBK, duration: u32, apply: ApplicationRequest, }, GetColorZones { start_index: u8, end_index: u8, }, StateZone { count: u8, index: u8, color: HSBK, }, StateMultiZone { count: u8, index: u8, color0: HSBK, color1: HSBK, color2: HSBK, color3: HSBK, color4: HSBK, color5: HSBK, color6: HSBK, color7: HSBK, },
}
Expand description

Decoded LIFX Messages

This enum lists all of the LIFX message types known to this library.

Note that other message types exist, but are not officially documented (and so are not available here).

Variants§

§

GetService

GetService - 2

Sent by a client to acquire responses from all devices on the local network. No payload is required. Causes the devices to transmit a StateService message.

§

StateService

StateService - 3

Response to Message::GetService message.

Fields

§port: u32

Port number of the light. If the service is temporarily unavailable, then the port value will be 0.

§service: Service

unsigned 8-bit integer, maps to Service

§

GetHostInfo

GetHostInfo - 12

Get Host MCU information. No payload is required. Causes the device to transmit a Message::StateHostInfo message.

§

StateHostInfo

StateHostInfo - 13

Response to Message::GetHostInfo message.

Provides host MCU information.

Fields

§signal: f32

radio receive signal strength in miliWatts

§tx: u32

Bytes transmitted since power on

§rx: u32

Bytes received since power on

§reserved: i16
§

GetHostFirmware

GetHostFirmware - 14

Gets Host MCU firmware information. No payload is required. Causes the device to transmit a Message::StateHostFirmware message.

§

StateHostFirmware

StateHostFirmware - 15

Response to Message::GetHostFirmware message.

Provides host firmware information.

Fields

§build: u64

Firmware build time (absolute time in nanoseconds since epoch)

§reserved: u64
§version: u32

Firmware version

§

GetWifiInfo

GetWifiInfo - 16

Get Wifi subsystem information. No payload is required. Causes the device to transmit a Message::StateWifiInfo message.

§

StateWifiInfo

StateWifiInfo - 17

Response to Message::GetWifiInfo message.

Provides Wifi subsystem information.

Fields

§signal: f32

Radio receive signal strength in mw

§tx: u32

bytes transmitted since power on

§rx: u32

bytes received since power on

§reserved: i16
§

GetWifiFirmware

GetWifiFirmware - 18

Get Wifi subsystem firmware. No payload is required. Causes the device to transmit a Message::StateWifiFirmware message.

§

StateWifiFirmware

StateWifiFirmware - 19
Response to Message::GetWifiFirmware message.

Provides Wifi subsystem information.

Fields

§build: u64

firmware build time (absolute time in nanoseconds since epoch)

§reserved: u64
§version: u32

firmware version

§

GetPower

GetPower - 20

Get device power level. No payload is required. Causes the device to transmit a Message::StatePower message

§

SetPower

SetPower - 21

Set device power level.

Fields

§level: PowerLevel

normally a u16, but only 0 and 65535 are supported.

Zero implies standby and non-zero sets a corresponding power draw level.

§

StatePower

StatePower - 22

Response to Message::GetPower message.

Provides device power level.

Fields

§

GetLabel

GetLabel - 23

Get device label. No payload is required. Causes the device to transmit a Message::StateLabel message.

§

SetLabel

SetLabel - 24

Set the device label text.

Fields

§

StateLabel

StateLabel - 25

Response to Message::GetLabel message.

Provides device label.

Fields

§

GetVersion

GetVersion - 32

Get the hardware version. No payload is required. Causes the device to transmit a Message::StateVersion message.

§

StateVersion

StateVersion - 33

Response to Message::GetVersion message.

Provides the hardware version of the device.

Fields

§vendor: u32

vendor ID

§product: u32

product ID

§version: u32

hardware version

§

GetInfo

GetInfo - 34

Get run-time information. No payload is required. Causes the device to transmit a Message::StateInfo message.

§

StateInfo

StateInfo - 35

Response to Message::GetInfo message.

Provides run-time information of device.

Fields

§time: u64

current time (absolute time in nanoseconds since epoch)

§uptime: u64

time since last power on (relative time in nanoseconds)

§downtime: u64

last power off period (5 second accuracy, in nanoseconds)

§

Acknowledgement

Acknowledgement - 45

Response to any message sent with ack_required set to 1. See message header frame address.

(Note that technically this message has no payload, but the frame sequence number is stored here for convenience).

Fields

§seq: u8
§

GetLocation

GetLocation - 48

Ask the bulb to return its location information. No payload is required. Causes the device to transmit a Message::StateLocation message.

§

SetLocation

SetLocation – 49

Set the device location

Fields

§location: LifxIdent

GUID byte array

§label: LifxString

text label for location

§updated_at: u64

UTC timestamp of last label update in nanoseconds

§

StateLocation

StateLocation - 50

Device location.

Fields

§location: LifxIdent
§updated_at: u64
§

GetGroup

GetGroup - 51

Ask the bulb to return its group membership information. No payload is required. Causes the device to transmit a Message::StateGroup message.

§

SetGroup

SetGroup - 52

Set the device group

Fields

§updated_at: u64
§

StateGroup

StateGroup - 53

Device group.

Fields

§updated_at: u64
§

EchoRequest

EchoRequest - 58

Request an arbitrary payload be echoed back. Causes the device to transmit an Message::EchoResponse message.

Fields

§payload: EchoPayload
§

EchoResponse

EchoResponse - 59

Response to Message::EchoRequest message.

Echo response with payload sent in the EchoRequest.

Fields

§payload: EchoPayload
§

LightGet

Get - 101

Sent by a client to obtain the light state. No payload required. Causes the device to transmit a Message::LightState message.

§

LightSetColor

SetColor - 102

Sent by a client to change the light state.

If the Frame Address res_required field is set to one (1) then the device will transmit a State message.

Fields

§reserved: u8
§color: HSBK

Color in HSBK

§duration: u32

Color transition time in milliseconds

§

SetWaveform

SetWaveform - 103

Apply an effect to the bulb.

Fields

§reserved: u8
§transient: bool
§color: HSBK
§period: u32

Duration of a cycle in milliseconds

§cycles: f32

Number of cycles

§skew_ratio: i16

Waveform Skew, [-32768, 32767] scaled to [0, 1].

§waveform: Waveform

Waveform to use for transition.

§

LightState

State - 107

Sent by a device to provide the current light state.

Fields

§color: HSBK
§reserved: i16
§reserved2: u64
§

LightGetPower

GetPower - 116

Sent by a client to obtain the power level. No payload required. Causes the device to transmit a StatePower message.

§

LightSetPower

SetPower - 117

Sent by a client to change the light power level.

Field Type level unsigned 16-bit integer duration unsigned 32-bit integer The power level must be either 0 or 65535.

The duration is the power level transition time in milliseconds.

If the Frame Address res_required field is set to one (1) then the device will transmit a StatePower message.

Fields

§level: u16
§duration: u32
§

LightStatePower

StatePower - 118

Sent by a device to provide the current power level.

Field Type level unsigned 16-bit integer

Fields

§level: u16
§

SetWaveformOptional

SetWaveformOptional - 119

Apply an effect to the bulb.

Fields

§reserved: u8
§transient: bool
§color: HSBK
§period: u32

Duration of a cycle in milliseconds

§cycles: f32

Number of cycles

§skew_ratio: i16
§waveform: Waveform
§set_hue: bool
§set_saturation: bool
§set_brightness: bool
§set_kelvin: bool
§

LightGetInfrared

GetInfrared - 120

Gets the current maximum power level of the Infraed channel

§

LightStateInfrared

StateInfrared - 121

Indicates the current maximum setting for the infrared channel.

Fields

§brightness: u16
§

LightSetInfrared

SetInfrared – 122

Set the current maximum brightness for the infrared channel.

Fields

§brightness: u16
§

SetColorZones

SetColorZones - 501

This message is used for changing the color of either a single or multiple zones. The changes are stored in a buffer and are only applied once a message with either ApplicationRequest::Apply or ApplicationRequest::ApplyOnly set.

Fields

§start_index: u8
§end_index: u8
§color: HSBK
§duration: u32
§

GetColorZones

GetColorZones - 502

GetColorZones is used to request the zone colors for a range of zones. The bulb will respond with either Message::StateZone or Message::StateMultiZone messages as required to cover the requested range. The bulb may send state messages that cover more than the requested zones. Any zones outside the requested indexes will still contain valid values at the time the message was sent.

Fields

§start_index: u8
§end_index: u8
§

StateZone

StateZone - 503 The StateZone message represents the state of a single zone with the index field indicating which zone is represented. The count field contains the count of the total number of zones available on the device.

Fields

§count: u8
§index: u8
§color: HSBK
§

StateMultiZone

StateMultiZone - 506

The StateMultiZone message represents the state of eight consecutive zones in a single message. As in the StateZone message the count field represents the count of the total number of zones available on the device. In this message the index field represents the index of color0 and the rest of the colors are the consecutive zones thus the index of the color_n zone will be index + n.

Fields

§count: u8
§index: u8
§color0: HSBK
§color1: HSBK
§color2: HSBK
§color3: HSBK
§color4: HSBK
§color5: HSBK
§color6: HSBK
§color7: HSBK

Implementations§

Source§

impl Message

Source

pub fn get_num(&self) -> u16

Source

pub fn from_raw(msg: &RawMessage) -> Result<Message, Error>

Tries to parse the payload in a RawMessage, based on its message type.

Trait Implementations§

Source§

impl Clone for Message

Source§

fn clone(&self) -> Message

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Message

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,