19#include <simgear/debug/logstream.hxx>
25 std::string defaultName)
27 _name = config->getStringValue(
"name", defaultName.c_str());
28 _index = config->getIntValue(
"number", 0);
29 if (_powerSupplyPath.empty()) {
30 _powerSupplyPath =
"/systems/electrical/outputs/" + defaultName +
"[" + std::to_string(_index) +
"]";
33 if (config->hasChild(
"power-supply")) {
34 _powerSupplyPath = config->getStringValue(
"power-supply");
40 _minimumSupplyVolts = config->getDoubleValue(
"minimum-supply-volts", 1.0);
45 return "/instrumentation/" + _name +
"[" + std::to_string(_index) +
"]";
50 _serviceableNode = node->getNode(
"serviceable", 0,
true);
51 if (_serviceableNode->getType() == simgear::props::NONE)
52 _serviceableNode->setBoolValue(
true);
54 _powerButtonNode = node->getChild(
"power-btn", 0,
true);
57 if (_powerButtonNode->getType() == simgear::props::NONE)
58 _powerButtonNode->setBoolValue(
true);
60 if (_powerSupplyPath !=
"NO_DEFAULT") {
61 _powerSupplyNode =
fgGetNode(_powerSupplyPath,
true);
64 node->tie(
"operable", SGRawValueMethods<AbstractInstrument,bool>
72 nd->untie(
"operable");
81 if (_powerSupplyNode && (_powerSupplyNode->getDoubleValue() < _minimumSupplyVolts))
94 _minimumSupplyVolts = v;
99 return _powerButtonNode->getBoolValue();
void initServicePowerProperties(SGPropertyNode *node)
virtual bool isPowerSwitchOn() const
void setMinimumSupplyVolts(double v)
void readConfig(SGPropertyNode *config, std::string defaultName)
std::string nodePath() const
void setDefaultPowerSupplyPath(const std::string &p)
specify the default path to use to power the instrument, if it's non- standard.
bool isServiceableAndPowered() const
SGPropertyNode * fgGetNode(const char *path, bool create)
Get a property node.