Enum lifx_core::Message [−][src]
pub enum Message { 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, }, }
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 of StateService
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 |
GetHostInfo
GetHostInfo - 12
Get Host MCU information. No payload is required. Causes the device to transmit a Message::StateHostInfo message.
StateHostInfo
Fields of StateHostInfo
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 of StateHostFirmware
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
Fields of StateWifiInfo
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 of StateWifiFirmware
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 of SetPower
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
Fields of StatePower
level: PowerLevel |
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 of SetLabel
label: LifxString |
StateLabel
Fields of StateLabel
label: LifxString |
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 of StateVersion
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
Fields of StateInfo
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 of Acknowledgement
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 of SetLocation
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 of StateLocation
location: LifxIdent | |
label: LifxString | |
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 of SetGroup
group: LifxIdent | |
label: LifxString | |
updated_at: u64 |
StateGroup
StateGroup - 53
Device group.
Fields of StateGroup
group: LifxIdent | |
label: LifxString | |
updated_at: u64 |
EchoRequest
EchoRequest - 58
Request an arbitrary payload be echoed back. Causes the device to transmit an Message::EchoResponse message.
Fields of EchoRequest
payload: EchoPayload |
EchoResponse
EchoResponse - 59
Response to Message::EchoRequest message.
Echo response with payload sent in the EchoRequest.
Fields of EchoResponse
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 of LightSetColor
reserved: u8 | |
color: HSBK | Color in HSBK |
duration: u32 | Color transition time in milliseconds |
SetWaveform
SetWaveform - 103
Apply an effect to the bulb.
Fields of SetWaveform
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 of LightState
color: HSBK | |
reserved: i16 | |
power: PowerLevel | |
label: LifxString | |
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 of LightSetPower
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 of LightStatePower
level: u16 |
SetWaveformOptional
SetWaveformOptional - 119
Apply an effect to the bulb.
Fields of SetWaveformOptional
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 of LightStateInfrared
brightness: u16 |
LightSetInfrared
SetInfrared -- 122
Set the current maximum brightness for the infrared channel.
Fields of LightSetInfrared
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 of SetColorZones
start_index: u8 | |
end_index: u8 | |
color: HSBK | |
duration: u32 | |
apply: ApplicationRequest |
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 of GetColorZones
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 of StateZone
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 of StateMultiZone
count: u8 | |
index: u8 | |
color0: HSBK | |
color1: HSBK | |
color2: HSBK | |
color3: HSBK | |
color4: HSBK | |
color5: HSBK | |
color6: HSBK | |
color7: HSBK |
Methods
impl Message
[src]
impl Message
pub fn get_num(&self) -> u16
[src]
pub fn get_num(&self) -> u16
pub fn from_raw(msg: &RawMessage) -> Result<Message, Error>
[src]
pub fn from_raw(msg: &RawMessage) -> Result<Message, Error>
Tries to parse the payload in a RawMessage, based on its message type.
Trait Implementations
impl Clone for Message
[src]
impl Clone for Message
fn clone(&self) -> Message
[src]
fn clone(&self) -> Message
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Message
[src]
impl Debug for Message