Commit a675e68ae82a4fc72594a079666366c24308fe24
Committed by
Moritz Wirger
1 parent
7b070eb8
Add new functions to Hue class
- add getPictureOfLight and getPictureOfModel to get a picture name of a light or a model id
Showing
49 changed files
with
155 additions
and
0 deletions
CMakeLists.txt
100755 → 100644
Doxyfile
100755 → 100644
Jenkinsfile
100755 → 100644
README.md
100755 → 100644
hueplusplus/CMakeLists.txt
100755 → 100644
hueplusplus/ExtendedColorHueStrategy.cpp
100755 → 100644
hueplusplus/ExtendedColorTemperatureStrategy.cpp
100755 → 100644
hueplusplus/Hue.cpp
100755 → 100644
| ... | ... | @@ -283,6 +283,143 @@ bool Hue::lightExists(int id) const |
| 283 | 283 | return false; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | +std::string Hue::getPictureOfLight(int id) const | |
| 287 | +{ | |
| 288 | + std::string ret = ""; | |
| 289 | + auto pos = lights.find(id); | |
| 290 | + if (pos != lights.end()) | |
| 291 | + { | |
| 292 | + ret = getPictureOfModel(pos->second.getModelId()); | |
| 293 | + } | |
| 294 | + return ret; | |
| 295 | +} | |
| 296 | + | |
| 297 | +std::string Hue::getPictureOfModel(std::string model_id) const | |
| 298 | +{ | |
| 299 | + std::string ret = ""; | |
| 300 | + if(model_id == "LCT001" || model_id == "LCT007" || model_id == "LCT010" || model_id == "LCT014" || | |
| 301 | + model_id == "LTW010" || model_id == "LTW001" || model_id == "LTW004" || model_id == "LTW015" || | |
| 302 | + model_id == "LWB004" || model_id == "LWB006") | |
| 303 | + { | |
| 304 | + ret.append("e27_waca"); | |
| 305 | + } | |
| 306 | + else if (model_id == "LWB010" || model_id == "LWB014") | |
| 307 | + { | |
| 308 | + ret.append("e27_white"); | |
| 309 | + } | |
| 310 | + else if (model_id == "LCT012" || model_id == "LTW012") | |
| 311 | + { | |
| 312 | + ret.append("e14"); | |
| 313 | + } | |
| 314 | + else if (model_id == "LCT002") | |
| 315 | + { | |
| 316 | + ret.append("br30"); | |
| 317 | + } | |
| 318 | + else if (model_id == "LCT011" || model_id == "LTW011") | |
| 319 | + { | |
| 320 | + ret.append("br30_slim"); | |
| 321 | + } | |
| 322 | + else if (model_id == "LCT003") | |
| 323 | + { | |
| 324 | + ret.append("gu10"); | |
| 325 | + } | |
| 326 | + else if (model_id == "LTW013") | |
| 327 | + { | |
| 328 | + ret.append("gu10_perfectfit"); | |
| 329 | + } | |
| 330 | + else if (model_id == "LST001" || model_id == "LST002") | |
| 331 | + { | |
| 332 | + ret.append("lightstrip"); | |
| 333 | + } | |
| 334 | + else if (model_id == "LLC006 " || model_id == "LLC010") | |
| 335 | + { | |
| 336 | + ret.append("iris"); | |
| 337 | + } | |
| 338 | + else if (model_id == "LLC005" || model_id == "LLC011" || model_id == "LLC012" || | |
| 339 | + model_id == "LLC007") | |
| 340 | + { | |
| 341 | + ret.append("bloom"); | |
| 342 | + } | |
| 343 | + else if (model_id == "LLC014") | |
| 344 | + { | |
| 345 | + ret.append("aura"); | |
| 346 | + } | |
| 347 | + else if (model_id == "LLC013") | |
| 348 | + { | |
| 349 | + ret.append("storylight"); | |
| 350 | + } | |
| 351 | + else if (model_id == "LLC020") | |
| 352 | + { | |
| 353 | + ret.append("go"); | |
| 354 | + } | |
| 355 | + else if (model_id == "HBL001" || model_id == "HBL002" || model_id == "HBL003") | |
| 356 | + { | |
| 357 | + ret.append("beyond_ceiling_pendant_table"); | |
| 358 | + } | |
| 359 | + else if (model_id == "HIL001 " || model_id == "HIL002") | |
| 360 | + { | |
| 361 | + ret.append("impulse"); | |
| 362 | + } | |
| 363 | + else if (model_id == "HEL001 " || model_id == "HEL002") | |
| 364 | + { | |
| 365 | + ret.append("entity"); | |
| 366 | + } | |
| 367 | + else if (model_id == "HML001" || model_id == "HML002" || model_id == "HML003" || | |
| 368 | + model_id == "HML004" || model_id == "HML005") | |
| 369 | + { | |
| 370 | + ret.append("phoenix_ceiling_pendant_table_wall"); | |
| 371 | + } | |
| 372 | + else if (model_id == "HML006") | |
| 373 | + { | |
| 374 | + ret.append("phoenix_down"); | |
| 375 | + } | |
| 376 | + else if (model_id == "LTP001" || model_id == "LTP002" || model_id == "LTP003" || | |
| 377 | + model_id == "LTP004" || model_id == "LTP005" || model_id == "LTD003") | |
| 378 | + { | |
| 379 | + ret.append("pendant"); | |
| 380 | + } | |
| 381 | + else if (model_id == "LDF002" || model_id == "LTF001" || model_id == "LTF002" || | |
| 382 | + model_id == "LTC001" || model_id == "LTC002" || model_id == "LTC003" || | |
| 383 | + model_id == "LTC004" || model_id == "LTD001" || model_id == "LTD002" || | |
| 384 | + model_id == "LDF001") | |
| 385 | + { | |
| 386 | + ret.append("ceiling"); | |
| 387 | + } | |
| 388 | + else if (model_id == "LDD002 " || model_id == "LFF001") | |
| 389 | + { | |
| 390 | + ret.append("floor"); | |
| 391 | + } | |
| 392 | + else if (model_id == "LDD001 " || model_id == "LTT001") | |
| 393 | + { | |
| 394 | + ret.append("table"); | |
| 395 | + } | |
| 396 | + else if (model_id == "LDT001 " || model_id == "MWM001") | |
| 397 | + { | |
| 398 | + ret.append("recessed"); | |
| 399 | + } | |
| 400 | + else if (model_id == "BSB001") | |
| 401 | + { | |
| 402 | + ret.append("bridge_v1"); | |
| 403 | + } | |
| 404 | + else if (model_id == "BSB002") | |
| 405 | + { | |
| 406 | + ret.append("bridge_v2"); | |
| 407 | + } | |
| 408 | + else if (model_id == "SWT001") | |
| 409 | + { | |
| 410 | + ret.append("tap"); | |
| 411 | + } | |
| 412 | + else if (model_id == "RWL021") | |
| 413 | + { | |
| 414 | + ret.append("hds"); | |
| 415 | + } | |
| 416 | + else if (model_id == "SML001") | |
| 417 | + { | |
| 418 | + ret.append("motion_sensor"); | |
| 419 | + } | |
| 420 | + return ret; | |
| 421 | +} | |
| 422 | + | |
| 286 | 423 | void Hue::refreshState() |
| 287 | 424 | { |
| 288 | 425 | if (username.empty()) | ... | ... |
hueplusplus/HueLight.cpp
100755 → 100644
hueplusplus/LinHttpHandler.cpp
100755 → 100644
hueplusplus/SimpleBrightnessStrategy.cpp
100755 → 100644
hueplusplus/SimpleColorHueStrategy.cpp
100755 → 100644
hueplusplus/SimpleColorTemperatureStrategy.cpp
100755 → 100644
hueplusplus/UPnP.cpp
100755 → 100644
hueplusplus/WinHttpHandler.cpp
100755 → 100644
hueplusplus/include/BaseHttpHandler.h
100755 → 100644
hueplusplus/include/BrightnessStrategy.h
100755 → 100644
hueplusplus/include/ColorHueStrategy.h
100755 → 100644
hueplusplus/include/ColorTemperatureStrategy.h
100755 → 100644
hueplusplus/include/ExtendedColorHueStrategy.h
100755 → 100644
hueplusplus/include/ExtendedColorTemperatureStrategy.h
100755 → 100644
hueplusplus/include/Hue.h
100755 → 100644
| ... | ... | @@ -160,6 +160,24 @@ public: |
| 160 | 160 | //! \return Bool that is true when a light with the given id exists and false when not |
| 161 | 161 | bool lightExists(int id) const; |
| 162 | 162 | |
| 163 | + //! \brief Const function that returns the picture name of a given light id | |
| 164 | + //! | |
| 165 | + //! \note This will not update the local state of the bridge. | |
| 166 | + //! \note This function will only return the filename without extension, because | |
| 167 | + //! Philips provides different file types. | |
| 168 | + //! \param id Id of a light to get the picture of | |
| 169 | + //! \return String that either contains the filename of the picture of the light or if it was not found an empty string | |
| 170 | + std::string getPictureOfLight(int id) const; | |
| 171 | + | |
| 172 | + //! \brief Const function that returns the picture name of a given model id | |
| 173 | + //! | |
| 174 | + //! \note This will not update the local state of the bridge. | |
| 175 | + //! \note This function will only return the filename without extension, because | |
| 176 | + //! Philips provides different file types. | |
| 177 | + //! \param model_id Model Id of a device to get the picture of | |
| 178 | + //! \return String that either contains the filename of the picture of the device or if it was not found an empty string | |
| 179 | + std::string getPictureOfModel(std::string model_id) const; | |
| 180 | + | |
| 163 | 181 | //! \brief Function that sets the HttpHandler and updates the HueCommandAPI. |
| 164 | 182 | //! |
| 165 | 183 | //! The HttpHandler and HueCommandAPI are used for bridge communication | ... | ... |
hueplusplus/include/HueConfig.h
100755 → 100644
hueplusplus/include/HueLight.h
100755 → 100644
hueplusplus/include/IHttpHandler.h
100755 → 100644
hueplusplus/include/LinHttpHandler.h
100755 → 100644
hueplusplus/include/SimpleBrightnessStrategy.h
100755 → 100644
hueplusplus/include/SimpleColorHueStrategy.h
100755 → 100644
hueplusplus/include/SimpleColorTemperatureStrategy.h
100755 → 100644
hueplusplus/include/UPnP.h
100755 → 100644
hueplusplus/include/WinHttpHandler.h
100755 → 100644
hueplusplus/include/json/json-forwards.h
100755 → 100644
hueplusplus/jsoncpp.cpp
100755 → 100644
hueplusplus/test/CMakeLists.txt
100755 → 100644
hueplusplus/test/CMakeLists.txt.in
100755 → 100644
hueplusplus/test/CodeCoverage.cmake
100755 → 100644
hueplusplus/test/mocks/mock_HttpHandler.h
100755 → 100644
hueplusplus/test/mocks/mock_HueLight.h
100755 → 100644
hueplusplus/test/test_BaseHttpHandler.cpp
100755 → 100644
hueplusplus/test/test_ExtendedColorHueStrategy.cpp
100755 → 100644
hueplusplus/test/test_ExtendedColorTemperatureStrategy.cpp
100755 → 100644
hueplusplus/test/test_Hue.cpp
100755 → 100644
hueplusplus/test/test_HueLight.cpp
100755 → 100644
hueplusplus/test/test_Main.cpp
100755 → 100644
hueplusplus/test/test_SimpleBrightnessStrategy.cpp
100755 → 100644
hueplusplus/test/test_SimpleColorHueStrategy.cpp
100755 → 100644
hueplusplus/test/test_SimpleColorTemperatureStrategy.cpp
100755 → 100644
hueplusplus/test/test_UPnP.cpp
100755 → 100644
hueplusplus/test/testhelper.h
100755 → 100644