Chris Mullins 8 éve
szülő
commit
76dfabca0c
2 módosított fájl, 10 hozzáadás és 0 törlés
  1. 5 0
      lib/MiLightState/GroupState.cpp
  2. 5 0
      lib/MiLightState/GroupState.h

+ 5 - 0
lib/MiLightState/GroupState.cpp

@@ -69,6 +69,7 @@ GroupState::GroupState() {
   _isSetMode            = 0;
   _isSetKelvin          = 0;
   _isSetBulbMode        = 0;
+  _dirty                = 1;
 }
 
 bool GroupState::isSetState() const { return _isSetState; }
@@ -164,6 +165,10 @@ void GroupState::setBulbMode(BulbMode bulbMode) {
   _bulbMode = bulbMode;
 }
 
+bool GroupState::isDirty() const { return _dirty; }
+bool GroupState::setDirty() { _dirty = 1; }
+bool GroupState::clearDirty() { _dirty = 0; }
+
 void GroupState::patch(const JsonObject& state) {
   if (state.containsKey("state")) {
     setState(state["state"] == "ON" ? ON : OFF);

+ 5 - 0
lib/MiLightState/GroupState.h

@@ -70,6 +70,10 @@ public:
   BulbMode getBulbMode() const;
   void setBulbMode(BulbMode mode);
 
+  bool isDirty() const;
+  bool setDirty();
+  bool clearDirty();
+
   void patch(const JsonObject& state);
   void applyState(JsonObject& state);
 
@@ -97,6 +101,7 @@ private:
     _brightnessMode       : 7,
     _isSetBrightnessColor : 1,
     _isSetBrightnessMode  : 1,
+    _dirty                : 1,
                           : 5;
 };