]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/arducontrol.h
Implement halt mode to ArduControl
[r2c2.git] / source / libr2c2 / arducontrol.h
index 555280985767a7e37ea512607a0337359ac11618..8560a13b969d21257c7e8dfab3aa611113d16682 100644 (file)
@@ -117,6 +117,7 @@ private:
 
                bool set(T v) { if(v==pending) return false; pending = v; ++serial; return true; }
                bool commit(unsigned short s) { if(s!=serial) return false; current = pending; return true; }
+               void rollback() { pending = current; ++serial; }
 
                operator T() const { return current; }
        };
@@ -173,6 +174,7 @@ private:
                unsigned address;
                unsigned bits;
                ControlledVariable<unsigned> state;
+               unsigned uncertain;
                unsigned target;
                Msp::Time::TimeDelta active_time;
 
@@ -369,6 +371,7 @@ private:
        Msp::FS::Path state_file;
 
        ControlledVariable<bool> power;
+       bool halted;
 
        LocomotiveMap locomotives;
        MfxInfoArray mfx_info;
@@ -399,7 +402,7 @@ public:
        virtual void set_power(bool);
        virtual bool get_power() const { return power; }
        virtual void halt(bool);
-       virtual bool is_halted() const { return false; }
+       virtual bool is_halted() const { return halted; }
 
        virtual const char *enumerate_protocols(unsigned) const;
 private: