return 0;
}
-void Intellibox::add_loco(unsigned addr, const string &proto_name, const VehicleType &type)
+unsigned Intellibox::add_loco(unsigned addr, const string &proto_name, const VehicleType &type)
{
Protocol proto = map_protocol(proto_name);
data[1] = (addr>>8)&0xFF;
command(CMD_LOK_STATUS, addr, data, 2);
}
+
+ return addr;
+}
+
+void Intellibox::remove_loco(unsigned addr)
+{
+ locos.erase(addr);
}
void Intellibox::set_loco_speed(unsigned addr, unsigned speed)
signal_loco_function.emit(addr, func, state);
}
-void Intellibox::add_turnout(unsigned addr, const TrackType &type)
+unsigned Intellibox::add_turnout(unsigned addr, const TrackType &type)
{
- add_turnout(addr, type.get_state_bits(), false);
+ return add_turnout(addr, type.get_state_bits(), false);
}
-void Intellibox::add_turnout(unsigned addr, unsigned bits, bool signal)
+void Intellibox::remove_turnout(unsigned addr)
+{
+ turnouts.erase(addr);
+}
+
+unsigned Intellibox::add_turnout(unsigned addr, unsigned bits, bool signal)
{
if(!turnouts.count(addr))
{
command(CMD_TURNOUT_STATUS, addr+i, data, 2);
}
}
+
+ return addr;
}
void Intellibox::turnout_state_changed(unsigned addr, const Turnout &turnout) const
return 0;
}
-void Intellibox::add_signal(unsigned addr, const SignalType &)
+unsigned Intellibox::add_signal(unsigned addr, const SignalType &)
{
- add_turnout(addr, 1, true);
+ return add_turnout(addr, 1, true);
+}
+
+void Intellibox::remove_signal(unsigned addr)
+{
+ remove_turnout(addr);
}
void Intellibox::set_signal(unsigned addr, unsigned state)
return get_turnout(addr);
}
-void Intellibox::add_sensor(unsigned addr)
+unsigned Intellibox::add_sensor(unsigned addr)
{
if(!sensors.count(addr))
{
sensors[addr];
update_sensors = true;
}
+
+ return addr;
+}
+
+void Intellibox::remove_sensor(unsigned addr)
+{
+ sensors.erase(addr);
+ update_sensors = true;
}
bool Intellibox::get_sensor(unsigned addr) const