net->master_alt = node->getChild("master-alt")->getBoolValue();
net->master_avionics = node->getChild("master-avionics")->getBoolValue();
+ net->wind_speed_kt = fgGetDouble("/environment/wind-speed-kt");
+ net->wind_dir_deg = fgGetDouble("/environment/wind-from-heading-deg");
+
// cur_fdm_state->get_ground_elev_ft() is what we want ... this
// reports the altitude of the aircraft.
// "/environment/ground-elevation-m" reports the ground elevation
net->hground = cur_fdm_state->get_ground_elev_ft() * SG_FEET_TO_METER;
net->magvar = fgGetDouble("/environment/magnetic-variation-deg");
net->speedup = fgGetInt("/sim/speed-up");
+ net->freeze = 0;
+ if ( fgGetBool("/sim/freeze/master") ) {
+ net->freeze |= 0x01;
+ }
+ if ( fgGetBool("/sim/freeze/position") ) {
+ net->freeze |= 0x02;
+ }
+ if ( fgGetBool("/sim/freeze/fuel") ) {
+ net->freeze |= 0x04;
+ }
// convert to network byte order
net->version = htonl(net->version);
net->master_bat = htonl(net->master_bat);
net->master_alt = htonl(net->master_alt);
net->master_avionics = htonl(net->master_avionics);
+ htond(net->wind_speed_kt);
+ htond(net->wind_dir_deg);
htond(net->hground);
htond(net->magvar);
net->speedup = htonl(net->speedup);
+ net->freeze = htonl(net->freeze);
}
double lon = fgGetDouble( "/position/longitude-deg" );
double lat = fgGetDouble( "/position/latitude-deg" );
+ double alt = fgGetDouble( "/position/altitude-ft" );
double ground = fgGetDouble( "/environment/ground-elevation-m" );
double heading = fgGetDouble("/orientation/heading-deg");
+ double speed = fgGetDouble( "/velocities/airspeed-kt" );
char cmd[256];
while ( !http->isDone(1000000) ) http->poll(0);
delete http;
+ sprintf( cmd, "/altitude-ft?value=%.8f", alt );
+ http = new HTTPClient( fdm_host.c_str(), cmd_port, cmd );
+ while ( !http->isDone(1000000) ) http->poll(0);
+ delete http;
+
sprintf( cmd, "/ground-m?value=%.8f", ground );
http = new HTTPClient( fdm_host.c_str(), cmd_port, cmd );
while ( !http->isDone(1000000) ) http->poll(0);
delete http;
+ sprintf( cmd, "/speed-kts?value=%.8f", speed );
+ http = new HTTPClient( fdm_host.c_str(), cmd_port, cmd );
+ while ( !http->isDone(1000000) ) http->poll(0);
+ delete http;
+
sprintf( cmd, "/heading-deg?value=%.8f", heading );
http = new HTTPClient( fdm_host.c_str(), cmd_port, cmd );
while ( !http->isDone(1000000) ) http->poll(0);
SG_LOG( SG_IO, SG_INFO, "before sending reset command." );
- sprintf( cmd, "/reset?value=ground" );
+ if( fgGetBool("/sim/startup/onground") ) {
+ sprintf( cmd, "/reset?value=ground" );
+ } else {
+ sprintf( cmd, "/reset?value=air" );
+ }
http = new HTTPClient( fdm_host.c_str(), cmd_port, cmd );
while ( !http->isDone(1000000) ) http->poll(0);
delete http;