Commit 137804f7ceaaf80fa44829cd57b592b4f04ad536

Authored by Jojo-1000
Committed by Moritz Wirger
1 parent 8e6c4c13

Change Bridge::setRefreshDuration to also update durations of its members.

include/hueplusplus/Bridge.h
... ... @@ -174,6 +174,9 @@ public:
174 174  
175 175 //! \brief Sets refresh interval for the whole bridge state.
176 176 //! \param refreshDuration The new minimum duration between refreshes. May be 0 or \ref c_refreshNever.
  177 + //!
  178 + //! Also sets refresh duration on all resource lists on the bridge, but not on already existing lights.
  179 + //! The resource lists (such as lights()) can have their own durations, but those must be set after calling this function.
177 180 void setRefreshDuration(std::chrono::steady_clock::duration refreshDuration);
178 181  
179 182 //! \brief Function to get the ip address of the hue bridge
... ...
src/Bridge.cpp
... ... @@ -20,6 +20,8 @@
20 20 along with hueplusplus. If not, see <http://www.gnu.org/licenses/>.
21 21 **/
22 22  
  23 +#include "hueplusplus/Bridge.h"
  24 +
23 25 #include <algorithm>
24 26 #include <cctype>
25 27 #include <chrono>
... ... @@ -29,7 +31,6 @@
29 31 #include <stdexcept>
30 32 #include <thread>
31 33  
32   -#include "hueplusplus/Bridge.h"
33 34 #include "hueplusplus/HueExceptionMacro.h"
34 35 #include "hueplusplus/LibConfig.h"
35 36 #include "hueplusplus/UPnP.h"
... ... @@ -185,6 +186,13 @@ void Bridge::refresh()
185 186 void Bridge::setRefreshDuration(std::chrono::steady_clock::duration refreshDuration)
186 187 {
187 188 stateCache->setRefreshDuration(refreshDuration);
  189 + lightList.setRefreshDuration(refreshDuration);
  190 + groupList.setRefreshDuration(refreshDuration);
  191 + scheduleList.setRefreshDuration(refreshDuration);
  192 + sceneList.setRefreshDuration(refreshDuration);
  193 + sensorList.setRefreshDuration(refreshDuration);
  194 + ruleList.setRefreshDuration(refreshDuration);
  195 + bridgeConfig.setRefreshDuration(refreshDuration);
188 196 }
189 197  
190 198 std::string Bridge::getBridgeIP() const
... ...