| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#pragma once |
| 22 |
|
| 23 |
#include <cstring> |
| 24 |
|
| 25 |
#include "Hardware/HardwareInterface.h" |
| 26 |
#include "Hardware/HardwareParams.h" |
| 27 |
#include "Logger/Logger.h" |
| 28 |
|
| 29 |
namespace Hardware |
| 30 |
{ |
| 31 |
|
| 32 |
class Virtual : HardwareInterface |
| 33 |
{ |
| 34 |
public: |
| 35 |
Virtual() = delete; |
| 36 |
Virtual(const Virtual&) = delete; |
| 37 |
Virtual& operator=(const Virtual&) = delete; |
| 38 |
|
| 39 |
Virtual(const HardwareParams* params); |
| 40 |
|
| 41 |
inline Hardware::Capabilities GetCapabilities() const override |
| 42 |
{ |
| 43 |
return Hardware::CapabilityLoco |
| 44 |
| Hardware::CapabilityAccessory |
| 45 |
| Hardware::CapabilityFeedback |
| 46 |
| Hardware::CapabilityProgram |
| 47 |
| Hardware::CapabilityProgramMmWrite |
| 48 |
| Hardware::CapabilityProgramMmPomWrite |
| 49 |
| Hardware::CapabilityProgramMfxRead |
| 50 |
| Hardware::CapabilityProgramMfxWrite |
| 51 |
| Hardware::CapabilityProgramDccRegisterRead |
| 52 |
| Hardware::CapabilityProgramDccRegisterWrite |
| 53 |
| Hardware::CapabilityProgramDccPageRead |
| 54 |
| Hardware::CapabilityProgramDccPageWrite |
| 55 |
| Hardware::CapabilityProgramDccDirectRead |
| 56 |
| Hardware::CapabilityProgramDccDirectWrite |
| 57 |
| Hardware::CapabilityProgramDccPomLocoRead |
| 58 |
| Hardware::CapabilityProgramDccPomLocoWrite |
| 59 |
| Hardware::CapabilityProgramDccPomAccessoryRead |
| 60 |
| Hardware::CapabilityProgramDccPomAccessoryWrite; |
| 61 |
} |
| 62 |
|
| 63 |
static void GetHint(std::string& hint) |
| 64 |
{ |
| 65 |
hint = Languages::GetText(Languages::TextHintVirtual); |
| 66 |
} |
| 67 |
|
| 68 |
void GetLocoProtocols(std::vector<Protocol>& protocols) const override { protocols.push_back(ProtocolNone); } |
| 69 |
bool LocoProtocolSupported(const Protocol protocol) const override { return protocol == ProtocolNone; } |
| 70 |
void GetAccessoryProtocols(std::vector<Protocol>& protocols) const override { protocols.push_back(ProtocolNone); } |
| 71 |
bool AccessoryProtocolSupported(const Protocol protocol) const override { return protocol == ProtocolNone; } |
| 72 |
|
| 73 |
void Booster(const BoosterState status) override; |
| 74 |
void LocoSpeed(const Protocol protocol, const Address address, const Speed speed) override; |
| 75 |
void LocoOrientation(const Protocol protocol, const Address address, const Orientation orientation) override; |
| 76 |
|
| 77 |
void LocoFunction(const Protocol protocol, |
| 78 |
const Address address, |
| 79 |
const DataModel::LocoFunctionNr function, |
| 80 |
const DataModel::LocoFunctionState on) override; |
| 81 |
|
| 82 |
void Accessory(const Protocol protocol, |
| 83 |
const Address address, |
| 84 |
const DataModel::AccessoryState state, |
| 85 |
const bool on, |
| 86 |
const DataModel::AccessoryPulseDuration duration) override; |
| 87 |
|
| 88 |
void ProgramRead(const ProgramMode mode, const Address address, const CvNumber cv) override; |
| 89 |
void ProgramWrite(const ProgramMode mode, const Address address, const CvNumber cv, const CvValue value) override; |
| 90 |
}; |
| 91 |
} |
| 92 |
|