Commit f0166f40dba9980d1151210187cd8255a6a1a732

Authored by Jojo-1000
Committed by Moritz Wirger
1 parent 5f351ad1

Rename classes to simplify names.

- remove redundant Hue prefix
- change Hue class to Bridge class to make usage clearer
- rename APIConfig to LibConfig to clarify that the configuration is for the library, not for the Hue API that is accessed
Showing 41 changed files with 506 additions and 546 deletions
README.md
... ... @@ -23,14 +23,14 @@ A simple and easy to use library for Philips Hue Lights
23 23 ## How to use
24 24 ### <a name="searchingBridges"></a>Searching for Bridges
25 25 To start searching for a Hue Bridge you will need to choose an IHttpHandler and create one. The options are a "WinHttpHandler" (for windows) or a "LinHttpHandler" (for linux).
26   -Then create a HueFinder object with the handler.
  26 +Then create a BridgeFinder object with the handler.
27 27 The handler is needed, because it tells the finder which functions to use to communicate with a bridge or your local network.
28 28 After that you can call FindBridges(), which will return a vector containing the ip and mac address of all found Bridges.
29 29 ```C++
30 30 // For windows use std::make_shared<hueplusplus::WinHttpHandler>();
31 31 handler = std::make_shared<hueplusplus::LinHttpHandler>();
32   -hueplusplus::HueFinder finder(handler);
33   -std::vector<hueplusplus::HueFinder::HueIdentification> bridges = finder.FindBridges();
  32 +hueplusplus::BridgeFinder finder(handler);
  33 +std::vector<hueplusplus::BridgeFinder::BridgeIdentification> bridges = finder.FindBridges();
34 34 if (bridges.empty())
35 35 {
36 36 std::cerr << "No bridges found\n";
... ... @@ -44,32 +44,32 @@ If you have found the Bridge you were looking for, you can then move on with the
44 44 To get a new username from the Bridge (for now) you simply call GetBridge(bridges[\<index\>]),
45 45 where index is your preferred Bridge from the part [Searching for Bridges](#searchingBridges).
46 46 ```C++
47   -hueplusplus::Hue bridge = finder.GetBridge(bridges[0]);
  47 +hueplusplus::Bridge bridge = finder.GetBridge(bridges[0]);
48 48 ```
49 49 If you on the other hand already have a username you can add your bridge like so
50 50 ```C++
51 51 finder.AddUsername(bridges[0].mac, "<username>");
52   -hueplusplus::Hue bridge = finder.GetBridge(bridges[0]);
  52 +hueplusplus::Bridge bridge = finder.GetBridge(bridges[0]);
53 53 ```
54   -If you do not want to use the HueFinder or you already know the ip and username of your bridge you have the option to create your own Hue object.
  54 +If you do not want to use the BridgeFinder or you already know the ip and username of your bridge you have the option to create your own Bridge object.
55 55 Here you will need to provide the ip address, the port number, a username and an HttpHandler
56 56 ```C++
57 57 // For windows use std::make_shared<hueplusplus::WinHttpHandler>();
58 58 handler = std::make_shared<hueplusplus::LinHttpHandler>();
59   -hueplusplus::Hue bridge("192.168.2.102", 80, "<username>", handler);
  59 +hueplusplus::Bridge bridge("192.168.2.102", 80, "<username>", handler);
60 60 ```
61 61  
62 62 ### Controlling lights
63 63 If you have your Bridge all set up, you can now control its lights.
64   -For that create a new HueLight object and call lights().get(\<id\>) on your bridge object to get a reference to a specific light, where id
  64 +For that create a new Light object and call lights().get(\<id\>) on your bridge object to get a reference to a specific light, where id
65 65 is the id of the light set internally by the Hue Bridge.
66 66 ```C++
67   -hueplusplus::HueLight light1 = bridge.lights().get(1);
  67 +hueplusplus::Light light1 = bridge.lights().get(1);
68 68 ```
69 69 If you don't know the id of a specific light or want to get an overview over all lights that are controlled by your bridge,
70 70 you can get a vector containing them by calling getAll(). If no lights are found the vector will be empty.
71 71 ```C++
72   -std::vector<std::reference_wrapper<hueplusplus::HueLight>> lights = bridge.lights().getAll();
  72 +std::vector<std::reference_wrapper<hueplusplus::Light>> lights = bridge.lights().getAll();
73 73 ```
74 74 If you now want to control a light, call a specific function of it.
75 75 ```C++
... ...
doc/markdown/Mainpage.md
... ... @@ -19,14 +19,14 @@ A simple and easy to use library for Philips Hue Lights.
19 19 ### <a name="searchingBridges"></a>Searching for Bridges
20 20 To start searching for a Hue Bridge you will need to choose an IHttpHandler and create one. The options are a [WinHttpHandler](@ref hueplusplus::WinHttpHandler) (for windows) or a [LinHttpHandler](@ref hueplusplus::LinHttpHandler) (for linux or linux-like).
21 21  
22   -Then create a [HueFinder](@ref hueplusplus::HueFinder) object with the handler.
  22 +Then create a [BridgeFinder](@ref hueplusplus::BridgeFinder) object with the handler.
23 23 The handler is needed, because it tells the finder which functions to use to communicate with a bridge or your local network.
24   -After that you can call [FindBridges()](@ref hueplusplus::HueFinder::FindBridges), which will return a vector containing the ip and mac address of all found Bridges.
  24 +After that you can call [FindBridges()](@ref hueplusplus::BridgeFinder::FindBridges), which will return a vector containing the ip and mac address of all found Bridges.
25 25 ```{.cpp}
26 26 // For windows use std::make_shared<hueplusplus::WinHttpHandler>();
27 27 handler = std::make_shared<hueplusplus::LinHttpHandler>();
28   -hueplusplus::HueFinder finder(handler);
29   -std::vector<hueplusplus::HueFinder::HueIdentification> bridges = finder.FindBridges();
  28 +hueplusplus::BridgeFinder finder(handler);
  29 +std::vector<hueplusplus::BridgeFinder::BridgeIdentification> bridges = finder.FindBridges();
30 30 if (bridges.empty())
31 31 {
32 32 std::cerr << "No bridges found\n";
... ... @@ -37,35 +37,35 @@ if (bridges.empty())
37 37  
38 38 ### Authenticate Bridges
39 39 If you have found the Bridge you were looking for, you can then move on with the authentication process.
40   -To get a new username from the Bridge (for now) you simply call [GetBridge(bridges[\<index\>])](@ref hueplusplus::HueFinder::GetBridge),
  40 +To get a new username from the Bridge (for now) you simply call [GetBridge(bridges[\<index\>])](@ref hueplusplus::BridgeFinder::GetBridge),
41 41 where index is your preferred Bridge from the part [Searching for Bridges](#searchingBridges). This requires the user to press the link button.
42 42 ```{.cpp}
43   -hueplusplus::Hue bridge = finder.GetBridge(bridges[0]);
  43 +hueplusplus::Bridge bridge = finder.GetBridge(bridges[0]);
44 44 ```
45 45 If you on the other hand already have a username you can add your bridge like so
46 46 ```{.cpp}
47 47 finder.AddUsername(bridges[0].mac, "<username>");
48   -hueplusplus::Hue bridge = finder.GetBridge(bridges[0]);
  48 +hueplusplus::Bridge bridge = finder.GetBridge(bridges[0]);
49 49 ```
50   -If you do not want to use the HueFinder or you already know the ip and username of your bridge you have the option to create your own Hue object.
  50 +If you do not want to use the BridgeFinder or you already know the ip and username of your bridge you have the option to create your own Bridge object.
51 51 Here you will need to provide the ip address, the port number, a username and an HttpHandler
52 52 ```{.cpp}
53 53 // For windows use std::make_shared<hueplusplus::WinHttpHandler>();
54 54 handler = std::make_shared<hueplusplus::LinHttpHandler>();
55   -hueplusplus::Hue bridge("192.168.2.102", 80, "<username>", handler);
  55 +hueplusplus::Bridge bridge("192.168.2.102", 80, "<username>", handler);
56 56 ```
57 57  
58 58 ### Controlling lights
59 59 If you have your Bridge all set up, you can now control its lights.
60   -For that create a new HueLight object and call [lights().get(\<id\>)](@ref hueplusplus::ResourceList::get) on your bridge object to get a reference to a specific light, where id
  60 +For that create a new Light object and call [lights().get(\<id\>)](@ref hueplusplus::ResourceList::get) on your bridge object to get a reference to a specific light, where id
61 61 is the id of the light set internally by the Hue Bridge.
62 62 ```{.cpp}
63   -hueplusplus::HueLight light1 = bridge.lights().get(1);
  63 +hueplusplus::Light light1 = bridge.lights().get(1);
64 64 ```
65 65 If you don't know the id of a specific light or want to get an overview over all lights that are controlled by your bridge,
66 66 you can get a vector containing them by calling [getAll()](@ref hueplusplus::ResourceList::getAll) on your bridge object. If no lights are found the vector will be empty.
67 67 ```{.cpp}
68   -std::vector<std::reference_wrapper<hueplusplus::HueLight>> lights = bridge.lights().getAll();
  68 +std::vector<std::reference_wrapper<hueplusplus::Light>> lights = bridge.lights().getAll();
