]> git.tdb.fi Git - r2c2.git/commitdiff
Add interface for importing detected locomotives from the driver
authorMikko Rasa <tdb@tdb.fi>
Wed, 13 Nov 2013 06:19:03 +0000 (08:19 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 13 Nov 2013 06:19:03 +0000 (08:19 +0200)
source/libr2c2/arducontrol.h
source/libr2c2/centralstation.h
source/libr2c2/driver.h
source/libr2c2/dummy.h
source/libr2c2/intellibox.h

index 33696bea818077b1bc3aea0432a98b306a058621..2431cf927ae8d59b7dfc11a411b7e99e7159e83d 100644 (file)
@@ -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);
index acfc7d6c807a35479586d60045879755d01163e4..91bef1a3e1ab830966a3ff137a8965b325bed701 100644 (file)
@@ -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);
index 101426026a15b2c6577e7aceb27376e7c47540d8..7c762d0066b4b9b668030edb0e53dec09d0ebf50 100644 (file)
@@ -13,8 +13,17 @@ class VehicleType;
 class Driver
 {
 public:
+       struct DetectedLocomotive
+       {
+               std::string protocol;
+               unsigned address;
+               std::string name;
+       };
+
        sigc::signal<void, bool> signal_power;
        sigc::signal<void, bool> signal_halt;
+       sigc::signal<void, const DetectedLocomotive &> signal_locomotive_detected;
+       sigc::signal<void, const DetectedLocomotive &> signal_locomotive_gone;
        sigc::signal<void, unsigned, unsigned, bool> signal_loco_speed;
        sigc::signal<void, unsigned, unsigned, bool> signal_loco_function;
        sigc::signal<void, unsigned, unsigned> 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;
index 4c43d14a6910be161dbbe555ffe6909da1698372..77a07a4bc4e7895bbfd1b996141a5db8124c349a 100644 (file)
@@ -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);
index 8058aabbc5cc1883c211b0493d0ca8ae77ece2d8..3e298592ead1c0ee8c61b2e755f86c25324e3851 100644 (file)
@@ -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);