diff --git a/include/hueplusplus/Hue.h b/include/hueplusplus/Hue.h
index 8fdddfb..aa122e2 100644
--- a/include/hueplusplus/Hue.h
+++ b/include/hueplusplus/Hue.h
@@ -346,25 +346,6 @@ public:
///@}
- //! \brief Const function that returns the picture name of a given light id
- //!
- //! \note This will not update the local state of the bridge.
- //! \note This function will only return the filename without extension,
- //! because Philips provides different file types. \param id Id of a light to
- //! get the picture of \return String that either contains the filename of the
- //! picture of the light or if it was not found an empty string
- std::string getPictureOfLight(int id);
-
- //! \brief Const function that returns the picture name of a given model id
- //!
- //! \note This will not update the local state of the bridge.
- //! \note This function will only return the filename without extension,
- //! because Philips provides different file types. \param model_id Model Id of
- //! a device to get the picture of \return String that either contains the
- //! filename of the picture of the device or if it was not found an empty
- //! string
- std::string getPictureOfModel(const std::string& model_id) const;
-
private:
std::string ip; //!< IP-Address of the hue bridge in dotted decimal notation
//!< like "192.168.2.1"
diff --git a/include/hueplusplus/ModelPictures.h b/include/hueplusplus/ModelPictures.h
new file mode 100644
index 0000000..411c9fc
--- /dev/null
+++ b/include/hueplusplus/ModelPictures.h
@@ -0,0 +1,40 @@
+/**
+ \file ModelPictures.h
+ Copyright Notice\n
+ Copyright (C) 2020 Jan Rogall - developer\n
+
+ This file is part of hueplusplus.
+
+ hueplusplus is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ hueplusplus is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with hueplusplus. If not, see .
+**/
+
+#ifndef INCLUDE_HUEPLUSPLUS_MODEL_PICTURES_H
+#define INCLUDE_HUEPLUSPLUS_MODEL_PICTURES_H
+
+#include
+
+namespace hueplusplus
+{
+ //! \brief Get the picture name of a given model id
+ //!
+ //! \note This function will only return the filename without extension,
+ //! because Philips provides different file types.
+ //! \param model_id Model Id of a device to get the picture of
+ //! \returns String that either contains the filename of the picture of the device
+ //! or an empty string if it was not found.
+ std::string getPictureOfModel(const std::string& modelId);
+}
+
+
+#endif
\ No newline at end of file
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c3f2cb8..14a975d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,6 +1,7 @@
set(hueplusplus_SOURCES
APICache.cpp
BaseHttpHandler.cpp
+ ColorUnits.cpp
ExtendedColorHueStrategy.cpp
ExtendedColorTemperatureStrategy.cpp
Group.cpp
@@ -9,6 +10,7 @@ set(hueplusplus_SOURCES
HueDeviceTypes.cpp
HueException.cpp
HueLight.cpp
+ ModelPictures.cpp
Scene.cpp
Schedule.cpp
SimpleBrightnessStrategy.cpp
@@ -16,9 +18,8 @@ set(hueplusplus_SOURCES
SimpleColorTemperatureStrategy.cpp
StateTransaction.cpp
TimePattern.cpp
- "ColorUnits.cpp"
UPnP.cpp
- Utils.cpp )
+ Utils.cpp)
# on windows we want to compile the WinHttpHandler
if(WIN32)
diff --git a/src/Hue.cpp b/src/Hue.cpp
index 13ad06d..316f2a2 100644
--- a/src/Hue.cpp
+++ b/src/Hue.cpp
@@ -305,140 +305,6 @@ std::string Hue::createScene(const CreateScene& params)
return scenes.create(params);
}
-std::string Hue::getPictureOfLight(int id)
-{
- std::string ret = "";
- if (lights.exists(id))
- {
- ret = getPictureOfModel(lights.get(id).getModelId());
- }
- return ret;
-}
-
-std::string Hue::getPictureOfModel(const std::string& model_id) const
-{
- std::string ret = "";
- if (model_id == "LCT001" || model_id == "LCT007" || model_id == "LCT010" || model_id == "LCT014"
- || model_id == "LTW010" || model_id == "LTW001" || model_id == "LTW004" || model_id == "LTW015"
- || model_id == "LWB004" || model_id == "LWB006")
- {
- ret.append("e27_waca");
- }
- else if (model_id == "LWB010" || model_id == "LWB014")
- {
- ret.append("e27_white");
- }
- else if (model_id == "LCT012" || model_id == "LTW012")
- {
- ret.append("e14");
- }
- else if (model_id == "LCT002")
- {
- ret.append("br30");
- }
- else if (model_id == "LCT011" || model_id == "LTW011")
- {
- ret.append("br30_slim");
- }
- else if (model_id == "LCT003")
- {
- ret.append("gu10");
- }
- else if (model_id == "LTW013")
- {
- ret.append("gu10_perfectfit");
- }
- else if (model_id == "LST001" || model_id == "LST002")
- {
- ret.append("lightstrip");
- }
- else if (model_id == "LLC006 " || model_id == "LLC010")
- {
- ret.append("iris");
- }
- else if (model_id == "LLC005" || model_id == "LLC011" || model_id == "LLC012" || model_id == "LLC007")
- {
- ret.append("bloom");
- }
- else if (model_id == "LLC014")
- {
- ret.append("aura");
- }
- else if (model_id == "LLC013")
- {
- ret.append("storylight");
- }
- else if (model_id == "LLC020")
- {
- ret.append("go");
- }
- else if (model_id == "HBL001" || model_id == "HBL002" || model_id == "HBL003")
- {
- ret.append("beyond_ceiling_pendant_table");
- }
- else if (model_id == "HIL001 " || model_id == "HIL002")
- {
- ret.append("impulse");
- }
- else if (model_id == "HEL001 " || model_id == "HEL002")
- {
- ret.append("entity");
- }
- else if (model_id == "HML001" || model_id == "HML002" || model_id == "HML003" || model_id == "HML004"
- || model_id == "HML005")
- {
- ret.append("phoenix_ceiling_pendant_table_wall");
- }
- else if (model_id == "HML006")
- {
- ret.append("phoenix_down");
- }
- else if (model_id == "LTP001" || model_id == "LTP002" || model_id == "LTP003" || model_id == "LTP004"
- || model_id == "LTP005" || model_id == "LTD003")
- {
- ret.append("pendant");
- }
- else if (model_id == "LDF002" || model_id == "LTF001" || model_id == "LTF002" || model_id == "LTC001"
- || model_id == "LTC002" || model_id == "LTC003" || model_id == "LTC004" || model_id == "LTD001"
- || model_id == "LTD002" || model_id == "LDF001")
- {
- ret.append("ceiling");
- }
- else if (model_id == "LDD002 " || model_id == "LFF001")
- {
- ret.append("floor");
- }
- else if (model_id == "LDD001 " || model_id == "LTT001")
- {
- ret.append("table");
- }
- else if (model_id == "LDT001 " || model_id == "MWM001")
- {
- ret.append("recessed");
- }
- else if (model_id == "BSB001")
- {
- ret.append("bridge_v1");
- }
- else if (model_id == "BSB002")
- {
- ret.append("bridge_v2");
- }
- else if (model_id == "SWT001")
- {
- ret.append("tap");
- }
- else if (model_id == "RWL021")
- {
- ret.append("hds");
- }
- else if (model_id == "SML001")
- {
- ret.append("motion_sensor");
- }
- return ret;
-}
-
void Hue::setHttpHandler(std::shared_ptr handler)
{
http_handler = handler;
diff --git a/src/ModelPictures.cpp b/src/ModelPictures.cpp
new file mode 100644
index 0000000..6944d5b
--- /dev/null
+++ b/src/ModelPictures.cpp
@@ -0,0 +1,148 @@
+/**
+ \file ModelPictures.cpp
+ Copyright Notice\n
+ Copyright (C) 2020 Jan Rogall - developer\n
+
+ This file is part of hueplusplus.
+
+ hueplusplus is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ hueplusplus is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with hueplusplus. If not, see .
+**/
+
+#include
+
+namespace hueplusplus
+{
+std::string getPictureOfModel(const std::string& modelId)
+{
+ if (modelId == "LCT001" || modelId == "LCT007" || modelId == "LCT010" || modelId == "LCT014" || modelId == "LTW010"
+ || modelId == "LTW001" || modelId == "LTW004" || modelId == "LTW015" || modelId == "LWB004"
+ || modelId == "LWB006")
+ {
+ return "e27_waca";
+ }
+ else if (modelId == "LWB010" || modelId == "LWB014")
+ {
+ return "e27_white";
+ }
+ else if (modelId == "LCT012" || modelId == "LTW012")
+ {
+ return "e14";
+ }
+ else if (modelId == "LCT002")
+ {
+ return "br30";
+ }
+ else if (modelId == "LCT011" || modelId == "LTW011")
+ {
+ return "br30_slim";
+ }
+ else if (modelId == "LCT003")
+ {
+ return "gu10";
+ }
+ else if (modelId == "LTW013")
+ {
+ return "gu10_perfectfit";
+ }
+ else if (modelId == "LST001" || modelId == "LST002")
+ {
+ return "lightstrip";
+ }
+ else if (modelId == "LLC006 " || modelId == "LLC010")
+ {
+ return "iris";
+ }
+ else if (modelId == "LLC005" || modelId == "LLC011" || modelId == "LLC012" || modelId == "LLC007")
+ {
+ return "bloom";
+ }
+ else if (modelId == "LLC014")
+ {
+ return "aura";
+ }
+ else if (modelId == "LLC013")
+ {
+ return "storylight";
+ }
+ else if (modelId == "LLC020")
+ {
+ return "go";
+ }
+ else if (modelId == "HBL001" || modelId == "HBL002" || modelId == "HBL003")
+ {
+ return "beyond_ceiling_pendant_table";
+ }
+ else if (modelId == "HIL001 " || modelId == "HIL002")
+ {
+ return "impulse";
+ }
+ else if (modelId == "HEL001 " || modelId == "HEL002")
+ {
+ return "entity";
+ }
+ else if (modelId == "HML001" || modelId == "HML002" || modelId == "HML003" || modelId == "HML004"
+ || modelId == "HML005")
+ {
+ return "phoenix_ceiling_pendant_table_wall";
+ }
+ else if (modelId == "HML006")
+ {
+ return "phoenix_down";
+ }
+ else if (modelId == "LTP001" || modelId == "LTP002" || modelId == "LTP003" || modelId == "LTP004"
+ || modelId == "LTP005" || modelId == "LTD003")
+ {
+ return "pendant";
+ }
+ else if (modelId == "LDF002" || modelId == "LTF001" || modelId == "LTF002" || modelId == "LTC001"
+ || modelId == "LTC002" || modelId == "LTC003" || modelId == "LTC004" || modelId == "LTD001"
+ || modelId == "LTD002" || modelId == "LDF001")
+ {
+ return "ceiling";
+ }
+ else if (modelId == "LDD002 " || modelId == "LFF001")
+ {
+ return "floor";
+ }
+ else if (modelId == "LDD001 " || modelId == "LTT001")
+ {
+ return "table";
+ }
+ else if (modelId == "LDT001 " || modelId == "MWM001")
+ {
+ return "recessed";
+ }
+ else if (modelId == "BSB001")
+ {
+ return "bridge_v1";
+ }
+ else if (modelId == "BSB002")
+ {
+ return "bridge_v2";
+ }
+ else if (modelId == "SWT001")
+ {
+ return "tap";
+ }
+ else if (modelId == "RWL021")
+ {
+ return "hds";
+ }
+ else if (modelId == "SML001")
+ {
+ return "motion_sensor";
+ }
+ return "";
+}
+} // namespace hueplusplus
\ No newline at end of file
diff --git a/test/test_Hue.cpp b/test/test_Hue.cpp
index 800ec87..2f8798a 100644
--- a/test/test_Hue.cpp
+++ b/test/test_Hue.cpp
@@ -551,34 +551,3 @@ TEST(Hue, createGroup)
.WillOnce(Return(response));
EXPECT_EQ(0, test_bridge.createGroup(create));
}
-
-TEST(Hue, getPictureOfLight)
-{
- using namespace ::testing;
- std::shared_ptr handler = std::make_shared();
- nlohmann::json hue_bridge_state {{"lights",
- {{"1",
- {{"state",
- {{"on", true}, {"bri", 254}, {"ct", 366}, {"alert", "none"}, {"colormode", "ct"},
- {"reachable", true}}},
- {"swupdate", {{"state", "noupdates"}, {"lastinstall", nullptr}}}, {"type", "Color temperature light"},
- {"name", "Hue ambiance lamp 1"}, {"modelid", "LTW001"}, {"manufacturername", "Philips"},
- {"uniqueid", "00:00:00:00:00:00:00:00-00"}, {"swversion", "5.50.1.19085"}}}}}};
-
- EXPECT_CALL(
- *handler, GETJson("/api/" + getBridgeUsername(), nlohmann::json::object(), getBridgeIp(), getBridgePort()))
- .Times(AtLeast(1))
- .WillRepeatedly(Return(hue_bridge_state));
- EXPECT_CALL(*handler,
- GETJson("/api/" + getBridgeUsername() + "/lights/1", nlohmann::json::object(), getBridgeIp(), getBridgePort()))
- .Times(AtLeast(1))
- .WillRepeatedly(Return(hue_bridge_state["lights"]["1"]));
-
- Hue test_bridge(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
-
- test_bridge.getLight(1);
-
- EXPECT_EQ("", test_bridge.getPictureOfLight(2));
-
- EXPECT_EQ("e27_waca", test_bridge.getPictureOfLight(1));
-}