diff --git a/include/hueplusplus/APIConfig.h b/include/hueplusplus/APIConfig.h index 3a592e8..3b1b4fa 100644 --- a/include/hueplusplus/APIConfig.h +++ b/include/hueplusplus/APIConfig.h @@ -1,5 +1,5 @@ /** - \file HueConfig.h + \file APIConfig.h Copyright Notice\n Copyright (C) 2017 Jan Rogall - developer\n Copyright (C) 2017 Moritz Wirger - developer\n diff --git a/include/hueplusplus/Hue.h b/include/hueplusplus/Hue.h index b644d60..e9534a6 100644 --- a/include/hueplusplus/Hue.h +++ b/include/hueplusplus/Hue.h @@ -134,6 +134,12 @@ class Hue friend class HueFinder; public: + using LightList = ResourceList; + using GroupList = GroupResourceList; + using ScheduleList = CreateableResourceList; + using SceneList = CreateableResourceList; + +public: //! \brief Constructor of Hue class //! //! \param ip IP address in dotted decimal notation like "192.168.2.1" @@ -195,191 +201,18 @@ public: BridgeConfig& config(); const BridgeConfig& config() const; - ///@} - //! \name Lights - ///@{ - - //! \brief Function that returns a \ref HueLight of specified id - //! - //! \param id Integer that specifies the ID of a Hue light - //! \return \ref HueLight that can be controlled - //! \throws std::system_error when system or socket operations fail - //! \throws HueException when id does not exist or type is unknown - //! \throws HueAPIResponseException when response contains an error - //! \throws nlohmann::json::parse_error when response could not be parsed - HueLight& getLight(int id); - - //! \brief Function to remove a light from the bridge - //! - //! \attention Any use of the light after it was successfully removed results in undefined behavior - //! \param id Id of the light to remove - //! \return true on success - //! \throws std::system_error when system or socket operations fail - //! \throws HueException when response contains no body - //! \throws HueAPIResponseException when response contains an error - //! \throws nlohmann::json::parse_error when response could not be parsed - bool removeLight(int id); - - //! \brief Function that returns all lights that are associated with this - //! bridge - //! - //! \return A vector containing references to every HueLight - //! \throws std::system_error when system or socket operations fail - //! \throws HueException when response contains no body - //! \throws HueAPIResponseException when response contains an error - //! \throws nlohmann::json::parse_error when response could not be parsed - std::vector> getAllLights(); - - //! \brief Function that tells whether a given light id represents an existing light - //! \param id Id of a light to check for existance - //! \return Bool that is true when a light with the given id exists and false when not - //! \throws std::system_error when system or socket operations fail - //! \throws HueException when response contains no body - //! \throws HueAPIResponseException when response contains an error - //! \throws nlohmann::json::parse_error when response could not be parsed - bool lightExists(int id); - - //! \brief Const function that tells whether a given light id represents an - //! existing light - //! - //! \note This will not update the local state of the bridge - //! \param id Id of a light to check for existance - //! \return Bool that is true when a light with the given id exists and false - //! when not - bool lightExists(int id) const; - - ///@} - //! \name Groups - ///@{ - - //! \brief Get all groups that exist on this bridge. - //! \return A vector of references to every Group. - //! \throws std::system_error when system or socket operations fail - //! \throws HueException when response contains no body - //! \throws HueAPIResponseException when response contains an error - //! \throws nlohmann::json::parse_error when response could not be parsed - std::vector> getAllGroups(); - - //! \brief Get group specified by id. - //! \param id ID of the group. - //! \returns Group that can be controlled. - //! \note Every bridge has a special group 0 which contains all lights - //! and is not visible to getAllGroups(). - //! \throws std::system_error when system or socket operations fail - //! \throws HueException when id does not exist - //! \throws HueAPIResponseException when response contains an error - //! \throws nlohmann::json::parse_error when response could not be parsed - Group& getGroup(int id); - - //! \brief Remove a group from the bridge. - //! \param id ID of the group. - //! \returns true on success. - //! \brief Remove a group from the bridge. - //! \param id ID of the group. - //! \returns true on success. - //! \throws std::system_error when system or socket operations fail - //! \throws HueException when response contains no body - //! \throws HueAPIResponseException when response contains an error - //! \throws nlohmann::json::parse_error when response could not be parsed - bool removeGroup(int id); - //! \brief Checks whether a group exists. - //! \param id ID of the group. - //! \returns true when the group exists. - //! \throws std::system_error when system or socket operations fail - //! \throws HueException when response contains no body - //! \throws HueAPIResponseException when response contains an error - //! \throws nlohmann::json::parse_error when response could not be parsed - bool groupExists(int id); - - //! \brief Checks whether a group exists. - //! \param id ID of the group. - //! \returns true when the group exists. - //! \note Does not refresh the cached state. - bool groupExists(int id) const; - - //! \brief Create a new group. - //! \param params CreateGroup parameters for the new group. - //! \returns The new group id or 0 if failed. - //! \throws std::system_error when system or socket operations fail - //! \throws HueException when response contains no body - //! \throws HueAPIResponseException when response contains an error - //! \throws nlohmann::json::parse_error when response could not be parsed - int createGroup(const CreateGroup& params); - - ///@} - //! \name Schedules - ///@{ - - //! \brief Get all schedules on this bridge. - //! \return A vector of references to every Schedule. - //! \throws std::system_error when system or socket operations fail - //! \throws HueException when response contains no body - //! \throws HueAPIResponseException when response contains an error - //! \throws nlohmann::json::parse_error when response could not be parsed - std::vector> getAllSchedules(); - - //! \brief Get schedule specified by id. - //! \param id ID of the schedule. - //! \returns Schedule that can be modified. - //! \throws std::system_error when system or socket operations fail - //! \throws HueException when id does not exist - //! \throws HueAPIResponseException when response contains an error - //! \throws nlohmann::json::parse_error when response could not be parsed - Schedule& getSchedule(int id); + LightList& lights(); + const LightList& lights() const; - //! \brief Checks whether a schedule exists. - //! \param id ID of the schedule. - //! \returns true when the schedule exists. - //! \note Does not refresh the cached state. - bool scheduleExists(int id) const; + GroupList& groups(); + const GroupList& groups() const; - //! \brief Create a new schedule. - //! \param params CreateSchedule parameters for the new schedule. - //! \returns The new schedule id or 0 if failed. - //! \throws std::system_error when system or socket operations fail - //! \throws HueException when response contains no body - //! \throws HueAPIResponseException when response contains an error - //! \throws nlohmann::json::parse_error when response could not be parsed - int createSchedule(const CreateSchedule& params); - - ///@} - ///! \name Scenes - ///@{ - - //! \brief Get all scenes on this bridge. - //! \return A vector of references to every Scene. - //! \throws std::system_error when system or socket operations fail - //! \throws HueException when response contains no body - //! \throws HueAPIResponseException when response contains an error - //! \throws nlohmann::json::parse_error when response could not be parsed - std::vector> getAllScenes(); - - //! \brief Get scene specified by id. - //! \param id ID of the scene. - //! \returns Schedule that can be modified. - //! \throws std::system_error when system or socket operations fail - //! \throws HueException when id does not exist - //! \throws HueAPIResponseException when response contains an error - //! \throws nlohmann::json::parse_error when response could not be parsed - Scene& getScene(const std::string& id); - - //! \brief Checks whether a scene exists. - //! \param id ID of the scene. - //! \returns true when the scene exists. - //! \note Does not refresh the cached state. - bool sceneExists(const std::string& id) const; - - //! \brief Create a new scene. - //! \param params CreateScene parameters for the new scene. - //! \returns The new scene id or 0 if failed. - //! \throws std::system_error when system or socket operations fail - //! \throws HueException when response contains no body - //! \throws HueAPIResponseException when response contains an error - //! \throws nlohmann::json::parse_error when response could not be parsed - std::string createScene(const CreateScene& params); + ScheduleList& schedules(); + const ScheduleList& schedules() const; - ///@} + SceneList& scenes(); + const SceneList& scenes() const; private: std::string ip; //!< IP-Address of the hue bridge in dotted decimal notation @@ -391,10 +224,10 @@ private: //!< bridge std::chrono::steady_clock::duration refreshDuration; std::shared_ptr stateCache; - MakeCopyable> lights; - MakeCopyable> groups; - MakeCopyable> schedules; - MakeCopyable> scenes; + MakeCopyable lightList; + MakeCopyable groupList; + MakeCopyable scheduleList; + MakeCopyable sceneList; MakeCopyable bridgeConfig; }; } // namespace hueplusplus diff --git a/src/Hue.cpp b/src/Hue.cpp index dcf4541..7eefb95 100644 --- a/src/Hue.cpp +++ b/src/Hue.cpp @@ -139,12 +139,12 @@ Hue::Hue(const std::string& ip, const int port, const std::string& username, refreshDuration(refreshDuration), stateCache(std::make_shared( "", HueCommandAPI(ip, port, username, http_handler), std::chrono::steady_clock::duration::max())), - lights(stateCache, "lights", refreshDuration, + lightList(stateCache, "lights", refreshDuration, [factory = HueLightFactory(stateCache->getCommandAPI(), refreshDuration)]( int id, const nlohmann::json& state) mutable { return factory.createLight(state, id); }), - groups(stateCache, "groups", refreshDuration), - schedules(stateCache, "schedules", refreshDuration), - scenes(stateCache, "scenes", refreshDuration), + groupList(stateCache, "groups", refreshDuration), + scheduleList(stateCache, "schedules", refreshDuration), + sceneList(stateCache, "scenes", refreshDuration), bridgeConfig(stateCache, refreshDuration) { } @@ -231,101 +231,56 @@ const BridgeConfig& Hue::config() const return bridgeConfig; } -HueLight& Hue::getLight(int id) +Hue::LightList& Hue::lights() { - return lights.get(id); + return lightList; } -bool Hue::removeLight(int id) +const Hue::LightList& Hue::lights() const { - return lights.remove(id); + return lightList; } -std::vector> Hue::getAllLights() +Hue::GroupList& Hue::groups() { - return lights.getAll(); + return groupList; } -std::vector> Hue::getAllGroups() +const Hue::GroupList& Hue::groups() const { - return groups.getAll(); + return groupList; } -Group& Hue::getGroup(int id) +Hue::ScheduleList& Hue::schedules() { - return groups.get(id); + return scheduleList; } -bool Hue::removeGroup(int id) +const Hue::ScheduleList& Hue::schedules() const { - return groups.remove(id); + return scheduleList; } -bool Hue::groupExists(int id) const +Hue::SceneList& Hue::scenes() { - return groups.exists(id); + return sceneList; } -int Hue::createGroup(const CreateGroup& params) +const Hue::SceneList& Hue::scenes() const { - return groups.create(params); -} - -bool Hue::lightExists(int id) const -{ - return lights.exists(id); -} - -std::vector> Hue::getAllSchedules() -{ - return schedules.getAll(); -} - -Schedule& Hue::getSchedule(int id) -{ - return schedules.get(id); -} - -bool Hue::scheduleExists(int id) const -{ - return schedules.exists(id); -} - -int Hue::createSchedule(const CreateSchedule& params) -{ - return schedules.create(params); -} - -std::vector> Hue::getAllScenes() -{ - return scenes.getAll(); -} - -Scene& Hue::getScene(const std::string& id) -{ - return scenes.get(id); -} - -bool Hue::sceneExists(const std::string& id) const -{ - return scenes.exists(id); -} - -std::string Hue::createScene(const CreateScene& params) -{ - return scenes.create(params); + return sceneList; } void Hue::setHttpHandler(std::shared_ptr handler) { http_handler = handler; stateCache = std::make_shared("", HueCommandAPI(ip, port, username, handler), refreshDuration); - lights = ResourceList(stateCache, "lights", refreshDuration, + lightList = ResourceList(stateCache, "lights", refreshDuration, [factory = HueLightFactory(stateCache->getCommandAPI(), refreshDuration)]( int id, const nlohmann::json& state) mutable { return factory.createLight(state, id); }); - groups = GroupResourceList(stateCache, "groups", refreshDuration); - schedules = CreateableResourceList(stateCache, "schedules", refreshDuration); - scenes = CreateableResourceList(stateCache, "scenes", refreshDuration); + groupList = GroupResourceList(stateCache, "groups", refreshDuration); + scheduleList = CreateableResourceList(stateCache, "schedules", refreshDuration); + sceneList = CreateableResourceList(stateCache, "scenes", refreshDuration); bridgeConfig = BridgeConfig(stateCache, refreshDuration); } } // namespace hueplusplus diff --git a/test/test_Hue.cpp b/test/test_Hue.cpp index 37d1725..ece39ab 100644 --- a/test/test_Hue.cpp +++ b/test/test_Hue.cpp @@ -221,7 +221,7 @@ TEST(Hue, requestUsername) .Times(1) .WillOnce(Return(hue_bridge_state)); - test_bridge.getAllLights(); + test_bridge.lights().getAll(); } } @@ -254,7 +254,7 @@ TEST(Hue, getLight) Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler); // Test exception - ASSERT_THROW(test_bridge.getLight(1), HueException); + ASSERT_THROW(test_bridge.lights().get(1), HueException); nlohmann::json hue_bridge_state {{"lights", {{"1", @@ -279,13 +279,13 @@ TEST(Hue, getLight) test_bridge = Hue(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler); // Test when correct data is sent - HueLight test_light_1 = test_bridge.getLight(1); + HueLight test_light_1 = test_bridge.lights().get(1); EXPECT_EQ(test_light_1.getName(), "Hue ambiance lamp 1"); EXPECT_EQ(test_light_1.getColorType(), ColorType::TEMPERATURE); // Test again to check whether light is returned directly -> interesting for // code coverage test - test_light_1 = test_bridge.getLight(1); + test_light_1 = test_bridge.lights().get(1); EXPECT_EQ(test_light_1.getName(), "Hue ambiance lamp 1"); EXPECT_EQ(test_light_1.getColorType(), ColorType::TEMPERATURE); } @@ -326,11 +326,11 @@ TEST(Hue, removeLight) .WillOnce(Return(nlohmann::json())); // Test when correct data is sent - HueLight test_light_1 = test_bridge.getLight(1); + HueLight test_light_1 = test_bridge.lights().get(1); - EXPECT_EQ(test_bridge.removeLight(1), true); + EXPECT_EQ(test_bridge.lights().remove(1), true); - EXPECT_EQ(test_bridge.removeLight(1), false); + EXPECT_EQ(test_bridge.lights().remove(1), false); } TEST(Hue, getAllLights) @@ -358,7 +358,7 @@ TEST(Hue, getAllLights) Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler); - std::vector> test_lights = test_bridge.getAllLights(); + std::vector> test_lights = test_bridge.lights().getAll(); ASSERT_EQ(1, test_lights.size()); EXPECT_EQ(test_lights[0].get().getName(), "Hue ambiance lamp 1"); EXPECT_EQ(test_lights[0].get().getColorType(), ColorType::TEMPERATURE); @@ -385,8 +385,8 @@ TEST(Hue, lightExists) test_bridge.refresh(); - EXPECT_TRUE(Const(test_bridge).lightExists(1)); - EXPECT_FALSE(Const(test_bridge).lightExists(2)); + EXPECT_TRUE(Const(test_bridge).lights().exists(1)); + EXPECT_FALSE(Const(test_bridge).lights().exists(2)); } TEST(Hue, getGroup) @@ -400,7 +400,7 @@ TEST(Hue, getGroup) Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler); // Test exception - ASSERT_THROW(test_bridge.getGroup(1), HueException); + ASSERT_THROW(test_bridge.groups().get(1), HueException); nlohmann::json hue_bridge_state {{"groups", {{"1", @@ -424,12 +424,12 @@ TEST(Hue, getGroup) test_bridge = Hue(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler); // Test when correct data is sent - Group test_group_1 = test_bridge.getGroup(1); + Group test_group_1 = test_bridge.groups().get(1); EXPECT_EQ(test_group_1.getName(), "Group 1"); EXPECT_EQ(test_group_1.getType(), "LightGroup"); // Test again to check whether group is returned directly - test_group_1 = test_bridge.getGroup(1); + test_group_1 = test_bridge.groups().get(1); EXPECT_EQ(test_group_1.getName(), "Group 1"); EXPECT_EQ(test_group_1.getType(), "LightGroup"); } @@ -469,11 +469,11 @@ TEST(Hue, removeGroup) .WillOnce(Return(nlohmann::json())); // Test when correct data is sent - Group test_group_1 = test_bridge.getGroup(1); + Group test_group_1 = test_bridge.groups().get(1); - EXPECT_EQ(test_bridge.removeGroup(1), true); + EXPECT_EQ(test_bridge.groups().remove(1), true); - EXPECT_EQ(test_bridge.removeGroup(1), false); + EXPECT_EQ(test_bridge.groups().remove(1), false); } TEST(Hue, groupExists) @@ -496,8 +496,8 @@ TEST(Hue, groupExists) test_bridge.refresh(); - EXPECT_EQ(true, Const(test_bridge).groupExists(1)); - EXPECT_EQ(false, Const(test_bridge).groupExists(2)); + EXPECT_EQ(true, Const(test_bridge).groups().exists(1)); + EXPECT_EQ(false, Const(test_bridge).groups().exists(2)); } TEST(Hue, getAllGroups) @@ -524,7 +524,7 @@ TEST(Hue, getAllGroups) Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler); - std::vector> test_groups = test_bridge.getAllGroups(); + std::vector> test_groups = test_bridge.groups().getAll(); ASSERT_EQ(1, test_groups.size()); EXPECT_EQ(test_groups[0].get().getName(), "Group 1"); EXPECT_EQ(test_groups[0].get().getType(), "LightGroup"); @@ -544,10 +544,10 @@ TEST(Hue, createGroup) nlohmann::json response = {{{"success", {{"id", std::to_string(id)}}}}}; EXPECT_CALL(*handler, POSTJson("/api/" + getBridgeUsername() + "/groups", request, getBridgeIp(), getBridgePort())) .WillOnce(Return(response)); - EXPECT_EQ(id, test_bridge.createGroup(create)); + EXPECT_EQ(id, test_bridge.groups().create(create)); response = {}; EXPECT_CALL(*handler, POSTJson("/api/" + getBridgeUsername() + "/groups", request, getBridgeIp(), getBridgePort())) .WillOnce(Return(response)); - EXPECT_EQ(0, test_bridge.createGroup(create)); + EXPECT_EQ(0, test_bridge.groups().create(create)); } diff --git a/test/test_HueLight.cpp b/test/test_HueLight.cpp index 8722eb1..3a61275 100644 --- a/test/test_HueLight.cpp +++ b/test/test_HueLight.cpp @@ -93,12 +93,12 @@ protected: TEST_F(HueLightTest, Constructor) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - HueLight test_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - HueLight test_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + HueLight test_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + HueLight test_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_3 = test_bridge.lights().get(3); } TEST_F(HueLightTest, On) @@ -120,9 +120,9 @@ TEST_F(HueLightTest, On) .Times(1) .WillOnce(Return(prep_ret)); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(true, test_light_1.On(33)); EXPECT_EQ(false, test_light_2.On()); @@ -144,9 +144,9 @@ TEST_F(HueLightTest, Off) .Times(1) .WillOnce(Return(prep_ret)); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(true, test_light_1.Off(33)); EXPECT_EQ(true, test_light_2.Off()); @@ -155,12 +155,12 @@ TEST_F(HueLightTest, Off) TEST_F(HueLightTest, isOn) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(true, ctest_light_1.isOn()); EXPECT_EQ(false, ctest_light_2.isOn()); @@ -172,12 +172,12 @@ TEST_F(HueLightTest, isOn) TEST_F(HueLightTest, getId) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(1, ctest_light_1.getId()); EXPECT_EQ(2, ctest_light_2.getId()); @@ -189,12 +189,12 @@ TEST_F(HueLightTest, getId) TEST_F(HueLightTest, getType) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ("Dimmable light", ctest_light_1.getType()); EXPECT_EQ("Color light", ctest_light_2.getType()); @@ -206,12 +206,12 @@ TEST_F(HueLightTest, getType) TEST_F(HueLightTest, getName) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ("Hue lamp 1", ctest_light_1.getName()); EXPECT_EQ("Hue lamp 2", ctest_light_2.getName()); @@ -223,12 +223,12 @@ TEST_F(HueLightTest, getName) TEST_F(HueLightTest, getModelId) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ("LWB004", ctest_light_1.getModelId()); EXPECT_EQ("LST001", ctest_light_2.getModelId()); @@ -240,12 +240,12 @@ TEST_F(HueLightTest, getModelId) TEST_F(HueLightTest, getUId) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ("00:00:00:00:00:00:00:00-00", ctest_light_1.getUId()); EXPECT_EQ("11:11:11:11:11:11:11:11-11", ctest_light_2.getUId()); @@ -257,12 +257,12 @@ TEST_F(HueLightTest, getUId) TEST_F(HueLightTest, getManufacturername) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ("Philips", ctest_light_1.getManufacturername()); EXPECT_EQ("", ctest_light_2.getManufacturername()); @@ -274,12 +274,12 @@ TEST_F(HueLightTest, getManufacturername) TEST_F(HueLightTest, getProductname) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ("Hue bloom", ctest_light_1.getProductname()); EXPECT_EQ("", ctest_light_2.getProductname()); @@ -291,12 +291,12 @@ TEST_F(HueLightTest, getProductname) TEST_F(HueLightTest, getLuminaireUId) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ("0000000", ctest_light_1.getLuminaireUId()); EXPECT_EQ("", ctest_light_2.getLuminaireUId()); @@ -308,12 +308,12 @@ TEST_F(HueLightTest, getLuminaireUId) TEST_F(HueLightTest, getSwVersion) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ("5.50.1.19085", ctest_light_1.getSwVersion()); EXPECT_EQ("5.50.1.19085", ctest_light_2.getSwVersion()); @@ -348,9 +348,9 @@ TEST_F(HueLightTest, setName) .Times(1) .WillOnce(Return(prep_ret)); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(true, test_light_1.setName(expected_request["name"].get())); EXPECT_EQ(false, test_light_2.setName(expected_request["name"].get())); @@ -359,12 +359,12 @@ TEST_F(HueLightTest, setName) TEST_F(HueLightTest, getColorType) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(ColorType::NONE, ctest_light_1.getColorType()); EXPECT_EQ(ColorType::GAMUT_A, ctest_light_2.getColorType()); @@ -376,12 +376,12 @@ TEST_F(HueLightTest, getColorType) TEST_F(HueLightTest, KelvinToMired) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(10000, ctest_light_1.KelvinToMired(100)); EXPECT_EQ(500, ctest_light_2.KelvinToMired(2000)); @@ -393,12 +393,12 @@ TEST_F(HueLightTest, KelvinToMired) TEST_F(HueLightTest, MiredToKelvin) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(100, ctest_light_1.MiredToKelvin(10000)); EXPECT_EQ(2000, ctest_light_2.MiredToKelvin(500)); @@ -411,12 +411,12 @@ TEST_F(HueLightTest, MiredToKelvin) TEST_F(HueLightTest, hasBrightnessControl) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(true, ctest_light_1.hasBrightnessControl()); EXPECT_EQ(true, ctest_light_2.hasBrightnessControl()); @@ -428,12 +428,12 @@ TEST_F(HueLightTest, hasBrightnessControl) TEST_F(HueLightTest, hasTemperatureControl) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(false, ctest_light_1.hasTemperatureControl()); EXPECT_EQ(false, ctest_light_2.hasTemperatureControl()); @@ -445,12 +445,12 @@ TEST_F(HueLightTest, hasTemperatureControl) TEST_F(HueLightTest, hasColorControl) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(false, ctest_light_1.hasColorControl()); EXPECT_EQ(true, ctest_light_2.hasColorControl()); @@ -481,9 +481,9 @@ TEST_F(HueLightTest, setBrightness) .Times(1) .WillOnce(Return(prep_ret)); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(false, test_light_1.setBrightness(200)); EXPECT_EQ(true, test_light_2.setBrightness(0, 2)); @@ -492,12 +492,12 @@ TEST_F(HueLightTest, setBrightness) TEST_F(HueLightTest, getBrightness) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(254, ctest_light_1.getBrightness()); EXPECT_EQ(0, ctest_light_2.getBrightness()); @@ -525,9 +525,9 @@ TEST_F(HueLightTest, setColorTemperature) .Times(1) .WillOnce(Return(prep_ret)); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(false, test_light_1.setColorTemperature(153)); EXPECT_EQ(false, test_light_2.setColorTemperature(400, 2)); @@ -536,12 +536,12 @@ TEST_F(HueLightTest, setColorTemperature) TEST_F(HueLightTest, getColorTemperature) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(0, ctest_light_1.getColorTemperature()); EXPECT_EQ(0, ctest_light_2.getColorTemperature()); @@ -572,9 +572,9 @@ TEST_F(HueLightTest, setColorHue) .Times(1) .WillOnce(Return(prep_ret)); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(false, test_light_1.setColorHue(153)); EXPECT_EQ(false, test_light_2.setColorHue(30000, 2)); @@ -602,9 +602,9 @@ TEST_F(HueLightTest, setColorSaturation) .Times(1) .WillOnce(Return(prep_ret)); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(false, test_light_1.setColorSaturation(0)); EXPECT_EQ(false, test_light_2.setColorSaturation(140, 2)); @@ -635,9 +635,9 @@ TEST_F(HueLightTest, setColorHueSaturation) .Times(1) .WillOnce(Return(prep_ret)); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(false, test_light_1.setColorHueSaturation({153, 0})); EXPECT_EQ(false, test_light_2.setColorHueSaturation({30000, 140}, 2)); @@ -646,12 +646,12 @@ TEST_F(HueLightTest, setColorHueSaturation) TEST_F(HueLightTest, getColorHueSaturation) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ((HueSaturation {0, 0}), ctest_light_1.getColorHueSaturation()); EXPECT_EQ((HueSaturation {12345, 123}), ctest_light_2.getColorHueSaturation()); @@ -683,9 +683,9 @@ TEST_F(HueLightTest, setColorXY) .Times(1) .WillOnce(Return(prep_ret)); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(false, test_light_1.setColorXY({{0.01f, 0.f}, 1.f})); EXPECT_EQ(false, test_light_2.setColorXY({{0.123f, 1.f}, 1.f}, 2)); @@ -694,12 +694,12 @@ TEST_F(HueLightTest, setColorXY) TEST_F(HueLightTest, getColorXY) { - const HueLight ctest_light_1 = test_bridge.getLight(1); - const HueLight ctest_light_2 = test_bridge.getLight(2); - const HueLight ctest_light_3 = test_bridge.getLight(3); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + const HueLight ctest_light_1 = test_bridge.lights().get(1); + const HueLight ctest_light_2 = test_bridge.lights().get(2); + const HueLight ctest_light_3 = test_bridge.lights().get(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ((XYBrightness {{0.f, 0.f}, 0.f}), ctest_light_1.getColorXY()); EXPECT_EQ((XYBrightness {{0.102f, 0.102f}, 0.f}), ctest_light_2.getColorXY()); EXPECT_EQ((XYBrightness {{0.102f, 0.102f}, 1.f}), ctest_light_3.getColorXY()); @@ -730,9 +730,9 @@ TEST_F(HueLightTest, setColorRGB) .Times(1) .WillOnce(Return(prep_ret)); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(false, test_light_1.setColorRGB({0, 0, 0}, 0)); EXPECT_EQ(false, test_light_2.setColorRGB({32, 64, 128}, 2)); @@ -757,9 +757,9 @@ TEST_F(HueLightTest, alert) .Times(1) .WillOnce(Return(prep_ret)); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(false, test_light_1.alert()); EXPECT_EQ(false, test_light_2.alert()); @@ -773,9 +773,9 @@ TEST_F(HueLightTest, alertTemperature) .Times(1) .WillOnce(Return(nlohmann::json::array())); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(false, test_light_1.alertTemperature(400)); EXPECT_EQ(false, test_light_2.alertTemperature(100)); @@ -789,9 +789,9 @@ TEST_F(HueLightTest, alertHueSaturation) .Times(1) .WillOnce(Return(nlohmann::json::array())); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(false, test_light_1.alertHueSaturation({0, 255})); EXPECT_EQ(false, test_light_2.alertHueSaturation({3000, 100})); @@ -805,9 +805,9 @@ TEST_F(HueLightTest, alertXY) .Times(1) .WillOnce(Return(nlohmann::json::array())); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(false, test_light_1.alertXY({{0.1f, 0.1f}, 1.f})); EXPECT_EQ(false, test_light_2.alertXY({{0.2434f, 0.2344f}, 1.f})); @@ -824,9 +824,9 @@ TEST_F(HueLightTest, setColorLoop) .Times(1) .WillOnce(Return(nlohmann::json::array())); - HueLight test_light_1 = test_bridge.getLight(1); - HueLight test_light_2 = test_bridge.getLight(2); - HueLight test_light_3 = test_bridge.getLight(3); + HueLight test_light_1 = test_bridge.lights().get(1); + HueLight test_light_2 = test_bridge.lights().get(2); + HueLight test_light_3 = test_bridge.lights().get(3); EXPECT_EQ(false, test_light_1.setColorLoop(true)); EXPECT_EQ(false, test_light_2.setColorLoop(false));