X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fdriver.h;h=a0e5cc434405a194e56099bd5e3f63dd7512e8b4;hb=399b48a7a80dafde49e7530ff8dfd2820232a73f;hp=101426026a15b2c6577e7aceb27376e7c47540d8;hpb=73e4a36bbf828e07b83a779b696875e1f80045cc;p=r2c2.git diff --git a/source/libr2c2/driver.h b/source/libr2c2/driver.h index 1014260..a0e5cc4 100644 --- a/source/libr2c2/driver.h +++ b/source/libr2c2/driver.h @@ -1,8 +1,10 @@ #ifndef LIBR2C2_DRIVER_H_ #define LIBR2C2_DRIVER_H_ +#include #include #include +#include namespace R2C2 { @@ -13,11 +15,44 @@ class VehicleType; class Driver { public: + class Options + { + private: + typedef std::map OptionMap; + + OptionMap opts; + + public: + Options() { } + Options(const std::string &); + + void set(const std::string &, const std::string &); + + template + T get(const std::string &k, const T &d = T()) const + { + OptionMap::const_iterator i = opts.find(k); + if(i==opts.end()) + return d; + return Msp::lexical_cast(i->second); + } + }; + + struct DetectedLocomotive + { + std::string protocol; + unsigned address; + std::string name; + }; + sigc::signal signal_power; sigc::signal signal_halt; + sigc::signal signal_locomotive_detected; + sigc::signal signal_locomotive_gone; sigc::signal signal_loco_speed; sigc::signal signal_loco_function; sigc::signal signal_turnout; + sigc::signal signal_turnout_failed; sigc::signal signal_signal; sigc::signal signal_sensor; @@ -33,6 +68,8 @@ public: virtual const char *enumerate_protocols(unsigned) const = 0; virtual unsigned get_protocol_speed_steps(const std::string &) const = 0; + + virtual const DetectedLocomotive *enumerate_detected_locos(unsigned) const = 0; virtual unsigned add_loco(unsigned, const std::string &, const VehicleType &) = 0; virtual void remove_loco(unsigned) = 0; virtual void set_loco_speed(unsigned, unsigned) = 0;