AirspeedIndicator::AirspeedIndicator ( SGPropertyNode *node )
:
- name("airspeed-indicator"),
- num(0),
- pitot_port("/systems/pitot"),
- static_port("/systems/static")
+ _name(node->getStringValue("name", "airspeed-indicator")),
+ _num(node->getIntValue("number", 0)),
+ _total_pressure(node->getStringValue("total-pressure", "/systems/pitot/total-pressure-inhg")),
+ _static_pressure(node->getStringValue("static-pressure", "/systems/static/pressure-inhg"))
{
- int i;
- for ( i = 0; i < node->nChildren(); ++i ) {
- SGPropertyNode *child = node->getChild(i);
- string cname = child->getName();
- string cval = child->getStringValue();
- if ( cname == "name" ) {
- name = cval;
- } else if ( cname == "number" ) {
- num = child->getIntValue();
- } else if ( cname == "pitot-port" ) {
- pitot_port = cval;
- } else if ( cname == "static-port" ) {
- static_port = cval;
- } else {
- SG_LOG( SG_AUTOPILOT, SG_WARN, "Error in aispeed-indicator config logic" );
- if ( name.length() ) {
- SG_LOG( SG_AUTOPILOT, SG_WARN, "Section = " << name );
- }
- }
- }
-}
-
-
-AirspeedIndicator::AirspeedIndicator ( int i )
- :
- name("airspeed-indicator"),
- num(0),
- pitot_port("/systems/pitot"),
- static_port("/systems/static")
-{
- num = i;
}
AirspeedIndicator::~AirspeedIndicator ()
AirspeedIndicator::init ()
{
string branch;
- branch = "/instrumentation/" + name;
- pitot_port += "/total-pressure-inhg";
- static_port += "/pressure-inhg";
+ branch = "/instrumentation/" + _name;
- SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+ SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
_serviceable_node = node->getChild("serviceable", 0, true);
- _total_pressure_node = fgGetNode(pitot_port.c_str(), true);
- _static_pressure_node = fgGetNode(static_port.c_str(), true);
+ _total_pressure_node = fgGetNode(_total_pressure.c_str(), true);
+ _static_pressure_node = fgGetNode(_static_pressure.c_str(), true);
_density_node = fgGetNode("/environment/density-slugft3", true);
_speed_node = node->getChild("indicated-speed-kt", 0, true);
-
- _serviceable_node->setBoolValue(true);
}
#ifndef FPSTOKTS