1 #ifndef LIBMARKLIN_CONTROL_H_
2 #define LIBMARKLIN_CONTROL_H_
6 #include <msp/time/timer.h>
7 #include <msp/time/timestamp.h>
10 #include "locomotive.h"
23 std::list<Command> queue;
24 std::map<unsigned, Turnout *> turnouts;
25 std::map<unsigned, Locomotive *> locomotives;
26 std::map<unsigned, Sensor *> sensors;
27 Msp::Time::TimeStamp next_event_query;
30 Msp::Time::Timer timer;
33 sigc::signal<void, unsigned, bool> signal_turnout_event;
34 sigc::signal<void, unsigned, bool> signal_sensor_event;
40 bool get_power() const { return power; }
42 const std::map<unsigned, Sensor *> &get_sensors() const { return sensors; }
43 unsigned get_queue_length() const { return queue.size(); }
44 void open(const std::string &);
45 Command &command(const std::string &);
47 void add_turnout(Turnout &);
48 Turnout &get_turnout(unsigned) const;
49 void add_locomotive(Locomotive &);
50 Locomotive &get_locomotive(unsigned) const;
51 void add_sensor(Sensor &);
52 Sensor &get_sensor(unsigned) const;
55 Msp::Time::Timer::Slot &set_timer(const Msp::Time::TimeDelta &);
57 void read_all(int, char *, int);
58 std::string read_reply(Cmd);
59 void event_query_done(Error, const std::string &);
60 void turnout_event_done(Error, const std::string &);
61 void sensor_event_done(Error, const std::string &);
64 } // namespace Marklin