diff --git a/server/src/hardware/commandstation/commandstation.cpp b/server/src/hardware/commandstation/commandstation.cpp index 28ff6af8..e1254921 100644 --- a/server/src/hardware/commandstation/commandstation.cpp +++ b/server/src/hardware/commandstation/commandstation.cpp @@ -36,7 +36,7 @@ CommandStation::CommandStation(const std::weak_ptr& world, std::string_vi [this](bool value) { emergencyStop.setAttributeEnabled(value); - trackVoltageOff.setAttributeEnabled(value); + powerOn.setAttributeEnabled(value); }, std::bind(&CommandStation::setOnline, this, std::placeholders::_1)}, //status{this, "status", CommandStationStatus::Offline, PropertyFlags::ReadOnly}, @@ -45,10 +45,10 @@ CommandStation::CommandStation(const std::weak_ptr& world, std::string_vi { emergencyStopChanged(value); }}, - trackVoltageOff{this, "track_voltage_off", true, PropertyFlags::ReadWrite | PropertyFlags::NoStore, + powerOn{this, "power_on", false, PropertyFlags::ReadWrite | PropertyFlags::NoStore, [this](bool value) { - trackVoltageOffChanged(value); + powerOnChanged(value); }}, decoders{this, "decoders", nullptr, PropertyFlags::ReadOnly | PropertyFlags::Store | PropertyFlags::SubObject}, controllers{this, "controllers", nullptr, PropertyFlags::ReadOnly | PropertyFlags::Store | PropertyFlags::SubObject}, @@ -69,9 +69,9 @@ CommandStation::CommandStation(const std::weak_ptr& world, std::string_vi Attributes::addObjectEditor(emergencyStop, false); m_interfaceItems.insertBefore(emergencyStop, notes); - Attributes::addEnabled(trackVoltageOff, online); - Attributes::addObjectEditor(trackVoltageOff, false); - m_interfaceItems.insertBefore(trackVoltageOff, notes); + Attributes::addEnabled(powerOn, online); + Attributes::addObjectEditor(powerOn, false); + m_interfaceItems.insertBefore(powerOn, notes); m_interfaceItems.add(decoders); @@ -107,11 +107,11 @@ void CommandStation::worldEvent(WorldState state, WorldEvent event) break; case WorldEvent::PowerOff: - trackVoltageOff = true; + powerOn = false; break; case WorldEvent::PowerOn: - trackVoltageOff = false; + powerOn = true; break; case WorldEvent::Stop: @@ -145,10 +145,10 @@ void CommandStation::emergencyStopChanged(bool value) controller->emergencyStopChanged(value); } -void CommandStation::trackVoltageOffChanged(bool value) +void CommandStation::powerOnChanged(bool value) { for(auto& controller : *controllers) - controller->trackPowerChanged(!value); + controller->powerOnChanged(value); } void CommandStation::decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber) diff --git a/server/src/hardware/commandstation/commandstation.hpp b/server/src/hardware/commandstation/commandstation.hpp index 395a793d..7f271ce3 100644 --- a/server/src/hardware/commandstation/commandstation.hpp +++ b/server/src/hardware/commandstation/commandstation.hpp @@ -3,7 +3,7 @@ * * This file is part of the traintastic source code. * - * Copyright (C) 2019-2020 Reinder Feenstra + * Copyright (C) 2019-2021 Reinder Feenstra * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -42,7 +42,7 @@ class CommandStation : public IdObject virtual bool setOnline(bool& value) = 0; virtual void emergencyStopChanged(bool value); - virtual void trackVoltageOffChanged(bool value); + virtual void powerOnChanged(bool value); //virtual bool isDecoderSupported(Decoder& decoder) const = 0; virtual void decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber); @@ -52,7 +52,7 @@ class CommandStation : public IdObject Property name; Property online; Property emergencyStop; - Property trackVoltageOff; + Property powerOn; ObjectProperty decoders; ObjectProperty controllers; Property notes; diff --git a/server/src/hardware/commandstation/commandstationlisttablemodel.cpp b/server/src/hardware/commandstation/commandstationlisttablemodel.cpp index 11fe194d..989ec26b 100644 --- a/server/src/hardware/commandstation/commandstationlisttablemodel.cpp +++ b/server/src/hardware/commandstation/commandstationlisttablemodel.cpp @@ -3,7 +3,7 @@ * * This file is part of the traintastic source code * - * Copyright (C) 2019-2020 Reinder Feenstra + * Copyright (C) 2019-2021 Reinder Feenstra * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -72,7 +72,7 @@ std::string CommandStationListTableModel::getText(uint32_t column, uint32_t row) return cs.emergencyStop ? "\u2022" : ""; case columnTrackPower: - return cs.trackVoltageOff ? UTF8_BALLOT_X : UTF8_CHECKMARK; + return cs.powerOn ? UTF8_CHECKMARK : UTF8_BALLOT_X; default: assert(false); diff --git a/server/src/hardware/commandstation/loconetserial.cpp b/server/src/hardware/commandstation/loconetserial.cpp index ed587509..6d45c903 100644 --- a/server/src/hardware/commandstation/loconetserial.cpp +++ b/server/src/hardware/commandstation/loconetserial.cpp @@ -3,7 +3,7 @@ * * This file is part of the traintastic source code * - * Copyright (C) 2019-2020 Reinder Feenstra + * Copyright (C) 2019-2021 Reinder Feenstra * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -65,12 +65,12 @@ void LocoNetSerial::emergencyStopChanged(bool value) loconet->emergencyStopChanged(value); } -void LocoNetSerial::trackVoltageOffChanged(bool value) +void LocoNetSerial::powerOnChanged(bool value) { - CommandStation::trackVoltageOffChanged(value); + CommandStation::powerOnChanged(value); if(online) - loconet->trackVoltageOffChanged(value); + loconet->powerOnChanged(value); } void LocoNetSerial::decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber) diff --git a/server/src/hardware/commandstation/loconetserial.hpp b/server/src/hardware/commandstation/loconetserial.hpp index 904a2bc5..ec9886ab 100644 --- a/server/src/hardware/commandstation/loconetserial.hpp +++ b/server/src/hardware/commandstation/loconetserial.hpp @@ -31,7 +31,7 @@ class LocoNetSerial : public SerialCommandStation { protected: void emergencyStopChanged(bool value) final; - void trackVoltageOffChanged(bool value) final; + void powerOnChanged(bool value) final; void decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber) final; bool start(); diff --git a/server/src/hardware/commandstation/rocoz21.cpp b/server/src/hardware/commandstation/rocoz21.cpp index 8ad2872d..641a53ba 100644 --- a/server/src/hardware/commandstation/rocoz21.cpp +++ b/server/src/hardware/commandstation/rocoz21.cpp @@ -1,9 +1,9 @@ /** - * hardware/commandstation/z21.cpp + * server/src/hardware/commandstation/rocoz21.cpp * * This file is part of the traintastic source code * - * Copyright (C) 2019-2020 Reinder Feenstra + * Copyright (C) 2019-2021 Reinder Feenstra * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -131,14 +131,14 @@ void RocoZ21::emergencyStopChanged(bool value) send(Z21::LanXSetStop()); } -void RocoZ21::trackVoltageOffChanged(bool value) +void RocoZ21::powerOnChanged(bool value) { if(online) { if(value) - send(Z21::LanXSetTrackPowerOff()); - else send(Z21::LanXSetTrackPowerOn()); + else + send(Z21::LanXSetTrackPowerOff()); } } diff --git a/server/src/hardware/commandstation/rocoz21.hpp b/server/src/hardware/commandstation/rocoz21.hpp index 190a69e8..aa832b8a 100644 --- a/server/src/hardware/commandstation/rocoz21.hpp +++ b/server/src/hardware/commandstation/rocoz21.hpp @@ -1,9 +1,9 @@ /** - * server/src/hardware/commandstation/z21.hpp + * server/src/hardware/commandstation/rocoz21.hpp * * This file is part of the traintastic source code. * - * Copyright (C) 2019-2020 Reinder Feenstra + * Copyright (C) 2019-2021 Reinder Feenstra * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -45,7 +45,7 @@ class RocoZ21 : public CommandStation bool setOnline(bool& value) final; //bool isDecoderSupported(Decoder& decoder) const final; void emergencyStopChanged(bool value) final; - void trackVoltageOffChanged(bool value) final; + void powerOnChanged(bool value) final; void decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber) final; void receive(); diff --git a/server/src/hardware/commandstation/usbxpressnetinterface.cpp b/server/src/hardware/commandstation/usbxpressnetinterface.cpp index 77b069e5..f46de41b 100644 --- a/server/src/hardware/commandstation/usbxpressnetinterface.cpp +++ b/server/src/hardware/commandstation/usbxpressnetinterface.cpp @@ -1,7 +1,7 @@ /** - * Traintastic + * server/src/hardware/commandstation/usbxpressnetinterface.cpp * - * Copyright (C) 2019-2020 Reinder Feenstra + * Copyright (C) 2019-2021 Reinder Feenstra * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -87,7 +87,7 @@ void USBXpressNetInterface::emergencyStopChanged(bool value) } -void USBXpressNetInterface::trackVoltageOffChanged(bool value) +void USBXpressNetInterface::powerOnChanged(bool value) { } diff --git a/server/src/hardware/commandstation/usbxpressnetinterface.hpp b/server/src/hardware/commandstation/usbxpressnetinterface.hpp index 7d4b47eb..c6e2d2ea 100644 --- a/server/src/hardware/commandstation/usbxpressnetinterface.hpp +++ b/server/src/hardware/commandstation/usbxpressnetinterface.hpp @@ -3,7 +3,7 @@ * * This file is part of the traintastic source code. * - * Copyright (C) 2019-2020 Reinder Feenstra + * Copyright (C) 2019-2021 Reinder Feenstra * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -37,7 +37,7 @@ class USBXpressNetInterface : public CommandStation bool setOnline(bool& value) final; void emergencyStopChanged(bool value) final; - void trackVoltageOffChanged(bool value) final; + void powerOnChanged(bool value) final; void decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber) final; bool send(const XpressNet::Message& msg); diff --git a/server/src/hardware/commandstation/xpressnetserial.cpp b/server/src/hardware/commandstation/xpressnetserial.cpp index d3a47f9b..1bd51ce3 100644 --- a/server/src/hardware/commandstation/xpressnetserial.cpp +++ b/server/src/hardware/commandstation/xpressnetserial.cpp @@ -101,12 +101,12 @@ void XpressNetSerial::emergencyStopChanged(bool value) xpressnet->emergencyStopChanged(value); } -void XpressNetSerial::trackVoltageOffChanged(bool value) +void XpressNetSerial::powerOnChanged(bool value) { - CommandStation::trackVoltageOffChanged(value); + CommandStation::powerOnChanged(value); if(online) - xpressnet->trackVoltageOffChanged(value); + xpressnet->powerOnChanged(value); } void XpressNetSerial::decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber) diff --git a/server/src/hardware/commandstation/xpressnetserial.hpp b/server/src/hardware/commandstation/xpressnetserial.hpp index 773dc7e8..a7d55bf5 100644 --- a/server/src/hardware/commandstation/xpressnetserial.hpp +++ b/server/src/hardware/commandstation/xpressnetserial.hpp @@ -38,7 +38,7 @@ class XpressNetSerial : public SerialCommandStation void worldEvent(WorldState state, WorldEvent event) final; void emergencyStopChanged(bool value) final; - void trackVoltageOffChanged(bool value) final; + void powerOnChanged(bool value) final; void decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber) final; bool send(const XpressNet::Message& msg); diff --git a/server/src/hardware/controller/controller.hpp b/server/src/hardware/controller/controller.hpp index 600454ab..4ed95d95 100644 --- a/server/src/hardware/controller/controller.hpp +++ b/server/src/hardware/controller/controller.hpp @@ -3,7 +3,7 @@ * * This file is part of the traintastic source code. * - * Copyright (C) 2019-2020 Reinder Feenstra + * Copyright (C) 2019-2021 Reinder Feenstra * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -43,7 +43,7 @@ class Controller : public IdObject virtual bool setActive(bool& value) = 0; virtual void emergencyStopChanged(bool value) = 0; - virtual void trackPowerChanged(bool value) = 0; + virtual void powerOnChanged(bool value) = 0; virtual void decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber) = 0; public: diff --git a/server/src/hardware/controller/wlanmaus.cpp b/server/src/hardware/controller/wlanmaus.cpp index db30d68b..943a2e16 100644 --- a/server/src/hardware/controller/wlanmaus.cpp +++ b/server/src/hardware/controller/wlanmaus.cpp @@ -3,7 +3,7 @@ * * This file is part of the traintastic source code. * - * Copyright (C) 2019-2020 Reinder Feenstra + * Copyright (C) 2019-2021 Reinder Feenstra * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -94,7 +94,7 @@ void WLANmaus::emergencyStopChanged(bool value) if(it.second.broadcastFlags & Z21::PowerLocoTurnout) sendTo(Z21::LanXBCStopped(), it.first); } - else if(commandStation && !commandStation->trackVoltageOff) // send z21_lan_x_bc_track_power_on if power is on + else if(commandStation && commandStation->powerOn) // send z21_lan_x_bc_track_power_on if power is on { for(auto it : m_clients) if(it.second.broadcastFlags & Z21::PowerLocoTurnout) @@ -102,7 +102,7 @@ void WLANmaus::emergencyStopChanged(bool value) } } -void WLANmaus::trackPowerChanged(bool value) +void WLANmaus::powerOnChanged(bool value) { if(value) { @@ -169,7 +169,7 @@ void WLANmaus::receive() if(!commandStation || commandStation->emergencyStop) response.db1 |= Z21_CENTRALSTATE_EMERGENCYSTOP; - if(!commandStation || commandStation->trackVoltageOff) + if(!commandStation || !commandStation->powerOn) response.db1 |= Z21_CENTRALSTATE_TRACKVOLTAGEOFF; response.calcChecksum(); @@ -185,8 +185,8 @@ void WLANmaus::receive() if(commandStation) { commandStation->emergencyStop = false; - commandStation->trackVoltageOff = false; - if(!commandStation->trackVoltageOff) + commandStation->powerOn = true; + if(commandStation->powerOn) sendTo(Z21::LanXBCTrackPowerOn(), endpoint); } }); @@ -198,8 +198,8 @@ void WLANmaus::receive() { if(commandStation) { - commandStation->trackVoltageOff = true; - if(commandStation->trackVoltageOff) + commandStation->powerOn = false; + if(!commandStation->powerOn) sendTo(Z21::LanXBCTrackPowerOff(), endpoint); } }); @@ -411,7 +411,7 @@ void WLANmaus::receive() if(!commandStation || commandStation->emergencyStop) response.centralState |= Z21_CENTRALSTATE_EMERGENCYSTOP; - if(!commandStation || commandStation->trackVoltageOff) + if(!commandStation || !commandStation->powerOn) response.centralState |= Z21_CENTRALSTATE_TRACKVOLTAGEOFF; sendTo(response, endpoint); diff --git a/server/src/hardware/controller/wlanmaus.hpp b/server/src/hardware/controller/wlanmaus.hpp index 0e1c455b..fc72d667 100644 --- a/server/src/hardware/controller/wlanmaus.hpp +++ b/server/src/hardware/controller/wlanmaus.hpp @@ -3,7 +3,7 @@ * * This file is part of the traintastic source code. * - * Copyright (C) 2019-2020 Reinder Feenstra + * Copyright (C) 2019-2021 Reinder Feenstra * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -62,7 +62,7 @@ class WLANmaus : public Controller bool setActive(bool& value) final; void emergencyStopChanged(bool value) final; - void trackPowerChanged(bool value) final; + void powerOnChanged(bool value) final; void decoderChanged(const Decoder& decoder, DecoderChangeFlags, uint32_t) final; void receive(); diff --git a/server/src/hardware/protocol/loconet/loconet.cpp b/server/src/hardware/protocol/loconet/loconet.cpp index 72792d33..0a21bdc1 100644 --- a/server/src/hardware/protocol/loconet/loconet.cpp +++ b/server/src/hardware/protocol/loconet/loconet.cpp @@ -147,7 +147,7 @@ void LocoNet::receive(const Message& message) if(m_commandStation) { m_commandStation->emergencyStop.setValueInternal(false); - m_commandStation->trackVoltageOff.setValueInternal(false); + m_commandStation->powerOn.setValueInternal(true); } }); break; @@ -157,7 +157,7 @@ void LocoNet::receive(const Message& message) [this]() { if(m_commandStation) - m_commandStation->trackVoltageOff.setValueInternal(true); + m_commandStation->powerOn.setValueInternal(false); }); break; @@ -294,13 +294,13 @@ void LocoNet::emergencyStopChanged(bool value) { if(value) send(Idle()); - else if(m_commandStation && !m_commandStation->trackVoltageOff) + else if(m_commandStation && m_commandStation->powerOn) send(GlobalPowerOn()); } -void LocoNet::trackVoltageOffChanged(bool value) +void LocoNet::powerOnChanged(bool value) { - if(!value) + if(value) send(GlobalPowerOn()); else send(GlobalPowerOff()); diff --git a/server/src/hardware/protocol/loconet/loconet.hpp b/server/src/hardware/protocol/loconet/loconet.hpp index 5760525f..11694977 100644 --- a/server/src/hardware/protocol/loconet/loconet.hpp +++ b/server/src/hardware/protocol/loconet/loconet.hpp @@ -3,7 +3,7 @@ * * This file is part of the traintastic source code. * - * Copyright (C) 2019-2020 Reinder Feenstra + * Copyright (C) 2019-2021 Reinder Feenstra * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -153,7 +153,7 @@ class LocoNet : public SubObject void receive(const Message& message); void emergencyStopChanged(bool value); - void trackVoltageOffChanged(bool value); + void powerOnChanged(bool value); void decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber); void queryLocoSlots(); diff --git a/server/src/hardware/protocol/xpressnet/xpressnet.cpp b/server/src/hardware/protocol/xpressnet/xpressnet.cpp index 67a1f49d..56692139 100644 --- a/server/src/hardware/protocol/xpressnet/xpressnet.cpp +++ b/server/src/hardware/protocol/xpressnet/xpressnet.cpp @@ -154,7 +154,7 @@ void XpressNet::receive(const Message& message) [cs=m_commandStation->shared_ptr()]() { cs->emergencyStop.setValueInternal(false); - cs->trackVoltageOff.setValueInternal(false); + cs->powerOn.setValueInternal(true); }); } else if(message == TrackPowerOff()) @@ -162,7 +162,7 @@ void XpressNet::receive(const Message& message) EventLoop::call( [cs=m_commandStation->shared_ptr()]() { - cs->trackVoltageOff.setValueInternal(true); + cs->powerOn.setValueInternal(false); }); } break; @@ -185,13 +185,13 @@ void XpressNet::emergencyStopChanged(bool value) { if(value) send(EmergencyStop()); - else if(m_commandStation && !m_commandStation->trackVoltageOff) + else if(m_commandStation && m_commandStation->powerOn) send(NormalOperationResumed()); } -void XpressNet::trackVoltageOffChanged(bool value) +void XpressNet::powerOnChanged(bool value) { - if(!value) + if(value) send(NormalOperationResumed()); else send(TrackPowerOff()); diff --git a/server/src/hardware/protocol/xpressnet/xpressnet.hpp b/server/src/hardware/protocol/xpressnet/xpressnet.hpp index 3e83d593..b4153671 100644 --- a/server/src/hardware/protocol/xpressnet/xpressnet.hpp +++ b/server/src/hardware/protocol/xpressnet/xpressnet.hpp @@ -69,7 +69,7 @@ class XpressNet : public SubObject void receive(const Message& msg); void emergencyStopChanged(bool value); - void trackVoltageOffChanged(bool value); + void powerOnChanged(bool value); void decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber); [[nodiscard]] bool isInputAddressAvailable(uint16_t address) const;