Commit f2baaccf4b75e96b37a442f8635df2b181f33f1c

Authored by Nodeduino
Committed by Moritz Wirger
1 parent 6f8222e3

Rename function IsOn to isOn and add a const version of it

hueplusplus/HueLight.cpp
@@ -39,12 +39,17 @@ bool HueLight::Off(uint8_t transition) @@ -39,12 +39,17 @@ bool HueLight::Off(uint8_t transition)
39 return OffNoRefresh(transition); 39 return OffNoRefresh(transition);
40 } 40 }
41 41
42 -bool HueLight::IsOn() 42 +bool HueLight::isOn()
43 { 43 {
44 refreshState(); 44 refreshState();
45 return state["state"]["on"].asBool(); 45 return state["state"]["on"].asBool();
46 } 46 }
47 47
  48 +bool HueLight::isOn() const
  49 +{
  50 + return state["state"]["on"].asBool();
  51 +}
  52 +
48 std::string HueLight::getName() 53 std::string HueLight::getName()
49 { 54 {
50 refreshState(); 55 refreshState();
hueplusplus/include/HueLight.h
@@ -116,7 +116,13 @@ public: @@ -116,7 +116,13 @@ public:
116 //! \brief Function to check whether a light is on or off 116 //! \brief Function to check whether a light is on or off
117 //! 117 //!
118 //! \return Bool that is true, when the light is on and false, when off 118 //! \return Bool that is true, when the light is on and false, when off
119 - bool IsOn(); 119 + bool isOn();
  120 +
  121 + //! \brief Const function to check whether a light is on or off
  122 + //!
  123 + //! \note This will not refresh the light state
  124 + //! \return Bool that is true, when the light is on and false, when off
  125 + bool isOn() const;
120 126
121 //! \brief Function that returns the name of the light. 127 //! \brief Function that returns the name of the light.
122 //! 128 //!