]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/control.h
Rewrite command/reply system
[r2c2.git] / source / libmarklin / control.h
index a91186059b033ed1052ea80408f9a7c0e474e8db..0ec3d5ba53022a6f3d2bde7614547d1c24703ee0 100644 (file)
@@ -20,12 +20,12 @@ Distributed under the GPL
 namespace Marklin {
 
 class Command;
+class Reply;
 
 class Control
 {
 private:
        int  serial_fd;
-       bool p50_enabled;
        bool power;
        std::list<Command> queue;
        std::map<unsigned, Turnout *> turnouts;
@@ -50,7 +50,9 @@ public:
        const std::map<unsigned, Sensor *> &get_sensors() const { return sensors; }
        unsigned   get_queue_length() const { return queue.size(); }
        void       open(const std::string &);
-       Command    &command(const std::string &);
+       Command    &command(Cmd);
+       Command    &command(Cmd, unsigned char);
+       Command    &command(Cmd, const unsigned char *, unsigned);
 
        void       add_turnout(Turnout &);
        Turnout    &get_turnout(unsigned) const;
@@ -64,10 +66,10 @@ public:
 private:
        void read_all(int, char *, int);
        std::string read_reply(Cmd);
-       void status_done(Error, const std::string &);
-       void event_query_done(Error, const std::string &);
-       void turnout_event_done(Error, const std::string &);
-       void sensor_event_done(Error, const std::string &);
+       void status_done(const Reply &);
+       void event_query_done(const Reply &);
+       void turnout_event_done(const Reply &);
+       void sensor_event_done(const Reply &);
 };
 
 } // namespace Marklin