diff --git a/hueplusplus/include/BrightnessStrategy.h b/hueplusplus/include/BrightnessStrategy.h index 85f2f9b..ff29224 100755 --- a/hueplusplus/include/BrightnessStrategy.h +++ b/hueplusplus/include/BrightnessStrategy.h @@ -27,15 +27,20 @@ class HueLight; //! Virtual base class for all BrightnessStrategies class BrightnessStrategy { - public: - //! \brief Virtual function for changing a lights brightness with a specified transition. - //! - //! \param bri The brightness raning from 0 = off to 255 = fully lit - //! \param transition The time it takes to fade to the new brightness in multiples of 100ms, 4 = 400ms and should be seen as the default - //! \param light A reference of the light - virtual bool setBrightness(unsigned int bri, uint8_t transition, HueLight& light) const = 0; - //! \brief Virtual dtor - virtual ~BrightnessStrategy() = default; +public: + //! \brief Virtual function for changing a lights brightness with a specified transition. + //! + //! \param bri The brightness raning from 0 = off to 255 = fully lit + //! \param transition The time it takes to fade to the new brightness in multiples of 100ms, 4 = 400ms and should be seen as the default + //! \param light A reference of the light + virtual bool setBrightness(unsigned int bri, uint8_t transition, HueLight& light) const = 0; + //! \brief Virtual function that returns the current brightnessof the light + //! + //! \param light A reference of the light + //! \return Unsigned int representing the brightness + virtual unsigned int getBrightness(HueLight& light) const = 0; + //! \brief Virtual dtor + virtual ~BrightnessStrategy() = default; }; #endif diff --git a/hueplusplus/include/ColorHueStrategy.h b/hueplusplus/include/ColorHueStrategy.h index b1880d9..3d848db 100755 --- a/hueplusplus/include/ColorHueStrategy.h +++ b/hueplusplus/include/ColorHueStrategy.h @@ -20,6 +20,7 @@ #ifndef _COLOR_HUE_STRATEGY_H #define _COLOR_HUE_STRATEGY_H +#include #include class HueLight; @@ -27,81 +28,91 @@ class HueLight; //! Virtual base class for all ColorHueStrategies class ColorHueStrategy { - public: - //! \brief Function for changing a lights color in hue with a specified transition. - //! - //! The hue ranges from 0 to 65535, whereas 65535 and 0 are red, 25500 is green and 46920 is blue. - //! \param hue The hue of the color - //! \param transition The time it takes to fade to the new color in multiples of 100ms, 4 = 400ms and should be seen as the default - //! \param light A reference of the light - virtual bool setColorHue(uint16_t hue, uint8_t transition, HueLight& light) const = 0; - //! \brief Function for changing a lights color in saturation with a specified transition. - //! - //! The saturation ranges from 0 to 254, whereas 0 is least saturated (white) and 254 is most saturated (vibrant). - //! \param sat The saturation of the color - //! \param transition The time it takes to fade to the new color in multiples of 100ms, 4 = 400ms and should be seen as the default - //! \param light A reference of the light - virtual bool setColorSaturation(uint8_t sat, uint8_t transition, HueLight& light) const = 0; - //! \brief Function for changing a lights color in hue and saturation format with a specified transition. - //! - //! The hue ranges from 0 to 65535, whereas 65535 and 0 are red, 25500 is green and 46920 is blue. - //! The saturation ranges from 0 to 254, whereas 0 is least saturated (white) and 254 is most saturated (vibrant). - //! \param hue The hue of the color - //! \param sat The saturation of the color - //! \param transition The time it takes to fade to the new color in multiples of 100ms, 4 = 400ms and should be seen as the default - //! \param light A reference of the light - virtual bool setColorHueSaturation(uint16_t hue, uint8_t sat, uint8_t transition, HueLight& light) const = 0; - //! \brief Function for changing a lights color in CIE format with a specified transition. - //! - //! \param x The x coordinate in CIE, ranging from 0 to 1 - //! \param y The y coordinate in CIE, ranging from 0 to 1 - //! \param transition The time it takes to fade to the new color in multiples of 100ms, 4 = 400ms and should be seen as the default - //! \param light A reference of the light - virtual bool setColorXY(float x, float y, uint8_t transition, HueLight& light) const = 0; - //! \brief Function for changing a lights color in rgb format with a specified transition. - //! - //! Red, green and blue are ranging from 0 to 255. - //! \param r The red portion of the color - //! \param g The green portion of the color - //! \param b The blue portion of the color - //! \param transition The time it takes to fade to the new color in multiples of 100ms, 4 = 400ms and should be seen as the default - //! \param light A reference of the light - virtual bool setColorRGB(uint8_t r, uint8_t g, uint8_t b, uint8_t transition, HueLight& light) const = 0; - //! \brief Function for turning on/off the color loop feature of a light. - //! - //! Can be theoretically set for any light, but it only works for lights that support this feature. - //! When this feature is activated the light will fade through every color on the current hue and saturation settings. - //! Notice that none of the setter functions check whether this feature is enabled and - //! the colorloop can only be disabled with this function or by simply calling Off()/OffNoRefresh() - //! and then On()/OnNoRefresh(), so you could alternatively call Off() and - //! then use any of the setter functions. - //! \param on Boolean to turn this feature on or off, true/1 for on and false/0 for off - //! \param light A reference of the light - virtual bool setColorLoop(bool on, HueLight& light) const = 0; - //! \brief Function that lets the light perform one breath cycle in the specified color. - //! - //! The hue ranges from 0 to 65535, whereas 65535 and 0 are red, 25500 is green and 46920 is blue. - //! The saturation ranges from 0 to 254, whereas 0 is least saturated (white) and 254 is most saturated (vibrant). - //! \param hue The hue of the color - //! \param sat The saturation of the color - //! \param light A reference of the light - virtual bool alertHueSaturation(uint16_t hue, uint8_t sat, HueLight& light) const = 0; - //! \brief Function that lets the light perform one breath cycle in the specified color. - //! - //! \param x The x coordinate in CIE, ranging from 0 to 1 - //! \param y The y coordinate in CIE, ranging from 0 to 1 - //! \param light A reference of the light - virtual bool alertXY(float x, float y, HueLight& light) const = 0; - //! \brief Function that lets the light perform one breath cycle in the specified color. - //! - //! Red, green and blue are ranging from 0 to 255. - //! \param r The red portion of the color - //! \param g The green portion of the color - //! \param b The blue portion of the color - //! \param light A reference of the light - virtual bool alertRGB(uint8_t r, uint8_t g, uint8_t b, HueLight& light) const = 0; - //! \brief Virtual dtor - virtual ~ColorHueStrategy() = default; +public: + //! \brief Virtual function for changing a lights color in hue with a specified transition. + //! + //! The hue ranges from 0 to 65535, whereas 65535 and 0 are red, 25500 is green and 46920 is blue. + //! \param hue The hue of the color + //! \param transition The time it takes to fade to the new color in multiples of 100ms, 4 = 400ms and should be seen as the default + //! \param light A reference of the light + virtual bool setColorHue(uint16_t hue, uint8_t transition, HueLight& light) const = 0; + //! \brief Virtual function for changing a lights color in saturation with a specified transition. + //! + //! The saturation ranges from 0 to 254, whereas 0 is least saturated (white) and 254 is most saturated (vibrant). + //! \param sat The saturation of the color + //! \param transition The time it takes to fade to the new color in multiples of 100ms, 4 = 400ms and should be seen as the default + //! \param light A reference of the light + virtual bool setColorSaturation(uint8_t sat, uint8_t transition, HueLight& light) const = 0; + //! \brief Virtual function for changing a lights color in hue and saturation format with a specified transition. + //! + //! The hue ranges from 0 to 65535, whereas 65535 and 0 are red, 25500 is green and 46920 is blue. + //! The saturation ranges from 0 to 254, whereas 0 is least saturated (white) and 254 is most saturated (vibrant). + //! \param hue The hue of the color + //! \param sat The saturation of the color + //! \param transition The time it takes to fade to the new color in multiples of 100ms, 4 = 400ms and should be seen as the default + //! \param light A reference of the light + virtual bool setColorHueSaturation(uint16_t hue, uint8_t sat, uint8_t transition, HueLight& light) const = 0; + //! \brief Virtual function for changing a lights color in CIE format with a specified transition. + //! + //! \param x The x coordinate in CIE, ranging from 0 to 1 + //! \param y The y coordinate in CIE, ranging from 0 to 1 + //! \param transition The time it takes to fade to the new color in multiples of 100ms, 4 = 400ms and should be seen as the default + //! \param light A reference of the light + virtual bool setColorXY(float x, float y, uint8_t transition, HueLight& light) const = 0; + //! \brief Virtual function for changing a lights color in rgb format with a specified transition. + //! + //! Red, green and blue are ranging from 0 to 255. + //! \param r The red portion of the color + //! \param g The green portion of the color + //! \param b The blue portion of the color + //! \param transition The time it takes to fade to the new color in multiples of 100ms, 4 = 400ms and should be seen as the default + //! \param light A reference of the light + virtual bool setColorRGB(uint8_t r, uint8_t g, uint8_t b, uint8_t transition, HueLight& light) const = 0; + //! \brief Virtual function for turning on/off the color loop feature of a light. + //! + //! Can be theoretically set for any light, but it only works for lights that support this feature. + //! When this feature is activated the light will fade through every color on the current hue and saturation settings. + //! Notice that none of the setter functions check whether this feature is enabled and + //! the colorloop can only be disabled with this function or by simply calling Off()/OffNoRefresh() + //! and then On()/OnNoRefresh(), so you could alternatively call Off() and + //! then use any of the setter functions. + //! \param on Boolean to turn this feature on or off, true/1 for on and false/0 for off + //! \param light A reference of the light + virtual bool setColorLoop(bool on, HueLight& light) const = 0; + //! \brief Virtual function that lets the light perform one breath cycle in the specified color. + //! + //! The hue ranges from 0 to 65535, whereas 65535 and 0 are red, 25500 is green and 46920 is blue. + //! The saturation ranges from 0 to 254, whereas 0 is least saturated (white) and 254 is most saturated (vibrant). + //! \param hue The hue of the color + //! \param sat The saturation of the color + //! \param light A reference of the light + virtual bool alertHueSaturation(uint16_t hue, uint8_t sat, HueLight& light) const = 0; + //! \brief Virtual function that lets the light perform one breath cycle in the specified color. + //! + //! \param x The x coordinate in CIE, ranging from 0 to 1 + //! \param y The y coordinate in CIE, ranging from 0 to 1 + //! \param light A reference of the light + virtual bool alertXY(float x, float y, HueLight& light) const = 0; + //! \brief Virtual function that lets the light perform one breath cycle in the specified color. + //! + //! Red, green and blue are ranging from 0 to 255. + //! \param r The red portion of the color + //! \param g The green portion of the color + //! \param b The blue portion of the color + //! \param light A reference of the light + virtual bool alertRGB(uint8_t r, uint8_t g, uint8_t b, HueLight& light) const = 0; + //! \brief Virtual function that returns the current color of the light as hue and saturation + //! + //! \param light A reference of the light + //! \return Pair containing the hue as first value and saturation as second value + virtual std::pair getColorHueSaturation(HueLight& light) const = 0; + //! \brief Virtual function that returns the current color of the light as xy + //! + //! \param light A reference of the light + //! \return Pair containing the x as first value and y as second value + virtual std::pair getColorXY(HueLight& light) const = 0; + //! \brief Virtual dtor + virtual ~ColorHueStrategy() = default; }; #endif diff --git a/hueplusplus/include/ColorTemperatureStrategy.h b/hueplusplus/include/ColorTemperatureStrategy.h index 05bde50..58dc0a9 100755 --- a/hueplusplus/include/ColorTemperatureStrategy.h +++ b/hueplusplus/include/ColorTemperatureStrategy.h @@ -27,22 +27,28 @@ class HueLight; //! Virtual base class for all ColorTemperatureStrategies class ColorTemperatureStrategy { - public: - //! \brief Virtual function for changing a lights color temperature in mired with a specified transition. - //! - //! The color temperature in mired ranges from 153 to 500 whereas 153 is cold and 500 is warm. - //! \param mired The color temperature in mired - //! \param transition The time it takes to fade to the new color in multiples of 100ms, 4 = 400ms and should be seen as the default - //! \param light A reference of the light - virtual bool setColorTemperature(unsigned int mired, uint8_t transition, HueLight& light) const = 0; - //! \brief Virtual function that lets the light perform one breath cycle in the specified color. - //! - //! The color temperature in mired ranges from 153 to 500 whereas 153 is cold and 500 is warm. - //! \param mired The color temperature in mired - //! \param light A reference of the light - virtual bool alertTemperature(unsigned int mired, HueLight& light) const = 0; - //! \brief Virtual dtor - virtual ~ColorTemperatureStrategy() = default; +public: + //! \brief Virtual function for changing a lights color temperature in mired with a specified transition. + //! + //! The color temperature in mired ranges from 153 to 500 whereas 153 is cold and 500 is warm. + //! \param mired The color temperature in mired + //! \param transition The time it takes to fade to the new color in multiples of 100ms, 4 = 400ms and should be seen as the default + //! \param light A reference of the light + virtual bool setColorTemperature(unsigned int mired, uint8_t transition, HueLight& light) const = 0; + //! \brief Virtual function that lets the light perform one breath cycle in the specified color. + //! + //! The color temperature in mired ranges from 153 to 500 whereas 153 is cold and 500 is warm. + //! \param mired The color temperature in mired + //! \param light A reference of the light + virtual bool alertTemperature(unsigned int mired, HueLight& light) const = 0; + //! \brief Virtual function that returns the current color temperature of the light + //! + //! The color temperature in mired ranges from 153 to 500 whereas 153 is cold and 500 is warm. + //! \param light A reference of the light + //! \return Unsigned int representing the color temperature in mired + virtual unsigned int getColorTemperature(HueLight& light) const = 0; + //! \brief Virtual dtor + virtual ~ColorTemperatureStrategy() = default; }; #endif