Loading...
Searching...
No Matches
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.
bool | isOn () const
| Get whether the light is on.
bool | hasBrightness () const
| Get whether a brightness is stored.
int | getBrightness () const
| Get brightness of the light.
bool | hasHueSat () const
| Get whether hue and saturation is stored.
HueSaturation | getHueSat () const
| Get hue and saturation of the light.
bool | hasXY () const
| Get whether xy color is stored.
XYBrightness | getXY () const
| Get xy color of the light.
bool | hasCt () const
| Get whether color temperature is stored.
int | getCt () const
| Get color temperature of the light.
bool | hasEffect () const
| Get whether effect is stored.
bool | getColorloop () const
| Get whether colorloop effect is active.
int | getTransitionTime () const
| Get transition time to this light state.
nlohmann::json | toJson () const
| Convert to json representation.
bool | operator== (const LightState &other) const
| Equality comparison.
bool | operator!= (const LightState &other) const
| Inequality comparison.

## 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:

- include/hueplusplus/Scene.h
- src/Scene.cpp