69 69 ```
70 70 If you now want to control a light, call a specific function of it.
71 71 ```{.cpp}
... ... @@ -79,7 +79,7 @@ lights.at(1).setColorHue(4562);
79 79 ```
80 80 But keep in mind that some light types do not have all functions available. So you might call a
81 81 specific function, but nothing will happen. For that you might want to check what type
82   -of a light you are controlling. For that you can call the function [getColorType()](@ref hueplusplus::HueLight::getColorType()), which will return
  82 +of a light you are controlling. For that you can call the function [getColorType()](@ref hueplusplus::Light::getColorType()), which will return
83 83 a ColorType.
84 84 ```{.cpp}
85 85 hueplusplus::ColorType type1 = light1.getColorType();
... ...
include/hueplusplus/Hue.h renamed to include/hueplusplus/Bridge.h
1 1 /**
2   - \file Hue.h
  2 + \file Bridge.h
3 3 Copyright Notice\n
4 4 Copyright (C) 2017 Jan Rogall - developer\n
5 5 Copyright (C) 2017 Moritz Wirger - developer\n
... ... @@ -37,12 +37,12 @@
37 37 #include "Group.h"
38 38 #include "HueCommandAPI.h"
39 39 #include "HueDeviceTypes.h"
40   -#include "HueLight.h"
41   -#include "HueSensor.h"
42 40 #include "IHttpHandler.h"
  41 +#include "Light.h"
43 42 #include "ResourceList.h"
44 43 #include "Scene.h"
45 44 #include "Schedule.h"
  45 +#include "Sensor.h"
46 46 #include "Utils.h"
47 47  
48 48 #include "json/json.hpp"
... ... @@ -51,15 +51,15 @@
51 51 namespace hueplusplus
52 52 {
53 53 // forward declarations
54   -class Hue;
  54 +class Bridge;
55 55  
56 56 //!
57 57 //! Class to find all Hue bridges on the network and create usernames for them.
58 58 //!
59   -class HueFinder
  59 +class BridgeFinder
60 60 {
61 61 public:
62   - struct HueIdentification
  62 + struct BridgeIdentification
63 63 {
64 64 std::string ip;
65 65 int port = 80;
... ... @@ -67,10 +67,10 @@ public:
67 67 };
68 68  
69 69 public:
70   - //! \brief Constructor of HueFinder class
  70 + //! \brief Constructor of BridgeFinder class
71 71 //!
72 72 //! \param handler HttpHandler of type \ref IHttpHandler for communication with the bridge
73   - HueFinder(std::shared_ptr<const IHttpHandler> handler);
  73 + BridgeFinder(std::shared_ptr<const IHttpHandler> handler);
74 74  
75 75 //! \brief Finds all bridges in the network and returns them.
76 76 //!
... ... @@ -78,17 +78,17 @@ public:
78 78 //! \return vector containing ip and mac of all found bridges
79 79 //! \throws std::system_error when system or socket operations fail
80 80 //! \throws HueException when response contained no body
81   - std::vector<HueIdentification> FindBridges() const;
  81 + std::vector<BridgeIdentification> FindBridges() const;
82 82  
83   - //! \brief Gets a \ref Hue bridge based on its identification
  83 + //! \brief Gets a Hue bridge based on its identification
84 84 //!
85   - //! \param identification \ref HueIdentification that specifies a bridge
86   - //! \return \ref Hue class object
  85 + //! \param identification \ref BridgeIdentification that specifies a bridge
  86 + //! \return \ref Bridge class object
87 87 //! \throws std::system_error when system or socket operations fail
88 88 //! \throws HueException when response contained no body or username could not be requested
89 89 //! \throws HueAPIResponseException when response contains an error
90 90 //! \throws nlohmann::json::parse_error when response could not be parsed
91   - Hue GetBridge(const HueIdentification& identification);
  91 + Bridge GetBridge(const BridgeIdentification& identification);
92 92  
93 93 //! \brief Function that adds a username to the usernames map
94 94 //!
... ... @@ -116,26 +116,26 @@ private:
116 116 static std::string ParseDescription(const std::string& description);
117 117  
118 118 std::map<std::string, std::string> usernames; //!< Maps all macs to usernames added by \ref
119   - //!< HueFinder::AddUsername
  119 + //!< BridgeFinder::AddUsername
120 120 std::shared_ptr<const IHttpHandler> http_handler;
121 121 };
122 122  
123   -//! \brief Hue class for a bridge.
  123 +//! \brief Bridge class for a bridge.
124 124 //!
125 125 //! This is the main class used to interact with the Hue bridge.
126   -class Hue
  126 +class Bridge
127 127 {
128   - friend class HueFinder;
  128 + friend class BridgeFinder;
129 129  
130 130 public:
131   - using LightList = ResourceList<HueLight, int>;
  131 + using LightList = ResourceList<Light, int>;
132 132 using GroupList = GroupResourceList<Group, CreateGroup>;
133 133 using ScheduleList = CreateableResourceList<Schedule, int, CreateSchedule>;
134 134 using SceneList = CreateableResourceList<Scene, std::string, CreateScene>;
135   - using SensorList = ResourceList<HueSensor, int>;
  135 + using SensorList = ResourceList<Sensor, int>;
136 136  
137 137 public:
138   - //! \brief Constructor of Hue class
  138 + //! \brief Constructor of Bridge class
139 139 //!
140 140 //! \param ip IP address in dotted decimal notation like "192.168.2.1"
141 141 //! \param port Port of the hue bridge
... ... @@ -143,7 +143,8 @@ public:
143 143 //! the bridge. Can be left empty and acquired in \ref requestUsername.
144 144 //! \param handler HttpHandler for communication with the bridge
145 145 //! \param refreshDuration Time between refreshing the cached state.
146   - Hue(const std::string& ip, const int port, const std::string& username, std::shared_ptr<const IHttpHandler> handler,
  146 + Bridge(const std::string& ip, const int port, const std::string& username,
  147 + std::shared_ptr<const IHttpHandler> handler,
147 148 std::chrono::steady_clock::duration refreshDuration = std::chrono::seconds(10));
148 149  
149 150 //! \brief Refreshes the bridge state.
... ... @@ -200,9 +201,9 @@ public:
200 201 //! \note Does not refresh state.
201 202 const BridgeConfig& config() const;
202 203  
203   - //! \brief Provides access to the HueLight%s on the bridge.
  204 + //! \brief Provides access to the Light%s on the bridge.
204 205 LightList& lights();
205   - //! \brief Provides access to the HueLight%s on the bridge.
  206 + //! \brief Provides access to the Light%s on the bridge.
206 207 //! \note Does not refresh state.
207 208 const LightList& lights() const;
208 209  
... ... @@ -224,9 +225,9 @@ public:
224 225 //! \note Does not refresh state.
225 226 const SceneList& scenes() const;
226 227  
227   - //! \brief Provides access to the HueSensor%s on the bridge.
  228 + //! \brief Provides access to the Sensor%s on the bridge.
228 229 SensorList& sensors();
229   - //! \brief Provides access to the HueSensor%s on the bridge.
  230 + //! \brief Provides access to the Sensor%s on the bridge.
230 231 //! \note Does not refresh state.
231 232 const SensorList& sensors() const;
232 233  
... ... @@ -236,7 +237,7 @@ private:
236 237 //!
237 238 //! The HttpHandler and HueCommandAPI are used for bridge communication.
238 239 //! Resetting the HttpHandler should only be done when the username is first set,
239   - //! before Hue is used.
  240 + //! before Bridge is used.
240 241 //! Resets all caches and resource lists.
241 242 void setHttpHandler(std::shared_ptr<const IHttpHandler> handler);
242 243  
... ...
include/hueplusplus/BrightnessStrategy.h
... ... @@ -27,7 +27,7 @@
27 27  
28 28 namespace hueplusplus
29 29 {
30   -class HueLight;
  30 +class Light;
31 31  
32 32 //! Virtual base class for all BrightnessStrategies
33 33 class BrightnessStrategy
... ... @@ -40,19 +40,19 @@ public:
40 40 //! \param transition The time it takes to fade to the new brightness in
41 41 //! multiples of 100ms, 4 = 400ms and should be seen as the default \param
42 42 //! light A reference of the light
43   - virtual bool setBrightness(unsigned int bri, uint8_t transition, HueLight& light) const = 0;
  43 + virtual bool setBrightness(unsigned int bri, uint8_t transition, Light& light) const = 0;
44 44 //! \brief Virtual function that returns the current brightnessof the light
45 45 //!
46 46 //! Should update the lights state by calling refreshState()
47 47 //! \param light A reference of the light
48 48 //! \return Unsigned int representing the brightness
49   - virtual unsigned int getBrightness(HueLight& light) const = 0;
  49 + virtual unsigned int getBrightness(Light& light) const = 0;
50 50 //! \brief Virtual function that returns the current brightness of the light
51 51 //!
52 52 //! \note This should not update the lights state
53 53 //! \param light A const reference of the light
54 54 //! \return Unsigned int representing the brightness
55   - virtual unsigned int getBrightness(const HueLight& light) const = 0;
  55 + virtual unsigned int getBrightness(const Light& light) const = 0;
56 56 //! \brief Virtual dtor
57 57 virtual ~BrightnessStrategy() = default;
58 58 };
... ...
include/hueplusplus/ColorHueStrategy.h
... ... @@ -30,7 +30,7 @@
30 30  
31 31 namespace hueplusplus
32 32 {
33   -class HueLight;
  33 +class Light;
34 34  
35 35 //! Virtual base class for all ColorHueStrategies
36 36 class ColorHueStrategy
... ... @@ -44,7 +44,7 @@ public:
44 44 //! The time it takes to fade to the new color in multiples of 100ms, 4 =
45 45 //! 400ms and should be seen as the default \param light A reference of the
46 46 //! light
47   - virtual bool setColorHue(uint16_t hue, uint8_t transition, HueLight& light) const = 0;
  47 + virtual bool setColorHue(uint16_t hue, uint8_t transition, Light& light) const = 0;
48 48 //! \brief Virtual function for changing a lights color in saturation with a
49 49 //! specified transition.
50 50 //!
... ... @@ -53,7 +53,7 @@ public:
53 53 //! color \param transition The time it takes to fade to the new color in
54 54 //! multiples of 100ms, 4 = 400ms and should be seen as the default \param
55 55 //! light A reference of the light
56   - virtual bool setColorSaturation(uint8_t sat, uint8_t transition, HueLight& light) const = 0;
  56 + virtual bool setColorSaturation(uint8_t sat, uint8_t transition, Light& light) const = 0;
57 57 //! \brief Virtual function for changing a lights color in hue and saturation
58 58 //! format with a specified transition.
59 59 //!
... ... @@ -61,7 +61,7 @@ public:
61 61 //! \param transition The time it takes to fade to the new color in multiples of
62 62 //! 100ms, 4 = 400ms and should be seen as the default
63 63 //! \param light A reference of the light
64   - virtual bool setColorHueSaturation(const HueSaturation& hueSat, uint8_t transition, HueLight& light) const = 0;
  64 + virtual bool setColorHueSaturation(const HueSaturation& hueSat, uint8_t transition, Light& light) const = 0;
65 65 //! \brief Virtual function for changing a lights color in CIE format with a
66 66 //! specified transition.
67 67 //!
... ... @@ -69,7 +69,7 @@ public:
69 69 //! \param transition The time it takes to fade to the new color in multiples
70 70 //! of 100ms, 4 = 400ms and should be seen as the default \param light A
71 71 //! reference of the light
72   - virtual bool setColorXY(const XYBrightness& xy, uint8_t transition, HueLight& light) const = 0;
  72 + virtual bool setColorXY(const XYBrightness& xy, uint8_t transition, Light& light) const = 0;
73 73  
74 74 //! \brief Virtual function for turning on/off the color loop feature of a
75 75 //! light.
... ... @@ -83,43 +83,43 @@ public:
83 83 //! alternatively call Off() and then use any of the setter functions. \param
84 84 //! on Boolean to turn this feature on or off, true/1 for on and false/0 for
85 85 //! off \param light A reference of the light
86   - virtual bool setColorLoop(bool on, HueLight& light) const = 0;
  86 + virtual bool setColorLoop(bool on, Light& light) const = 0;
87 87 //! \brief Virtual function that lets the light perform one breath cycle in
88 88 //! the specified color.
89 89 //!
90 90 //! \param hueSat The color in hue and saturation
91 91 //! \param light A reference of the light
92   - virtual bool alertHueSaturation(const HueSaturation& hueSat, HueLight& light) const = 0;
  92 + virtual bool alertHueSaturation(const HueSaturation& hueSat, Light& light) const = 0;
93 93 //! \brief Virtual function that lets the light perform one breath cycle in
94 94 //! the specified color.
95 95 //!
96 96 //! \param xy The color in XY and brightness
97 97 //! \param light A reference of the light
98   - virtual bool alertXY(const XYBrightness& xy, HueLight& light) const = 0;
  98 + virtual bool alertXY(const XYBrightness& xy, Light& light) const = 0;
99 99 //! \brief Virtual function that returns the current color of the light as hue
100 100 //! and saturation
101 101 //!
102 102 //! Should update the lights state by calling refreshState()
103 103 //! \param light A reference of the light
104   - virtual HueSaturation getColorHueSaturation(HueLight& light) const = 0;
  104 + virtual HueSaturation getColorHueSaturation(Light& light) const = 0;
105 105 //! \brief Virtual function that returns the current color of the light as hue
106 106 //! and saturation
107 107 //!
108 108 //! \note This should not update the lights state
109 109 //! \param light A const reference of the light
110   - virtual HueSaturation getColorHueSaturation(const HueLight& light) const = 0;
  110 + virtual HueSaturation getColorHueSaturation(const Light& light) const = 0;
111 111 //! \brief Virtual function that returns the current color of the light as xy
112 112 //!
113 113 //! Should update the lights state by calling refreshState()
114 114 //! \param light A reference of the light
115 115 //! \return XY and brightness of current color
116   - virtual XYBrightness getColorXY(HueLight& light) const = 0;
  116 + virtual XYBrightness getColorXY(Light& light) const = 0;
117 117 //! \brief Virtual function that returns the current color of the light as xy
118 118 //!
119 119 //! \note This should not update the lights state
120 120 //! \param light A const reference of the light
121 121 //! \return XY and brightness of current color
122   - virtual XYBrightness getColorXY(const HueLight& light) const = 0;
  122 + virtual XYBrightness getColorXY(const Light& light) const = 0;
123 123 //! \brief Virtual dtor
124 124 virtual ~ColorHueStrategy() = default;
125 125 };
... ...
include/hueplusplus/ColorTemperatureStrategy.h
... ... @@ -27,7 +27,7 @@
27 27  
28 28 namespace hueplusplus
29 29 {
30   -class HueLight;
  30 +class Light;
31 31  
32 32 //! Virtual base class for all ColorTemperatureStrategies
33 33 class ColorTemperatureStrategy
... ... @@ -41,14 +41,14 @@ public:
41 41 //! transition The time it takes to fade to the new color in multiples of
42 42 //! 100ms, 4 = 400ms and should be seen as the default \param light A
43 43 //! reference of the light
44   - virtual bool setColorTemperature(unsigned int mired, uint8_t transition, HueLight& light) const = 0;
  44 + virtual bool setColorTemperature(unsigned int mired, uint8_t transition, Light& light) const = 0;
45 45 //! \brief Virtual function that lets the light perform one breath cycle in
46 46 //! the specified color.
47 47 //!
48 48 //! The color temperature in mired ranges from 153 to 500 whereas 153 is cold
49 49 //! and 500 is warm. \param mired The color temperature in mired \param light
50 50 //! A reference of the light
51   - virtual bool alertTemperature(unsigned int mired, HueLight& light) const = 0;
  51 + virtual bool alertTemperature(unsigned int mired, Light& light) const = 0;
52 52 //! \brief Virtual function that returns the current color temperature of the
53 53 //! light
54 54 //!
... ... @@ -56,7 +56,7 @@ public:
56 56 //! The color temperature in mired ranges from 153 to 500 whereas 153 is cold
57 57 //! and 500 is warm. \param light A reference of the light \return Unsigned
58 58 //! int representing the color temperature in mired
59   - virtual unsigned int getColorTemperature(HueLight& light) const = 0;
  59 + virtual unsigned int getColorTemperature(Light& light) const = 0;
60 60 //! \brief Virtual function that returns the current color temperature of the
61 61 //! light
62 62 //!
... ... @@ -64,7 +64,7 @@ public:
64 64 //! and 500 is warm. \note This should not update the lights state \param
65 65 //! light A const reference of the light \return Unsigned int representing the
66 66 //! color temperature in mired
67   - virtual unsigned int getColorTemperature(const HueLight& light) const = 0;
  67 + virtual unsigned int getColorTemperature(const Light& light) const = 0;
68 68 //! \brief Virtual dtor
69 69 virtual ~ColorTemperatureStrategy() = default;
70 70 };
... ...
include/hueplusplus/ExtendedColorHueStrategy.h
... ... @@ -23,7 +23,7 @@
23 23 #ifndef INCLUDE_HUEPLUSPLUS_EXTENDED_COLOR_HUE_STRATEGY_H
24 24 #define INCLUDE_HUEPLUSPLUS_EXTENDED_COLOR_HUE_STRATEGY_H
25 25  
26   -#include "HueLight.h"
  26 +#include "Light.h"
27 27 #include "SimpleColorHueStrategy.h"
28 28  
29 29 namespace hueplusplus
... ... @@ -39,15 +39,15 @@ public:
39 39 //! \param hueSat The color in hue and saturation
40 40 //! \param light A reference of the light
41 41 //!
42   - //! Blocks for the time a \ref HueLight::alert() needs
43   - bool alertHueSaturation(const HueSaturation& hueSat, HueLight& light) const override;
  42 + //! Blocks for the time a \ref Light::alert() needs
  43 + bool alertHueSaturation(const HueSaturation& hueSat, Light& light) const override;
44 44 //! \brief Function that lets the light perform one breath cycle in the
45 45 //! specified color.
46 46 //! \param xy The color in XY and brightness
47 47 //! \param light A reference of the light
48 48 //!
49   - //! Blocks for the time a \ref HueLight::alert() needs
50   - bool alertXY(const XYBrightness& xy, HueLight& light) const override;
  49 + //! Blocks for the time a \ref Light::alert() needs
  50 + bool alertXY(const XYBrightness& xy, Light& light) const override;
51 51 };
52 52 } // namespace hueplusplus
53 53  
... ...
include/hueplusplus/ExtendedColorTemperatureStrategy.h
... ... @@ -23,7 +23,7 @@
23 23 #ifndef INCLUDE_HUEPLUSPLUS_EXTENDED_COLOR_TEMPERATURE_STRATEGY_H
24 24 #define INCLUDE_HUEPLUSPLUS_EXTENDED_COLOR_TEMPERATURE_STRATEGY_H
25 25  
26   -#include "HueLight.h"
  26 +#include "Light.h"
27 27 #include "SimpleColorTemperatureStrategy.h"
28 28  
29 29 namespace hueplusplus
... ... @@ -36,10 +36,10 @@ public:
36 36 //! specified color.
37 37 //!
38 38 //! It uses this_thread::sleep_for to accomodate for the time an \ref
39   - //! HueLight::alert() needs The color temperature in mired ranges from 153 to
  39 + //! Light::alert() needs The color temperature in mired ranges from 153 to
40 40 //! 500 whereas 153 is cold and 500 is warm. \param mired The color
41 41 //! temperature in mired \param light A reference of the light
42   - bool alertTemperature(unsigned int mired, HueLight& light) const override;
  42 + bool alertTemperature(unsigned int mired, Light& light) const override;
43 43 };
44 44 } // namespace hueplusplus
45 45  
... ...
include/hueplusplus/HueDeviceTypes.h
... ... @@ -26,27 +26,27 @@
26 26 #include <memory>
27 27 #include <string>
28 28  
29   -#include "HueLight.h"
  29 +#include "Light.h"
30 30  
31 31 namespace hueplusplus
32 32 {
33   -class HueLightFactory
  33 +class LightFactory
34 34 {
35 35 public:
36   - //! \brief Create a factory for HueLight%s
  36 + //! \brief Create a factory for Light%s
37 37 //! \param commands HueCommandAPI for communication with the bridge
38 38 //! \param refreshDuration Time between refreshing the cached light state.
39   - HueLightFactory(const HueCommandAPI& commands, std::chrono::steady_clock::duration refreshDuration);
  39 + LightFactory(const HueCommandAPI& commands, std::chrono::steady_clock::duration refreshDuration);
40 40  
41   - //! \brief Create a HueLight with the correct type from the JSON state.
  41 + //! \brief Create a Light with the correct type from the JSON state.
42 42 //! \param lightState Light JSON as returned from the bridge (not only the "state" part of it).
43 43 //! \param id Light id.
44   - //! \returns HueLight with matching id, strategies and \ref ColorType.
  44 + //! \returns Light with matching id, strategies and \ref ColorType.
45 45 //! \throws std::system_error when system or socket operations fail
46 46 //! \throws HueException when light type is unknown
47 47 //! \throws HueAPIResponseException when response contains an error
48 48 //! \throws nlohmann::json::parse_error when response could not be parsed
49   - HueLight createLight(const nlohmann::json& lightState, int id);
  49 + Light createLight(const nlohmann::json& lightState, int id);
50 50  
51 51 private:
52 52 //! \brief Get color type from light JSON.
... ...
include/hueplusplus/APIConfig.h renamed to include/hueplusplus/LibConfig.h
1 1 /**
2   - \file APIConfig.h
  2 + \file LibConfig.h
3 3 Copyright Notice\n
4 4 Copyright (C) 2017 Jan Rogall - developer\n
5 5 Copyright (C) 2017 Moritz Wirger - developer\n
... ... @@ -47,7 +47,7 @@ public:
47 47 //! \brief Delay between bridge requests
48 48 duration getBridgeRequestDelay() const { return bridgeRequestDelay; }
49 49  
50   - //! \brief Timeout for Hue::requestUsername, waits until link button was pressed
  50 + //! \brief Timeout for Bridge::requestUsername, waits until link button was pressed
51 51 duration getRequestUsernameTimeout() const { return requestUsernameDelay; }
52 52  
53 53 //! \brief Interval in which username requests are attempted
... ...
include/hueplusplus/HueLight.h renamed to include/hueplusplus/Light.h
1 1 /**
2   - \file HueLight.h
  2 + \file Light.h
3 3 Copyright Notice\n
4 4 Copyright (C) 2017 Jan Rogall - developer\n
5 5 Copyright (C) 2017 Moritz Wirger - developer\n
... ... @@ -37,47 +37,6 @@
37 37  
38 38 namespace hueplusplus
39 39 {
40   -/*enum ModelType
41   -{
42   -UNDEFINED, // undefined model
43   -LCT001, // Hue bulb A19, Color Gamut B, ECL
44   -LCT007, // Hue bulb A19, Color Gamut B, ECL
45   -LCT010, // Hue bulb A19, Color Gamut C, ECL
46   -LCT014, // Hue bulb A19, Color Gamut C, ECL
47   -
48   -LCT002, // Hue Spot BR30, Color Gamut B, ECL
49   -LCT003, // Hue Spot GU10, Color Gamut B, ECL
50   -
51   -LCT011, // Hue BR30, Color Gamut C, ECL
52   -
53   -LST001, // Hue LightStrips, Color Gamut A, CL
54   -LST002, // Hue LightStrips Plus, Color Gamut C, ECL
55   -
56   -LLC010, // Hue Living Colors Iris, Color Gamut A, CL
57   -LLC011, // Hue Living Colors Bloom, Color Gamut A, CL
58   -LLC012, // Hue Living Colors Bloom, Color Gamut A, CL
59   -LLC006, // Living Colors Gen3 Iris, Color Gamut A, CL, NO HUE FRIEND
60   -LLC007, // Living Colors Gen3 Bloom, Aura, Color Gamut A, CL, NO HUE FRIEND
61   -LLC013, // Disney Living Colors, Color Gamut A, CL
62   -
63   -LWB004, // Hue A19 Lux, Color Gamut -, DL
64   -LWB006, // Hue A19 Lux, Color Gamut -, DL
65   -LWB007, // Hue A19 Lux, Color Gamut -, DL
66   -LWB010, // Hue A19 Lux, Color Gamut -, DL
67   -LWB014, // Hue A19 Lux, Color Gamut -, DL
68   -
69   -LLM001, // Color Light Module, Color Gamut B, ECL
70   -LLM010, // Color Temperature Module, Color Gamut 2200K-6500K, CTL
71   -LLM011, // Color Temperature Module, Color Gamut 2200K-6500K, CTL
72   -LLM012, // Color Temperature Module, Color Gamut 2200K-6500K, CTL
73   -
74   -LTW001, // Hue Spot BR30, Color Gamut 2200K-6500K, CTL
75   -LTW004, // Hue Spot BR30, Color Gamut 2200K-6500K, CTL
76   -LTW013, // Hue Spot BR30, Color Gamut 2200K-6500K, CTL
77   -LTW014, // Hue Spot BR30, Color Gamut 2200K-6500K, CTL
78   -
79   -LLC020 // Hue Go, Color Gamut C, ECL
80   -};*/
81 40  
82 41 //! enum that specifies the color type of all HueLights
83 42 enum class ColorType
... ... @@ -96,9 +55,9 @@ enum class ColorType
96 55 //! \brief Class for Hue Light fixtures
97 56 //!
98 57 //! Provides methods to query and control lights.
99   -class HueLight : public BaseDevice
  58 +class Light : public BaseDevice
