]> git.tdb.fi Git - r2c2.git/commitdiff
Implement flush() for ArduControl
authorMikko Rasa <tdb@tdb.fi>
Wed, 2 Apr 2014 20:15:26 +0000 (23:15 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 2 Apr 2014 20:15:26 +0000 (23:15 +0300)
source/libr2c2/arducontrol.cpp
source/libr2c2/arducontrol.h

index 9edc1e2244d41beb448921617186dfe635c4d192..1bb48d47f88eac60a301fc32720abccf33c83809 100644 (file)
@@ -456,6 +456,8 @@ void ArduControl::tick()
 
 void ArduControl::flush()
 {
+       while(!command_queue.empty() || !accessory_queue.empty())
+               tick();
 }
 
 void ArduControl::save_state() const
@@ -657,6 +659,12 @@ bool ArduControl::Queue<T>::pop(T &item)
        return true;
 }
 
+template<typename T>
+bool ArduControl::Queue<T>::empty() const
+{
+       return items.empty();
+}
+
 
 ArduControl::RefreshTask::RefreshTask():
        next(cycle.end()),
index 8560a13b969d21257c7e8dfab3aa611113d16682..3bb956badb4db577fbd4b60cffa9f2986f9c8046 100644 (file)
@@ -219,6 +219,7 @@ private:
        public:
                void push(const T &);
                bool pop(T &);
+               bool empty() const;
        };
 
        class Task