diff --git a/include/hueplusplus/Bridge.h b/include/hueplusplus/Bridge.h index 04797a0..838018d 100644 --- a/include/hueplusplus/Bridge.h +++ b/include/hueplusplus/Bridge.h @@ -185,6 +185,11 @@ public: //! \return bool - whether stream request was successful bool StartStreaming(std::string group_identifier); + //! \brief Function to set stream mode to active for entertainment mode + //! + //! \return bool - whether stream request was successful + bool StopStreaming(std::string group_identifier); + //! \brief Function to get the port of the hue bridge //! //! \return integer containing port diff --git a/src/Bridge.cpp b/src/Bridge.cpp index 05652cf..6211150 100644 --- a/src/Bridge.cpp +++ b/src/Bridge.cpp @@ -276,6 +276,34 @@ bool Bridge::StartStreaming(std::string group_identifier) return false; } +bool Bridge::StopStreaming(std::string group_identifier) +{ + nlohmann::json request; + + request["stream"]["active"] = false; + + nlohmann::json answer; + + std::string uri = "/api/" + username + "/groups/" + group_identifier; + + answer = http_handler->PUTJson(uri, request, ip, port); + + if(answer[0].contains("success")) + { + std::string key = "/groups/" + group_identifier + "/stream/active"; + + if(answer[0]["success"].contains(key)) + { + if(answer[0]["success"][key] == false) + { + return true; + } + } + } + + return false; +} + std::string Bridge::getUsername() const { return username;