Commit ea8672289a6e537c5587bd2d6897f630bf5134d4

Authored by Jojo-1000
Committed by Moritz Wirger
1 parent 374adda3

Remove functions that just forward from Hue.

include/hueplusplus/APIConfig.h
1 /** 1 /**
2 - \file HueConfig.h 2 + \file APIConfig.h
3 Copyright Notice\n 3 Copyright Notice\n
4 Copyright (C) 2017 Jan Rogall - developer\n 4 Copyright (C) 2017 Jan Rogall - developer\n
5 Copyright (C) 2017 Moritz Wirger - developer\n 5 Copyright (C) 2017 Moritz Wirger - developer\n
include/hueplusplus/Hue.h
@@ -134,6 +134,12 @@ class Hue @@ -134,6 +134,12 @@ class Hue
134 friend class HueFinder; 134 friend class HueFinder;
135 135
136 public: 136 public:
  137 + using LightList = ResourceList<HueLight, int>;
  138 + using GroupList = GroupResourceList<Group, CreateGroup>;
  139 + using ScheduleList = CreateableResourceList<Schedule, int, CreateSchedule>;
  140 + using SceneList = CreateableResourceList<Scene, std::string, CreateScene>;
  141 +
  142 +public:
137 //! \brief Constructor of Hue class 143 //! \brief Constructor of Hue class
138 //! 144 //!
139 //! \param ip IP address in dotted decimal notation like "192.168.2.1" 145 //! \param ip IP address in dotted decimal notation like "192.168.2.1"
@@ -195,191 +201,18 @@ public: @@ -195,191 +201,18 @@ public:
195 201
196 BridgeConfig& config(); 202 BridgeConfig& config();
197 const BridgeConfig& config() const; 203 const BridgeConfig& config() const;
198 - ///@}  
199 - //! \name Lights  
200 - ///@{  
201 -  
202 - //! \brief Function that returns a \ref HueLight of specified id  
203 - //!  
204 - //! \param id Integer that specifies the ID of a Hue light  
205 - //! \return \ref HueLight that can be controlled  
206 - //! \throws std::system_error when system or socket operations fail  
207 - //! \throws HueException when id does not exist or type is unknown  
208 - //! \throws HueAPIResponseException when response contains an error  
209 - //! \throws nlohmann::json::parse_error when response could not be parsed  
210 - HueLight& getLight(int id);  
211 -  
212 - //! \brief Function to remove a light from the bridge  
213 - //!  
214 - //! \attention Any use of the light after it was successfully removed results in undefined behavior  
215 - //! \param id Id of the light to remove  
216 - //! \return true on success  
217 - //! \throws std::system_error when system or socket operations fail  
218 - //! \throws HueException when response contains no body  
219 - //! \throws HueAPIResponseException when response contains an error  
220 - //! \throws nlohmann::json::parse_error when response could not be parsed  
221 - bool removeLight(int id);  
222 -  
223 - //! \brief Function that returns all lights that are associated with this  
224 - //! bridge  
225 - //!  
226 - //! \return A vector containing references to every HueLight  
227 - //! \throws std::system_error when system or socket operations fail  
228 - //! \throws HueException when response contains no body  
229 - //! \throws HueAPIResponseException when response contains an error  
230 - //! \throws nlohmann::json::parse_error when response could not be parsed  
231 - std::vector<std::reference_wrapper<HueLight>> getAllLights();  
232 -  
233 - //! \brief Function that tells whether a given light id represents an existing light  
234 - //! \param id Id of a light to check for existance  
235 - //! \return Bool that is true when a light with the given id exists and false when not  
236 - //! \throws std::system_error when system or socket operations fail  
237 - //! \throws HueException when response contains no body  
238 - //! \throws HueAPIResponseException when response contains an error  
239 - //! \throws nlohmann::json::parse_error when response could not be parsed  
240 - bool lightExists(int id);  
241 -  
242 - //! \brief Const function that tells whether a given light id represents an  
243 - //! existing light  
244 - //!  
245 - //! \note This will not update the local state of the bridge  
246 - //! \param id Id of a light to check for existance  
247 - //! \return Bool that is true when a light with the given id exists and false  
248 - //! when not  
249 - bool lightExists(int id) const;  
250 -  
251 - ///@}  
252 - //! \name Groups  
253 - ///@{  
254 -  
255 - //! \brief Get all groups that exist on this bridge.  
256 - //! \return A vector of references to every Group.  
257 - //! \throws std::system_error when system or socket operations fail  
258 - //! \throws HueException when response contains no body  
259 - //! \throws HueAPIResponseException when response contains an error  
260 - //! \throws nlohmann::json::parse_error when response could not be parsed  
261 - std::vector<std::reference_wrapper<Group>> getAllGroups();  
262 -  
263 - //! \brief Get group specified by id.  
264 - //! \param id ID of the group.  
265 - //! \returns Group that can be controlled.  
266 - //! \note Every bridge has a special group 0 which contains all lights  
267 - //! and is not visible to getAllGroups().  
268 - //! \throws std::system_error when system or socket operations fail  
269 - //! \throws HueException when id does not exist  
270 - //! \throws HueAPIResponseException when response contains an error  
271 - //! \throws nlohmann::json::parse_error when response could not be parsed  
272 - Group& getGroup(int id);  
273 -  
274 - //! \brief Remove a group from the bridge.  
275 - //! \param id ID of the group.  
276 - //! \returns true on success.  
277 - //! \brief Remove a group from the bridge.  
278 - //! \param id ID of the group.  
279 - //! \returns true on success.  
280 - //! \throws std::system_error when system or socket operations fail  
281 - //! \throws HueException when response contains no body  
282 - //! \throws HueAPIResponseException when response contains an error  
283 - //! \throws nlohmann::json::parse_error when response could not be parsed  
284 - bool removeGroup(int id);  
285 204
286 - //! \brief Checks whether a group exists.  
287 - //! \param id ID of the group.  
288 - //! \returns true when the group exists.  
289 - //! \throws std::system_error when system or socket operations fail  
290 - //! \throws HueException when response contains no body  
291 - //! \throws HueAPIResponseException when response contains an error  
292 - //! \throws nlohmann::json::parse_error when response could not be parsed  
293 - bool groupExists(int id);  
294 -  
295 - //! \brief Checks whether a group exists.  
296 - //! \param id ID of the group.  
297 - //! \returns true when the group exists.  
298 - //! \note Does not refresh the cached state.  
299 - bool groupExists(int id) const;  
300 -  
301 - //! \brief Create a new group.  
302 - //! \param params CreateGroup parameters for the new group.  
303 - //! \returns The new group id or 0 if failed.  
304 - //! \throws std::system_error when system or socket operations fail  
305 - //! \throws HueException when response contains no body  
306 - //! \throws HueAPIResponseException when response contains an error  
307 - //! \throws nlohmann::json::parse_error when response could not be parsed  
308 - int createGroup(const CreateGroup& params);  
309 -  
310 - ///@}  
311 - //! \name Schedules  
312 - ///@{  
313 -  
314 - //! \brief Get all schedules on this bridge.  
315 - //! \return A vector of references to every Schedule.  
316 - //! \throws std::system_error when system or socket operations fail  
317 - //! \throws HueException when response contains no body  
318 - //! \throws HueAPIResponseException when response contains an error  
319 - //! \throws nlohmann::json::parse_error when response could not be parsed  
320 - std::vector<std::reference_wrapper<Schedule>> getAllSchedules();  
321 -  
322 - //! \brief Get schedule specified by id.  
323 - //! \param id ID of the schedule.  
324 - //! \returns Schedule that can be modified.  
325 - //! \throws std::system_error when system or socket operations fail  
326 - //! \throws HueException when id does not exist  
327 - //! \throws HueAPIResponseException when response contains an error  
328 - //! \throws nlohmann::json::parse_error when response could not be parsed  
329 - Schedule& getSchedule(int id); 205 + LightList& lights();
  206 + const LightList& lights() const;
330 207
331 - //! \brief Checks whether a schedule exists.  
332 - //! \param id ID of the schedule.  
333 - //! \returns true when the schedule exists.  
334 - //! \note Does not refresh the cached state.  
335 - bool scheduleExists(int id) const; 208 + GroupList& groups();
  209 + const GroupList& groups() const;
336 210
337 - //! \brief Create a new schedule.  
338 - //! \param params CreateSchedule parameters for the new schedule.  
339 - //! \returns The new schedule id or 0 if failed.  
340 - //! \throws std::system_error when system or socket operations fail  
341 - //! \throws HueException when response contains no body  
342 - //! \throws HueAPIResponseException when response contains an error  
343 - //! \throws nlohmann::json::parse_error when response could not be parsed  
344 - int createSchedule(const CreateSchedule& params);  
345 -  
346 - ///@}  
347 - ///! \name Scenes  
348 - ///@{  
349 -  
350 - //! \brief Get all scenes on this bridge.  
351 - //! \return A vector of references to every Scene.  
352 - //! \throws std::system_error when system or socket operations fail  
353 - //! \throws HueException when response contains no body  
354 - //! \throws HueAPIResponseException when response contains an error  
355 - //! \throws nlohmann::json::parse_error when response could not be parsed  
356 - std::vector<std::reference_wrapper<Scene>> getAllScenes();  
357 -  
358 - //! \brief Get scene specified by id.  
359 - //! \param id ID of the scene.  
360 - //! \returns Schedule that can be modified.  
361 - //! \throws std::system_error when system or socket operations fail  
362 - //! \throws HueException when id does not exist  
363 - //! \throws HueAPIResponseException when response contains an error  
364 - //! \throws nlohmann::json::parse_error when response could not be parsed  
365 - Scene& getScene(const std::string& id);  
366 -  
367 - //! \brief Checks whether a scene exists.  
368 - //! \param id ID of the scene.  
369 - //! \returns true when the scene exists.  
370 - //! \note Does not refresh the cached state.  
371 - bool sceneExists(const std::string& id) const;  
372 -  
373 - //! \brief Create a new scene.  
374 - //! \param params CreateScene parameters for the new scene.  
375 - //! \returns The new scene id or 0 if failed.  
376 - //! \throws std::system_error when system or socket operations fail  
377 - //! \throws HueException when response contains no body  
378 - //! \throws HueAPIResponseException when response contains an error  
379 - //! \throws nlohmann::json::parse_error when response could not be parsed  
380 - std::string createScene(const CreateScene& params); 211 + ScheduleList& schedules();
  212 + const ScheduleList& schedules() const;
381 213
382 - ///@} 214 + SceneList& scenes();
  215 + const SceneList& scenes() const;
383 216
384 private: 217 private:
385 std::string ip; //!< IP-Address of the hue bridge in dotted decimal notation 218 std::string ip; //!< IP-Address of the hue bridge in dotted decimal notation
@@ -391,10 +224,10 @@ private: @@ -391,10 +224,10 @@ private:
391 //!< bridge 224 //!< bridge
392 std::chrono::steady_clock::duration refreshDuration; 225 std::chrono::steady_clock::duration refreshDuration;
393 std::shared_ptr<APICache> stateCache; 226 std::shared_ptr<APICache> stateCache;
394 - MakeCopyable<ResourceList<HueLight, int>> lights;  
395 - MakeCopyable<GroupResourceList<Group, CreateGroup>> groups;  
396 - MakeCopyable<CreateableResourceList<Schedule, int, CreateSchedule>> schedules;  
397 - MakeCopyable<CreateableResourceList<Scene, std::string, CreateScene>> scenes; 227 + MakeCopyable<LightList> lightList;
  228 + MakeCopyable<GroupList> groupList;
  229 + MakeCopyable<ScheduleList> scheduleList;
  230 + MakeCopyable<SceneList> sceneList;
398 MakeCopyable<BridgeConfig> bridgeConfig; 231 MakeCopyable<BridgeConfig> bridgeConfig;
399 }; 232 };
400 } // namespace hueplusplus 233 } // namespace hueplusplus
src/Hue.cpp
@@ -139,12 +139,12 @@ Hue::Hue(const std::string&amp; ip, const int port, const std::string&amp; username, @@ -139,12 +139,12 @@ Hue::Hue(const std::string&amp; ip, const int port, const std::string&amp; username,
139 refreshDuration(refreshDuration), 139 refreshDuration(refreshDuration),
140 stateCache(std::make_shared<APICache>( 140 stateCache(std::make_shared<APICache>(
141 "", HueCommandAPI(ip, port, username, http_handler), std::chrono::steady_clock::duration::max())), 141 "", HueCommandAPI(ip, port, username, http_handler), std::chrono::steady_clock::duration::max())),
142 - lights(stateCache, "lights", refreshDuration, 142 + lightList(stateCache, "lights", refreshDuration,
143 [factory = HueLightFactory(stateCache->getCommandAPI(), refreshDuration)]( 143 [factory = HueLightFactory(stateCache->getCommandAPI(), refreshDuration)](
144 int id, const nlohmann::json& state) mutable { return factory.createLight(state, id); }), 144 int id, const nlohmann::json& state) mutable { return factory.createLight(state, id); }),
145 - groups(stateCache, "groups", refreshDuration),  
146 - schedules(stateCache, "schedules", refreshDuration),  
147 - scenes(stateCache, "scenes", refreshDuration), 145 + groupList(stateCache, "groups", refreshDuration),
  146 + scheduleList(stateCache, "schedules", refreshDuration),
  147 + sceneList(stateCache, "scenes", refreshDuration),
148 bridgeConfig(stateCache, refreshDuration) 148 bridgeConfig(stateCache, refreshDuration)
149 { } 149 { }
150 150
@@ -231,101 +231,56 @@ const BridgeConfig&amp; Hue::config() const @@ -231,101 +231,56 @@ const BridgeConfig&amp; Hue::config() const
231 return bridgeConfig; 231 return bridgeConfig;
232 } 232 }
233 233
234 -HueLight& Hue::getLight(int id) 234 +Hue::LightList& Hue::lights()
235 { 235 {
236 - return lights.get(id); 236 + return lightList;
237 } 237 }
238 238
239 -bool Hue::removeLight(int id) 239 +const Hue::LightList& Hue::lights() const
240 { 240 {
241 - return lights.remove(id); 241 + return lightList;
242 } 242 }
243 243
244 -std::vector<std::reference_wrapper<HueLight>> Hue::getAllLights() 244 +Hue::GroupList& Hue::groups()
245 { 245 {
246 - return lights.getAll(); 246 + return groupList;
247 } 247 }
248 248
249 -std::vector<std::reference_wrapper<Group>> Hue::getAllGroups() 249 +const Hue::GroupList& Hue::groups() const
250 { 250 {
251 - return groups.getAll(); 251 + return groupList;
252 } 252 }
253 253
254 -Group& Hue::getGroup(int id) 254 +Hue::ScheduleList& Hue::schedules()
255 { 255 {
256 - return groups.get(id); 256 + return scheduleList;
257 } 257 }
258 258
259 -bool Hue::removeGroup(int id) 259 +const Hue::ScheduleList& Hue::schedules() const
260 { 260 {
261 - return groups.remove(id); 261 + return scheduleList;
262 } 262 }
263 263
264 -bool Hue::groupExists(int id) const 264 +Hue::SceneList& Hue::scenes()
265 { 265 {
266 - return groups.exists(id); 266 + return sceneList;
267 } 267 }
268 268
269 -int Hue::createGroup(const CreateGroup& params) 269 +const Hue::SceneList& Hue::scenes() const
270 { 270 {
271 - return groups.create(params);  
272 -}  
273 -  
274 -bool Hue::lightExists(int id) const  
275 -{  
276 - return lights.exists(id);  
277 -}  
278 -  
279 -std::vector<std::reference_wrapper<Schedule>> Hue::getAllSchedules()  
280 -{  
281 - return schedules.getAll();  
282 -}  
283 -  
284 -Schedule& Hue::getSchedule(int id)  
285 -{  
286 - return schedules.get(id);  
287 -}  
288 -  
289 -bool Hue::scheduleExists(int id) const  
290 -{  
291 - return schedules.exists(id);  
292 -}  
293 -  
294 -int Hue::createSchedule(const CreateSchedule& params)  
295 -{  
296 - return schedules.create(params);  
297 -}  
298 -  
299 -std::vector<std::reference_wrapper<Scene>> Hue::getAllScenes()  
300 -{  
301 - return scenes.getAll();  
302 -}  
303 -  
304 -Scene& Hue::getScene(const std::string& id)  
305 -{  
306 - return scenes.get(id);  
307 -}  
308 -  
309 -bool Hue::sceneExists(const std::string& id) const  
310 -{  
311 - return scenes.exists(id);  
312 -}  
313 -  
314 -std::string Hue::createScene(const CreateScene& params)  
315 -{  
316 - return scenes.create(params); 271 + return sceneList;
317 } 272 }
318 273
319 void Hue::setHttpHandler(std::shared_ptr<const IHttpHandler> handler) 274 void Hue::setHttpHandler(std::shared_ptr<const IHttpHandler> handler)
320 { 275 {
321 http_handler = handler; 276 http_handler = handler;
322 stateCache = std::make_shared<APICache>("", HueCommandAPI(ip, port, username, handler), refreshDuration); 277 stateCache = std::make_shared<APICache>("", HueCommandAPI(ip, port, username, handler), refreshDuration);
323 - lights = ResourceList<HueLight, int>(stateCache, "lights", refreshDuration, 278 + lightList = ResourceList<HueLight, int>(stateCache, "lights", refreshDuration,
324 [factory = HueLightFactory(stateCache->getCommandAPI(), refreshDuration)]( 279 [factory = HueLightFactory(stateCache->getCommandAPI(), refreshDuration)](
325 int id, const nlohmann::json& state) mutable { return factory.createLight(state, id); }); 280 int id, const nlohmann::json& state) mutable { return factory.createLight(state, id); });
326 - groups = GroupResourceList<Group, CreateGroup>(stateCache, "groups", refreshDuration);  
327 - schedules = CreateableResourceList<Schedule, int, CreateSchedule>(stateCache, "schedules", refreshDuration);  
328 - scenes = CreateableResourceList<Scene, std::string, CreateScene>(stateCache, "scenes", refreshDuration); 281 + groupList = GroupResourceList<Group, CreateGroup>(stateCache, "groups", refreshDuration);
  282 + scheduleList = CreateableResourceList<Schedule, int, CreateSchedule>(stateCache, "schedules", refreshDuration);
  283 + sceneList = CreateableResourceList<Scene, std::string, CreateScene>(stateCache, "scenes", refreshDuration);
329 bridgeConfig = BridgeConfig(stateCache, refreshDuration); 284 bridgeConfig = BridgeConfig(stateCache, refreshDuration);
330 } 285 }
331 } // namespace hueplusplus 286 } // namespace hueplusplus
test/test_Hue.cpp
@@ -221,7 +221,7 @@ TEST(Hue, requestUsername) @@ -221,7 +221,7 @@ TEST(Hue, requestUsername)
221 .Times(1) 221 .Times(1)
222 .WillOnce(Return(hue_bridge_state)); 222 .WillOnce(Return(hue_bridge_state));
223 223
224 - test_bridge.getAllLights(); 224 + test_bridge.lights().getAll();
225 } 225 }
226 } 226 }
227 227
@@ -254,7 +254,7 @@ TEST(Hue, getLight) @@ -254,7 +254,7 @@ TEST(Hue, getLight)
254 Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler); 254 Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
255 255
256 // Test exception 256 // Test exception
257 - ASSERT_THROW(test_bridge.getLight(1), HueException); 257 + ASSERT_THROW(test_bridge.lights().get(1), HueException);
258 258
259 nlohmann::json hue_bridge_state {{"lights", 259 nlohmann::json hue_bridge_state {{"lights",
260 {{"1", 260 {{"1",
@@ -279,13 +279,13 @@ TEST(Hue, getLight) @@ -279,13 +279,13 @@ TEST(Hue, getLight)
279 test_bridge = Hue(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler); 279 test_bridge = Hue(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
280 280
281 // Test when correct data is sent 281 // Test when correct data is sent
282 - HueLight test_light_1 = test_bridge.getLight(1); 282 + HueLight test_light_1 = test_bridge.lights().get(1);
283 EXPECT_EQ(test_light_1.getName(), "Hue ambiance lamp 1"); 283 EXPECT_EQ(test_light_1.getName(), "Hue ambiance lamp 1");
284 EXPECT_EQ(test_light_1.getColorType(), ColorType::TEMPERATURE); 284 EXPECT_EQ(test_light_1.getColorType(), ColorType::TEMPERATURE);
285 285
286 // Test again to check whether light is returned directly -> interesting for 286 // Test again to check whether light is returned directly -> interesting for
287 // code coverage test 287 // code coverage test
288 - test_light_1 = test_bridge.getLight(1); 288 + test_light_1 = test_bridge.lights().get(1);
289 EXPECT_EQ(test_light_1.getName(), "Hue ambiance lamp 1"); 289 EXPECT_EQ(test_light_1.getName(), "Hue ambiance lamp 1");
290 EXPECT_EQ(test_light_1.getColorType(), ColorType::TEMPERATURE); 290 EXPECT_EQ(test_light_1.getColorType(), ColorType::TEMPERATURE);
291 } 291 }
@@ -326,11 +326,11 @@ TEST(Hue, removeLight) @@ -326,11 +326,11 @@ TEST(Hue, removeLight)
326 .WillOnce(Return(nlohmann::json())); 326 .WillOnce(Return(nlohmann::json()));
327 327
328 // Test when correct data is sent 328 // Test when correct data is sent
329 - HueLight test_light_1 = test_bridge.getLight(1); 329 + HueLight test_light_1 = test_bridge.lights().get(1);
330 330
331 - EXPECT_EQ(test_bridge.removeLight(1), true); 331 + EXPECT_EQ(test_bridge.lights().remove(1), true);
332 332
333 - EXPECT_EQ(test_bridge.removeLight(1), false); 333 + EXPECT_EQ(test_bridge.lights().remove(1), false);
334 } 334 }
335 335
336 TEST(Hue, getAllLights) 336 TEST(Hue, getAllLights)
@@ -358,7 +358,7 @@ TEST(Hue, getAllLights) @@ -358,7 +358,7 @@ TEST(Hue, getAllLights)
358 358
359 Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler); 359 Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
360 360
361 - std::vector<std::reference_wrapper<HueLight>> test_lights = test_bridge.getAllLights(); 361 + std::vector<std::reference_wrapper<HueLight>> test_lights = test_bridge.lights().getAll();
362 ASSERT_EQ(1, test_lights.size()); 362 ASSERT_EQ(1, test_lights.size());
363 EXPECT_EQ(test_lights[0].get().getName(), "Hue ambiance lamp 1"); 363 EXPECT_EQ(test_lights[0].get().getName(), "Hue ambiance lamp 1");
364 EXPECT_EQ(test_lights[0].get().getColorType(), ColorType::TEMPERATURE); 364 EXPECT_EQ(test_lights[0].get().getColorType(), ColorType::TEMPERATURE);
@@ -385,8 +385,8 @@ TEST(Hue, lightExists) @@ -385,8 +385,8 @@ TEST(Hue, lightExists)
385 385
386 test_bridge.refresh(); 386 test_bridge.refresh();
387 387
388 - EXPECT_TRUE(Const(test_bridge).lightExists(1));  
389 - EXPECT_FALSE(Const(test_bridge).lightExists(2)); 388 + EXPECT_TRUE(Const(test_bridge).lights().exists(1));
  389 + EXPECT_FALSE(Const(test_bridge).lights().exists(2));
390 } 390 }
391 391
392 TEST(Hue, getGroup) 392 TEST(Hue, getGroup)
@@ -400,7 +400,7 @@ TEST(Hue, getGroup) @@ -400,7 +400,7 @@ TEST(Hue, getGroup)
400 Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler); 400 Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
401 401
402 // Test exception 402 // Test exception
403 - ASSERT_THROW(test_bridge.getGroup(1), HueException); 403 + ASSERT_THROW(test_bridge.groups().get(1), HueException);
404 404
405 nlohmann::json hue_bridge_state {{"groups", 405 nlohmann::json hue_bridge_state {{"groups",
406 {{"1", 406 {{"1",
@@ -424,12 +424,12 @@ TEST(Hue, getGroup) @@ -424,12 +424,12 @@ TEST(Hue, getGroup)
424 test_bridge = Hue(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler); 424 test_bridge = Hue(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
425 425
426 // Test when correct data is sent 426 // Test when correct data is sent
427 - Group test_group_1 = test_bridge.getGroup(1); 427 + Group test_group_1 = test_bridge.groups().get(1);
428 EXPECT_EQ(test_group_1.getName(), "Group 1"); 428 EXPECT_EQ(test_group_1.getName(), "Group 1");
429 EXPECT_EQ(test_group_1.getType(), "LightGroup"); 429 EXPECT_EQ(test_group_1.getType(), "LightGroup");
430 430
431 // Test again to check whether group is returned directly 431 // Test again to check whether group is returned directly
432 - test_group_1 = test_bridge.getGroup(1); 432 + test_group_1 = test_bridge.groups().get(1);
433 EXPECT_EQ(test_group_1.getName(), "Group 1"); 433 EXPECT_EQ(test_group_1.getName(), "Group 1");
434 EXPECT_EQ(test_group_1.getType(), "LightGroup"); 434 EXPECT_EQ(test_group_1.getType(), "LightGroup");
435 } 435 }
@@ -469,11 +469,11 @@ TEST(Hue, removeGroup) @@ -469,11 +469,11 @@ TEST(Hue, removeGroup)
469 .WillOnce(Return(nlohmann::json())); 469 .WillOnce(Return(nlohmann::json()));
470 470
471 // Test when correct data is sent 471 // Test when correct data is sent
472 - Group test_group_1 = test_bridge.getGroup(1); 472 + Group test_group_1 = test_bridge.groups().get(1);
473 473
474 - EXPECT_EQ(test_bridge.removeGroup(1), true); 474 + EXPECT_EQ(test_bridge.groups().remove(1), true);
475 475
476 - EXPECT_EQ(test_bridge.removeGroup(1), false); 476 + EXPECT_EQ(test_bridge.groups().remove(1), false);
477 } 477 }
478 478
479 TEST(Hue, groupExists) 479 TEST(Hue, groupExists)
@@ -496,8 +496,8 @@ TEST(Hue, groupExists) @@ -496,8 +496,8 @@ TEST(Hue, groupExists)
496 496
497 test_bridge.refresh(); 497 test_bridge.refresh();
498 498
499 - EXPECT_EQ(true, Const(test_bridge).groupExists(1));  
500 - EXPECT_EQ(false, Const(test_bridge).groupExists(2)); 499 + EXPECT_EQ(true, Const(test_bridge).groups().exists(1));
  500 + EXPECT_EQ(false, Const(test_bridge).groups().exists(2));
501 } 501 }
502 502
503 TEST(Hue, getAllGroups) 503 TEST(Hue, getAllGroups)
@@ -524,7 +524,7 @@ TEST(Hue, getAllGroups) @@ -524,7 +524,7 @@ TEST(Hue, getAllGroups)
524 524
525 Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler); 525 Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
526 526
527 - std::vector<std::reference_wrapper<Group>> test_groups = test_bridge.getAllGroups(); 527 + std::vector<std::reference_wrapper<Group>> test_groups = test_bridge.groups().getAll();
528 ASSERT_EQ(1, test_groups.size()); 528 ASSERT_EQ(1, test_groups.size());
529 EXPECT_EQ(test_groups[0].get().getName(), "Group 1"); 529 EXPECT_EQ(test_groups[0].get().getName(), "Group 1");
530 EXPECT_EQ(test_groups[0].get().getType(), "LightGroup"); 530 EXPECT_EQ(test_groups[0].get().getType(), "LightGroup");
@@ -544,10 +544,10 @@ TEST(Hue, createGroup) @@ -544,10 +544,10 @@ TEST(Hue, createGroup)
544 nlohmann::json response = {{{"success", {{"id", std::to_string(id)}}}}}; 544 nlohmann::json response = {{{"success", {{"id", std::to_string(id)}}}}};
545 EXPECT_CALL(*handler, POSTJson("/api/" + getBridgeUsername() + "/groups", request, getBridgeIp(), getBridgePort())) 545 EXPECT_CALL(*handler, POSTJson("/api/" + getBridgeUsername() + "/groups", request, getBridgeIp(), getBridgePort()))
546 .WillOnce(Return(response)); 546 .WillOnce(Return(response));
547 - EXPECT_EQ(id, test_bridge.createGroup(create)); 547 + EXPECT_EQ(id, test_bridge.groups().create(create));
548 548
549 response = {}; 549 response = {};
550 EXPECT_CALL(*handler, POSTJson("/api/" + getBridgeUsername() + "/groups", request, getBridgeIp(), getBridgePort())) 550 EXPECT_CALL(*handler, POSTJson("/api/" + getBridgeUsername() + "/groups", request, getBridgeIp(), getBridgePort()))
551 .WillOnce(Return(response)); 551 .WillOnce(Return(response));
552 - EXPECT_EQ(0, test_bridge.createGroup(create)); 552 + EXPECT_EQ(0, test_bridge.groups().create(create));
553 } 553 }
test/test_HueLight.cpp
@@ -93,12 +93,12 @@ protected: @@ -93,12 +93,12 @@ protected:
93 93
94 TEST_F(HueLightTest, Constructor) 94 TEST_F(HueLightTest, Constructor)
95 { 95 {
96 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
97 - HueLight test_light_1 = test_bridge.getLight(1);  
98 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
99 - HueLight test_light_2 = test_bridge.getLight(2);  
100 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
101 - HueLight test_light_3 = test_bridge.getLight(3); 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);
102 } 102 }
103 103
104 TEST_F(HueLightTest, On) 104 TEST_F(HueLightTest, On)
@@ -120,9 +120,9 @@ TEST_F(HueLightTest, On) @@ -120,9 +120,9 @@ TEST_F(HueLightTest, On)
120 .Times(1) 120 .Times(1)
121 .WillOnce(Return(prep_ret)); 121 .WillOnce(Return(prep_ret));
122 122
123 - HueLight test_light_1 = test_bridge.getLight(1);  
124 - HueLight test_light_2 = test_bridge.getLight(2);  
125 - HueLight test_light_3 = test_bridge.getLight(3); 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);
126 126
127 EXPECT_EQ(true, test_light_1.On(33)); 127 EXPECT_EQ(true, test_light_1.On(33));
128 EXPECT_EQ(false, test_light_2.On()); 128 EXPECT_EQ(false, test_light_2.On());
@@ -144,9 +144,9 @@ TEST_F(HueLightTest, Off) @@ -144,9 +144,9 @@ TEST_F(HueLightTest, Off)
144 .Times(1) 144 .Times(1)
145 .WillOnce(Return(prep_ret)); 145 .WillOnce(Return(prep_ret));
146 146
147 - HueLight test_light_1 = test_bridge.getLight(1);  
148 - HueLight test_light_2 = test_bridge.getLight(2);  
149 - HueLight test_light_3 = test_bridge.getLight(3); 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);
150 150
151 EXPECT_EQ(true, test_light_1.Off(33)); 151 EXPECT_EQ(true, test_light_1.Off(33));
152 EXPECT_EQ(true, test_light_2.Off()); 152 EXPECT_EQ(true, test_light_2.Off());
@@ -155,12 +155,12 @@ TEST_F(HueLightTest, Off) @@ -155,12 +155,12 @@ TEST_F(HueLightTest, Off)
155 155
156 TEST_F(HueLightTest, isOn) 156 TEST_F(HueLightTest, isOn)
157 { 157 {
158 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
159 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
160 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
161 - HueLight test_light_1 = test_bridge.getLight(1);  
162 - HueLight test_light_2 = test_bridge.getLight(2);  
163 - HueLight test_light_3 = test_bridge.getLight(3); 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);
164 164
165 EXPECT_EQ(true, ctest_light_1.isOn()); 165 EXPECT_EQ(true, ctest_light_1.isOn());
166 EXPECT_EQ(false, ctest_light_2.isOn()); 166 EXPECT_EQ(false, ctest_light_2.isOn());
@@ -172,12 +172,12 @@ TEST_F(HueLightTest, isOn) @@ -172,12 +172,12 @@ TEST_F(HueLightTest, isOn)
172 172
173 TEST_F(HueLightTest, getId) 173 TEST_F(HueLightTest, getId)
174 { 174 {
175 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
176 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
177 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
178 - HueLight test_light_1 = test_bridge.getLight(1);  
179 - HueLight test_light_2 = test_bridge.getLight(2);  
180 - HueLight test_light_3 = test_bridge.getLight(3); 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);
181 181
182 EXPECT_EQ(1, ctest_light_1.getId()); 182 EXPECT_EQ(1, ctest_light_1.getId());
183 EXPECT_EQ(2, ctest_light_2.getId()); 183 EXPECT_EQ(2, ctest_light_2.getId());
@@ -189,12 +189,12 @@ TEST_F(HueLightTest, getId) @@ -189,12 +189,12 @@ TEST_F(HueLightTest, getId)
189 189
190 TEST_F(HueLightTest, getType) 190 TEST_F(HueLightTest, getType)
191 { 191 {
192 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
193 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
194 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
195 - HueLight test_light_1 = test_bridge.getLight(1);  
196 - HueLight test_light_2 = test_bridge.getLight(2);  
197 - HueLight test_light_3 = test_bridge.getLight(3); 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);
198 198
199 EXPECT_EQ("Dimmable light", ctest_light_1.getType()); 199 EXPECT_EQ("Dimmable light", ctest_light_1.getType());
200 EXPECT_EQ("Color light", ctest_light_2.getType()); 200 EXPECT_EQ("Color light", ctest_light_2.getType());
@@ -206,12 +206,12 @@ TEST_F(HueLightTest, getType) @@ -206,12 +206,12 @@ TEST_F(HueLightTest, getType)
206 206
207 TEST_F(HueLightTest, getName) 207 TEST_F(HueLightTest, getName)
208 { 208 {
209 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
210 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
211 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
212 - HueLight test_light_1 = test_bridge.getLight(1);  
213 - HueLight test_light_2 = test_bridge.getLight(2);  
214 - HueLight test_light_3 = test_bridge.getLight(3); 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);
215 215
216 EXPECT_EQ("Hue lamp 1", ctest_light_1.getName()); 216 EXPECT_EQ("Hue lamp 1", ctest_light_1.getName());
217 EXPECT_EQ("Hue lamp 2", ctest_light_2.getName()); 217 EXPECT_EQ("Hue lamp 2", ctest_light_2.getName());
@@ -223,12 +223,12 @@ TEST_F(HueLightTest, getName) @@ -223,12 +223,12 @@ TEST_F(HueLightTest, getName)
223 223
224 TEST_F(HueLightTest, getModelId) 224 TEST_F(HueLightTest, getModelId)
225 { 225 {
226 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
227 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
228 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
229 - HueLight test_light_1 = test_bridge.getLight(1);  
230 - HueLight test_light_2 = test_bridge.getLight(2);  
231 - HueLight test_light_3 = test_bridge.getLight(3); 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);
232 232
233 EXPECT_EQ("LWB004", ctest_light_1.getModelId()); 233 EXPECT_EQ("LWB004", ctest_light_1.getModelId());
234 EXPECT_EQ("LST001", ctest_light_2.getModelId()); 234 EXPECT_EQ("LST001", ctest_light_2.getModelId());
@@ -240,12 +240,12 @@ TEST_F(HueLightTest, getModelId) @@ -240,12 +240,12 @@ TEST_F(HueLightTest, getModelId)
240 240
241 TEST_F(HueLightTest, getUId) 241 TEST_F(HueLightTest, getUId)
242 { 242 {
243 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
244 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
245 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
246 - HueLight test_light_1 = test_bridge.getLight(1);  
247 - HueLight test_light_2 = test_bridge.getLight(2);  
248 - HueLight test_light_3 = test_bridge.getLight(3); 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);
249 249
250 EXPECT_EQ("00:00:00:00:00:00:00:00-00", ctest_light_1.getUId()); 250 EXPECT_EQ("00:00:00:00:00:00:00:00-00", ctest_light_1.getUId());
251 EXPECT_EQ("11:11:11:11:11:11:11:11-11", ctest_light_2.getUId()); 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,12 +257,12 @@ TEST_F(HueLightTest, getUId)
257 257
258 TEST_F(HueLightTest, getManufacturername) 258 TEST_F(HueLightTest, getManufacturername)
259 { 259 {
260 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
261 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
262 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
263 - HueLight test_light_1 = test_bridge.getLight(1);  
264 - HueLight test_light_2 = test_bridge.getLight(2);  
265 - HueLight test_light_3 = test_bridge.getLight(3); 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);
266 266
267 EXPECT_EQ("Philips", ctest_light_1.getManufacturername()); 267 EXPECT_EQ("Philips", ctest_light_1.getManufacturername());
268 EXPECT_EQ("", ctest_light_2.getManufacturername()); 268 EXPECT_EQ("", ctest_light_2.getManufacturername());
@@ -274,12 +274,12 @@ TEST_F(HueLightTest, getManufacturername) @@ -274,12 +274,12 @@ TEST_F(HueLightTest, getManufacturername)
274 274
275 TEST_F(HueLightTest, getProductname) 275 TEST_F(HueLightTest, getProductname)
276 { 276 {
277 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
278 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
279 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
280 - HueLight test_light_1 = test_bridge.getLight(1);  
281 - HueLight test_light_2 = test_bridge.getLight(2);  
282 - HueLight test_light_3 = test_bridge.getLight(3); 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);
283 283
284 EXPECT_EQ("Hue bloom", ctest_light_1.getProductname()); 284 EXPECT_EQ("Hue bloom", ctest_light_1.getProductname());
285 EXPECT_EQ("", ctest_light_2.getProductname()); 285 EXPECT_EQ("", ctest_light_2.getProductname());
@@ -291,12 +291,12 @@ TEST_F(HueLightTest, getProductname) @@ -291,12 +291,12 @@ TEST_F(HueLightTest, getProductname)
291 291
292 TEST_F(HueLightTest, getLuminaireUId) 292 TEST_F(HueLightTest, getLuminaireUId)
293 { 293 {
294 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
295 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
296 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
297 - HueLight test_light_1 = test_bridge.getLight(1);  
298 - HueLight test_light_2 = test_bridge.getLight(2);  
299 - HueLight test_light_3 = test_bridge.getLight(3); 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);
300 300
301 EXPECT_EQ("0000000", ctest_light_1.getLuminaireUId()); 301 EXPECT_EQ("0000000", ctest_light_1.getLuminaireUId());
302 EXPECT_EQ("", ctest_light_2.getLuminaireUId()); 302 EXPECT_EQ("", ctest_light_2.getLuminaireUId());
@@ -308,12 +308,12 @@ TEST_F(HueLightTest, getLuminaireUId) @@ -308,12 +308,12 @@ TEST_F(HueLightTest, getLuminaireUId)
308 308
309 TEST_F(HueLightTest, getSwVersion) 309 TEST_F(HueLightTest, getSwVersion)
310 { 310 {
311 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
312 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
313 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
314 - HueLight test_light_1 = test_bridge.getLight(1);  
315 - HueLight test_light_2 = test_bridge.getLight(2);  
316 - HueLight test_light_3 = test_bridge.getLight(3); 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);
317 317
318 EXPECT_EQ("5.50.1.19085", ctest_light_1.getSwVersion()); 318 EXPECT_EQ("5.50.1.19085", ctest_light_1.getSwVersion());
319 EXPECT_EQ("5.50.1.19085", ctest_light_2.getSwVersion()); 319 EXPECT_EQ("5.50.1.19085", ctest_light_2.getSwVersion());
@@ -348,9 +348,9 @@ TEST_F(HueLightTest, setName) @@ -348,9 +348,9 @@ TEST_F(HueLightTest, setName)
348 .Times(1) 348 .Times(1)
349 .WillOnce(Return(prep_ret)); 349 .WillOnce(Return(prep_ret));
350 350
351 - HueLight test_light_1 = test_bridge.getLight(1);  
352 - HueLight test_light_2 = test_bridge.getLight(2);  
353 - HueLight test_light_3 = test_bridge.getLight(3); 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);
354 354
355 EXPECT_EQ(true, test_light_1.setName(expected_request["name"].get<std::string>())); 355 EXPECT_EQ(true, test_light_1.setName(expected_request["name"].get<std::string>()));
356 EXPECT_EQ(false, test_light_2.setName(expected_request["name"].get<std::string>())); 356 EXPECT_EQ(false, test_light_2.setName(expected_request["name"].get<std::string>()));
@@ -359,12 +359,12 @@ TEST_F(HueLightTest, setName) @@ -359,12 +359,12 @@ TEST_F(HueLightTest, setName)
359 359
360 TEST_F(HueLightTest, getColorType) 360 TEST_F(HueLightTest, getColorType)
361 { 361 {
362 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
363 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
364 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
365 - HueLight test_light_1 = test_bridge.getLight(1);  
366 - HueLight test_light_2 = test_bridge.getLight(2);  
367 - HueLight test_light_3 = test_bridge.getLight(3); 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);
368 368
369 EXPECT_EQ(ColorType::NONE, ctest_light_1.getColorType()); 369 EXPECT_EQ(ColorType::NONE, ctest_light_1.getColorType());
370 EXPECT_EQ(ColorType::GAMUT_A, ctest_light_2.getColorType()); 370 EXPECT_EQ(ColorType::GAMUT_A, ctest_light_2.getColorType());
@@ -376,12 +376,12 @@ TEST_F(HueLightTest, getColorType) @@ -376,12 +376,12 @@ TEST_F(HueLightTest, getColorType)
376 376
377 TEST_F(HueLightTest, KelvinToMired) 377 TEST_F(HueLightTest, KelvinToMired)
378 { 378 {
379 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
380 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
381 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
382 - HueLight test_light_1 = test_bridge.getLight(1);  
383 - HueLight test_light_2 = test_bridge.getLight(2);  
384 - HueLight test_light_3 = test_bridge.getLight(3); 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);
385 385
386 EXPECT_EQ(10000, ctest_light_1.KelvinToMired(100)); 386 EXPECT_EQ(10000, ctest_light_1.KelvinToMired(100));
387 EXPECT_EQ(500, ctest_light_2.KelvinToMired(2000)); 387 EXPECT_EQ(500, ctest_light_2.KelvinToMired(2000));
@@ -393,12 +393,12 @@ TEST_F(HueLightTest, KelvinToMired) @@ -393,12 +393,12 @@ TEST_F(HueLightTest, KelvinToMired)
393 393
394 TEST_F(HueLightTest, MiredToKelvin) 394 TEST_F(HueLightTest, MiredToKelvin)
395 { 395 {
396 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
397 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
398 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
399 - HueLight test_light_1 = test_bridge.getLight(1);  
400 - HueLight test_light_2 = test_bridge.getLight(2);  
401 - HueLight test_light_3 = test_bridge.getLight(3); 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);
402 402
403 EXPECT_EQ(100, ctest_light_1.MiredToKelvin(10000)); 403 EXPECT_EQ(100, ctest_light_1.MiredToKelvin(10000));
404 EXPECT_EQ(2000, ctest_light_2.MiredToKelvin(500)); 404 EXPECT_EQ(2000, ctest_light_2.MiredToKelvin(500));
@@ -411,12 +411,12 @@ TEST_F(HueLightTest, MiredToKelvin) @@ -411,12 +411,12 @@ TEST_F(HueLightTest, MiredToKelvin)
411 411
412 TEST_F(HueLightTest, hasBrightnessControl) 412 TEST_F(HueLightTest, hasBrightnessControl)
413 { 413 {
414 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
415 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
416 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
417 - HueLight test_light_1 = test_bridge.getLight(1);  
418 - HueLight test_light_2 = test_bridge.getLight(2);  
419 - HueLight test_light_3 = test_bridge.getLight(3); 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);
420 420
421 EXPECT_EQ(true, ctest_light_1.hasBrightnessControl()); 421 EXPECT_EQ(true, ctest_light_1.hasBrightnessControl());
422 EXPECT_EQ(true, ctest_light_2.hasBrightnessControl()); 422 EXPECT_EQ(true, ctest_light_2.hasBrightnessControl());
@@ -428,12 +428,12 @@ TEST_F(HueLightTest, hasBrightnessControl) @@ -428,12 +428,12 @@ TEST_F(HueLightTest, hasBrightnessControl)
428 428
429 TEST_F(HueLightTest, hasTemperatureControl) 429 TEST_F(HueLightTest, hasTemperatureControl)
430 { 430 {
431 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
432 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
433 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
434 - HueLight test_light_1 = test_bridge.getLight(1);  
435 - HueLight test_light_2 = test_bridge.getLight(2);  
436 - HueLight test_light_3 = test_bridge.getLight(3); 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);
437 437
438 EXPECT_EQ(false, ctest_light_1.hasTemperatureControl()); 438 EXPECT_EQ(false, ctest_light_1.hasTemperatureControl());
439 EXPECT_EQ(false, ctest_light_2.hasTemperatureControl()); 439 EXPECT_EQ(false, ctest_light_2.hasTemperatureControl());
@@ -445,12 +445,12 @@ TEST_F(HueLightTest, hasTemperatureControl) @@ -445,12 +445,12 @@ TEST_F(HueLightTest, hasTemperatureControl)
445 445
446 TEST_F(HueLightTest, hasColorControl) 446 TEST_F(HueLightTest, hasColorControl)
447 { 447 {
448 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
449 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
450 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
451 - HueLight test_light_1 = test_bridge.getLight(1);  
452 - HueLight test_light_2 = test_bridge.getLight(2);  
453 - HueLight test_light_3 = test_bridge.getLight(3); 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);
454 454
455 EXPECT_EQ(false, ctest_light_1.hasColorControl()); 455 EXPECT_EQ(false, ctest_light_1.hasColorControl());
456 EXPECT_EQ(true, ctest_light_2.hasColorControl()); 456 EXPECT_EQ(true, ctest_light_2.hasColorControl());
@@ -481,9 +481,9 @@ TEST_F(HueLightTest, setBrightness) @@ -481,9 +481,9 @@ TEST_F(HueLightTest, setBrightness)
481 .Times(1) 481 .Times(1)
482 .WillOnce(Return(prep_ret)); 482 .WillOnce(Return(prep_ret));
483 483
484 - HueLight test_light_1 = test_bridge.getLight(1);  
485 - HueLight test_light_2 = test_bridge.getLight(2);  
486 - HueLight test_light_3 = test_bridge.getLight(3); 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);
487 487
488 EXPECT_EQ(false, test_light_1.setBrightness(200)); 488 EXPECT_EQ(false, test_light_1.setBrightness(200));
489 EXPECT_EQ(true, test_light_2.setBrightness(0, 2)); 489 EXPECT_EQ(true, test_light_2.setBrightness(0, 2));
@@ -492,12 +492,12 @@ TEST_F(HueLightTest, setBrightness) @@ -492,12 +492,12 @@ TEST_F(HueLightTest, setBrightness)
492 492
493 TEST_F(HueLightTest, getBrightness) 493 TEST_F(HueLightTest, getBrightness)
494 { 494 {
495 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
496 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
497 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
498 - HueLight test_light_1 = test_bridge.getLight(1);  
499 - HueLight test_light_2 = test_bridge.getLight(2);  
500 - HueLight test_light_3 = test_bridge.getLight(3); 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);
501 501
502 EXPECT_EQ(254, ctest_light_1.getBrightness()); 502 EXPECT_EQ(254, ctest_light_1.getBrightness());
503 EXPECT_EQ(0, ctest_light_2.getBrightness()); 503 EXPECT_EQ(0, ctest_light_2.getBrightness());
@@ -525,9 +525,9 @@ TEST_F(HueLightTest, setColorTemperature) @@ -525,9 +525,9 @@ TEST_F(HueLightTest, setColorTemperature)
525 .Times(1) 525 .Times(1)
526 .WillOnce(Return(prep_ret)); 526 .WillOnce(Return(prep_ret));
527 527
528 - HueLight test_light_1 = test_bridge.getLight(1);  
529 - HueLight test_light_2 = test_bridge.getLight(2);  
530 - HueLight test_light_3 = test_bridge.getLight(3); 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);
531 531
532 EXPECT_EQ(false, test_light_1.setColorTemperature(153)); 532 EXPECT_EQ(false, test_light_1.setColorTemperature(153));
533 EXPECT_EQ(false, test_light_2.setColorTemperature(400, 2)); 533 EXPECT_EQ(false, test_light_2.setColorTemperature(400, 2));
@@ -536,12 +536,12 @@ TEST_F(HueLightTest, setColorTemperature) @@ -536,12 +536,12 @@ TEST_F(HueLightTest, setColorTemperature)
536 536
537 TEST_F(HueLightTest, getColorTemperature) 537 TEST_F(HueLightTest, getColorTemperature)
538 { 538 {
539 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
540 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
541 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
542 - HueLight test_light_1 = test_bridge.getLight(1);  
543 - HueLight test_light_2 = test_bridge.getLight(2);  
544 - HueLight test_light_3 = test_bridge.getLight(3); 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);
545 545
546 EXPECT_EQ(0, ctest_light_1.getColorTemperature()); 546 EXPECT_EQ(0, ctest_light_1.getColorTemperature());
547 EXPECT_EQ(0, ctest_light_2.getColorTemperature()); 547 EXPECT_EQ(0, ctest_light_2.getColorTemperature());
@@ -572,9 +572,9 @@ TEST_F(HueLightTest, setColorHue) @@ -572,9 +572,9 @@ TEST_F(HueLightTest, setColorHue)
572 .Times(1) 572 .Times(1)
573 .WillOnce(Return(prep_ret)); 573 .WillOnce(Return(prep_ret));
574 574
575 - HueLight test_light_1 = test_bridge.getLight(1);  
576 - HueLight test_light_2 = test_bridge.getLight(2);  
577 - HueLight test_light_3 = test_bridge.getLight(3); 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);
578 578
579 EXPECT_EQ(false, test_light_1.setColorHue(153)); 579 EXPECT_EQ(false, test_light_1.setColorHue(153));
580 EXPECT_EQ(false, test_light_2.setColorHue(30000, 2)); 580 EXPECT_EQ(false, test_light_2.setColorHue(30000, 2));
@@ -602,9 +602,9 @@ TEST_F(HueLightTest, setColorSaturation) @@ -602,9 +602,9 @@ TEST_F(HueLightTest, setColorSaturation)
602 .Times(1) 602 .Times(1)
603 .WillOnce(Return(prep_ret)); 603 .WillOnce(Return(prep_ret));
604 604
605 - HueLight test_light_1 = test_bridge.getLight(1);  
606 - HueLight test_light_2 = test_bridge.getLight(2);  
607 - HueLight test_light_3 = test_bridge.getLight(3); 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);
608 608
609 EXPECT_EQ(false, test_light_1.setColorSaturation(0)); 609 EXPECT_EQ(false, test_light_1.setColorSaturation(0));
610 EXPECT_EQ(false, test_light_2.setColorSaturation(140, 2)); 610 EXPECT_EQ(false, test_light_2.setColorSaturation(140, 2));
@@ -635,9 +635,9 @@ TEST_F(HueLightTest, setColorHueSaturation) @@ -635,9 +635,9 @@ TEST_F(HueLightTest, setColorHueSaturation)
635 .Times(1) 635 .Times(1)
636 .WillOnce(Return(prep_ret)); 636 .WillOnce(Return(prep_ret));
637 637
638 - HueLight test_light_1 = test_bridge.getLight(1);  
639 - HueLight test_light_2 = test_bridge.getLight(2);  
640 - HueLight test_light_3 = test_bridge.getLight(3); 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);
641 641
642 EXPECT_EQ(false, test_light_1.setColorHueSaturation({153, 0})); 642 EXPECT_EQ(false, test_light_1.setColorHueSaturation({153, 0}));
643 EXPECT_EQ(false, test_light_2.setColorHueSaturation({30000, 140}, 2)); 643 EXPECT_EQ(false, test_light_2.setColorHueSaturation({30000, 140}, 2));
@@ -646,12 +646,12 @@ TEST_F(HueLightTest, setColorHueSaturation) @@ -646,12 +646,12 @@ TEST_F(HueLightTest, setColorHueSaturation)
646 646
647 TEST_F(HueLightTest, getColorHueSaturation) 647 TEST_F(HueLightTest, getColorHueSaturation)
648 { 648 {
649 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
650 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
651 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
652 - HueLight test_light_1 = test_bridge.getLight(1);  
653 - HueLight test_light_2 = test_bridge.getLight(2);  
654 - HueLight test_light_3 = test_bridge.getLight(3); 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);
655 655
656 EXPECT_EQ((HueSaturation {0, 0}), ctest_light_1.getColorHueSaturation()); 656 EXPECT_EQ((HueSaturation {0, 0}), ctest_light_1.getColorHueSaturation());
657 EXPECT_EQ((HueSaturation {12345, 123}), ctest_light_2.getColorHueSaturation()); 657 EXPECT_EQ((HueSaturation {12345, 123}), ctest_light_2.getColorHueSaturation());
@@ -683,9 +683,9 @@ TEST_F(HueLightTest, setColorXY) @@ -683,9 +683,9 @@ TEST_F(HueLightTest, setColorXY)
683 .Times(1) 683 .Times(1)
684 .WillOnce(Return(prep_ret)); 684 .WillOnce(Return(prep_ret));
685 685
686 - HueLight test_light_1 = test_bridge.getLight(1);  
687 - HueLight test_light_2 = test_bridge.getLight(2);  
688 - HueLight test_light_3 = test_bridge.getLight(3); 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);
689 689
690 EXPECT_EQ(false, test_light_1.setColorXY({{0.01f, 0.f}, 1.f})); 690 EXPECT_EQ(false, test_light_1.setColorXY({{0.01f, 0.f}, 1.f}));
691 EXPECT_EQ(false, test_light_2.setColorXY({{0.123f, 1.f}, 1.f}, 2)); 691 EXPECT_EQ(false, test_light_2.setColorXY({{0.123f, 1.f}, 1.f}, 2));
@@ -694,12 +694,12 @@ TEST_F(HueLightTest, setColorXY) @@ -694,12 +694,12 @@ TEST_F(HueLightTest, setColorXY)
694 694
695 TEST_F(HueLightTest, getColorXY) 695 TEST_F(HueLightTest, getColorXY)
696 { 696 {
697 - const HueLight ctest_light_1 = test_bridge.getLight(1);  
698 - const HueLight ctest_light_2 = test_bridge.getLight(2);  
699 - const HueLight ctest_light_3 = test_bridge.getLight(3);  
700 - HueLight test_light_1 = test_bridge.getLight(1);  
701 - HueLight test_light_2 = test_bridge.getLight(2);  
702 - HueLight test_light_3 = test_bridge.getLight(3); 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);
703 EXPECT_EQ((XYBrightness {{0.f, 0.f}, 0.f}), ctest_light_1.getColorXY()); 703 EXPECT_EQ((XYBrightness {{0.f, 0.f}, 0.f}), ctest_light_1.getColorXY());
704 EXPECT_EQ((XYBrightness {{0.102f, 0.102f}, 0.f}), ctest_light_2.getColorXY()); 704 EXPECT_EQ((XYBrightness {{0.102f, 0.102f}, 0.f}), ctest_light_2.getColorXY());
705 EXPECT_EQ((XYBrightness {{0.102f, 0.102f}, 1.f}), ctest_light_3.getColorXY()); 705 EXPECT_EQ((XYBrightness {{0.102f, 0.102f}, 1.f}), ctest_light_3.getColorXY());
@@ -730,9 +730,9 @@ TEST_F(HueLightTest, setColorRGB) @@ -730,9 +730,9 @@ TEST_F(HueLightTest, setColorRGB)
730 .Times(1) 730 .Times(1)
731 .WillOnce(Return(prep_ret)); 731 .WillOnce(Return(prep_ret));
732 732
733 - HueLight test_light_1 = test_bridge.getLight(1);  
734 - HueLight test_light_2 = test_bridge.getLight(2);  
735 - HueLight test_light_3 = test_bridge.getLight(3); 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);
736 736
737 EXPECT_EQ(false, test_light_1.setColorRGB({0, 0, 0}, 0)); 737 EXPECT_EQ(false, test_light_1.setColorRGB({0, 0, 0}, 0));
738 EXPECT_EQ(false, test_light_2.setColorRGB({32, 64, 128}, 2)); 738 EXPECT_EQ(false, test_light_2.setColorRGB({32, 64, 128}, 2));
@@ -757,9 +757,9 @@ TEST_F(HueLightTest, alert) @@ -757,9 +757,9 @@ TEST_F(HueLightTest, alert)
757 .Times(1) 757 .Times(1)
758 .WillOnce(Return(prep_ret)); 758 .WillOnce(Return(prep_ret));
759 759
760 - HueLight test_light_1 = test_bridge.getLight(1);  
761 - HueLight test_light_2 = test_bridge.getLight(2);  
762 - HueLight test_light_3 = test_bridge.getLight(3); 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);
763 763
764 EXPECT_EQ(false, test_light_1.alert()); 764 EXPECT_EQ(false, test_light_1.alert());
765 EXPECT_EQ(false, test_light_2.alert()); 765 EXPECT_EQ(false, test_light_2.alert());
@@ -773,9 +773,9 @@ TEST_F(HueLightTest, alertTemperature) @@ -773,9 +773,9 @@ TEST_F(HueLightTest, alertTemperature)
773 .Times(1) 773 .Times(1)
774 .WillOnce(Return(nlohmann::json::array())); 774 .WillOnce(Return(nlohmann::json::array()));
775 775
776 - HueLight test_light_1 = test_bridge.getLight(1);  
777 - HueLight test_light_2 = test_bridge.getLight(2);  
778 - HueLight test_light_3 = test_bridge.getLight(3); 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);
779 779
780 EXPECT_EQ(false, test_light_1.alertTemperature(400)); 780 EXPECT_EQ(false, test_light_1.alertTemperature(400));
781 EXPECT_EQ(false, test_light_2.alertTemperature(100)); 781 EXPECT_EQ(false, test_light_2.alertTemperature(100));
@@ -789,9 +789,9 @@ TEST_F(HueLightTest, alertHueSaturation) @@ -789,9 +789,9 @@ TEST_F(HueLightTest, alertHueSaturation)
789 .Times(1) 789 .Times(1)
790 .WillOnce(Return(nlohmann::json::array())); 790 .WillOnce(Return(nlohmann::json::array()));
791 791
792 - HueLight test_light_1 = test_bridge.getLight(1);  
793 - HueLight test_light_2 = test_bridge.getLight(2);  
794 - HueLight test_light_3 = test_bridge.getLight(3); 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);
795 795
796 EXPECT_EQ(false, test_light_1.alertHueSaturation({0, 255})); 796 EXPECT_EQ(false, test_light_1.alertHueSaturation({0, 255}));
797 EXPECT_EQ(false, test_light_2.alertHueSaturation({3000, 100})); 797 EXPECT_EQ(false, test_light_2.alertHueSaturation({3000, 100}));
@@ -805,9 +805,9 @@ TEST_F(HueLightTest, alertXY) @@ -805,9 +805,9 @@ TEST_F(HueLightTest, alertXY)
805 .Times(1) 805 .Times(1)
806 .WillOnce(Return(nlohmann::json::array())); 806 .WillOnce(Return(nlohmann::json::array()));
807 807
808 - HueLight test_light_1 = test_bridge.getLight(1);  
809 - HueLight test_light_2 = test_bridge.getLight(2);  
810 - HueLight test_light_3 = test_bridge.getLight(3); 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);
811 811
812 EXPECT_EQ(false, test_light_1.alertXY({{0.1f, 0.1f}, 1.f})); 812 EXPECT_EQ(false, test_light_1.alertXY({{0.1f, 0.1f}, 1.f}));
813 EXPECT_EQ(false, test_light_2.alertXY({{0.2434f, 0.2344f}, 1.f})); 813 EXPECT_EQ(false, test_light_2.alertXY({{0.2434f, 0.2344f}, 1.f}));
@@ -824,9 +824,9 @@ TEST_F(HueLightTest, setColorLoop) @@ -824,9 +824,9 @@ TEST_F(HueLightTest, setColorLoop)
824 .Times(1) 824 .Times(1)
825 .WillOnce(Return(nlohmann::json::array())); 825 .WillOnce(Return(nlohmann::json::array()));
826 826
827 - HueLight test_light_1 = test_bridge.getLight(1);  
828 - HueLight test_light_2 = test_bridge.getLight(2);  
829 - HueLight test_light_3 = test_bridge.getLight(3); 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);
830 830
831 EXPECT_EQ(false, test_light_1.setColorLoop(true)); 831 EXPECT_EQ(false, test_light_1.setColorLoop(true));
832 EXPECT_EQ(false, test_light_2.setColorLoop(false)); 832 EXPECT_EQ(false, test_light_2.setColorLoop(false));