23 #ifndef INCLUDE_HUEPLUSPLUS_HUE_LIGHT_H 24 #define INCLUDE_HUEPLUSPLUS_HUE_LIGHT_H 36 #include "json/json.hpp" 77 virtual std::string getLuminaireUId()
const;
100 virtual bool on(uint8_t transition = 4);
110 virtual bool off(uint8_t transition = 4);
125 virtual bool isOn()
const;
160 if (brightnessStrategy)
162 return brightnessStrategy->setBrightness(bri, transition, *
this);
175 if (brightnessStrategy)
177 return brightnessStrategy->getBrightness(*
this);
194 if (brightnessStrategy)
196 return brightnessStrategy->getBrightness(*
this);
215 if (colorTemperatureStrategy)
217 return colorTemperatureStrategy->setColorTemperature(mired, transition, *
this);
233 if (colorTemperatureStrategy)
235 return colorTemperatureStrategy->getColorTemperature(*
this);
254 if (colorTemperatureStrategy)
256 return colorTemperatureStrategy->getColorTemperature(*
this);
275 if (colorHueStrategy)
277 return colorHueStrategy->setColorHue(hue, transition, *
this);
296 if (colorHueStrategy)
298 return colorHueStrategy->setColorSaturation(sat, transition, *
this);
317 if (colorHueStrategy)
319 return colorHueStrategy->setColorHueSaturation(hueSat, transition, *
this);
337 if (colorHueStrategy)
339 return colorHueStrategy->getColorHueSaturation(*
this);
357 if (colorHueStrategy)
359 return colorHueStrategy->getColorHueSaturation(*
this);
377 if (colorHueStrategy)
379 return colorHueStrategy->setColorXY(xy, transition, *
this);
392 if (colorHueStrategy)
394 return colorHueStrategy->getColorXY(*
this);
411 if (colorHueStrategy)
413 return colorHueStrategy->getColorXY(*
this);
433 if (colorHueStrategy)
435 return colorHueStrategy->setColorXY(rgb.
toXY(getColorGamut()), transition, *
this);
448 virtual bool alert();
463 if (colorTemperatureStrategy)
465 return colorTemperatureStrategy->alertTemperature(mired, *
this);
483 if (colorHueStrategy)
485 return colorHueStrategy->alertHueSaturation(hueSat, *
this);
503 if (colorHueStrategy)
505 return colorHueStrategy->alertXY(xy, *
this);
527 if (colorHueStrategy)
529 return colorHueStrategy->setColorLoop(on, *
this);
561 Light(
int id,
const std::shared_ptr<APICache>& baseCache);
578 Light(
int id,
const HueCommandAPI& commands, std::shared_ptr<const BrightnessStrategy> brightnessStrategy,
579 std::shared_ptr<const ColorTemperatureStrategy> colorTempStrategy,
580 std::shared_ptr<const ColorHueStrategy> colorHueStrategy, std::chrono::steady_clock::duration refreshDuration,
581 const nlohmann::json& currentState);
590 brightnessStrategy = std::move(strat);
600 colorTemperatureStrategy = std::move(strat);
609 colorHueStrategy = std::move(strat);
615 std::shared_ptr<const BrightnessStrategy>
617 std::shared_ptr<const ColorTemperatureStrategy>
619 std::shared_ptr<const ColorHueStrategy>
virtual bool hasTemperatureControl() const
Const function to check whether this light has color temperature control.
Definition: Light.h:138
ColorType
enum that specifies the color type of all HueLights
Definition: Light.h:42
virtual bool setColorRGB(const RGB &rgb, uint8_t transition=4)
Function to set the color of this light with red green and blue values.
Definition: Light.h:431
light uses Gamut A and has color temperature control
Definition: HueCommandAPI.h:37
Color in RGB.
Definition: ColorUnits.h:109
virtual void setColorHueStrategy(std::shared_ptr< const ColorHueStrategy > strat)
Protected function that sets the colorHue strategy.
Definition: Light.h:607
light uses capabilities to specify a different gamut and has color temperature control ...
virtual bool setColorHueSaturation(const HueSaturation &hueSat, uint8_t transition=4)
Function to set the color of this light with specified hue and saturation.
Definition: Light.h:315
std::shared_ptr< const ColorHueStrategy > colorHueStrategy
holds a reference to the strategy that handles all color commands
Definition: Light.h:620
light has color temperature control
Class implementing the functions of ColorTemperatureStrategy.
Definition: ExtendedColorTemperatureStrategy.h:32
virtual bool hasColorControl() const
Connst function to check whether this light has full color control.
Definition: Light.h:144
Namespace for the hueplusplus library.
Definition: Action.h:27
light uses Gamut C and has color temperature control
virtual bool alertTemperature(unsigned int mired)
Function that lets the light perform one breath cycle in specified color temperature.
Definition: Light.h:461
ColorType for this light is unknown or undefined.
virtual unsigned int getColorTemperature()
Function that returns the current color temperature of the light.
Definition: Light.h:252
virtual bool alertXY(const XYBrightness &xy)
Function that lets the light perform one breath cycle in specified color.
Definition: Light.h:501
Definition: SimpleColorHueStrategy.h:34
virtual unsigned int getBrightness() const
Const function that returns the brightness of this light.
Definition: Light.h:173
light has no specific ColorType
std::shared_ptr< const BrightnessStrategy > brightnessStrategy
holds a reference to the strategy that handles brightness commands
Definition: Light.h:616
virtual HueSaturation getColorHueSaturation()
Function that returns the current color of the light as hue and saturation.
Definition: Light.h:355
Base class for physical devices connected to the bridge (sensor or light).
Definition: BaseDevice.h:35
virtual XYBrightness getColorXY()
Function that returns the current color of the light as xy.
Definition: Light.h:409
Definition: HueDeviceTypes.h:33
virtual bool hasBrightnessControl() const
Const function to check whether this light has brightness control.
Definition: Light.h:131
Color and brightness in CIE.
Definition: ColorUnits.h:62
Class implementing the functions of BrightnessStrategy.
Definition: SimpleBrightnessStrategy.h:32
light uses capabilities to specify a different gamut
virtual bool setColorTemperature(unsigned int mired, uint8_t transition=4)
Function that sets the color temperature of this light in mired.
Definition: Light.h:213
virtual bool setColorSaturation(uint8_t sat, uint8_t transition=4)
Function to set the color of this light with specified saturation.
Definition: Light.h:294
Definition: ExtendedColorHueStrategy.h:34
ColorType colorType
holds the ColorType of the light
Definition: Light.h:610
virtual bool alertHueSaturation(const HueSaturation &hueSat)
Function that lets the light perform one breath cycle in specified color.
Definition: Light.h:481
Transaction class which can be used for either light or group state.
Definition: StateTransaction.h:61
virtual bool setBrightness(unsigned int bri, uint8_t transition=4)
Function that sets the brightness of this light.
Definition: Light.h:158
virtual void setColorTemperatureStrategy(std::shared_ptr< const ColorTemperatureStrategy > strat)
Protected function that sets the colorTemperature strategy.
Definition: Light.h:598
Class for Hue Light fixtures.
Definition: Light.h:60
virtual unsigned int getColorTemperature() const
Const function that returns the current color temperature of the light.
Definition: Light.h:231
virtual unsigned int getBrightness()
Function that returns the brightness of this light.
Definition: Light.h:192
virtual XYBrightness getColorXY() const
Const function that returns the current color of the light as xy.
Definition: Light.h:390
virtual bool setColorHue(uint16_t hue, uint8_t transition=4)
Function to set the color of this light with specified hue.
Definition: Light.h:273
std::shared_ptr< const ColorTemperatureStrategy > colorTemperatureStrategy
holds a reference to the strategy that handles colortemperature commands
Definition: Light.h:618
virtual void setBrightnessStrategy(std::shared_ptr< const BrightnessStrategy > strat)
Protected function that sets the brightness strategy.
Definition: Light.h:588
virtual bool setColorXY(const XYBrightness &xy, uint8_t transition=4)
Function to set the color of this light in CIE with specified x y.
Definition: Light.h:375
Triangle of representable colors in CIE.
Definition: ColorUnits.h:77
Color in hue and saturation.
Definition: ColorUnits.h:31
virtual HueSaturation getColorHueSaturation() const
Const function that returns the current color of the light as hue and saturation. ...
Definition: Light.h:335
light uses Gamut B and has color temperature control
Class implementing the functions of ColorTemperatureStrategy.
Definition: SimpleColorTemperatureStrategy.h:32
XYBrightness toXY() const
Convert to XYBrightness without clamping.
Definition: ColorUnits.cpp:109
virtual bool setColorLoop(bool on)
Function to turn colorloop effect on/off.
Definition: Light.h:525