From: Mikko Rasa Date: Wed, 13 Nov 2013 06:19:03 +0000 (+0200) Subject: Add interface for importing detected locomotives from the driver X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=77f1712e7f8913af3ce33efc0e1e4ebbe0e5f93a;p=r2c2.git Add interface for importing detected locomotives from the driver --- diff --git a/source/libr2c2/arducontrol.h b/source/libr2c2/arducontrol.h index 33696be..2431cf9 100644 --- a/source/libr2c2/arducontrol.h +++ b/source/libr2c2/arducontrol.h @@ -328,6 +328,7 @@ private: public: virtual unsigned get_protocol_speed_steps(const std::string &) const; + virtual const DetectedLocomotive *enumerate_detected_locos(unsigned) const { return 0; } virtual unsigned add_loco(unsigned, const std::string &, const VehicleType &); virtual void remove_loco(unsigned); virtual void set_loco_speed(unsigned, unsigned); diff --git a/source/libr2c2/centralstation.h b/source/libr2c2/centralstation.h index acfc7d6..91bef1a 100644 --- a/source/libr2c2/centralstation.h +++ b/source/libr2c2/centralstation.h @@ -137,6 +137,7 @@ public: virtual const char *enumerate_protocols(unsigned) const; virtual unsigned get_protocol_speed_steps(const std::string &) const; + virtual DetectedLocomotive *enumerate_detected_locos(unsigned) const { return 0; } virtual unsigned add_loco(unsigned, const std::string &, const VehicleType &); virtual void remove_loco(unsigned); virtual void set_loco_speed(unsigned, unsigned); diff --git a/source/libr2c2/driver.h b/source/libr2c2/driver.h index 1014260..7c762d0 100644 --- a/source/libr2c2/driver.h +++ b/source/libr2c2/driver.h @@ -13,8 +13,17 @@ class VehicleType; class Driver { public: + 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; @@ -33,6 +42,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; diff --git a/source/libr2c2/dummy.h b/source/libr2c2/dummy.h index 4c43d14..77a07a4 100644 --- a/source/libr2c2/dummy.h +++ b/source/libr2c2/dummy.h @@ -40,6 +40,7 @@ public: virtual const char *enumerate_protocols(unsigned) const; virtual unsigned get_protocol_speed_steps(const std::string &) const; + virtual DetectedLocomotive *enumerate_detected_locos(unsigned) const { return 0; } virtual unsigned add_loco(unsigned a, const std::string &, const VehicleType &) { return a; } virtual void remove_loco(unsigned) { } virtual void set_loco_speed(unsigned, unsigned); diff --git a/source/libr2c2/intellibox.h b/source/libr2c2/intellibox.h index 8058aab..3e29859 100644 --- a/source/libr2c2/intellibox.h +++ b/source/libr2c2/intellibox.h @@ -136,6 +136,7 @@ public: virtual const char *enumerate_protocols(unsigned) const; virtual unsigned get_protocol_speed_steps(const std::string &) const; + virtual DetectedLocomotive *enumerate_detected_locos(unsigned) const { return 0; } virtual unsigned add_loco(unsigned, const std::string &, const VehicleType &); virtual void remove_loco(unsigned); virtual void set_loco_speed(unsigned, unsigned);