]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/intellibox.cpp
Framework for supporting multiple control protocols in a single driver
[r2c2.git] / source / libmarklin / intellibox.cpp
index 416d02184e9564836361da811ef247a4777a0f3c..bbe6781cd6b85d8090c3ed534989dec4460e4713 100644 (file)
@@ -94,11 +94,26 @@ void Intellibox::halt(bool h)
        signal_halt.emit(halted);
 }
 
-void Intellibox::add_loco(unsigned addr)
+const char *Intellibox::enumerate_protocols(unsigned i) const
+{
+       if(i==0)
+               return "MM";
+       return 0;
+}
+
+unsigned Intellibox::get_protocol_speed_steps(const string &proto) const
+{
+       if(proto=="MM")
+               return 14;
+       else
+               throw InvalidParameterValue("Unknown protocol");
+}
+
+void Intellibox::add_loco(unsigned addr, const string &proto)
 {
        if(!locos.count(addr))
        {
-               locos[addr];
+               locos[addr].protocol = proto;
 
                unsigned char data[2];
                data[0] = addr&0xFF;