hueplusplus  1.0.0
Public Member Functions | List of all members
hueplusplus::LightState Class Reference

Immutable state of a light. More...

#include <hueplusplus/Scene.h>

Public Member Functions

 LightState (const nlohmann::json &state)
 Create LightState from json. More...
 
bool isOn () const
 Get whether the light is on. More...
 
bool hasBrightness () const
 Get whether a brightness is stored. More...
 
int getBrightness () const
 Get brightness of the light. More...
 
bool hasHueSat () const
 Get whether hue and saturation is stored. More...
 
HueSaturation getHueSat () const
 Get hue and saturation of the light. More...
 
bool hasXY () const
 Get whether xy color is stored. More...
 
XYBrightness getXY () const
 Get xy color of the light. More...
 
bool hasCt () const
 Get whether color temperature is stored. More...
 
int getCt () const
 Get color temperature of the light. More...
 
bool hasEffect () const
 Get whether effect is stored. More...
 
bool getColorloop () const
 Get whether colorloop effect is active. More...
 
int getTransitionTime () const
 Get transition time to this light state. More...
 
nlohmann::json toJson () const
 Convert to json representation. More...
 
bool operator== (const LightState &other) const
 Equality comparison. More...
 
bool operator!= (const LightState &other) const
 Inequality comparison. More...
 

Detailed Description

Immutable state of a light.

Constructor & Destructor Documentation

◆ LightState()

hueplusplus::LightState::LightState ( const nlohmann::json &  state)
explicit

Create LightState from json.

Note
Use LightStateBuilder for easier creation.

Member Function Documentation

◆ getBrightness()

int hueplusplus::LightState::getBrightness ( ) const

Get brightness of the light.

Returns
Stored brightness, or 0

◆ getColorloop()

bool hueplusplus::LightState::getColorloop ( ) const

Get whether colorloop effect is active.

Returns
true when colorloop is enabled, false otherwise or if not stored

◆ getCt()

int hueplusplus::LightState::getCt ( ) const

Get color temperature of the light.

Returns
Stored color temperature in mired, or 0 if not stored

◆ getHueSat()

HueSaturation hueplusplus::LightState::getHueSat ( ) const

Get hue and saturation of the light.

Returns
Stored hue and saturation, or {0,0} if not stored

◆ getTransitionTime()

int hueplusplus::LightState::getTransitionTime ( ) const

Get transition time to this light state.

Returns
Stored transition time or 4 by default

◆ getXY()

XYBrightness hueplusplus::LightState::getXY ( ) const

Get xy color of the light.

Returns
Stored x,y and brightness, or zeros if not stored

◆ hasBrightness()

bool hueplusplus::LightState::hasBrightness ( ) const

Get whether a brightness is stored.

◆ hasCt()

bool hueplusplus::LightState::hasCt ( ) const

Get whether color temperature is stored.

◆ hasEffect()

bool hueplusplus::LightState::hasEffect ( ) const

Get whether effect is stored.

◆ hasHueSat()

bool hueplusplus::LightState::hasHueSat ( ) const

Get whether hue and saturation is stored.

◆ hasXY()

bool hueplusplus::LightState::hasXY ( ) const

Get whether xy color is stored.

◆ isOn()

bool hueplusplus::LightState::isOn ( ) const

Get whether the light is on.

◆ operator!=()

bool hueplusplus::LightState::operator!= ( const LightState other) const

Inequality comparison.

◆ operator==()

bool hueplusplus::LightState::operator== ( const LightState other) const

Equality comparison.

◆ toJson()

nlohmann::json hueplusplus::LightState::toJson ( ) const

Convert to json representation.


The documentation for this class was generated from the following files: