X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibmarklin%2Fcontrol.h;h=a041e957caaf1b009ee216b43ef34e1794cf52e7;hb=02c9a9779954d993cb73fe5f7a72b0847e87f633;hp=0ec3d5ba53022a6f3d2bde7614547d1c24703ee0;hpb=540e931ec79129c8776f48434ff5b230b53337f1;p=r2c2.git diff --git a/source/libmarklin/control.h b/source/libmarklin/control.h index 0ec3d5b..a041e95 100644 --- a/source/libmarklin/control.h +++ b/source/libmarklin/control.h @@ -1,7 +1,7 @@ /* $Id$ This file is part of the MSP Märklin suite -Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa +Copyright © 2006-2009 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ @@ -24,8 +24,13 @@ class Reply; class Control { +public: + sigc::signal signal_power_event; + sigc::signal signal_turnout_event; + sigc::signal signal_sensor_event; + private: - int serial_fd; + int serial_fd; bool power; std::list queue; std::map turnouts; @@ -37,35 +42,32 @@ private: Msp::Time::Timer timer; public: - sigc::signal signal_power_event; - sigc::signal signal_turnout_event; - sigc::signal signal_sensor_event; - Control(); ~Control(); - void set_power(bool); - bool get_power() const { return power; } - void set_debug(bool); - const std::map &get_sensors() const { return sensors; } - unsigned get_queue_length() const { return queue.size(); } - void open(const std::string &); - Command &command(Cmd); - Command &command(Cmd, unsigned char); - Command &command(Cmd, const unsigned char *, unsigned); + void open(const std::string &); + void set_debug(bool); + void set_power(bool); + bool get_power() const { return power; } + Command &command(Cmd); + Command &command(Cmd, unsigned char); + Command &command(Cmd, const unsigned char *, unsigned); + unsigned get_queue_length() const { return queue.size(); } + void flush(); - void add_turnout(Turnout &); - Turnout &get_turnout(unsigned) const; - void add_locomotive(Locomotive &); + void add_turnout(Turnout &); + Turnout &get_turnout(unsigned) const; + const std::map &get_turnouts() const { return turnouts; } + void add_locomotive(Locomotive &); Locomotive &get_locomotive(unsigned) const; - void add_sensor(Sensor &); - Sensor &get_sensor(unsigned) const; + const std::map &get_locomotives() const { return locomotives; } + void add_sensor(Sensor &); + Sensor &get_sensor(unsigned) const; + const std::map &get_sensors() const { return sensors; } - void tick(); + void tick(); Msp::Time::Timer::Slot &set_timer(const Msp::Time::TimeDelta &); private: - void read_all(int, char *, int); - std::string read_reply(Cmd); void status_done(const Reply &); void event_query_done(const Reply &); void turnout_event_done(const Reply &);