]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/command.h
Allow intercepting and denying turnout route and locomotive speed changes
[r2c2.git] / source / libmarklin / command.h
index 2106d237bb67f0d44464529297d6914daff7f78a..a270be0af0083ca80e68f3225029a0bf4fc22c04 100644 (file)
@@ -1,24 +1,40 @@
+/* $Id$
+
+This file is part of the MSP Märklin suite
+Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa
+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:
+       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(const std::string &c): cmd(c), sent(false) { }
-       void              set_sent(bool s)     { sent=s; }
-       const std::string &get_command() const { return cmd; }
-       bool              get_sent() const     { return sent; }
-private:
-       std::string cmd;
-       bool        sent;
+       Command(Cmd, const unsigned char *, unsigned);
+
+       void send(int);
+       bool get_sent() const   { return sent; }
+       Cmd get_command() const { return cmd; }
+
+       friend std::ostream &operator<<(std::ostream &, const Command &);
 };
 
 } // namespace Marklin