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;
38 bool get_power() const { return power; }
39 void set_debug(bool d) { debug=d; }
40 //const TurnoutMap &get_turnouts() const { return turnouts; }
41 const std::map<unsigned, Sensor *> &get_sensors() const { return sensors; }
42 unsigned get_queue_length() const { return queue.size(); }
43 void open(const std::string &);
44 Command &command(const std::string &);
45 void add_turnout(Turnout &);
46 Turnout &get_turnout(unsigned) const;
47 void add_locomotive(Locomotive &);
48 Locomotive &get_locomotive(unsigned) const;
49 void add_sensor(Sensor &);
50 Sensor &get_sensor(unsigned) const;
52 Msp::Time::Timer::Slot &set_timer(const Msp::Time::TimeDelta &);
55 void read_all(int, char *, int);
56 std::string read_reply(Cmd);
57 void event_query_done(Error, const std::string &);
58 void turnout_event_done(Error, const std::string &);
59 void sensor_event_done(Error, const std::string &);
62 } // namespace Marklin