100 59 {
101   - friend class HueLightFactory;
  60 + friend class LightFactory;
102 61 friend class SimpleBrightnessStrategy;
103 62 friend class SimpleColorHueStrategy;
104 63 friend class ExtendedColorHueStrategy;
... ... @@ -595,15 +554,15 @@ public:
595 554 ///@}
596 555  
597 556 protected:
598   - //! \brief Protected ctor that is used by \ref Hue class.
  557 + //! \brief Protected ctor that is used by \ref Bridge class.
599 558 //!
600 559 //! \param id Integer that specifies the id of this light
601 560 //! \param commands HueCommandAPI for communication with the bridge
602 561 //!
603 562 //! leaves strategies unset
604   - HueLight(int id, const HueCommandAPI& commands);
  563 + Light(int id, const HueCommandAPI& commands);
605 564  
606   - //! \brief Protected ctor that is used by \ref Hue class, also sets
  565 + //! \brief Protected ctor that is used by \ref Bridge class, also sets
607 566 //! strategies.
608 567 //!
609 568 //! \param id Integer that specifies the id of this light
... ... @@ -617,7 +576,7 @@ protected:
617 576 //! \throws HueException when response contained no body
618 577 //! \throws HueAPIResponseException when response contains an error
619 578 //! \throws nlohmann::json::parse_error when response could not be parsed
620   - HueLight(int id, const HueCommandAPI& commands, std::shared_ptr<const BrightnessStrategy> brightnessStrategy,
  579 + Light(int id, const HueCommandAPI& commands, std::shared_ptr<const BrightnessStrategy> brightnessStrategy,
621 580 std::shared_ptr<const ColorTemperatureStrategy> colorTempStrategy,
622 581 std::shared_ptr<const ColorHueStrategy> colorHueStrategy,
623 582 std::chrono::steady_clock::duration refreshDuration = std::chrono::seconds(10));
... ...
include/hueplusplus/HueSensor.h renamed to include/hueplusplus/Sensor.h
1 1 /**
2   - \file HueSensor.h
  2 + \file Sensor.h
3 3 Copyright Notice\n
4 4 Copyright (C) 2020 Stefan Herbrechtsmeier - developer\n
5 5  
... ... @@ -32,15 +32,15 @@
32 32 namespace hueplusplus
33 33 {
34 34 //!
35   -//! Class for Hue Sensor fixtures
  35 +//! Class for Hue sensors
36 36 //!
37   -class HueSensor : public BaseDevice
  37 +class Sensor : public BaseDevice
38 38 {
39   - friend class Hue;
  39 + friend class Bridge;
40 40  
41 41 public:
42 42 //! \brief std dtor
43   - ~HueSensor() = default;
  43 + ~Sensor() = default;
44 44  
45 45 //! \brief Function to get button event
46 46 //!
... ... @@ -85,12 +85,12 @@ public:
85 85 virtual bool hasStatus() const;
86 86  
87 87 protected:
88   - //! \brief Protected ctor that is used by \ref Hue class.
  88 + //! \brief Protected ctor that is used by \ref Bridge class.
89 89 //!
90 90 //! \param id Integer that specifies the id of this sensor
91 91 //! \param commands HueCommandAPI for communication with the bridge
92 92 //! \param refreshDuration Time between refreshing the cached state.
93   - HueSensor(int id, const HueCommandAPI& commands, std::chrono::steady_clock::duration refreshDuration);
  93 + Sensor(int id, const HueCommandAPI& commands, std::chrono::steady_clock::duration refreshDuration);
94 94 };
95 95 } // namespace hueplusplus
96 96  
... ...
include/hueplusplus/SimpleBrightnessStrategy.h
... ... @@ -24,7 +24,7 @@
24 24 #define INCLUDE_HUEPLUSPLUS_SIMPLE_BRIGHTNESS_STRATEGY_H
25 25  
26 26 #include "BrightnessStrategy.h"
27   -#include "HueLight.h"
  27 +#include "Light.h"
28 28  
29 29 namespace hueplusplus
30 30 {
... ... @@ -39,19 +39,19 @@ public:
39 39 //! \param transition The time it takes to fade to the new brightness in
40 40 //! multiples of 100ms, 4 = 400ms and should be seen as the default \param
41 41 //! light A reference of the light
42   - bool setBrightness(unsigned int bri, uint8_t transition, HueLight& light) const override;
  42 + bool setBrightness(unsigned int bri, uint8_t transition, Light& light) const override;
43 43 //! \brief Function that returns the current brightness of the light
44 44 //!
45 45 //! Updates the lights state by calling refreshState()
46 46 //! \param light A reference of the light
47 47 //! \return Unsigned int representing the brightness
48   - unsigned int getBrightness(HueLight& light) const override;
  48 + unsigned int getBrightness(Light& light) const override;
49 49 //! \brief Function that returns the current brightness of the light
50 50 //!
51 51 //! \note This does not update the lights state
52 52 //! \param light A const reference of the light
53 53 //! \return Unsigned int representing the brightness
54   - unsigned int getBrightness(const HueLight& light) const override;
  54 + unsigned int getBrightness(const Light& light) const override;
55 55 };
56 56 } // namespace hueplusplus
57 57  
... ...
include/hueplusplus/SimpleColorHueStrategy.h
... ... @@ -24,7 +24,7 @@
24 24 #define INCLUDE_HUEPLUSPLUS_SIMPLE_COLOR_HUE_STRATEGY_H
25 25  
26 26 #include "ColorHueStrategy.h"
27   -#include "HueLight.h"
  27 +#include "Light.h"
28 28  
29 29 namespace hueplusplus
30 30 {
... ... @@ -42,7 +42,7 @@ public:
42 42 //! The time it takes to fade to the new color in multiples of 100ms, 4 =
43 43 //! 400ms and should be seen as the default \param light A reference of the
44 44 //! light
45   - bool setColorHue(uint16_t hue, uint8_t transition, HueLight& light) const override;
  45 + bool setColorHue(uint16_t hue, uint8_t transition, Light& light) const override;
46 46 //! \brief Function for changing a lights color in saturation with a specified
47 47 //! transition.
48 48 //!
... ... @@ -51,7 +51,7 @@ public:
51 51 //! color \param transition The time it takes to fade to the new color in
52 52 //! multiples of 100ms, 4 = 400ms and should be seen as the default \param
53 53 //! light A reference of the light
54   - bool setColorSaturation(uint8_t sat, uint8_t transition, HueLight& light) const override;
  54 + bool setColorSaturation(uint8_t sat, uint8_t transition, Light& light) const override;
55 55 //! \brief Function for changing a lights color in hue and saturation format
56 56 //! with a specified transition.
57 57 //!
... ... @@ -59,7 +59,7 @@ public:
59 59 //! \param transition The time it takes to fade to the new color in multiples of
60 60 //! 100ms, 4 = 400ms and should be seen as the default
61 61 //! \param light A reference of the light
62   - bool setColorHueSaturation(const HueSaturation& hueSat, uint8_t transition, HueLight& light) const override;
  62 + bool setColorHueSaturation(const HueSaturation& hueSat, uint8_t transition, Light& light) const override;
63 63 //! \brief Function for changing a lights color in CIE format with a specified
64 64 //! transition.
65 65 //!
... ... @@ -67,7 +67,7 @@ public:
67 67 //! \param transition The time it takes to fade to the new color in multiples
68 68 //! of 100ms, 4 = 400ms and should be seen as the default \param light A
69 69 //! reference of the light
70   - bool setColorXY(const XYBrightness& xy, uint8_t transition, HueLight& light) const override;
  70 + bool setColorXY(const XYBrightness& xy, uint8_t transition, Light& light) const override;
71 71  
72 72 //! \brief Function for turning on/off the color loop feature of a light.
73 73 //!
... ... @@ -80,19 +80,19 @@ public:
80 80 //! alternatively call Off() and then use any of the setter functions.
81 81 //! \param on Boolean to turn this feature on or off, true/1 for on and
82 82 //! false/0 for off \param light A reference of the light
83   - bool setColorLoop(bool on, HueLight& light) const override;
  83 + bool setColorLoop(bool on, Light& light) const override;
84 84 //! \brief Function that lets the light perform one breath cycle in the
85 85 //! specified color.
86 86 //! \param hueSat The color in hue and saturation
87 87 //! \param light A reference of the light
88 88 //!
89   - //! Blocks for the time a \ref HueLight::alert() needs
90   - bool alertHueSaturation(const HueSaturation& hueSat, HueLight& light) const override;
  89 + //! Blocks for the time a \ref Light::alert() needs
  90 + bool alertHueSaturation(const HueSaturation& hueSat, Light& light) const override;
91 91 //! \brief Function that lets the light perform one breath cycle in the
92 92 //! specified color.
93 93 //! \param xy The color in XY and brightness
94 94 //! \param light A reference of the light
95   - bool alertXY(const XYBrightness& xy, HueLight& light) const override;
  95 + bool alertXY(const XYBrightness& xy, Light& light) const override;
96 96 //! \brief Function that returns the current color of the light as hue and
97 97 //! saturation
98 98 //!
... ... @@ -100,7 +100,7 @@ public:
100 100 //! \param light A reference of the light
101 101 //! \return Pair containing the hue as first value and saturation as second
102 102 //! value
103   - HueSaturation getColorHueSaturation(HueLight& light) const override;
  103 + HueSaturation getColorHueSaturation(Light& light) const override;
104 104 //! \brief Function that returns the current color of the light as hue and
105 105 //! saturation
106 106 //!
... ... @@ -108,19 +108,19 @@ public:
108 108 //! \param light A const reference of the light
109 109 //! \return Pair containing the hue as first value and saturation as second
110 110 //! value
111   - HueSaturation getColorHueSaturation(const HueLight& light) const override;
  111 + HueSaturation getColorHueSaturation(const Light& light) const override;
112 112 //! \brief Function that returns the current color of the light as xy
113 113 //!
114 114 //! Updates the lights state by calling refreshState()
115 115 //! \param light A reference of the light
116 116 //! \return XY and brightness of current color
117   - XYBrightness getColorXY(HueLight& light) const override;
  117 + XYBrightness getColorXY(Light& light) const override;
118 118 //! \brief Function that returns the current color of the light as xy
119 119 //!
120 120 //! \note This does not update the lights state
121 121 //! \param light A const reference of the light
122 122 //! \return XY and brightness of current color
123   - XYBrightness getColorXY(const HueLight& light) const override;
  123 + XYBrightness getColorXY(const Light& light) const override;
124 124 };
125 125 } // namespace hueplusplus
126 126  
... ...
include/hueplusplus/SimpleColorTemperatureStrategy.h
... ... @@ -24,7 +24,7 @@
24 24 #define INCLUDE_HUEPLUSPLUS_SIMPLE_COLOR_TEMPERATURE_STRATEGY_H
25 25  
26 26 #include "ColorTemperatureStrategy.h"
27   -#include "HueLight.h"
  27 +#include "Light.h"
28 28  
29 29 namespace hueplusplus
30 30 {
... ... @@ -40,29 +40,29 @@ public:
40 40 //! transition The time it takes to fade to the new color in multiples of
41 41 //! 100ms, 4 = 400ms and should be seen as the default \param light A
42 42 //! reference of the light
43   - bool setColorTemperature(unsigned int mired, uint8_t transition, HueLight& light) const override;
  43 + bool setColorTemperature(unsigned int mired, uint8_t transition, Light& light) const override;
44 44 //! \brief Function that lets the light perform one breath cycle in the
45 45 //! specified color.
46 46 //!
47 47 //! It uses this_thread::sleep_for to accomodate for the time an \ref
48   - //! HueLight::alert() needs The color temperature in mired ranges from 153 to
  48 + //! Light::alert() needs The color temperature in mired ranges from 153 to
49 49 //! 500 whereas 153 is cold and 500 is warm. \param mired The color
50 50 //! temperature in mired \param light A reference of the light
51   - bool alertTemperature(unsigned int mired, HueLight& light) const override;
  51 + bool alertTemperature(unsigned int mired, Light& light) const override;
52 52 //! \brief Function that returns the current color temperature of the light
53 53 //!
54 54 //! Updates the lights state by calling refreshState()
55 55 //! The color temperature in mired ranges from 153 to 500 whereas 153 is cold
56 56 //! and 500 is warm. \param light A reference of the light \return Unsigned
57 57 //! int representing the color temperature in mired
58   - unsigned int getColorTemperature(HueLight& light) const override;
  58 + unsigned int getColorTemperature(Light& light) const override;
59 59 //! \brief Function that returns the current color temperature of the light
60 60 //!
61 61 //! The color temperature in mired ranges from 153 to 500 whereas 153 is cold
62 62 //! and 500 is warm. \note This does not update the lights state \param light
63 63 //! A const reference of the light \return Unsigned int representing the color
64 64 //! temperature in mired
65   - unsigned int getColorTemperature(const HueLight& light) const override;
  65 + unsigned int getColorTemperature(const Light& light) const override;
66 66 };
67 67 } // namespace hueplusplus
68 68  
... ...
include/hueplusplus/StateTransaction.h
... ... @@ -77,7 +77,7 @@ public:
77 77 //! the current state are removed. This reduces load on the bridge. On the other hand, an outdated
78 78 //! state might cause requests to be dropped unexpectedly. Has no effect on groups.
79 79 //! \returns true on success or when no change was requested.
80   - //! \note After changing the state of a HueLight or Group,
  80 + //! \note After changing the state of a Light or Group,
81 81 //! refresh() must be called if the updated values are needed immediately.
82 82 //! \throws std::system_error when system or socket operations fail
83 83 //! \throws HueException when response contains no body
... ...
src/Hue.cpp renamed to src/Bridge.cpp
1 1 /**
2   - \file Hue.cpp
  2 + \file Bridge.cpp
3 3 Copyright Notice\n
4 4 Copyright (C) 2017 Jan Rogall - developer\n
5 5 Copyright (C) 2017 Moritz Wirger - developer\n
... ... @@ -20,7 +20,7 @@
20 20 along with hueplusplus. If not, see <http://www.gnu.org/licenses/>.
21 21 **/
22 22  
23   -#include "hueplusplus/Hue.h"
  23 +#include "hueplusplus/Bridge.h"
24 24  
25 25 #include <algorithm>
26 26 #include <cctype>
... ... @@ -31,27 +31,27 @@
31 31 #include <stdexcept>
32 32 #include <thread>
33 33  
34   -#include "hueplusplus/APIConfig.h"
  34 +#include "hueplusplus/LibConfig.h"
35 35 #include "hueplusplus/HueExceptionMacro.h"
36 36 #include "hueplusplus/UPnP.h"
37 37 #include "hueplusplus/Utils.h"
38 38  
39 39 namespace hueplusplus
40 40 {
41   -HueFinder::HueFinder(std::shared_ptr<const IHttpHandler> handler) : http_handler(std::move(handler)) { }
  41 +BridgeFinder::BridgeFinder(std::shared_ptr<const IHttpHandler> handler) : http_handler(std::move(handler)) { }
42 42  
43   -std::vector<HueFinder::HueIdentification> HueFinder::FindBridges() const
  43 +std::vector<BridgeFinder::BridgeIdentification> BridgeFinder::FindBridges() const
44 44 {
45 45 UPnP uplug;
46 46 std::vector<std::pair<std::string, std::string>> foundDevices = uplug.getDevices(http_handler);
47 47  
48   - std::vector<HueIdentification> foundBridges;
  48 + std::vector<BridgeIdentification> foundBridges;
49 49 for (const std::pair<std::string, std::string>& p : foundDevices)
50 50 {
51 51 size_t found = p.second.find("IpBridge");
52 52 if (found != std::string::npos)
53 53 {
54   - HueIdentification bridge;
  54 + BridgeIdentification bridge;
55 55 size_t start = p.first.find("//") + 2;
56 56 size_t length = p.first.find(":", start) - start;
57 57 bridge.ip = p.first.substr(start, length);
... ... @@ -68,15 +68,15 @@ std::vector&lt;HueFinder::HueIdentification&gt; HueFinder::FindBridges() const
68 68 return foundBridges;
69 69 }
70 70  
71   -Hue HueFinder::GetBridge(const HueIdentification& identification)
  71 +Bridge BridgeFinder::GetBridge(const BridgeIdentification& identification)
72 72 {
73 73 std::string normalizedMac = NormalizeMac(identification.mac);
74 74 auto pos = usernames.find(normalizedMac);
75 75 if (pos != usernames.end())
76 76 {
77   - return Hue(identification.ip, identification.port, pos->second, http_handler);
  77 + return Bridge(identification.ip, identification.port, pos->second, http_handler);
78 78 }
79   - Hue bridge(identification.ip, identification.port, "", http_handler);
  79 + Bridge bridge(identification.ip, identification.port, "", http_handler);
80 80 bridge.requestUsername();
81 81 if (bridge.getUsername().empty())
82 82 {
... ... @@ -88,17 +88,17 @@ Hue HueFinder::GetBridge(const HueIdentification&amp; identification)
88 88 return bridge;
89 89 }
90 90  
91   -void HueFinder::AddUsername(const std::string& mac, const std::string& username)
  91 +void BridgeFinder::AddUsername(const std::string& mac, const std::string& username)
92 92 {
93 93 usernames[NormalizeMac(mac)] = username;
94 94 }
95 95  
96   -const std::map<std::string, std::string>& HueFinder::GetAllUsernames() const
  96 +const std::map<std::string, std::string>& BridgeFinder::GetAllUsernames() const
97 97 {
98 98 return usernames;
99 99 }
100 100  
101   -std::string HueFinder::NormalizeMac(std::string input)
  101 +std::string BridgeFinder::NormalizeMac(std::string input)
102 102 {
103 103 // Remove any non alphanumeric characters (e.g. ':' and whitespace)
104 104 input.erase(std::remove_if(input.begin(), input.end(), [](char c) { return !std::isalnum(c, std::locale()); }),
... ... @@ -108,7 +108,7 @@ std::string HueFinder::NormalizeMac(std::string input)
108 108 return input;
109 109 }
110 110  
111   -std::string HueFinder::ParseDescription(const std::string& description)
  111 +std::string BridgeFinder::ParseDescription(const std::string& description)
112 112 {
113 113 const char* model = "<modelName>Philips hue bridge";
114 114 const char* serialBegin = "<serialNumber>";
... ... @@ -130,7 +130,7 @@ std::string HueFinder::ParseDescription(const std::string&amp; description)
130 130 return std::string();
131 131 }
132 132  
133   -Hue::Hue(const std::string& ip, const int port, const std::string& username,
  133 +Bridge::Bridge(const std::string& ip, const int port, const std::string& username,
134 134 std::shared_ptr<const IHttpHandler> handler, std::chrono::steady_clock::duration refreshDuration)
135 135 : ip(ip),
136 136 username(username),
... ... @@ -140,7 +140,7 @@ Hue::Hue(const std::string&amp; ip, const int port, const std::string&amp; username,
140 140 stateCache(std::make_shared<APICache>(
141 141 "", HueCommandAPI(ip, port, username, http_handler), std::chrono::steady_clock::duration::max())),
142 142 lightList(stateCache, "lights", refreshDuration,
143   - [factory = HueLightFactory(stateCache->getCommandAPI(), refreshDuration)](
  143 + [factory = LightFactory(stateCache->getCommandAPI(), refreshDuration)](
144 144 int id, const nlohmann::json& state) mutable { return factory.createLight(state, id); }),
145 145 groupList(stateCache, "groups", refreshDuration),
146 146 scheduleList(stateCache, "schedules", refreshDuration),
... ... @@ -149,22 +149,22 @@ Hue::Hue(const std::string&amp; ip, const int port, const std::string&amp; username,
149 149 bridgeConfig(stateCache, refreshDuration)
150 150 { }
151 151  
152   -void Hue::refresh()
  152 +void Bridge::refresh()
153 153 {
154 154 stateCache->refresh();
155 155 }
156 156  
157   -std::string Hue::getBridgeIP() const
  157 +std::string Bridge::getBridgeIP() const
158 158 {
159 159 return ip;
160 160 }
161 161  
162   -int Hue::getBridgePort() const
  162 +int Bridge::getBridgePort() const
163 163 {
164 164 return port;
165 165 }
166 166  
167   -std::string Hue::requestUsername()
  167 +std::string Bridge::requestUsername()
168 168 {
169 169 std::chrono::steady_clock::duration timeout = Config::instance().getRequestUsernameTimeout();
170 170 std::chrono::steady_clock::duration checkInterval = Config::instance().getRequestUsernameAttemptInterval();
... ... @@ -207,87 +207,87 @@ std::string Hue::requestUsername()
207 207 return username;
208 208 }
209 209  
210   -std::string Hue::getUsername() const
  210 +std::string Bridge::getUsername() const
211 211 {
212 212 return username;
213 213 }
214 214  
215   -void Hue::setIP(const std::string& ip)
  215 +void Bridge::setIP(const std::string& ip)
216 216 {
217 217 this->ip = ip;
218 218 }
219 219  
220   -void Hue::setPort(const int port)
  220 +void Bridge::setPort(const int port)
221 221 {
222 222 this->port = port;
223 223 }
224 224  
225   -BridgeConfig& Hue::config()
  225 +BridgeConfig& Bridge::config()
226 226 {
227 227 return bridgeConfig;
228 228 }
229 229  
230   -const BridgeConfig& Hue::config() const
  230 +const BridgeConfig& Bridge::config() const
231 231 {
232 232 return bridgeConfig;
233 233 }
234 234  
235   -Hue::LightList& Hue::lights()
  235 +Bridge::LightList& Bridge::lights()
236 236 {
237 237 return lightList;
238 238 }
239 239  
240   -const Hue::LightList& Hue::lights() const
  240 +const Bridge::LightList& Bridge::lights() const
241 241 {
242 242 return lightList;
243 243 }
244 244  
245   -Hue::GroupList& Hue::groups()
  245 +Bridge::GroupList& Bridge::groups()
246 246 {
247 247 return groupList;
248 248 }
249 249  
250   -const Hue::GroupList& Hue::groups() const
  250 +const Bridge::GroupList& Bridge::groups() const
251 251 {
252 252 return groupList;
253 253 }
254 254  
255   -Hue::ScheduleList& Hue::schedules()
  255 +Bridge::ScheduleList& Bridge::schedules()
256 256 {
257 257 return scheduleList;
258 258 }
259 259  
260   -const Hue::ScheduleList& Hue::schedules() const
  260 +const Bridge::ScheduleList& Bridge::schedules() const
261 261 {
262 262 return scheduleList;
263 263 }
264 264  
265   -Hue::SceneList& Hue::scenes()
  265 +Bridge::SceneList& Bridge::scenes()
266 266 {
267 267 return sceneList;
268 268 }
269 269  
270   -const Hue::SceneList& Hue::scenes() const
  270 +const Bridge::SceneList& Bridge::scenes() const
271 271 {
272 272 return sceneList;
273 273 }
274 274  
275   -Hue::SensorList& Hue::sensors()
  275 +Bridge::SensorList& Bridge::sensors()
276 276 {
277 277 return sensorList;
278 278 }
279 279  
280   -const Hue::SensorList& Hue::sensors() const
  280 +const Bridge::SensorList& Bridge::sensors() const
281 281 {
282 282 return sensorList;
283 283 }
284 284  
285   -void Hue::setHttpHandler(std::shared_ptr<const IHttpHandler> handler)
  285 +void Bridge::setHttpHandler(std::shared_ptr<const IHttpHandler> handler)
286 286 {
287 287 http_handler = handler;
288 288 stateCache = std::make_shared<APICache>("", HueCommandAPI(ip, port, username, handler), refreshDuration);
289   - lightList = ResourceList<HueLight, int>(stateCache, "lights", refreshDuration,
290   - [factory = HueLightFactory(stateCache->getCommandAPI(), refreshDuration)](
  289 + lightList = ResourceList<Light, int>(stateCache, "lights", refreshDuration,
  290 + [factory = LightFactory(stateCache->getCommandAPI(), refreshDuration)](
291 291 int id, const nlohmann::json& state) mutable { return factory.createLight(state, id); });
292 292 groupList = GroupList(stateCache, "groups", refreshDuration);
293 293 scheduleList = ScheduleList(stateCache, "schedules", refreshDuration);
... ...
src/CMakeLists.txt
... ... @@ -2,20 +2,20 @@ set(hueplusplus_SOURCES
2 2 APICache.cpp
3 3 BaseDevice.cpp
4 4 BaseHttpHandler.cpp
  5 + Bridge.cpp
5 6 BridgeConfig.cpp
6 7 ColorUnits.cpp
7 8 ExtendedColorHueStrategy.cpp
8 9 ExtendedColorTemperatureStrategy.cpp
9 10 Group.cpp
10   - Hue.cpp
11 11 HueCommandAPI.cpp
12 12 HueDeviceTypes.cpp
13 13 HueException.cpp
14   - HueLight.cpp
15   - HueSensor.cpp
  14 + Light.cpp
16 15 ModelPictures.cpp
17 16 Scene.cpp
18 17 Schedule.cpp
  18 + Sensor.cpp
19 19 SimpleBrightnessStrategy.cpp
20 20 SimpleColorHueStrategy.cpp
21 21 SimpleColorTemperatureStrategy.cpp
... ...
src/ExtendedColorHueStrategy.cpp
... ... @@ -26,11 +26,11 @@
26 26 #include <iostream>
27 27 #include <thread>
28 28  
29   -#include "hueplusplus/APIConfig.h"
  29 +#include "hueplusplus/LibConfig.h"
30 30  
31 31 namespace hueplusplus
32 32 {
33   -bool ExtendedColorHueStrategy::alertHueSaturation(const HueSaturation& hueSat, HueLight& light) const
  33 +bool ExtendedColorHueStrategy::alertHueSaturation(const HueSaturation& hueSat, Light& light) const
34 34 {
35 35 // Careful, only use state until any light function might refresh the value and invalidate the reference
36 36 const nlohmann::json& state = light.state.getValue()["state"];
... ... @@ -57,14 +57,14 @@ bool ExtendedColorHueStrategy::alertHueSaturation(const HueSaturation&amp; hueSat, H
57 57 }
58 58 }
59 59  
60   -bool ExtendedColorHueStrategy::alertXY(const XYBrightness& xy, HueLight& light) const
  60 +bool ExtendedColorHueStrategy::alertXY(const XYBrightness& xy, Light& light) const
61 61 {
62 62 // Careful, only use state until any light function might refresh the value and invalidate the reference
63 63 const nlohmann::json& state = light.state.getValue()["state"];
64 64 std::string cType = state["colormode"].get<std::string>();
65 65 bool on = state["on"].get<bool>();
66 66 // const reference to prevent refreshes
67   - const HueLight& cLight = light;
  67 + const Light& cLight = light;
68 68 if (cType != "ct")
69 69 {
70 70 return SimpleColorHueStrategy::alertXY(xy, light);
... ...
src/ExtendedColorTemperatureStrategy.cpp
... ... @@ -26,19 +26,19 @@
26 26 #include <iostream>
27 27 #include <thread>
28 28  
29   -#include "hueplusplus/APIConfig.h"
  29 +#include "hueplusplus/LibConfig.h"
30 30 #include "hueplusplus/HueExceptionMacro.h"
31 31 #include "hueplusplus/Utils.h"
32 32  
33 33 namespace hueplusplus
34 34 {
35   -bool ExtendedColorTemperatureStrategy::alertTemperature(unsigned int mired, HueLight& light) const
  35 +bool ExtendedColorTemperatureStrategy::alertTemperature(unsigned int mired, Light& light) const
36 36 {
37 37 // Careful, only use state until any light function might refresh the value and invalidate the reference
38 38 const nlohmann::json& state = light.state.getValue()["state"];
39 39 std::string cType = state["colormode"].get<std::string>();
40 40 bool on = state["on"].get<bool>();
41   - const HueLight& cLight = light;
  41 + const Light& cLight = light;
42 42 if (cType == "ct")
43 43 {
44 44 return SimpleColorTemperatureStrategy::alertTemperature(mired, light);
... ...
src/HueCommandAPI.cpp
... ... @@ -24,7 +24,7 @@
24 24  
25 25 #include <thread>
26 26  
27   -#include "hueplusplus/APIConfig.h"
  27 +#include "hueplusplus/LibConfig.h"
28 28 #include "hueplusplus/HueExceptionMacro.h"
29 29  
30 30 namespace hueplusplus
... ...
src/HueDeviceTypes.cpp
... ... @@ -59,7 +59,7 @@ const std::set&lt;std::string&gt;&amp; getGamutATypes()
59 59 }
60 60 } // namespace
61 61  
62   -HueLightFactory::HueLightFactory(const HueCommandAPI& commands, std::chrono::steady_clock::duration refreshDuration)
  62 +LightFactory::LightFactory(const HueCommandAPI& commands, std::chrono::steady_clock::duration refreshDuration)
63 63 : commands(commands),
64 64 refreshDuration(refreshDuration),
65 65 simpleBrightness(std::make_shared<SimpleBrightnessStrategy>()),
... ... @@ -69,7 +69,7 @@ HueLightFactory::HueLightFactory(const HueCommandAPI&amp; commands, std::chrono::ste
69 69 extendedColorHue(std::make_shared<ExtendedColorHueStrategy>())
70 70 {}
71 71  
72   -HueLight HueLightFactory::createLight(const nlohmann::json& lightState, int id)
  72 +Light LightFactory::createLight(const nlohmann::json& lightState, int id)
73 73 {
74 74 std::string type = lightState.value("type", "");
75 75 // Ignore case
... ... @@ -77,39 +77,39 @@ HueLight HueLightFactory::createLight(const nlohmann::json&amp; lightState, int id)
77 77  
78 78 if (type == "on/off light" || type == "on/off plug-in unit")
79 79 {
80   - HueLight light(id, commands, nullptr, nullptr, nullptr, refreshDuration);
  80 + Light light(id, commands, nullptr, nullptr, nullptr, refreshDuration);
81 81 light.colorType = ColorType::NONE;
82 82 return light;
83 83 }
84 84 else if (type == "dimmable light" || type =="dimmable plug-in unit")
85 85 {
86   - HueLight light(id, commands, simpleBrightness, nullptr, nullptr, refreshDuration);
  86 + Light light(id, commands, simpleBrightness, nullptr, nullptr, refreshDuration);
87 87 light.colorType = ColorType::NONE;
88 88 return light;
89 89 }
90 90 else if (type == "color temperature light")
91 91 {
92   - HueLight light(id, commands, simpleBrightness, simpleColorTemperature, nullptr, refreshDuration);
  92 + Light light(id, commands, simpleBrightness, simpleColorTemperature, nullptr, refreshDuration);
93 93 light.colorType = ColorType::TEMPERATURE;
94 94 return light;
95 95 }
96 96 else if (type == "color light")
97 97 {
98   - HueLight light(id, commands, simpleBrightness, nullptr, simpleColorHue, refreshDuration);
  98 + Light light(id, commands, simpleBrightness, nullptr, simpleColorHue, refreshDuration);
99 99 light.colorType = getColorType(lightState, false);
100 100 return light;
101 101 }
102 102 else if (type == "extended color light")
103 103 {
104   - HueLight light(id, commands, simpleBrightness, extendedColorTemperature, extendedColorHue, refreshDuration);
  104 + Light light(id, commands, simpleBrightness, extendedColorTemperature, extendedColorHue, refreshDuration);
105 105 light.colorType = getColorType(lightState, true);
106 106 return light;
107 107 }
108   - std::cerr << "Could not determine HueLight type:" << type << "!\n";
109   - throw HueException(CURRENT_FILE_INFO, "Could not determine HueLight type!");
  108 + std::cerr << "Could not determine Light type:" << type << "!\n";
  109 + throw HueException(CURRENT_FILE_INFO, "Could not determine Light type!");
110 110 }
111 111  
112   -ColorType HueLightFactory::getColorType(const nlohmann::json& lightState, bool hasCt) const
  112 +ColorType LightFactory::getColorType(const nlohmann::json& lightState, bool hasCt) const
113 113 {
114 114 // Try to get color type via capabilities
115 115 const nlohmann::json& gamuttype = utils::safeGetMember(lightState, "capabilities", "control", "colorgamuttype");
... ... @@ -150,8 +150,8 @@ ColorType HueLightFactory::getColorType(const nlohmann::json&amp; lightState, bool h
150 150 {
151 151 return hasCt ? ColorType::GAMUT_C_TEMPERATURE : ColorType::GAMUT_C;
152 152 }
153   - std::cerr << "Could not determine HueLight color type:" << modelid << "!\n";
154   - throw HueException(CURRENT_FILE_INFO, "Could not determine HueLight color type!");
  153 + std::cerr << "Could not determine Light color type:" << modelid << "!\n";
  154 + throw HueException(CURRENT_FILE_INFO, "Could not determine Light color type!");
155 155 }
156 156 }
157 157 } // namespace hueplusplus
... ...
src/HueLight.cpp renamed to src/Light.cpp
1 1 /**
2   - \file HueLight.cpp
  2 + \file Light.cpp
3 3 Copyright Notice\n
4 4 Copyright (C) 2017 Jan Rogall - developer\n
5 5 Copyright (C) 2017 Moritz Wirger - developer\n
... ... @@ -20,7 +20,7 @@
20 20 along with hueplusplus. If not, see <http://www.gnu.org/licenses/>.
21 21 **/
22 22  
23   -#include "hueplusplus/HueLight.h"
  23 +#include "hueplusplus/Light.h"
24 24  
25 25 #include <cmath>
26 26 #include <iostream>
... ... @@ -32,37 +32,37 @@
32 32  
33 33 namespace hueplusplus
34 34 {
35   -bool HueLight::On(uint8_t transition)
  35 +bool Light::On(uint8_t transition)
36 36 {
37 37 return transaction().setOn(true).setTransition(transition).commit();
38 38 }
39 39  
40   -bool HueLight::Off(uint8_t transition)
  40 +bool Light::Off(uint8_t transition)
41 41 {
42 42 return transaction().setOn(false).setTransition(transition).commit();
43 43 }
44 44  
45   -bool HueLight::isOn()
  45 +bool Light::isOn()
46 46 {
47 47 return state.getValue().at("state").at("on").get<bool>();
48 48 }
49 49  
50   -bool HueLight::isOn() const
  50 +bool Light::isOn() const
51 51 {
52 52 return state.getValue().at("state").at("on").get<bool>();
53 53 }
54 54  
55   -std::string HueLight::getLuminaireUId() const
  55 +std::string Light::getLuminaireUId() const
56 56 {
57 57 return state.getValue().value("luminaireuniqueid", std::string());
58 58 }
59 59  
60   -ColorType HueLight::getColorType() const
  60 +ColorType Light::getColorType() const
61 61 {
62 62 return colorType;
63 63 }
64 64  
65   -ColorGamut HueLight::getColorGamut() const
  65 +ColorGamut Light::getColorGamut() const
66 66 {
67 67 switch (colorType)
68 68 {
... ... @@ -91,30 +91,30 @@ ColorGamut HueLight::getColorGamut() const
91 91 }
92 92 }
93 93  
94   -unsigned int HueLight::KelvinToMired(unsigned int kelvin) const
  94 +unsigned int Light::KelvinToMired(unsigned int kelvin) const
95 95 {
96 96 return int(0.5f + (1000000 / kelvin));
97 97 }
98 98  
99   -unsigned int HueLight::MiredToKelvin(unsigned int mired) const
  99 +unsigned int Light::MiredToKelvin(unsigned int mired) const
100 100 {
101 101 return int(0.5f + (1000000 / mired));
102 102 }
103 103  
104   -bool HueLight::alert()
  104 +bool Light::alert()
105 105 {
106 106 return transaction().alert().commit();
107 107 }
108 108  
109   -StateTransaction HueLight::transaction()
  109 +StateTransaction Light::transaction()
110 110 {
111 111 return StateTransaction(
112 112 state.getCommandAPI(), "/lights/" + std::to_string(id) + "/state", &state.getValue().at("state"));
113 113 }
114 114  
115   -HueLight::HueLight(int id, const HueCommandAPI& commands) : HueLight(id, commands, nullptr, nullptr, nullptr) { }
  115 +Light::Light(int id, const HueCommandAPI& commands) : Light(id, commands, nullptr, nullptr, nullptr) { }
116 116  
117   -HueLight::HueLight(int id, const HueCommandAPI& commands, std::shared_ptr<const BrightnessStrategy> brightnessStrategy,
  117 +Light::Light(int id, const HueCommandAPI& commands, std::shared_ptr<const BrightnessStrategy> brightnessStrategy,
118 118 std::shared_ptr<const ColorTemperatureStrategy> colorTempStrategy,
119 119 std::shared_ptr<const ColorHueStrategy> colorHueStrategy, std::chrono::steady_clock::duration refreshDuration)
120 120 : BaseDevice(id, commands, "/lights/", refreshDuration),
... ...
src/HueSensor.cpp renamed to src/Sensor.cpp
1 1 /**
2   - \file HueSensor.cpp
  2 + \file Sensor.cpp
3 3 Copyright Notice\n
4 4 Copyright (C) 2020 Stefan Herbrechtsmeier - developer\n
5 5  
... ... @@ -19,13 +19,13 @@
19 19 along with hueplusplus. If not, see <http://www.gnu.org/licenses/>.
20 20 **/
21 21  
22   -#include "hueplusplus/HueSensor.h"
  22 +#include "hueplusplus/Sensor.h"
23 23  
24 24 #include "json/json.hpp"
25 25  
26 26 namespace hueplusplus
27 27 {
28   -int HueSensor::getButtonEvent()
  28 +int Sensor::getButtonEvent()
29 29 {
30 30 if (hasButtonEvent())
31 31 {
... ... @@ -34,7 +34,7 @@ int HueSensor::getButtonEvent()
34 34 return 0;
35 35 }
36 36  
37   -int HueSensor::getButtonEvent() const
  37 +int Sensor::getButtonEvent() const
38 38 {
39 39 if (hasButtonEvent())
40 40 {
... ... @@ -43,7 +43,7 @@ int HueSensor::getButtonEvent() const
43 43 return 0;
44 44 }
45 45  
46   -int HueSensor::getStatus()
  46 +int Sensor::getStatus()
47 47 {
48 48 if (hasStatus())
49 49 {
... ... @@ -52,7 +52,7 @@ int HueSensor::getStatus()
52 52 return 0;
53 53 }
54 54  
55   -int HueSensor::getStatus() const
  55 +int Sensor::getStatus() const
56 56 {
57 57 if (hasStatus())
58 58 {
... ... @@ -61,17 +61,17 @@ int HueSensor::getStatus() const
61 61 return 0;
62 62 }
63 63  
64   -bool HueSensor::hasButtonEvent() const
  64 +bool Sensor::hasButtonEvent() const
65 65 {
66 66 return state.getValue().at("state").count("buttonevent") != 0;
67 67 }
68 68  
69   -bool HueSensor::hasStatus() const
  69 +bool Sensor::hasStatus() const
70 70 {
71 71 return state.getValue().at("state").count("status") != 0;
72 72 }
73 73  
74   -HueSensor::HueSensor(int id, const HueCommandAPI& commands, std::chrono::steady_clock::duration refreshDuration)
  74 +Sensor::Sensor(int id, const HueCommandAPI& commands, std::chrono::steady_clock::duration refreshDuration)
75 75 : BaseDevice(id, commands, "/sensors/", refreshDuration)
76 76 { }
77 77 } // namespace hueplusplus
... ...
src/SimpleBrightnessStrategy.cpp
... ... @@ -31,18 +31,18 @@
31 31  
32 32 namespace hueplusplus
33 33 {
34   -bool SimpleBrightnessStrategy::setBrightness(unsigned int bri, uint8_t transition, HueLight& light) const
  34 +bool SimpleBrightnessStrategy::setBrightness(unsigned int bri, uint8_t transition, Light& light) const
35 35 {
36 36 // Careful, only use state until any light function might refresh the value and invalidate the reference
37 37 return light.transaction().setBrightness(bri).setTransition(transition).commit();
38 38 }
39 39  
40   -unsigned int SimpleBrightnessStrategy::getBrightness(HueLight& light) const
  40 +unsigned int SimpleBrightnessStrategy::getBrightness(Light& light) const
41 41 {
42 42 return light.state.getValue()["state"]["bri"].get<unsigned int>();
43 43 }
44 44  
45   -unsigned int SimpleBrightnessStrategy::getBrightness(const HueLight& light) const
  45 +unsigned int SimpleBrightnessStrategy::getBrightness(const Light& light) const
46 46 {
47 47 return light.state.getValue()["state"]["bri"].get<unsigned int>();
48 48 }
... ...
src/SimpleColorHueStrategy.cpp
... ... @@ -26,45 +26,45 @@
26 26 #include <iostream>
27 27 #include <thread>
28 28  
29   -#include "hueplusplus/APIConfig.h"
  29 +#include "hueplusplus/LibConfig.h"
30 30 #include "hueplusplus/HueExceptionMacro.h"
31 31 #include "hueplusplus/Utils.h"
32 32  
33 33 namespace hueplusplus
34 34 {
35   -bool SimpleColorHueStrategy::setColorHue(uint16_t hue, uint8_t transition, HueLight& light) const
  35 +bool SimpleColorHueStrategy::setColorHue(uint16_t hue, uint8_t transition, Light& light) const
36 36 {
37 37 return light.transaction().setColorHue(hue).setTransition(transition).commit();
38 38 }
39 39  
40   -bool SimpleColorHueStrategy::setColorSaturation(uint8_t sat, uint8_t transition, HueLight& light) const
  40 +bool SimpleColorHueStrategy::setColorSaturation(uint8_t sat, uint8_t transition, Light& light) const
41 41 {
42 42 return light.transaction().setColorSaturation(sat).setTransition(transition).commit();
43 43 }
44 44  
45 45 bool SimpleColorHueStrategy::setColorHueSaturation(
46   - const HueSaturation& hueSat, uint8_t transition, HueLight& light) const
  46 + const HueSaturation& hueSat, uint8_t transition, Light& light) const
47 47 {
48 48 return light.transaction().setColor(hueSat).setTransition(transition).commit();
49 49 }
50 50  
51   -bool SimpleColorHueStrategy::setColorXY(const XYBrightness& xy, uint8_t transition, HueLight& light) const
  51 +bool SimpleColorHueStrategy::setColorXY(const XYBrightness& xy, uint8_t transition, Light& light) const
52 52 {
53 53 return light.transaction().setColor(xy).setTransition(transition).commit();
54 54 }
55 55  
56   -bool SimpleColorHueStrategy::setColorLoop(bool on, HueLight& light) const
  56 +bool SimpleColorHueStrategy::setColorLoop(bool on, Light& light) const
57 57 {
58 58 return light.transaction().setColorLoop(true).commit();
59 59 }
60 60  
61   -bool SimpleColorHueStrategy::alertHueSaturation(const HueSaturation& hueSat, HueLight& light) const
  61 +bool SimpleColorHueStrategy::alertHueSaturation(const HueSaturation& hueSat, Light& light) const
62 62 {
63 63 // Careful, only use state until any light function might refresh the value and invalidate the reference
64 64 const nlohmann::json& state = light.state.getValue()["state"];
65 65 std::string cType = state["colormode"].get<std::string>();
66 66 bool on = state["on"].get<bool>();
67   - const HueLight& cLight = light;
  67 + const Light& cLight = light;
68 68 if (cType == "hs")
69 69 {
70 70 HueSaturation oldHueSat = cLight.getColorHueSaturation();
... ... @@ -101,14 +101,14 @@ bool SimpleColorHueStrategy::alertHueSaturation(const HueSaturation&amp; hueSat, Hue
101 101 }
102 102 }
103 103  
104   -bool SimpleColorHueStrategy::alertXY(const XYBrightness& xy, HueLight& light) const
  104 +bool SimpleColorHueStrategy::alertXY(const XYBrightness& xy, Light& light) const
105 105 {
106 106 // Careful, only use state until any light function might refresh the value and invalidate the reference
107 107 const nlohmann::json& state = light.state.getValue()["state"];
108 108 std::string cType = state["colormode"].get<std::string>();
109 109 bool on = state["on"].get<bool>();
110 110 // const reference to prevent refreshes
111   - const HueLight& cLight = light;
  111 + const Light& cLight = light;
112 112 if (cType == "hs")
113 113 {
114 114 HueSaturation oldHueSat = cLight.getColorHueSaturation();
... ... @@ -146,27 +146,27 @@ bool SimpleColorHueStrategy::alertXY(const XYBrightness&amp; xy, HueLight&amp; light) co
146 146 }
147 147 }
148 148  
149   -HueSaturation SimpleColorHueStrategy::getColorHueSaturation(HueLight& light) const
  149 +HueSaturation SimpleColorHueStrategy::getColorHueSaturation(Light& light) const
150 150 {
151 151 // Save value, so there are no inconsistent results if it is refreshed between two calls
152 152 const nlohmann::json& state = light.state.getValue()["state"];
153 153 return HueSaturation {state["hue"].get<int>(), state["sat"].get<int>()};
154 154 }
155 155  
156   -HueSaturation SimpleColorHueStrategy::getColorHueSaturation(const HueLight& light) const
  156 +HueSaturation SimpleColorHueStrategy::getColorHueSaturation(const Light& light) const
157 157 {
158 158 return HueSaturation {
159 159 light.state.getValue()["state"]["hue"].get<int>(), light.state.getValue()["state"]["sat"].get<int>()};
160 160 }
161 161  
162   -XYBrightness SimpleColorHueStrategy::getColorXY(HueLight& light) const
  162 +XYBrightness SimpleColorHueStrategy::getColorXY(Light& light) const
163 163 {
164 164 // Save value, so there are no inconsistent results if it is refreshed between two calls
165 165 const nlohmann::json& state = light.state.getValue()["state"];
166 166 return XYBrightness {{state["xy"][0].get<float>(), state["xy"][1].get<float>()}, state["bri"].get<int>() / 254.f};
167 167 }
168 168  
169   -XYBrightness SimpleColorHueStrategy::getColorXY(const HueLight& light) const
  169 +XYBrightness SimpleColorHueStrategy::getColorXY(const Light& light) const
170 170 {
171 171 const nlohmann::json& state = light.state.getValue()["state"];
172 172 return XYBrightness {{state["xy"][0].get<float>(), state["xy"][1].get<float>()}, state["bri"].get<int>() / 254.f};
... ...
src/SimpleColorTemperatureStrategy.cpp
... ... @@ -26,18 +26,18 @@
26 26 #include <iostream>
27 27 #include <thread>
28 28  
29   -#include "hueplusplus/APIConfig.h"
  29 +#include "hueplusplus/LibConfig.h"
30 30 #include "hueplusplus/HueExceptionMacro.h"
31 31 #include "hueplusplus/Utils.h"
32 32  
33 33 namespace hueplusplus
34 34 {
35   -bool SimpleColorTemperatureStrategy::setColorTemperature(unsigned int mired, uint8_t transition, HueLight& light) const
  35 +bool SimpleColorTemperatureStrategy::setColorTemperature(unsigned int mired, uint8_t transition, Light& light) const
36 36 {
37 37 return light.transaction().setColorTemperature(mired).setTransition(transition).commit();
38 38 }
39 39  
40   -bool SimpleColorTemperatureStrategy::alertTemperature(unsigned int mired, HueLight& light) const
  40 +bool SimpleColorTemperatureStrategy::alertTemperature(unsigned int mired, Light& light) const
41 41 {
42 42 // Careful, only use state until any light function might refresh the value and invalidate the reference
43 43 const nlohmann::json& state = light.state.getValue()["state"];
... ... @@ -64,12 +64,12 @@ bool SimpleColorTemperatureStrategy::alertTemperature(unsigned int mired, HueLig
64 64 }
65 65 }
66 66  
67   -unsigned int SimpleColorTemperatureStrategy::getColorTemperature(HueLight& light) const
  67 +unsigned int SimpleColorTemperatureStrategy::getColorTemperature(Light& light) const
68 68 {
69 69 return light.state.getValue()["state"]["ct"].get<unsigned int>();
70 70 }
71 71  
72   -unsigned int SimpleColorTemperatureStrategy::getColorTemperature(const HueLight& light) const
  72 +unsigned int SimpleColorTemperatureStrategy::getColorTemperature(const Light& light) const
73 73 {
74 74 return light.state.getValue()["state"]["ct"].get<unsigned int>();
75 75 }
... ...
src/UPnP.cpp
... ... @@ -25,7 +25,7 @@
25 25 #include <algorithm>
26 26 #include <iostream>
27 27  
28   -#include "hueplusplus/APIConfig.h"
  28 +#include "hueplusplus/LibConfig.h"
29 29  
30 30 namespace hueplusplus
31 31 {
... ...
test/CMakeLists.txt
... ... @@ -32,15 +32,15 @@ target_compile_features(gtest PUBLIC cxx_std_14)
32 32 set(TEST_SOURCES
33 33 test_APICache.cpp
34 34 test_BaseHttpHandler.cpp
  35 + test_Bridge.cpp
35 36 test_BridgeConfig.cpp
36 37 test_ColorUnits.cpp
37 38 test_ExtendedColorHueStrategy.cpp
38 39 test_ExtendedColorTemperatureStrategy.cpp
39 40 test_Group.cpp
40   - test_Hue.cpp
41   - test_HueLight.cpp
42   - test_HueLightFactory.cpp
43 41 test_HueCommandAPI.cpp
  42 + test_Light.cpp
  43 + test_LightFactory.cpp
44 44 test_Main.cpp
45 45 test_UPnP.cpp
46 46 test_ResourceList.cpp
... ...
test/mocks/mock_HueLight.h renamed to test/mocks/mock_Light.h
1 1 /**
2   - \file mock_HueLight.h
  2 + \file mock_Light.h
3 3 Copyright Notice\n
4 4 Copyright (C) 2017 Jan Rogall - developer\n
5 5 Copyright (C) 2017 Moritz Wirger - developer\n
... ... @@ -29,15 +29,15 @@
29 29 #include <gmock/gmock.h>
30 30  
31 31 #include "../testhelper.h"
32   -#include "hueplusplus/HueLight.h"
  32 +#include "hueplusplus/Light.h"
33 33 #include "json/json.hpp"
34 34  
35 35 //! Mock Class
36   -class MockHueLight : public hueplusplus::HueLight
  36 +class MockLight : public hueplusplus::Light
37 37 {
38 38 public:
39   - MockHueLight(std::shared_ptr<const hueplusplus::IHttpHandler> handler)
40   - : HueLight(1, hueplusplus::HueCommandAPI(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler), nullptr,
  39 + MockLight(std::shared_ptr<const hueplusplus::IHttpHandler> handler)
  40 + : Light(1, hueplusplus::HueCommandAPI(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler), nullptr,
41 41 nullptr, nullptr, std::chrono::steady_clock::duration::max())
42 42 {
43 43 // Set refresh duration to max, so random refreshes do not hinder the test setups
... ...
test/test_Hue.cpp renamed to test/test_Bridge.cpp
1 1 /**
2   - \file test_Hue.cpp
  2 + \file test_Bridge.cpp
3 3 Copyright Notice\n
4 4 Copyright (C) 2017 Jan Rogall - developer\n
5 5 Copyright (C) 2017 Moritz Wirger - developer\n
... ... @@ -28,8 +28,8 @@
28 28  
29 29 #include "testhelper.h"
30 30  
31   -#include "hueplusplus/APIConfig.h"
32   -#include "hueplusplus/Hue.h"
  31 +#include "hueplusplus/Bridge.h"
  32 +#include "hueplusplus/LibConfig.h"
33 33 #include "json/json.hpp"
34 34 #include "mocks/mock_HttpHandler.h"
35 35  
... ... @@ -64,18 +64,18 @@ protected:
64 64  
65 65 TEST_F(HueFinderTest, FindBridges)
66 66 {
67   - HueFinder finder(handler);
68   - std::vector<HueFinder::HueIdentification> bridges = finder.FindBridges();
  67 + BridgeFinder finder(handler);
  68 + std::vector<BridgeFinder::BridgeIdentification> bridges = finder.FindBridges();
69 69  
70   - HueFinder::HueIdentification bridge_to_comp;
  70 + BridgeFinder::BridgeIdentification bridge_to_comp;
71 71 bridge_to_comp.ip = getBridgeIp();
72 72 bridge_to_comp.port = getBridgePort();
73 73 bridge_to_comp.mac = getBridgeMac();
74 74  
75   - EXPECT_EQ(bridges.size(), 1) << "HueFinder found more than one Bridge";
76   - EXPECT_EQ(bridges[0].ip, bridge_to_comp.ip) << "HueIdentification ip does not match";
77   - EXPECT_EQ(bridges[0].port, bridge_to_comp.port) << "HueIdentification port does not match";
78   - EXPECT_EQ(bridges[0].mac, bridge_to_comp.mac) << "HueIdentification mac does not match";
  75 + EXPECT_EQ(bridges.size(), 1) << "BridgeFinder found more than one Bridge";
  76 + EXPECT_EQ(bridges[0].ip, bridge_to_comp.ip) << "BridgeIdentification ip does not match";
  77 + EXPECT_EQ(bridges[0].port, bridge_to_comp.port) << "BridgeIdentification port does not match";
  78 + EXPECT_EQ(bridges[0].mac, bridge_to_comp.mac) << "BridgeIdentification mac does not match";
79 79  
80 80 // Test invalid description
81 81 EXPECT_CALL(*handler, GETString("/description.xml", "application/xml", "", getBridgeIp(), getBridgePort()))
... ... @@ -97,8 +97,8 @@ TEST_F(HueFinderTest, GetBridge)
97 97 .Times(AtLeast(1))
98 98 .WillRepeatedly(Return(errorResponse));
99 99  
100   - HueFinder finder(handler);
101   - std::vector<HueFinder::HueIdentification> bridges = finder.FindBridges();
  100 + BridgeFinder finder(handler);
  101 + std::vector<BridgeFinder::BridgeIdentification> bridges = finder.FindBridges();
102 102  
103 103 ASSERT_THROW(finder.GetBridge(bridges[0]), HueException);
104 104  
... ... @@ -108,10 +108,10 @@ TEST_F(HueFinderTest, GetBridge)
108 108 .Times(1)
109 109 .WillOnce(Return(successResponse));
110 110  
111   - finder = HueFinder(handler);
  111 + finder = BridgeFinder(handler);
112 112 bridges = finder.FindBridges();
113 113  
114   - Hue test_bridge = finder.GetBridge(bridges[0]);
  114 + Bridge test_bridge = finder.GetBridge(bridges[0]);
115 115  
116 116 EXPECT_EQ(test_bridge.getBridgeIP(), getBridgeIp()) << "Bridge IP not matching";
117 117 EXPECT_EQ(test_bridge.getBridgePort(), getBridgePort()) << "Bridge Port not matching";
... ... @@ -122,11 +122,11 @@ TEST_F(HueFinderTest, GetBridge)
122 122  
123 123 TEST_F(HueFinderTest, AddUsername)
124 124 {
125   - HueFinder finder(handler);
126   - std::vector<HueFinder::HueIdentification> bridges = finder.FindBridges();
  125 + BridgeFinder finder(handler);
  126 + std::vector<BridgeFinder::BridgeIdentification> bridges = finder.FindBridges();
127 127  
128 128 finder.AddUsername(bridges[0].mac, getBridgeUsername());
129   - Hue test_bridge = finder.GetBridge(bridges[0]);
  129 + Bridge test_bridge = finder.GetBridge(bridges[0]);
130 130  
131 131 EXPECT_EQ(test_bridge.getBridgeIP(), getBridgeIp()) << "Bridge IP not matching";
132 132 EXPECT_EQ(test_bridge.getBridgePort(), getBridgePort()) << "Bridge Port not matching";
... ... @@ -135,8 +135,8 @@ TEST_F(HueFinderTest, AddUsername)
135 135  
136 136 TEST_F(HueFinderTest, GetAllUsernames)
137 137 {
138   - HueFinder finder(handler);
139   - std::vector<HueFinder::HueIdentification> bridges = finder.FindBridges();
  138 + BridgeFinder finder(handler);
  139 + std::vector<BridgeFinder::BridgeIdentification> bridges = finder.FindBridges();
140 140  
141 141 finder.AddUsername(bridges[0].mac, getBridgeUsername());
142 142  
... ... @@ -144,17 +144,17 @@ TEST_F(HueFinderTest, GetAllUsernames)
144 144 EXPECT_EQ(users[getBridgeMac()], getBridgeUsername()) << "Username of MAC:" << getBridgeMac() << "not matching";
145 145 }
146 146  
147   -TEST(Hue, Constructor)
  147 +TEST(Bridge, Constructor)
148 148 {
149 149 std::shared_ptr<MockHttpHandler> handler = std::make_shared<MockHttpHandler>();
150   - Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
  150 + Bridge test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
151 151  
152 152 EXPECT_EQ(test_bridge.getBridgeIP(), getBridgeIp()) << "Bridge IP not matching";
153 153 EXPECT_EQ(test_bridge.getBridgePort(), getBridgePort()) << "Bridge Port not matching";
154 154 EXPECT_EQ(test_bridge.getUsername(), getBridgeUsername()) << "Bridge username not matching";
155 155 }
156 156  
157   -TEST(Hue, requestUsername)
  157 +TEST(Bridge, requestUsername)
158 158 {
159 159 using namespace ::testing;
160 160 std::shared_ptr<MockHttpHandler> handler = std::make_shared<MockHttpHandler>();
... ... @@ -168,7 +168,7 @@ TEST(Hue, requestUsername)
168 168 .Times(AtLeast(1))
169 169 .WillRepeatedly(Return(errorResponse));
170 170  
171   - Hue test_bridge(getBridgeIp(), getBridgePort(), "", handler);
  171 + Bridge test_bridge(getBridgeIp(), getBridgePort(), "", handler);
172 172  
173 173 std::string username = test_bridge.requestUsername();
174 174 EXPECT_EQ(username, "") << "Returned username not matching";
... ... @@ -180,7 +180,7 @@ TEST(Hue, requestUsername)
180 180 int otherError = 1;
181 181 nlohmann::json exceptionResponse
182 182 = {{{"error", {{"type", otherError}, {"address", ""}, {"description", "some error"}}}}};
183   - Hue testBridge(getBridgeIp(), getBridgePort(), "", handler);
  183 + Bridge testBridge(getBridgeIp(), getBridgePort(), "", handler);
184 184  
185 185 EXPECT_CALL(*handler, POSTJson("/api", request, getBridgeIp(), getBridgePort()))
186 186 .WillOnce(Return(exceptionResponse));
... ... @@ -206,9 +206,9 @@ TEST(Hue, requestUsername)
206 206 .Times(1)
207 207 .WillRepeatedly(Return(successResponse));
208 208  
209   - Hue test_bridge(getBridgeIp(), getBridgePort(), "", handler);
  209 + Bridge test_bridge(getBridgeIp(), getBridgePort(), "", handler);
210 210  
211   - nlohmann::json hue_bridge_state{ {"lights", {}} };
  211 + nlohmann::json hue_bridge_state {{"lights", {}}};
212 212 EXPECT_CALL(
213 213 *handler, GETJson("/api/" + getBridgeUsername(), nlohmann::json::object(), getBridgeIp(), getBridgePort()))
214 214 .Times(1)
... ... @@ -221,25 +221,25 @@ TEST(Hue, requestUsername)
221 221 }
222 222 }
223 223  
224   -TEST(Hue, setIP)
  224 +TEST(Bridge, setIP)
225 225 {
226 226 std::shared_ptr<MockHttpHandler> handler = std::make_shared<MockHttpHandler>();
227   - Hue test_bridge(getBridgeIp(), getBridgePort(), "", handler);
  227 + Bridge test_bridge(getBridgeIp(), getBridgePort(), "", handler);
228 228 EXPECT_EQ(test_bridge.getBridgeIP(), getBridgeIp()) << "Bridge IP not matching after initialization";
229 229 test_bridge.setIP("192.168.2.112");
230 230 EXPECT_EQ(test_bridge.getBridgeIP(), "192.168.2.112") << "Bridge IP not matching after setting it";
231 231 }
232 232  
233   -TEST(Hue, setPort)
  233 +TEST(Bridge, setPort)
234 234 {
235 235 std::shared_ptr<MockHttpHandler> handler = std::make_shared<MockHttpHandler>();
236   - Hue test_bridge = Hue(getBridgeIp(), getBridgePort(), "", handler);
  236 + Bridge test_bridge = Bridge(getBridgeIp(), getBridgePort(), "", handler);
237 237 EXPECT_EQ(test_bridge.getBridgePort(), getBridgePort()) << "Bridge Port not matching after initialization";
238 238 test_bridge.setPort(81);
239 239 EXPECT_EQ(test_bridge.getBridgePort(), 81) << "Bridge Port not matching after setting it";
240 240 }
241 241  
242   -TEST(Hue, getLight)
  242 +TEST(Bridge, getLight)
243 243 {
244 244 using namespace ::testing;
245 245 std::shared_ptr<MockHttpHandler> handler = std::make_shared<MockHttpHandler>();
... ... @@ -247,7 +247,7 @@ TEST(Hue, getLight)
247 247 *handler, GETJson("/api/" + getBridgeUsername(), nlohmann::json::object(), getBridgeIp(), getBridgePort()))
248 248 .Times(1);
249 249  
250   - Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
  250 + Bridge test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
251 251  
252 252 // Test exception
253 253 ASSERT_THROW(test_bridge.lights().get(1), HueException);
... ... @@ -272,10 +272,10 @@ TEST(Hue, getLight)
272 272 .WillRepeatedly(Return(hue_bridge_state["lights"]["1"]));
273 273  
274 274 // Refresh cache
275   - test_bridge = Hue(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
  275 + test_bridge = Bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
276 276  
277 277 // Test when correct data is sent
278   - HueLight test_light_1 = test_bridge.lights().get(1);
  278 + Light test_light_1 = test_bridge.lights().get(1);
279 279 EXPECT_EQ(test_light_1.getName(), "Hue ambiance lamp 1");
280 280 EXPECT_EQ(test_light_1.getColorType(), ColorType::TEMPERATURE);
281 281  
... ... @@ -286,7 +286,7 @@ TEST(Hue, getLight)
286 286 EXPECT_EQ(test_light_1.getColorType(), ColorType::TEMPERATURE);
287 287 }
288 288  
289   -TEST(Hue, removeLight)
  289 +TEST(Bridge, removeLight)
290 290 {
291 291 using namespace ::testing;
292 292 std::shared_ptr<MockHttpHandler> handler = std::make_shared<MockHttpHandler>();
... ... @@ -303,7 +303,7 @@ TEST(Hue, removeLight)
303 303 .Times(1)
304 304 .WillOnce(Return(hue_bridge_state));
305 305  
306   - Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
  306 + Bridge test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
307 307  
308 308 EXPECT_CALL(*handler,
309 309 GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), getBridgePort()))
... ... @@ -322,14 +322,14 @@ TEST(Hue, removeLight)
322 322 .WillOnce(Return(nlohmann::json()));
323 323  
324 324 // Test when correct data is sent
325   - HueLight test_light_1 = test_bridge.lights().get(1);
  325 + Light test_light_1 = test_bridge.lights().get(1);
326 326  
327 327 EXPECT_EQ(test_bridge.lights().remove(1), true);
328 328  
329 329 EXPECT_EQ(test_bridge.lights().remove(1), false);
330 330 }
331 331  
332   -TEST(Hue, getAllLights)
  332 +TEST(Bridge, getAllLights)
333 333 {
334 334 using namespace ::testing;
335 335 std::shared_ptr<MockHttpHandler> handler = std::make_shared<MockHttpHandler>();
... ... @@ -352,15 +352,15 @@ TEST(Hue, getAllLights)
352 352 .Times(AtLeast(1))
353 353 .WillRepeatedly(Return(hue_bridge_state["lights"]["1"]));
354 354  
355   - Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
  355 + Bridge test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
356 356  
357   - std::vector<std::reference_wrapper<HueLight>> test_lights = test_bridge.lights().getAll();
  357 + std::vector<std::reference_wrapper<Light>> test_lights = test_bridge.lights().getAll();
358 358 ASSERT_EQ(1, test_lights.size());
359 359 EXPECT_EQ(test_lights[0].get().getName(), "Hue ambiance lamp 1");
360 360 EXPECT_EQ(test_lights[0].get().getColorType(), ColorType::TEMPERATURE);
361 361 }
362 362  
363   -TEST(Hue, lightExists)
  363 +TEST(Bridge, lightExists)
364 364 {
365 365 using namespace ::testing;
366 366 std::shared_ptr<MockHttpHandler> handler = std::make_shared<MockHttpHandler>();
... ... @@ -377,7 +377,7 @@ TEST(Hue, lightExists)
377 377 .Times(AtLeast(1))
378 378 .WillRepeatedly(Return(hue_bridge_state));
379 379  
380   - Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
  380 + Bridge test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
381 381  
382 382 test_bridge.refresh();
383 383  
... ... @@ -385,7 +385,7 @@ TEST(Hue, lightExists)
385 385 EXPECT_FALSE(Const(test_bridge).lights().exists(2));
386 386 }
387 387  
388   -TEST(Hue, getGroup)
  388 +TEST(Bridge, getGroup)
389 389 {
390 390 using namespace ::testing;
391 391 std::shared_ptr<MockHttpHandler> handler = std::make_shared<MockHttpHandler>();
... ... @@ -393,7 +393,7 @@ TEST(Hue, getGroup)
393 393 *handler, GETJson("/api/" + getBridgeUsername(), nlohmann::json::object(), getBridgeIp(), getBridgePort()))
394 394 .Times(1);
395 395  
396   - Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
  396 + Bridge test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
397 397  
398 398 // Test exception
399 399 ASSERT_THROW(test_bridge.groups().get(1), HueException);
... ... @@ -417,7 +417,7 @@ TEST(Hue, getGroup)
417 417 .WillRepeatedly(Return(hue_bridge_state["groups"]["1"]));
418 418  
419 419 // Refresh cache
420   - test_bridge = Hue(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
  420 + test_bridge = Bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
421 421  
422 422 // Test when correct data is sent
423 423 Group test_group_1 = test_bridge.groups().get(1);
... ... @@ -430,7 +430,7 @@ TEST(Hue, getGroup)
430 430 EXPECT_EQ(test_group_1.getType(), "LightGroup");
431 431 }
432 432  
433   -TEST(Hue, removeGroup)
  433 +TEST(Bridge, removeGroup)
434 434 {
435 435 using namespace ::testing;
436 436 std::shared_ptr<MockHttpHandler> handler = std::make_shared<MockHttpHandler>();
... ... @@ -446,7 +446,7 @@ TEST(Hue, removeGroup)
446 446 .Times(1)
447 447 .WillOnce(Return(hue_bridge_state));
448 448  
449   - Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
  449 + Bridge test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
450 450  
451 451 EXPECT_CALL(*handler,
452 452 GETJson("/api/" + getBridgeUsername() + "/groups/1", nlohmann::json::object(), getBridgeIp(), getBridgePort()))
... ... @@ -472,7 +472,7 @@ TEST(Hue, removeGroup)
472 472 EXPECT_EQ(test_bridge.groups().remove(1), false);
473 473 }
474 474  
475   -TEST(Hue, groupExists)
  475 +TEST(Bridge, groupExists)
476 476 {
477 477 using namespace ::testing;
478 478 std::shared_ptr<MockHttpHandler> handler = std::make_shared<MockHttpHandler>();
... ... @@ -488,7 +488,7 @@ TEST(Hue, groupExists)
488 488 .Times(AtLeast(1))
489 489 .WillRepeatedly(Return(hue_bridge_state));
490 490  
491   - Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
  491 + Bridge test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
492 492  
493 493 test_bridge.refresh();
494 494  
... ... @@ -496,7 +496,7 @@ TEST(Hue, groupExists)
496 496 EXPECT_EQ(false, Const(test_bridge).groups().exists(2));
497 497 }
498 498  
499   -TEST(Hue, getAllGroups)
  499 +TEST(Bridge, getAllGroups)
500 500 {
501 501 using namespace ::testing;
502 502 std::shared_ptr<MockHttpHandler> handler = std::make_shared<MockHttpHandler>();
... ... @@ -518,7 +518,7 @@ TEST(Hue, getAllGroups)
518 518 .Times(AtLeast(1))
519 519 .WillRepeatedly(Return(hue_bridge_state["groups"]["1"]));
520 520  
521   - Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
  521 + Bridge test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
522 522  
523 523 std::vector<std::reference_wrapper<Group>> test_groups = test_bridge.groups().getAll();
524 524 ASSERT_EQ(1, test_groups.size());
... ... @@ -526,14 +526,14 @@ TEST(Hue, getAllGroups)
526 526 EXPECT_EQ(test_groups[0].get().getType(), "LightGroup");
527 527 }
528 528  
529   -TEST(Hue, createGroup)
  529 +TEST(Bridge, createGroup)
530 530 {
531 531 using namespace ::testing;
532 532 std::shared_ptr<MockHttpHandler> handler = std::make_shared<MockHttpHandler>();
533 533 EXPECT_CALL(
534 534 *handler, GETJson("/api/" + getBridgeUsername(), nlohmann::json::object(), getBridgeIp(), getBridgePort()))
535 535 .Times(AtLeast(1));
536   - Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
  536 + Bridge test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
537 537 CreateGroup create = CreateGroup::Room({2, 3}, "Nice room", "LivingRoom");
538 538 nlohmann::json request = create.getRequest();
539 539 const int id = 4;
... ...
test/test_ExtendedColorHueStrategy.cpp
... ... @@ -32,7 +32,7 @@
32 32 #include "hueplusplus/ExtendedColorHueStrategy.h"
33 33 #include "json/json.hpp"
34 34 #include "mocks/mock_HttpHandler.h"
35   -#include "mocks/mock_HueLight.h"
  35 +#include "mocks/mock_Light.h"
36 36  
37 37 using namespace hueplusplus;
38 38  
... ... @@ -44,7 +44,7 @@ TEST(ExtendedColorHueStrategy, alertHueSaturation)
44 44 *handler, GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), 80))
45 45 .Times(AtLeast(1))
46 46 .WillRepeatedly(Return(nlohmann::json::object()));
47   - MockHueLight light(handler);
  47 + MockLight light(handler);
48 48  
49 49 const HueSaturation hueSat {200, 100};
50 50 // Needs to update the state so transactions are correctly trimmed
... ... @@ -123,7 +123,7 @@ TEST(ExtendedColorHueStrategy, alertXY)
123 123 *handler, GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), 80))
124 124 .Times(AtLeast(1))
125 125 .WillRepeatedly(Return(nlohmann::json::object()));
126   - MockHueLight light(handler);
  126 + MockLight light(handler);
127 127  
128 128 const XYBrightness xy {{0.1f, 0.1f}, 1.f};
129 129 // Needs to update the state so transactions are correctly trimmed
... ...
test/test_ExtendedColorTemperatureStrategy.cpp
... ... @@ -32,7 +32,7 @@
32 32 #include "hueplusplus/ExtendedColorTemperatureStrategy.h"
33 33 #include "json/json.hpp"
34 34 #include "mocks/mock_HttpHandler.h"
35   -#include "mocks/mock_HueLight.h"
  35 +#include "mocks/mock_Light.h"
36 36  
37 37 using namespace hueplusplus;
38 38  
... ... @@ -44,7 +44,7 @@ TEST(ExtendedColorTemperatureStrategy, alertTemperature)
44 44 *handler, GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), 80))
45 45 .Times(AtLeast(1))
46 46 .WillRepeatedly(Return(nlohmann::json::object()));
47   - MockHueLight light(handler);
  47 + MockLight light(handler);
48 48  
49 49 const auto setCTLambda = [&](unsigned int ct, int transition) {
50 50 light.getState()["state"]["colormode"] = "ct";
... ...
test/test_HueCommandAPI.cpp
... ... @@ -25,7 +25,7 @@
25 25  
26 26 #include "testhelper.h"
27 27  
28   -#include "hueplusplus/Hue.h"
  28 +#include "hueplusplus/Bridge.h"
29 29 #include "json/json.hpp"
30 30 #include "mocks/mock_HttpHandler.h"
31 31  
... ...
test/test_HueLight.cpp renamed to test/test_Light.cpp
... ... @@ -25,8 +25,8 @@
25 25  
26 26 #include "testhelper.h"
27 27  
28   -#include "hueplusplus/Hue.h"
29   -#include "hueplusplus/HueLight.h"
  28 +#include "hueplusplus/Bridge.h"
  29 +#include "hueplusplus/Light.h"
30 30 #include "json/json.hpp"
31 31 #include "mocks/mock_HttpHandler.h"
32 32  
... ... @@ -37,7 +37,7 @@ class HueLightTest : public ::testing::Test
37 37 protected:
38 38 std::shared_ptr<MockHttpHandler> handler;
39 39 nlohmann::json hue_bridge_state;
40   - Hue test_bridge;
  40 + Bridge test_bridge;
41 41  
42 42 protected:
43 43 HueLightTest()
... ... @@ -93,12 +93,12 @@ protected:
93 93  
94 94 TEST_F(HueLightTest, Constructor)
95 95 {
96   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
97   - HueLight test_light_1 = test_bridge.lights().get(1);
98   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
99   - HueLight test_light_2 = test_bridge.lights().get(2);
100   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
101   - HueLight test_light_3 = test_bridge.lights().get(3);
  96 + const Light ctest_light_1 = test_bridge.lights().get(1);
  97 + Light test_light_1 = test_bridge.lights().get(1);
  98 + const Light ctest_light_2 = test_bridge.lights().get(2);
  99 + Light test_light_2 = test_bridge.lights().get(2);
  100 + const Light ctest_light_3 = test_bridge.lights().get(3);
  101 + Light test_light_3 = test_bridge.lights().get(3);
102 102 }
103 103  
104 104 TEST_F(HueLightTest, On)
... ... @@ -120,9 +120,9 @@ TEST_F(HueLightTest, On)
120 120 .Times(1)
121 121 .WillOnce(Return(prep_ret));
122 122  
123   - HueLight test_light_1 = test_bridge.lights().get(1);
124   - HueLight test_light_2 = test_bridge.lights().get(2);
125   - HueLight test_light_3 = test_bridge.lights().get(3);
  123 + Light test_light_1 = test_bridge.lights().get(1);
  124 + Light test_light_2 = test_bridge.lights().get(2);
  125 + Light test_light_3 = test_bridge.lights().get(3);
126 126  
127 127 EXPECT_EQ(true, test_light_1.On(33));
128 128 EXPECT_EQ(false, test_light_2.On());
... ... @@ -144,9 +144,9 @@ TEST_F(HueLightTest, Off)
144 144 .Times(1)
145 145 .WillOnce(Return(prep_ret));
146 146  
147   - HueLight test_light_1 = test_bridge.lights().get(1);
148   - HueLight test_light_2 = test_bridge.lights().get(2);
149   - HueLight test_light_3 = test_bridge.lights().get(3);
  147 + Light test_light_1 = test_bridge.lights().get(1);
  148 + Light test_light_2 = test_bridge.lights().get(2);
  149 + Light test_light_3 = test_bridge.lights().get(3);
150 150  
151 151 EXPECT_EQ(true, test_light_1.Off(33));
152 152 EXPECT_EQ(true, test_light_2.Off());
... ... @@ -155,12 +155,12 @@ TEST_F(HueLightTest, Off)
155 155  
156 156 TEST_F(HueLightTest, isOn)
157 157 {
158   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
159   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
160   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
161   - HueLight test_light_1 = test_bridge.lights().get(1);
162   - HueLight test_light_2 = test_bridge.lights().get(2);
163   - HueLight test_light_3 = test_bridge.lights().get(3);
  158 + const Light ctest_light_1 = test_bridge.lights().get(1);
  159 + const Light ctest_light_2 = test_bridge.lights().get(2);
  160 + const Light ctest_light_3 = test_bridge.lights().get(3);
  161 + Light test_light_1 = test_bridge.lights().get(1);
  162 + Light test_light_2 = test_bridge.lights().get(2);
  163 + Light test_light_3 = test_bridge.lights().get(3);
164 164  
165 165 EXPECT_EQ(true, ctest_light_1.isOn());
166 166 EXPECT_EQ(false, ctest_light_2.isOn());
... ... @@ -172,12 +172,12 @@ TEST_F(HueLightTest, isOn)
172 172  
173 173 TEST_F(HueLightTest, getId)
174 174 {
175   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
176   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
177   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
178   - HueLight test_light_1 = test_bridge.lights().get(1);
179   - HueLight test_light_2 = test_bridge.lights().get(2);
180   - HueLight test_light_3 = test_bridge.lights().get(3);
  175 + const Light ctest_light_1 = test_bridge.lights().get(1);
  176 + const Light ctest_light_2 = test_bridge.lights().get(2);
  177 + const Light ctest_light_3 = test_bridge.lights().get(3);
  178 + Light test_light_1 = test_bridge.lights().get(1);
  179 + Light test_light_2 = test_bridge.lights().get(2);
  180 + Light test_light_3 = test_bridge.lights().get(3);
181 181  
182 182 EXPECT_EQ(1, ctest_light_1.getId());
183 183 EXPECT_EQ(2, ctest_light_2.getId());
... ... @@ -189,12 +189,12 @@ TEST_F(HueLightTest, getId)
189 189  
190 190 TEST_F(HueLightTest, getType)
191 191 {
192   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
193   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
194   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
195   - HueLight test_light_1 = test_bridge.lights().get(1);
196   - HueLight test_light_2 = test_bridge.lights().get(2);
197   - HueLight test_light_3 = test_bridge.lights().get(3);
  192 + const Light ctest_light_1 = test_bridge.lights().get(1);
  193 + const Light ctest_light_2 = test_bridge.lights().get(2);
  194 + const Light ctest_light_3 = test_bridge.lights().get(3);
  195 + Light test_light_1 = test_bridge.lights().get(1);
  196 + Light test_light_2 = test_bridge.lights().get(2);
  197 + Light test_light_3 = test_bridge.lights().get(3);
198 198  
199 199 EXPECT_EQ("Dimmable light", ctest_light_1.getType());
200 200 EXPECT_EQ("Color light", ctest_light_2.getType());
... ... @@ -206,12 +206,12 @@ TEST_F(HueLightTest, getType)
206 206  
207 207 TEST_F(HueLightTest, getName)
208 208 {
209   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
210   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
211   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
212   - HueLight test_light_1 = test_bridge.lights().get(1);
213   - HueLight test_light_2 = test_bridge.lights().get(2);
214   - HueLight test_light_3 = test_bridge.lights().get(3);
  209 + const Light ctest_light_1 = test_bridge.lights().get(1);
  210 + const Light ctest_light_2 = test_bridge.lights().get(2);
  211 + const Light ctest_light_3 = test_bridge.lights().get(3);
  212 + Light test_light_1 = test_bridge.lights().get(1);
  213 + Light test_light_2 = test_bridge.lights().get(2);
  214 + Light test_light_3 = test_bridge.lights().get(3);
215 215  
216 216 EXPECT_EQ("Hue lamp 1", ctest_light_1.getName());
217 217 EXPECT_EQ("Hue lamp 2", ctest_light_2.getName());
... ... @@ -223,12 +223,12 @@ TEST_F(HueLightTest, getName)
223 223  
224 224 TEST_F(HueLightTest, getModelId)
225 225 {
226   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
227   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
228   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
229   - HueLight test_light_1 = test_bridge.lights().get(1);
230   - HueLight test_light_2 = test_bridge.lights().get(2);
231   - HueLight test_light_3 = test_bridge.lights().get(3);
  226 + const Light ctest_light_1 = test_bridge.lights().get(1);
  227 + const Light ctest_light_2 = test_bridge.lights().get(2);
  228 + const Light ctest_light_3 = test_bridge.lights().get(3);
  229 + Light test_light_1 = test_bridge.lights().get(1);
  230 + Light test_light_2 = test_bridge.lights().get(2);
  231 + Light test_light_3 = test_bridge.lights().get(3);
232 232  
233 233 EXPECT_EQ("LWB004", ctest_light_1.getModelId());
234 234 EXPECT_EQ("LST001", ctest_light_2.getModelId());
... ... @@ -240,12 +240,12 @@ TEST_F(HueLightTest, getModelId)
240 240  
241 241 TEST_F(HueLightTest, getUId)
242 242 {
243   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
244   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
245   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
246   - HueLight test_light_1 = test_bridge.lights().get(1);
247   - HueLight test_light_2 = test_bridge.lights().get(2);
248   - HueLight test_light_3 = test_bridge.lights().get(3);
  243 + const Light ctest_light_1 = test_bridge.lights().get(1);
  244 + const Light ctest_light_2 = test_bridge.lights().get(2);
  245 + const Light ctest_light_3 = test_bridge.lights().get(3);
  246 + Light test_light_1 = test_bridge.lights().get(1);
  247 + Light test_light_2 = test_bridge.lights().get(2);
  248 + Light test_light_3 = test_bridge.lights().get(3);
249 249  
250 250 EXPECT_EQ("00:00:00:00:00:00:00:00-00", ctest_light_1.getUId());
251 251 EXPECT_EQ("11:11:11:11:11:11:11:11-11", ctest_light_2.getUId());
... ... @@ -257,12 +257,12 @@ TEST_F(HueLightTest, getUId)
257 257  
258 258 TEST_F(HueLightTest, getManufacturername)
259 259 {
260   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
261   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
262   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
263   - HueLight test_light_1 = test_bridge.lights().get(1);
264   - HueLight test_light_2 = test_bridge.lights().get(2);
265   - HueLight test_light_3 = test_bridge.lights().get(3);
  260 + const Light ctest_light_1 = test_bridge.lights().get(1);
  261 + const Light ctest_light_2 = test_bridge.lights().get(2);
  262 + const Light ctest_light_3 = test_bridge.lights().get(3);
  263 + Light test_light_1 = test_bridge.lights().get(1);
  264 + Light test_light_2 = test_bridge.lights().get(2);
  265 + Light test_light_3 = test_bridge.lights().get(3);
266 266  
267 267 EXPECT_EQ("Philips", ctest_light_1.getManufacturername());
268 268 EXPECT_EQ("", ctest_light_2.getManufacturername());
... ... @@ -274,12 +274,12 @@ TEST_F(HueLightTest, getManufacturername)
274 274  
275 275 TEST_F(HueLightTest, getProductname)
276 276 {
277   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
278   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
279   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
280   - HueLight test_light_1 = test_bridge.lights().get(1);
281   - HueLight test_light_2 = test_bridge.lights().get(2);
282   - HueLight test_light_3 = test_bridge.lights().get(3);
  277 + const Light ctest_light_1 = test_bridge.lights().get(1);
  278 + const Light ctest_light_2 = test_bridge.lights().get(2);
  279 + const Light ctest_light_3 = test_bridge.lights().get(3);
  280 + Light test_light_1 = test_bridge.lights().get(1);
  281 + Light test_light_2 = test_bridge.lights().get(2);
  282 + Light test_light_3 = test_bridge.lights().get(3);
283 283  
284 284 EXPECT_EQ("Hue bloom", ctest_light_1.getProductname());
285 285 EXPECT_EQ("", ctest_light_2.getProductname());
... ... @@ -291,12 +291,12 @@ TEST_F(HueLightTest, getProductname)
291 291  
292 292 TEST_F(HueLightTest, getLuminaireUId)
293 293 {
294   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
295   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
296   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
297   - HueLight test_light_1 = test_bridge.lights().get(1);
298   - HueLight test_light_2 = test_bridge.lights().get(2);
299   - HueLight test_light_3 = test_bridge.lights().get(3);
  294 + const Light ctest_light_1 = test_bridge.lights().get(1);
  295 + const Light ctest_light_2 = test_bridge.lights().get(2);
  296 + const Light ctest_light_3 = test_bridge.lights().get(3);
  297 + Light test_light_1 = test_bridge.lights().get(1);
  298 + Light test_light_2 = test_bridge.lights().get(2);
  299 + Light test_light_3 = test_bridge.lights().get(3);
300 300  
301 301 EXPECT_EQ("0000000", ctest_light_1.getLuminaireUId());
302 302 EXPECT_EQ("", ctest_light_2.getLuminaireUId());
... ... @@ -308,12 +308,12 @@ TEST_F(HueLightTest, getLuminaireUId)
308 308  
309 309 TEST_F(HueLightTest, getSwVersion)
310 310 {
311   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
312   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
313   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
314   - HueLight test_light_1 = test_bridge.lights().get(1);
315   - HueLight test_light_2 = test_bridge.lights().get(2);
316   - HueLight test_light_3 = test_bridge.lights().get(3);
  311 + const Light ctest_light_1 = test_bridge.lights().get(1);
  312 + const Light ctest_light_2 = test_bridge.lights().get(2);
  313 + const Light ctest_light_3 = test_bridge.lights().get(3);
  314 + Light test_light_1 = test_bridge.lights().get(1);
  315 + Light test_light_2 = test_bridge.lights().get(2);
  316 + Light test_light_3 = test_bridge.lights().get(3);
317 317  
318 318 EXPECT_EQ("5.50.1.19085", ctest_light_1.getSwVersion());
319 319 EXPECT_EQ("5.50.1.19085", ctest_light_2.getSwVersion());
... ... @@ -348,9 +348,9 @@ TEST_F(HueLightTest, setName)
348 348 .Times(1)
349 349 .WillOnce(Return(prep_ret));
350 350  
351   - HueLight test_light_1 = test_bridge.lights().get(1);
352   - HueLight test_light_2 = test_bridge.lights().get(2);
353   - HueLight test_light_3 = test_bridge.lights().get(3);
  351 + Light test_light_1 = test_bridge.lights().get(1);
  352 + Light test_light_2 = test_bridge.lights().get(2);
  353 + Light test_light_3 = test_bridge.lights().get(3);
354 354  
355 355 EXPECT_EQ(true, test_light_1.setName(expected_request["name"].get<std::string>()));
356 356 EXPECT_EQ(false, test_light_2.setName(expected_request["name"].get<std::string>()));
... ... @@ -359,12 +359,12 @@ TEST_F(HueLightTest, setName)
359 359  
360 360 TEST_F(HueLightTest, getColorType)
361 361 {
362   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
363   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
364   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
365   - HueLight test_light_1 = test_bridge.lights().get(1);
366   - HueLight test_light_2 = test_bridge.lights().get(2);
367   - HueLight test_light_3 = test_bridge.lights().get(3);
  362 + const Light ctest_light_1 = test_bridge.lights().get(1);
  363 + const Light ctest_light_2 = test_bridge.lights().get(2);
  364 + const Light ctest_light_3 = test_bridge.lights().get(3);
  365 + Light test_light_1 = test_bridge.lights().get(1);
  366 + Light test_light_2 = test_bridge.lights().get(2);
  367 + Light test_light_3 = test_bridge.lights().get(3);
368 368  
369 369 EXPECT_EQ(ColorType::NONE, ctest_light_1.getColorType());
370 370 EXPECT_EQ(ColorType::GAMUT_A, ctest_light_2.getColorType());
... ... @@ -376,12 +376,12 @@ TEST_F(HueLightTest, getColorType)
376 376  
377 377 TEST_F(HueLightTest, KelvinToMired)
378 378 {
379   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
380   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
381   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
382   - HueLight test_light_1 = test_bridge.lights().get(1);
383   - HueLight test_light_2 = test_bridge.lights().get(2);
384   - HueLight test_light_3 = test_bridge.lights().get(3);
  379 + const Light ctest_light_1 = test_bridge.lights().get(1);
  380 + const Light ctest_light_2 = test_bridge.lights().get(2);
  381 + const Light ctest_light_3 = test_bridge.lights().get(3);
  382 + Light test_light_1 = test_bridge.lights().get(1);
  383 + Light test_light_2 = test_bridge.lights().get(2);
  384 + Light test_light_3 = test_bridge.lights().get(3);
385 385  
386 386 EXPECT_EQ(10000, ctest_light_1.KelvinToMired(100));
387 387 EXPECT_EQ(500, ctest_light_2.KelvinToMired(2000));
... ... @@ -393,12 +393,12 @@ TEST_F(HueLightTest, KelvinToMired)
393 393  
394 394 TEST_F(HueLightTest, MiredToKelvin)
395 395 {
396   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
397   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
398   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
399   - HueLight test_light_1 = test_bridge.lights().get(1);
400   - HueLight test_light_2 = test_bridge.lights().get(2);
401   - HueLight test_light_3 = test_bridge.lights().get(3);
  396 + const Light ctest_light_1 = test_bridge.lights().get(1);
  397 + const Light ctest_light_2 = test_bridge.lights().get(2);
  398 + const Light ctest_light_3 = test_bridge.lights().get(3);
  399 + Light test_light_1 = test_bridge.lights().get(1);
  400 + Light test_light_2 = test_bridge.lights().get(2);
  401 + Light test_light_3 = test_bridge.lights().get(3);
402 402  
403 403 EXPECT_EQ(100, ctest_light_1.MiredToKelvin(10000));
404 404 EXPECT_EQ(2000, ctest_light_2.MiredToKelvin(500));
... ... @@ -411,12 +411,12 @@ TEST_F(HueLightTest, MiredToKelvin)
411 411  
412 412 TEST_F(HueLightTest, hasBrightnessControl)
413 413 {
414   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
415   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
416   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
417   - HueLight test_light_1 = test_bridge.lights().get(1);
418   - HueLight test_light_2 = test_bridge.lights().get(2);
419   - HueLight test_light_3 = test_bridge.lights().get(3);
  414 + const Light ctest_light_1 = test_bridge.lights().get(1);
  415 + const Light ctest_light_2 = test_bridge.lights().get(2);
  416 + const Light ctest_light_3 = test_bridge.lights().get(3);
  417 + Light test_light_1 = test_bridge.lights().get(1);
  418 + Light test_light_2 = test_bridge.lights().get(2);
  419 + Light test_light_3 = test_bridge.lights().get(3);
420 420  
421 421 EXPECT_EQ(true, ctest_light_1.hasBrightnessControl());
422 422 EXPECT_EQ(true, ctest_light_2.hasBrightnessControl());
... ... @@ -428,12 +428,12 @@ TEST_F(HueLightTest, hasBrightnessControl)
428 428  
429 429 TEST_F(HueLightTest, hasTemperatureControl)
430 430 {
431   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
432   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
433   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
434   - HueLight test_light_1 = test_bridge.lights().get(1);
435   - HueLight test_light_2 = test_bridge.lights().get(2);
436   - HueLight test_light_3 = test_bridge.lights().get(3);
  431 + const Light ctest_light_1 = test_bridge.lights().get(1);
  432 + const Light ctest_light_2 = test_bridge.lights().get(2);
  433 + const Light ctest_light_3 = test_bridge.lights().get(3);
  434 + Light test_light_1 = test_bridge.lights().get(1);
  435 + Light test_light_2 = test_bridge.lights().get(2);
  436 + Light test_light_3 = test_bridge.lights().get(3);
437 437  
438 438 EXPECT_EQ(false, ctest_light_1.hasTemperatureControl());
439 439 EXPECT_EQ(false, ctest_light_2.hasTemperatureControl());
... ... @@ -445,12 +445,12 @@ TEST_F(HueLightTest, hasTemperatureControl)
445 445  
446 446 TEST_F(HueLightTest, hasColorControl)
447 447 {
448   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
449   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
450   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
451   - HueLight test_light_1 = test_bridge.lights().get(1);
452   - HueLight test_light_2 = test_bridge.lights().get(2);
453   - HueLight test_light_3 = test_bridge.lights().get(3);
  448 + const Light ctest_light_1 = test_bridge.lights().get(1);
  449 + const Light ctest_light_2 = test_bridge.lights().get(2);
  450 + const Light ctest_light_3 = test_bridge.lights().get(3);
  451 + Light test_light_1 = test_bridge.lights().get(1);
  452 + Light test_light_2 = test_bridge.lights().get(2);
  453 + Light test_light_3 = test_bridge.lights().get(3);
454 454  
455 455 EXPECT_EQ(false, ctest_light_1.hasColorControl());
456 456 EXPECT_EQ(true, ctest_light_2.hasColorControl());
... ... @@ -481,9 +481,9 @@ TEST_F(HueLightTest, setBrightness)
481 481 .Times(1)
482 482 .WillOnce(Return(prep_ret));
483 483  
484   - HueLight test_light_1 = test_bridge.lights().get(1);
485   - HueLight test_light_2 = test_bridge.lights().get(2);
486   - HueLight test_light_3 = test_bridge.lights().get(3);
  484 + Light test_light_1 = test_bridge.lights().get(1);
  485 + Light test_light_2 = test_bridge.lights().get(2);
  486 + Light test_light_3 = test_bridge.lights().get(3);
487 487  
488 488 EXPECT_EQ(false, test_light_1.setBrightness(200));
489 489 EXPECT_EQ(true, test_light_2.setBrightness(0, 2));
... ... @@ -492,12 +492,12 @@ TEST_F(HueLightTest, setBrightness)
492 492  
493 493 TEST_F(HueLightTest, getBrightness)
494 494 {
495   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
496   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
497   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
498   - HueLight test_light_1 = test_bridge.lights().get(1);
499   - HueLight test_light_2 = test_bridge.lights().get(2);
500   - HueLight test_light_3 = test_bridge.lights().get(3);
  495 + const Light ctest_light_1 = test_bridge.lights().get(1);
  496 + const Light ctest_light_2 = test_bridge.lights().get(2);
  497 + const Light ctest_light_3 = test_bridge.lights().get(3);
  498 + Light test_light_1 = test_bridge.lights().get(1);
  499 + Light test_light_2 = test_bridge.lights().get(2);
  500 + Light test_light_3 = test_bridge.lights().get(3);
501 501  
502 502 EXPECT_EQ(254, ctest_light_1.getBrightness());
503 503 EXPECT_EQ(0, ctest_light_2.getBrightness());
... ... @@ -525,9 +525,9 @@ TEST_F(HueLightTest, setColorTemperature)
525 525 .Times(1)
526 526 .WillOnce(Return(prep_ret));
527 527  
528   - HueLight test_light_1 = test_bridge.lights().get(1);
529   - HueLight test_light_2 = test_bridge.lights().get(2);
530   - HueLight test_light_3 = test_bridge.lights().get(3);
  528 + Light test_light_1 = test_bridge.lights().get(1);
  529 + Light test_light_2 = test_bridge.lights().get(2);
  530 + Light test_light_3 = test_bridge.lights().get(3);
531 531  
532 532 EXPECT_EQ(false, test_light_1.setColorTemperature(153));
533 533 EXPECT_EQ(false, test_light_2.setColorTemperature(400, 2));
... ... @@ -536,12 +536,12 @@ TEST_F(HueLightTest, setColorTemperature)
536 536  
537 537 TEST_F(HueLightTest, getColorTemperature)
538 538 {
539   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
540   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
541   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
542   - HueLight test_light_1 = test_bridge.lights().get(1);
543   - HueLight test_light_2 = test_bridge.lights().get(2);
544   - HueLight test_light_3 = test_bridge.lights().get(3);
  539 + const Light ctest_light_1 = test_bridge.lights().get(1);
  540 + const Light ctest_light_2 = test_bridge.lights().get(2);
  541 + const Light ctest_light_3 = test_bridge.lights().get(3);
  542 + Light test_light_1 = test_bridge.lights().get(1);
  543 + Light test_light_2 = test_bridge.lights().get(2);
  544 + Light test_light_3 = test_bridge.lights().get(3);
545 545  
546 546 EXPECT_EQ(0, ctest_light_1.getColorTemperature());
547 547 EXPECT_EQ(0, ctest_light_2.getColorTemperature());
... ... @@ -572,9 +572,9 @@ TEST_F(HueLightTest, setColorHue)
572 572 .Times(1)
573 573 .WillOnce(Return(prep_ret));
574 574  
575   - HueLight test_light_1 = test_bridge.lights().get(1);
576   - HueLight test_light_2 = test_bridge.lights().get(2);
577   - HueLight test_light_3 = test_bridge.lights().get(3);
  575 + Light test_light_1 = test_bridge.lights().get(1);
  576 + Light test_light_2 = test_bridge.lights().get(2);
  577 + Light test_light_3 = test_bridge.lights().get(3);
578 578  
579 579 EXPECT_EQ(false, test_light_1.setColorHue(153));
580 580 EXPECT_EQ(false, test_light_2.setColorHue(30000, 2));
... ... @@ -602,9 +602,9 @@ TEST_F(HueLightTest, setColorSaturation)
602 602 .Times(1)
603 603 .WillOnce(Return(prep_ret));
604 604  
605   - HueLight test_light_1 = test_bridge.lights().get(1);
606   - HueLight test_light_2 = test_bridge.lights().get(2);
607   - HueLight test_light_3 = test_bridge.lights().get(3);
  605 + Light test_light_1 = test_bridge.lights().get(1);
  606 + Light test_light_2 = test_bridge.lights().get(2);
  607 + Light test_light_3 = test_bridge.lights().get(3);
608 608  
609 609 EXPECT_EQ(false, test_light_1.setColorSaturation(0));
610 610 EXPECT_EQ(false, test_light_2.setColorSaturation(140, 2));
... ... @@ -635,9 +635,9 @@ TEST_F(HueLightTest, setColorHueSaturation)
635 635 .Times(1)
636 636 .WillOnce(Return(prep_ret));
637 637  
638   - HueLight test_light_1 = test_bridge.lights().get(1);
639   - HueLight test_light_2 = test_bridge.lights().get(2);
640   - HueLight test_light_3 = test_bridge.lights().get(3);
  638 + Light test_light_1 = test_bridge.lights().get(1);
  639 + Light test_light_2 = test_bridge.lights().get(2);
  640 + Light test_light_3 = test_bridge.lights().get(3);
641 641  
642 642 EXPECT_EQ(false, test_light_1.setColorHueSaturation({153, 0}));
643 643 EXPECT_EQ(false, test_light_2.setColorHueSaturation({30000, 140}, 2));
... ... @@ -646,12 +646,12 @@ TEST_F(HueLightTest, setColorHueSaturation)
646 646  
647 647 TEST_F(HueLightTest, getColorHueSaturation)
648 648 {
649   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
650   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
651   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
652   - HueLight test_light_1 = test_bridge.lights().get(1);
653   - HueLight test_light_2 = test_bridge.lights().get(2);
654   - HueLight test_light_3 = test_bridge.lights().get(3);
  649 + const Light ctest_light_1 = test_bridge.lights().get(1);
  650 + const Light ctest_light_2 = test_bridge.lights().get(2);
  651 + const Light ctest_light_3 = test_bridge.lights().get(3);
  652 + Light test_light_1 = test_bridge.lights().get(1);
  653 + Light test_light_2 = test_bridge.lights().get(2);
  654 + Light test_light_3 = test_bridge.lights().get(3);
655 655  
656 656 EXPECT_EQ((HueSaturation {0, 0}), ctest_light_1.getColorHueSaturation());
657 657 EXPECT_EQ((HueSaturation {12345, 123}), ctest_light_2.getColorHueSaturation());
... ... @@ -683,9 +683,9 @@ TEST_F(HueLightTest, setColorXY)
683 683 .Times(1)
684 684 .WillOnce(Return(prep_ret));
685 685  
686   - HueLight test_light_1 = test_bridge.lights().get(1);
687   - HueLight test_light_2 = test_bridge.lights().get(2);
688   - HueLight test_light_3 = test_bridge.lights().get(3);
  686 + Light test_light_1 = test_bridge.lights().get(1);
  687 + Light test_light_2 = test_bridge.lights().get(2);
  688 + Light test_light_3 = test_bridge.lights().get(3);
689 689  
690 690 EXPECT_EQ(false, test_light_1.setColorXY({{0.01f, 0.f}, 1.f}));
691 691 EXPECT_EQ(false, test_light_2.setColorXY({{0.123f, 1.f}, 1.f}, 2));
... ... @@ -694,12 +694,12 @@ TEST_F(HueLightTest, setColorXY)
694 694  
695 695 TEST_F(HueLightTest, getColorXY)
696 696 {
697   - const HueLight ctest_light_1 = test_bridge.lights().get(1);
698   - const HueLight ctest_light_2 = test_bridge.lights().get(2);
699   - const HueLight ctest_light_3 = test_bridge.lights().get(3);
700   - HueLight test_light_1 = test_bridge.lights().get(1);
701   - HueLight test_light_2 = test_bridge.lights().get(2);
702   - HueLight test_light_3 = test_bridge.lights().get(3);
  697 + const Light ctest_light_1 = test_bridge.lights().get(1);
  698 + const Light ctest_light_2 = test_bridge.lights().get(2);
  699 + const Light ctest_light_3 = test_bridge.lights().get(3);
  700 + Light test_light_1 = test_bridge.lights().get(1);
  701 + Light test_light_2 = test_bridge.lights().get(2);
  702 + Light test_light_3 = test_bridge.lights().get(3);
703 703 EXPECT_EQ((XYBrightness {{0.f, 0.f}, 0.f}), ctest_light_1.getColorXY());
704 704 EXPECT_EQ((XYBrightness {{0.102f, 0.102f}, 0.f}), ctest_light_2.getColorXY());
705 705 EXPECT_EQ((XYBrightness {{0.102f, 0.102f}, 1.f}), ctest_light_3.getColorXY());
... ... @@ -730,9 +730,9 @@ TEST_F(HueLightTest, setColorRGB)
730 730 .Times(1)
731 731 .WillOnce(Return(prep_ret));
732 732  
733   - HueLight test_light_1 = test_bridge.lights().get(1);
734   - HueLight test_light_2 = test_bridge.lights().get(2);
735   - HueLight test_light_3 = test_bridge.lights().get(3);
  733 + Light test_light_1 = test_bridge.lights().get(1);
  734 + Light test_light_2 = test_bridge.lights().get(2);
  735 + Light test_light_3 = test_bridge.lights().get(3);
736 736  
737 737 EXPECT_EQ(false, test_light_1.setColorRGB({0, 0, 0}, 0));
738 738 EXPECT_EQ(false, test_light_2.setColorRGB({32, 64, 128}, 2));
... ... @@ -757,9 +757,9 @@ TEST_F(HueLightTest, alert)
757 757 .Times(1)
758 758 .WillOnce(Return(prep_ret));
759 759  
760   - HueLight test_light_1 = test_bridge.lights().get(1);
761   - HueLight test_light_2 = test_bridge.lights().get(2);
762   - HueLight test_light_3 = test_bridge.lights().get(3);
  760 + Light test_light_1 = test_bridge.lights().get(1);
  761 + Light test_light_2 = test_bridge.lights().get(2);
  762 + Light test_light_3 = test_bridge.lights().get(3);
763 763  
764 764 EXPECT_EQ(false, test_light_1.alert());
765 765 EXPECT_EQ(false, test_light_2.alert());
... ... @@ -773,9 +773,9 @@ TEST_F(HueLightTest, alertTemperature)
773 773 .Times(1)
774 774 .WillOnce(Return(nlohmann::json::array()));
775 775  
776   - HueLight test_light_1 = test_bridge.lights().get(1);
777   - HueLight test_light_2 = test_bridge.lights().get(2);
778   - HueLight test_light_3 = test_bridge.lights().get(3);
  776 + Light test_light_1 = test_bridge.lights().get(1);
  777 + Light test_light_2 = test_bridge.lights().get(2);
  778 + Light test_light_3 = test_bridge.lights().get(3);
779 779  
780 780 EXPECT_EQ(false, test_light_1.alertTemperature(400));
781 781 EXPECT_EQ(false, test_light_2.alertTemperature(100));
... ... @@ -789,9 +789,9 @@ TEST_F(HueLightTest, alertHueSaturation)
789 789 .Times(1)
790 790 .WillOnce(Return(nlohmann::json::array()));
791 791  
792   - HueLight test_light_1 = test_bridge.lights().get(1);
793   - HueLight test_light_2 = test_bridge.lights().get(2);
794   - HueLight test_light_3 = test_bridge.lights().get(3);
  792 + Light test_light_1 = test_bridge.lights().get(1);
  793 + Light test_light_2 = test_bridge.lights().get(2);
  794 + Light test_light_3 = test_bridge.lights().get(3);
795 795  
796 796 EXPECT_EQ(false, test_light_1.alertHueSaturation({0, 255}));
797 797 EXPECT_EQ(false, test_light_2.alertHueSaturation({3000, 100}));
... ... @@ -805,9 +805,9 @@ TEST_F(HueLightTest, alertXY)
805 805 .Times(1)
806 806 .WillOnce(Return(nlohmann::json::array()));
807 807  
808   - HueLight test_light_1 = test_bridge.lights().get(1);
809   - HueLight test_light_2 = test_bridge.lights().get(2);
810   - HueLight test_light_3 = test_bridge.lights().get(3);
  808 + Light test_light_1 = test_bridge.lights().get(1);
  809 + Light test_light_2 = test_bridge.lights().get(2);
  810 + Light test_light_3 = test_bridge.lights().get(3);
811 811  
812 812 EXPECT_EQ(false, test_light_1.alertXY({{0.1f, 0.1f}, 1.f}));
813 813 EXPECT_EQ(false, test_light_2.alertXY({{0.2434f, 0.2344f}, 1.f}));
... ... @@ -824,9 +824,9 @@ TEST_F(HueLightTest, setColorLoop)
824 824 .Times(1)
825 825 .WillOnce(Return(nlohmann::json::array()));
826 826  
827   - HueLight test_light_1 = test_bridge.lights().get(1);
828   - HueLight test_light_2 = test_bridge.lights().get(2);
829   - HueLight test_light_3 = test_bridge.lights().get(3);
  827 + Light test_light_1 = test_bridge.lights().get(1);
  828 + Light test_light_2 = test_bridge.lights().get(2);
  829 + Light test_light_3 = test_bridge.lights().get(3);
830 830  
831 831 EXPECT_EQ(false, test_light_1.setColorLoop(true));
832 832 EXPECT_EQ(false, test_light_2.setColorLoop(false));
... ...
test/test_HueLightFactory.cpp renamed to test/test_LightFactory.cpp
... ... @@ -29,12 +29,12 @@
29 29  
30 30 using namespace hueplusplus;
31 31  
32   -TEST(HueLightFactory, createLight_noGamut)
  32 +TEST(LightFactory, createLight_noGamut)
33 33 {
34 34 using namespace ::testing;
35 35 std::shared_ptr<MockHttpHandler> handler = std::make_shared<MockHttpHandler>();
36 36  
37   - HueLightFactory factory(HueCommandAPI(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler),
  37 + LightFactory factory(HueCommandAPI(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler),
38 38 std::chrono::steady_clock::duration::max());
39 39  
40 40 nlohmann::json lightState
... ... @@ -49,7 +49,7 @@ TEST(HueLightFactory, createLight_noGamut)
49 49 .Times(AtLeast(1))
50 50 .WillRepeatedly(Return(lightState));
51 51  
52   - HueLight test_light_1 = factory.createLight(lightState, 1);
  52 + Light test_light_1 = factory.createLight(lightState, 1);
53 53 EXPECT_EQ(test_light_1.getColorType(), ColorType::TEMPERATURE);
54 54  
55 55 lightState["type"] = "Dimmable light";
... ... @@ -76,12 +76,12 @@ TEST(HueLightFactory, createLight_noGamut)
76 76 ASSERT_THROW(factory.createLight(lightState, 1), HueException);
77 77 }
78 78  
79   -TEST(HueLightFactory, createLight_gamutCapabilities)
  79 +TEST(LightFactory, createLight_gamutCapabilities)
80 80 {
81 81 using namespace ::testing;
82 82 std::shared_ptr<MockHttpHandler> handler = std::make_shared<MockHttpHandler>();
83 83  
84   - HueLightFactory factory(HueCommandAPI(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler),
  84 + LightFactory factory(HueCommandAPI(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler),
85 85 std::chrono::steady_clock::duration::max());
86 86  
87 87 nlohmann::json lightState
... ... @@ -97,7 +97,7 @@ TEST(HueLightFactory, createLight_gamutCapabilities)
97 97 .Times(AtLeast(1))
98 98 .WillRepeatedly(Return(lightState));
99 99  
100   - HueLight test_light_1 = factory.createLight(lightState, 1);
  100 + Light test_light_1 = factory.createLight(lightState, 1);
101 101 EXPECT_EQ(test_light_1.getColorType(), ColorType::GAMUT_A);
102 102  
103 103 lightState["capabilities"]["control"]["colorgamuttype"] = "B";
... ... @@ -160,12 +160,12 @@ TEST(HueLightFactory, createLight_gamutCapabilities)
160 160 EXPECT_EQ(test_light_1.getColorType(), ColorType::GAMUT_C_TEMPERATURE);
161 161 }
162 162  
163   -TEST(HueLightFactory, createLight_gamutModelid)
  163 +TEST(LightFactory, createLight_gamutModelid)
164 164 {
165 165 using namespace ::testing;
166 166 std::shared_ptr<MockHttpHandler> handler = std::make_shared<MockHttpHandler>();
167 167  
168   - HueLightFactory factory(HueCommandAPI(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler),
  168 + LightFactory factory(HueCommandAPI(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler),
169 169 std::chrono::steady_clock::duration::max());
170 170  
171 171 const std::string gamutAModel = "LST001";
... ... @@ -184,7 +184,7 @@ TEST(HueLightFactory, createLight_gamutModelid)
184 184 .Times(AtLeast(1))
185 185 .WillRepeatedly(Return(lightState));
186 186  
187   - HueLight test_light_1 = factory.createLight(lightState, 1);
  187 + Light test_light_1 = factory.createLight(lightState, 1);
188 188 EXPECT_EQ(test_light_1.getColorType(), ColorType::GAMUT_A);
189 189  
190 190 lightState["modelid"] = gamutBModel;
... ...
test/test_Main.cpp
... ... @@ -21,7 +21,7 @@
21 21 **/
22 22  
23 23 #include <gtest/gtest.h>
24   -#include <hueplusplus/APIConfig.h>
  24 +#include <hueplusplus/LibConfig.h>
25 25  
26 26 namespace
27 27 {
... ...
test/test_SimpleBrightnessStrategy.cpp
... ... @@ -32,7 +32,7 @@
32 32 #include "hueplusplus/SimpleBrightnessStrategy.h"
33 33 #include "json/json.hpp"
34 34 #include "mocks/mock_HttpHandler.h"
35   -#include "mocks/mock_HueLight.h"
  35 +#include "mocks/mock_Light.h"
36 36  
37 37 using namespace hueplusplus;
38 38  
... ... @@ -44,7 +44,7 @@ TEST(SimpleBrightnessStrategy, setBrightness)
44 44 *handler, GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), 80))
45 45 .Times(AtLeast(1))
46 46 .WillRepeatedly(Return(nlohmann::json::object()));
47   - MockHueLight test_light(handler);
  47 + MockLight test_light(handler);
48 48  
49 49 const std::string statePath = "/api/" + getBridgeUsername() + "/lights/1/state";
50 50  
... ... @@ -84,10 +84,10 @@ TEST(SimpleBrightnessStrategy, getBrightness)
84 84 *handler, GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), 80))
85 85 .Times(AtLeast(1))
86 86 .WillRepeatedly(Return(nlohmann::json::object()));
87   - MockHueLight test_light(handler);
  87 + MockLight test_light(handler);
88 88  
89 89 test_light.getState()["state"]["bri"] = 200;
90 90 EXPECT_EQ(200, SimpleBrightnessStrategy().getBrightness(test_light));
91 91 test_light.getState()["state"]["bri"] = 0;
92   - EXPECT_EQ(0, SimpleBrightnessStrategy().getBrightness(static_cast<const HueLight>(test_light)));
  92 + EXPECT_EQ(0, SimpleBrightnessStrategy().getBrightness(static_cast<const Light>(test_light)));
93 93 }
... ...
test/test_SimpleColorHueStrategy.cpp
... ... @@ -32,7 +32,7 @@
32 32 #include "hueplusplus/SimpleColorHueStrategy.h"
33 33 #include "json/json.hpp"
34 34 #include "mocks/mock_HttpHandler.h"
35   -#include "mocks/mock_HueLight.h"
  35 +#include "mocks/mock_Light.h"
36 36  
37 37 using namespace hueplusplus;
38 38  
... ... @@ -44,7 +44,7 @@ TEST(SimpleColorHueStrategy, setColorHue)
44 44 *handler, GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), 80))
45 45 .Times(AtLeast(1))
46 46 .WillRepeatedly(Return(nlohmann::json::object()));
47   - MockHueLight test_light(handler);
  47 + MockLight test_light(handler);
48 48  
49 49 const std::string statePath = "/api/" + getBridgeUsername() + "/lights/1/state";
50 50  
... ... @@ -78,7 +78,7 @@ TEST(SimpleColorHueStrategy, setColorSaturation)
78 78 *handler, GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), 80))
79 79 .Times(AtLeast(1))
80 80 .WillRepeatedly(Return(nlohmann::json::object()));
81   - MockHueLight test_light(handler);
  81 + MockLight test_light(handler);
82 82  
83 83 const std::string statePath = "/api/" + getBridgeUsername() + "/lights/1/state";
84 84  
... ... @@ -112,7 +112,7 @@ TEST(SimpleColorHueStrategy, setColorHueSaturation)
112 112 *handler, GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), 80))
113 113 .Times(AtLeast(1))
114 114 .WillRepeatedly(Return(nlohmann::json::object()));
115   - MockHueLight test_light(handler);
  115 + MockLight test_light(handler);
116 116  
117 117 const std::string statePath = "/api/" + getBridgeUsername() + "/lights/1/state";
118 118  
... ... @@ -150,7 +150,7 @@ TEST(SimpleColorHueStrategy, setColorXY)
150 150 *handler, GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), 80))
151 151 .Times(AtLeast(1))
152 152 .WillRepeatedly(Return(nlohmann::json::object()));
153   - MockHueLight test_light(handler);
  153 + MockLight test_light(handler);
154 154  
155 155 const std::string statePath = "/api/" + getBridgeUsername() + "/lights/1/state";
156 156  
... ... @@ -179,7 +179,7 @@ TEST(SimpleColorHueStrategy, setColorLoop)
179 179 *handler, GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), 80))
180 180 .Times(AtLeast(1))
181 181 .WillRepeatedly(Return(nlohmann::json::object()));
182   - MockHueLight test_light(handler);
  182 + MockLight test_light(handler);
183 183  
184 184 const std::string statePath = "/api/" + getBridgeUsername() + "/lights/1/state";
185 185  
... ... @@ -210,7 +210,7 @@ TEST(SimpleColorHueStrategy, alertHueSaturation)
210 210 *handler, GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), 80))
211 211 .Times(AtLeast(1))
212 212 .WillRepeatedly(Return(nlohmann::json::object()));
213   - MockHueLight light(handler);
  213 + MockLight light(handler);
214 214  
215 215 // Invalid colormode
216 216 {
... ... @@ -335,7 +335,7 @@ TEST(SimpleColorHueStrategy, alertXY)
335 335 *handler, GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), 80))
336 336 .Times(AtLeast(1))
337 337 .WillRepeatedly(Return(nlohmann::json::object()));
338   - MockHueLight light(handler);
  338 + MockLight light(handler);
339 339  
340 340 // Invalid colormode
341 341 {
... ... @@ -455,7 +455,7 @@ TEST(SimpleColorHueStrategy, getColorHueSaturation)
455 455 *handler, GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), 80))
456 456 .Times(AtLeast(1))
457 457 .WillRepeatedly(Return(nlohmann::json::object()));
458   - MockHueLight test_light(handler);
  458 + MockLight test_light(handler);
459 459  
460 460 test_light.getState()["state"]["hue"] = 5000;
461 461 test_light.getState()["state"]["sat"] = 128;
... ... @@ -463,7 +463,7 @@ TEST(SimpleColorHueStrategy, getColorHueSaturation)
463 463 test_light.getState()["state"]["hue"] = 50000;
464 464 test_light.getState()["state"]["sat"] = 158;
465 465 EXPECT_EQ((HueSaturation {50000, 158}),
466   - SimpleColorHueStrategy().getColorHueSaturation(static_cast<const HueLight>(test_light)));
  466 + SimpleColorHueStrategy().getColorHueSaturation(static_cast<const Light>(test_light)));
467 467 }
468 468  
469 469 TEST(SimpleColorHueStrategy, getColorXY)
... ... @@ -474,7 +474,7 @@ TEST(SimpleColorHueStrategy, getColorXY)
474 474 *handler, GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), 80))
475 475 .Times(AtLeast(1))
476 476 .WillRepeatedly(Return(nlohmann::json::object()));
477   - MockHueLight test_light(handler);
  477 + MockLight test_light(handler);
