+ "Version mismatch with raw controls packet format." );
+ SG_LOG( SG_IO, SG_ALERT,
+ "FlightGear needs version = " << FG_NET_CTRLS_VERSION
+ << " but is receiving version = " << net->version );
+ }
+ node = fgGetNode("/controls/flight", true);
+ node->setDoubleValue( "aileron", net->aileron );
+ node->setDoubleValue( "elevator", net->elevator );
+ node->setDoubleValue( "elevator-trim", net->elevator_trim );
+ node->setDoubleValue( "rudder", net->rudder );
+ node->setDoubleValue( "flaps", net->flaps );
+ fgSetBool( "/systems/electrical/outputs/flaps", net->flaps_power );
+ node->setBoolValue( "flaps-serviceable", net->flap_motor_ok );
+
+ for ( i = 0; i < FGNetCtrls::FG_MAX_ENGINES; ++i ) {
+ // Controls
+ node = fgGetNode("/controls/engines/engine", i);
+ node->getChild( "throttle" )->setDoubleValue( net->throttle[i] );
+ node->getChild( "mixture" )->setDoubleValue( net->mixture[i] );
+ node->getChild( "propeller-pitch" )
+ ->setDoubleValue( net->prop_advance[i] );
+ node->getChild( "condition" )
+ ->setDoubleValue( net->condition[i] );
+ node->getChild( "magnetos" )->setDoubleValue( net->magnetos[i] );
+
+ // Faults
+ SGPropertyNode *faults = node->getNode( "faults", true );
+ faults->setBoolValue( "serviceable", net->engine_ok[i] );
+ faults->setBoolValue( "left-magneto-serviceable",
+ net->mag_left_ok[i] );
+ faults->setBoolValue( "right-magneto-serviceable",
+ net->mag_right_ok[i]);
+ faults->setBoolValue( "spark-plugs-serviceable",
+ net->spark_plugs_ok[i] );
+ faults->setIntValue( "oil-pressure-status", net->oil_press_status[i] );
+ faults->setBoolValue( "fuel-pump-serviceable", net->fuel_pump_ok[i] );
+ }
+
+ fgSetBool( "/systems/electrical/outputs/fuel-pump",
+ net->fuel_pump_power[0] );
+ fgSetBool( "/systems/electrical/outputs/starter",
+ net->starter_power[0] );
+
+ for ( i = 0; i < FGNetCtrls::FG_MAX_TANKS; ++i ) {
+ node = fgGetNode( "/controls/fuel/tank", i );
+ node->getChild( "fuel_selector" )
+ ->setBoolValue( net->fuel_selector[i] );
+ }
+ node = fgGetNode( "/controls/gear" );
+ if ( node != NULL ) {
+ node->getChild( "brake-left" )->setDoubleValue( net->brake_left );
+ node->getChild( "brake-right" )->setDoubleValue( net->brake_right );
+ node->getChild( "copilot-brake-left" )
+ ->setDoubleValue( net->copilot_brake_left );
+ node->getChild( "copilot-brake-right" )
+ ->setDoubleValue( net->copilot_brake_right );
+ node->getChild( "brake-parking" )->setDoubleValue( net->brake_parking );
+ }
+
+ node = fgGetNode( "/controls/gear", true );
+ node->setBoolValue( "gear-down", net->gear_handle );
+
+ node = fgGetNode( "/controls/switches", true );
+ node->setBoolValue( "master-bat", net->master_bat );
+ node->setBoolValue( "master-alt", net->master_alt );
+ node->setBoolValue( "master-avionics", net->master_avionics );
+
+ node = fgGetNode( "/environment", true );
+ node->setDoubleValue( "wind-speed-kt", net->wind_speed_kt );
+ node->setDoubleValue( "wind-from-heading-deg", net->wind_dir_deg );
+ node->setDoubleValue( "turbulence/magnitude-norm", net->turbulence_norm );
+ node->setBoolValue( "magnetic-variation-deg", net->magvar );
+
+ node->setDoubleValue( "/environment/temperature-degc",
+ net->temp_c );
+ node->setDoubleValue( "/environment/pressure-sea-level-inhg",
+ net->press_inhg );
+
+ // ground elevation ???
+
+ fgSetDouble("/hazards/icing/wing", net->icing);
+
+ fgSetInt( "/sim/speed-up", net->speedup );
+
+ if ( honor_freezes ) {
+ node = fgGetNode( "/sim/freeze", true );
+ node->setBoolValue( "master", net->freeze & 0x01 );
+ node->setBoolValue( "position", net->freeze & 0x02 );
+ node->setBoolValue( "fuel", net->freeze & 0x04 );