]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/command.h
Rewrite command/reply system
[r2c2.git] / source / libmarklin / command.h
index 6075ab2e210d8085f8342f102b50df2cf4280ec7..a270be0af0083ca80e68f3225029a0bf4fc22c04 100644 (file)
@@ -8,26 +8,33 @@ Distributed under the GPL
 #ifndef COMMAND_H_
 #define COMMAND_H_
 
+#include <ostream>
 #include <string>
 #include <sigc++/sigc++.h>
 #include "constants.h"
 
 namespace Marklin {
 
+class Reply;
+
 class Command
 {
 private:
-       std::string cmd;
-       bool        sent;
+       Cmd cmd;
+       unsigned char data[128];
+       unsigned len;
+       bool sent;
 
 public:
-       sigc::signal<void, Error, const std::string &> signal_done;
+       sigc::signal<void, const Reply &> signal_done;
+
+       Command(Cmd, const unsigned char *, unsigned);
 
-       Command(const std::string &);
+       void send(int);
+       bool get_sent() const   { return sent; }
+       Cmd get_command() const { return cmd; }
 
-       void              set_sent(bool);
-       const std::string &get_command() const { return cmd; }
-       bool              get_sent() const     { return sent; }
+       friend std::ostream &operator<<(std::ostream &, const Command &);
 };
 
 } // namespace Marklin