478 478  
479 479 test_light.getState()["state"]["xy"][0] = 0.1234;
480 480 test_light.getState()["state"]["xy"][1] = 0.1234;
... ...
test/test_SimpleColorTemperatureStrategy.cpp
... ... @@ -33,7 +33,7 @@
33 33 #include "hueplusplus/SimpleColorTemperatureStrategy.h"
34 34 #include "json/json.hpp"
35 35 #include "mocks/mock_HttpHandler.h"
36   -#include "mocks/mock_HueLight.h"
  36 +#include "mocks/mock_Light.h"
37 37  
38 38 using namespace hueplusplus;
39 39  
... ... @@ -45,7 +45,7 @@ TEST(SimpleColorTemperatureStrategy, setColorTemperature)
45 45 *handler, GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), 80))
46 46 .Times(AtLeast(1))
47 47 .WillRepeatedly(Return(nlohmann::json::object()));
48   - MockHueLight test_light(handler);
  48 + MockLight test_light(handler);
49 49  
50 50 const std::string statePath = "/api/" + getBridgeUsername() + "/lights/1/state";
51 51  
... ... @@ -87,7 +87,7 @@ TEST(SimpleColorTemperatureStrategy, alertTemperature)
87 87 *handler, GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), 80))
88 88 .Times(AtLeast(1))
89 89 .WillRepeatedly(Return(nlohmann::json::object()));
90   - MockHueLight light(handler);
  90 + MockLight light(handler);
91 91  
92 92 const auto setCTLambda = [&](unsigned int ct, int transition) {
93 93 light.getState()["state"]["colormode"] = "ct";
... ... @@ -146,10 +146,10 @@ TEST(SimpleColorTemperatureStrategy, getColorTemperature)
146 146 *handler, GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), 80))
147 147 .Times(AtLeast(1))
148 148 .WillRepeatedly(Return(nlohmann::json::object()));
149   - MockHueLight test_light(handler);
  149 + MockLight test_light(handler);
150 150  
151 151 test_light.getState()["state"]["ct"] = 200;
152 152 EXPECT_EQ(200, SimpleColorTemperatureStrategy().getColorTemperature(test_light));
153 153 test_light.getState()["state"]["ct"] = 500;
154   - EXPECT_EQ(500, SimpleColorTemperatureStrategy().getColorTemperature(static_cast<const HueLight>(test_light)));
  154 + EXPECT_EQ(500, SimpleColorTemperatureStrategy().getColorTemperature(static_cast<const Light>(test_light)));
155 155 }
... ...
test/test_UPnP.cpp
... ... @@ -26,7 +26,7 @@
26 26 #include "iostream"
27 27 #include "testhelper.h"
28 28  
29   -#include "hueplusplus/APIConfig.h"
  29 +#include "hueplusplus/LibConfig.h"
30 30 #include "hueplusplus/UPnP.h"
31 31 #include "json/json.hpp"
32 32 #include "mocks/mock_HttpHandler.h"
... ...