2001-11-25 00:32:58 +00:00
|
|
|
// ExternalNet.hxx -- an net interface to an external flight dynamics model
|
|
|
|
//
|
|
|
|
// Written by Curtis Olson, started November 2001.
|
|
|
|
//
|
|
|
|
// Copyright (C) 2001 Curtis L. Olson - curt@flightgear.org
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
|
|
|
|
#include <simgear/debug/logstream.hxx>
|
2002-03-13 06:07:07 +00:00
|
|
|
#include <simgear/io/lowlevel.hxx> // endian tests
|
|
|
|
|
|
|
|
#include <Main/fg_props.hxx>
|
2001-11-25 00:32:58 +00:00
|
|
|
|
|
|
|
#include "ExternalNet.hxx"
|
|
|
|
|
|
|
|
|
2002-03-13 06:07:07 +00:00
|
|
|
// FreeBSD works better with this included last ... (?)
|
|
|
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
|
|
|
# include <windows.h>
|
|
|
|
#else
|
|
|
|
# include <netinet/in.h> // htonl() ntohl()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// The function htond is defined this way due to the way some
|
|
|
|
// processors and OSes treat floating point values. Some will raise
|
|
|
|
// an exception whenever a "bad" floating point value is loaded into a
|
|
|
|
// floating point register. Solaris is notorious for this, but then
|
|
|
|
// so is LynxOS on the PowerPC. By translating the data in place,
|
|
|
|
// there is no need to load a FP register with the "corruped" floating
|
|
|
|
// point value. By doing the BIG_ENDIAN test, I can optimize the
|
|
|
|
// routine for big-endian processors so it can be as efficient as
|
|
|
|
// possible
|
|
|
|
static void htond (double &x)
|
|
|
|
{
|
|
|
|
if ( sgIsLittleEndian() ) {
|
|
|
|
int *Double_Overlay;
|
|
|
|
int Holding_Buffer;
|
|
|
|
|
|
|
|
Double_Overlay = (int *) &x;
|
|
|
|
Holding_Buffer = Double_Overlay [0];
|
|
|
|
|
|
|
|
Double_Overlay [0] = htonl (Double_Overlay [1]);
|
|
|
|
Double_Overlay [1] = htonl (Holding_Buffer);
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void global2raw( FGRawCtrls *raw ) {
|
|
|
|
int i;
|
|
|
|
|
|
|
|
// fill in values
|
2002-04-08 19:57:45 +00:00
|
|
|
SGPropertyNode * node = fgGetNode("/controls", true);
|
2002-03-13 06:07:07 +00:00
|
|
|
raw->version = FG_RAW_CTRLS_VERSION;
|
2002-04-08 19:57:45 +00:00
|
|
|
raw->aileron = node->getDoubleValue( "aileron" );
|
|
|
|
raw->elevator = node->getDoubleValue( "elevator" );
|
|
|
|
raw->elevator_trim = node->getDoubleValue( "elevator-trim" );
|
|
|
|
raw->rudder = node->getDoubleValue( "rudder" );
|
|
|
|
raw->flaps = node->getDoubleValue( "flaps" );
|
2002-07-30 04:37:16 +00:00
|
|
|
raw->num_engines = FGRawCtrls::FG_MAX_ENGINES;
|
2002-04-08 19:57:45 +00:00
|
|
|
for ( i = 0; i < FGRawCtrls::FG_MAX_ENGINES; ++i ) {
|
2002-05-10 23:35:06 +00:00
|
|
|
raw->throttle[i] = node->getDoubleValue( "throttle", 0.0 );
|
|
|
|
raw->mixture[i] = node->getDoubleValue( "mixture", 0.0 );
|
|
|
|
raw->prop_advance[i] = node->getDoubleValue( "propeller-pitch", 0.0 );
|
|
|
|
raw->magnetos[i] = node->getIntValue( "magnetos", 0 );
|
2002-06-05 05:22:42 +00:00
|
|
|
if ( i == 0 ) {
|
|
|
|
// cout << "Magnetos -> " << node->getIntValue( "magnetos", 0 );
|
|
|
|
}
|
2002-05-10 23:35:06 +00:00
|
|
|
raw->starter[i] = node->getBoolValue( "starter", false );
|
2002-06-05 05:22:42 +00:00
|
|
|
if ( i == 0 ) {
|
|
|
|
// cout << " Starter -> " << node->getIntValue( "stater", false )
|
|
|
|
// << endl;
|
|
|
|
}
|
2002-03-13 06:07:07 +00:00
|
|
|
}
|
2002-07-30 04:37:16 +00:00
|
|
|
raw->num_tanks = FGRawCtrls::FG_MAX_TANKS;
|
2002-07-05 19:04:04 +00:00
|
|
|
for ( i = 0; i < FGRawCtrls::FG_MAX_TANKS; ++i ) {
|
2002-07-30 04:37:16 +00:00
|
|
|
if ( node->getChild("fuel-selector", i) != 0 ) {
|
|
|
|
raw->fuel_selector[i]
|
|
|
|
= node->getChild("fuel-selector", i)->getDoubleValue();
|
|
|
|
} else {
|
|
|
|
raw->fuel_selector[i] = false;
|
|
|
|
}
|
2002-07-05 19:04:04 +00:00
|
|
|
}
|
2002-07-30 04:37:16 +00:00
|
|
|
raw->num_wheels = FGRawCtrls::FG_MAX_WHEELS;
|
2002-04-08 19:57:45 +00:00
|
|
|
for ( i = 0; i < FGRawCtrls::FG_MAX_WHEELS; ++i ) {
|
2002-07-30 04:37:16 +00:00
|
|
|
if ( node->getChild("brakes", i) != 0 ) {
|
|
|
|
raw->brake[i]
|
|
|
|
= node->getChild("brakes", i)->getDoubleValue();
|
|
|
|
} else {
|
|
|
|
raw->brake[i] = 0.0;
|
|
|
|
}
|
2002-03-13 06:07:07 +00:00
|
|
|
}
|
|
|
|
raw->hground = fgGetDouble( "/environment/ground-elevation-m" );
|
2002-03-27 05:21:38 +00:00
|
|
|
raw->magvar = fgGetDouble("/environment/magnetic-variation-deg");
|
|
|
|
raw->speedup = fgGetInt("/sim/speed-up");
|
2002-03-13 06:07:07 +00:00
|
|
|
|
|
|
|
// convert to network byte order
|
|
|
|
raw->version = htonl(raw->version);
|
|
|
|
htond(raw->aileron);
|
|
|
|
htond(raw->elevator);
|
|
|
|
htond(raw->elevator_trim);
|
|
|
|
htond(raw->rudder);
|
|
|
|
htond(raw->flaps);
|
2002-04-08 19:57:45 +00:00
|
|
|
for ( i = 0; i < FGRawCtrls::FG_MAX_ENGINES; ++i ) {
|
2002-03-13 06:07:07 +00:00
|
|
|
htond(raw->throttle[i]);
|
|
|
|
htond(raw->mixture[i]);
|
|
|
|
htond(raw->prop_advance[i]);
|
2002-07-05 19:04:04 +00:00
|
|
|
raw->magnetos[i] = htonl(raw->magnetos[i]);
|
|
|
|
raw->starter[i] = htonl(raw->starter[i]);
|
|
|
|
}
|
2002-07-30 04:37:16 +00:00
|
|
|
raw->num_engines = htonl(raw->num_engines);
|
2002-07-05 19:04:04 +00:00
|
|
|
for ( i = 0; i < FGRawCtrls::FG_MAX_TANKS; ++i ) {
|
|
|
|
raw->fuel_selector[i] = htonl(raw->fuel_selector[i]);
|
2002-03-13 06:07:07 +00:00
|
|
|
}
|
2002-07-30 04:37:16 +00:00
|
|
|
raw->num_tanks = htonl(raw->num_tanks);
|
2002-04-08 19:57:45 +00:00
|
|
|
for ( i = 0; i < FGRawCtrls::FG_MAX_WHEELS; ++i ) {
|
2002-03-13 06:07:07 +00:00
|
|
|
htond(raw->brake[i]);
|
|
|
|
}
|
2002-07-30 04:37:16 +00:00
|
|
|
raw->num_wheels = htonl(raw->num_wheels);
|
2002-03-13 06:07:07 +00:00
|
|
|
htond(raw->hground);
|
2002-03-27 05:21:38 +00:00
|
|
|
htond(raw->magvar);
|
|
|
|
raw->speedup = htonl(raw->speedup);
|
2002-03-13 06:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void net2global( FGNetFDM *net ) {
|
2002-04-08 19:57:45 +00:00
|
|
|
int i;
|
|
|
|
|
2002-03-13 06:07:07 +00:00
|
|
|
// Convert to the net buffer from network format
|
|
|
|
net->version = ntohl(net->version);
|
2002-04-08 19:57:45 +00:00
|
|
|
|
2002-03-13 06:07:07 +00:00
|
|
|
htond(net->longitude);
|
|
|
|
htond(net->latitude);
|
|
|
|
htond(net->altitude);
|
|
|
|
htond(net->phi);
|
|
|
|
htond(net->theta);
|
|
|
|
htond(net->psi);
|
2002-04-08 19:57:45 +00:00
|
|
|
|
2002-03-27 05:21:38 +00:00
|
|
|
htond(net->phidot);
|
|
|
|
htond(net->thetadot);
|
|
|
|
htond(net->psidot);
|
2002-03-13 06:07:07 +00:00
|
|
|
htond(net->vcas);
|
|
|
|
htond(net->climb_rate);
|
2002-04-08 19:57:45 +00:00
|
|
|
|
2002-03-27 05:21:38 +00:00
|
|
|
htond(net->A_X_pilot);
|
|
|
|
htond(net->A_Y_pilot);
|
|
|
|
htond(net->A_Z_pilot);
|
2002-04-08 19:57:45 +00:00
|
|
|
|
|
|
|
net->num_engines = htonl(net->num_engines);
|
|
|
|
for ( i = 0; i < net->num_engines; ++i ) {
|
|
|
|
htonl(net->eng_state[i]);
|
|
|
|
htond(net->rpm[i]);
|
|
|
|
htond(net->fuel_flow[i]);
|
|
|
|
htond(net->EGT[i]);
|
|
|
|
htond(net->oil_temp[i]);
|
|
|
|
htond(net->oil_px[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
net->num_tanks = htonl(net->num_tanks);
|
|
|
|
for ( i = 0; i < net->num_tanks; ++i ) {
|
|
|
|
htond(net->fuel_quantity[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
net->num_wheels = htonl(net->num_wheels);
|
2002-05-10 23:35:06 +00:00
|
|
|
// I don't need to convert the Wow flags, since they are one byte in size
|
2002-06-03 23:35:43 +00:00
|
|
|
htond(net->flap_deflection);
|
2002-04-08 19:57:45 +00:00
|
|
|
|
2002-03-13 06:07:07 +00:00
|
|
|
net->cur_time = ntohl(net->cur_time);
|
|
|
|
net->warp = ntohl(net->warp);
|
|
|
|
htond(net->visibility);
|
|
|
|
|
|
|
|
if ( net->version == FG_NET_FDM_VERSION ) {
|
|
|
|
// cout << "pos = " << net->longitude << " " << net->latitude << endl;
|
2002-04-08 19:57:45 +00:00
|
|
|
// cout << "sea level rad = " << cur_fdm_state->get_Sea_level_radius()
|
|
|
|
// << endl;
|
2002-03-13 06:07:07 +00:00
|
|
|
cur_fdm_state->_updateGeodeticPosition( net->latitude,
|
|
|
|
net->longitude,
|
|
|
|
net->altitude
|
|
|
|
* SG_METER_TO_FEET );
|
|
|
|
cur_fdm_state->_set_Euler_Angles( net->phi,
|
|
|
|
net->theta,
|
|
|
|
net->psi );
|
2002-03-27 05:21:38 +00:00
|
|
|
cur_fdm_state->_set_Euler_Rates( net->phidot,
|
|
|
|
net->thetadot,
|
|
|
|
net->psidot );
|
2002-03-13 06:07:07 +00:00
|
|
|
cur_fdm_state->_set_V_calibrated_kts( net->vcas );
|
|
|
|
cur_fdm_state->_set_Climb_Rate( net->climb_rate );
|
2002-03-27 05:21:38 +00:00
|
|
|
cur_fdm_state->_set_Accels_Pilot_Body( net->A_X_pilot,
|
|
|
|
net->A_Y_pilot,
|
|
|
|
net->A_Z_pilot );
|
2002-04-08 19:57:45 +00:00
|
|
|
|
|
|
|
for ( i = 0; i < net->num_engines; ++i ) {
|
|
|
|
SGPropertyNode *node = fgGetNode( "engines/engine", i, true );
|
|
|
|
|
|
|
|
// node->setBoolValue("running", t->isRunning());
|
|
|
|
// node->setBoolValue("cranking", t->isCranking());
|
|
|
|
|
|
|
|
// cout << net->eng_state[i] << endl;
|
|
|
|
if ( net->eng_state[i] == 0 ) {
|
|
|
|
node->setBoolValue( "cranking", false );
|
|
|
|
node->setBoolValue( "running", false );
|
|
|
|
} else if ( net->eng_state[i] == 1 ) {
|
|
|
|
node->setBoolValue( "cranking", true );
|
|
|
|
node->setBoolValue( "running", false );
|
|
|
|
} else if ( net->eng_state[i] == 2 ) {
|
|
|
|
node->setBoolValue( "cranking", false );
|
|
|
|
node->setBoolValue( "running", true );
|
|
|
|
}
|
|
|
|
|
|
|
|
node->setDoubleValue( "rpm", net->rpm[i] );
|
|
|
|
node->setDoubleValue( "fuel-flow-gph", net->fuel_flow[i] );
|
|
|
|
node->setDoubleValue( "egt-degf", net->EGT[i] );
|
|
|
|
node->setDoubleValue( "oil-temperature-degf", net->oil_temp[i] );
|
|
|
|
node->setDoubleValue( "oil-pressure-psi", net->oil_px[i] );
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < net->num_tanks; ++i ) {
|
|
|
|
SGPropertyNode * node
|
|
|
|
= fgGetNode("/consumables/fuel/tank", i, true);
|
|
|
|
node->setDoubleValue("level-gal_us", net->fuel_quantity[i] );
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < net->num_wheels; ++i ) {
|
|
|
|
SGPropertyNode * node
|
|
|
|
= fgGetNode("/gear/gear", i, true);
|
|
|
|
node->setDoubleValue("wow", net->wow[i] );
|
|
|
|
}
|
|
|
|
|
2002-06-03 23:35:43 +00:00
|
|
|
fgSetDouble("/surface-positions/flap-pos-norm", net->flap_deflection);
|
2002-06-05 05:22:42 +00:00
|
|
|
SGPropertyNode * node = fgGetNode("/controls", true);
|
|
|
|
fgSetDouble("/surface-positions/elevator-pos-norm",
|
|
|
|
node->getDoubleValue( "elevator" ));
|
|
|
|
fgSetDouble("/surface-positions/rudder-pos-norm",
|
|
|
|
node->getDoubleValue( "rudder" ));
|
|
|
|
fgSetDouble("/surface-positions/left-aileron-pos-norm",
|
|
|
|
node->getDoubleValue( "aileron" ));
|
|
|
|
fgSetDouble("/surface-positions/right-aileron-pos-norm",
|
|
|
|
-node->getDoubleValue( "aileron" ));
|
2002-06-03 23:35:43 +00:00
|
|
|
|
2002-03-13 06:07:07 +00:00
|
|
|
/* these are ignored for now ... */
|
|
|
|
/*
|
|
|
|
if ( net->cur_time ) {
|
|
|
|
fgSetLong("/sim/time/cur-time-override", net->cur_time);
|
|
|
|
}
|
|
|
|
|
|
|
|
globals->set_warp( net->warp );
|
|
|
|
last_warp = net->warp;
|
|
|
|
*/
|
|
|
|
} else {
|
|
|
|
SG_LOG( SG_IO, SG_ALERT, "Error: version mismatch in net2global()" );
|
|
|
|
SG_LOG( SG_IO, SG_ALERT,
|
|
|
|
"\tread " << net->version << " need " << FG_NET_FDM_VERSION );
|
|
|
|
SG_LOG( SG_IO, SG_ALERT,
|
|
|
|
"\tsomeone needs to upgrade net_fdm.hxx and recompile." );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-04-11 05:39:56 +00:00
|
|
|
FGExternalNet::FGExternalNet( double dt, string host, int dop, int dip, int cp )
|
2002-03-13 06:07:07 +00:00
|
|
|
{
|
2002-05-11 16:28:50 +00:00
|
|
|
// set_delta_t( dt );
|
2001-11-25 00:32:58 +00:00
|
|
|
|
|
|
|
valid = true;
|
|
|
|
|
2002-03-13 06:07:07 +00:00
|
|
|
data_in_port = dip;
|
|
|
|
data_out_port = dop;
|
|
|
|
cmd_port = cp;
|
|
|
|
fdm_host = host;
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////
|
|
|
|
// Setup client udp connection (sends data to remote fdm)
|
|
|
|
|
2001-11-25 00:32:58 +00:00
|
|
|
if ( ! data_client.open( false ) ) {
|
|
|
|
SG_LOG( SG_FLIGHT, SG_ALERT, "Error opening client data channel" );
|
|
|
|
valid = false;
|
|
|
|
}
|
2002-03-13 06:07:07 +00:00
|
|
|
|
2001-11-25 00:32:58 +00:00
|
|
|
// fire and forget
|
|
|
|
data_client.setBlocking( false );
|
|
|
|
|
2002-03-13 06:07:07 +00:00
|
|
|
if ( data_client.connect( fdm_host.c_str(), data_out_port ) == -1 ) {
|
|
|
|
printf("error connecting to %s:%d\n", fdm_host.c_str(), data_out_port);
|
|
|
|
valid = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////
|
|
|
|
// Setup server udp connection (for receiving data)
|
|
|
|
|
2001-11-25 00:32:58 +00:00
|
|
|
if ( ! data_server.open( false ) ) {
|
|
|
|
SG_LOG( SG_FLIGHT, SG_ALERT, "Error opening client server channel" );
|
|
|
|
valid = false;
|
|
|
|
}
|
2002-03-13 06:07:07 +00:00
|
|
|
|
2002-07-31 23:24:55 +00:00
|
|
|
// disable blocking
|
|
|
|
data_server.setBlocking( false );
|
|
|
|
|
|
|
|
// allowed to read from a broadcast addr
|
2002-08-05 18:29:25 +00:00
|
|
|
// data_server.setBroadcast( true );
|
2002-03-13 06:07:07 +00:00
|
|
|
|
|
|
|
// if we bind to fdm_host = "" then we accept messages from
|
|
|
|
// anyone.
|
2002-07-31 23:24:55 +00:00
|
|
|
if ( data_server.bind( "", data_in_port ) == -1 ) {
|
2002-03-13 06:07:07 +00:00
|
|
|
printf("error binding to port %d\n", data_in_port);
|
|
|
|
valid = false;
|
|
|
|
}
|
2001-11-25 00:32:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FGExternalNet::~FGExternalNet() {
|
|
|
|
data_client.close();
|
|
|
|
data_server.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Initialize the ExternalNet flight model, dt is the time increment
|
|
|
|
// for each subsequent iteration through the EOM
|
|
|
|
void FGExternalNet::init() {
|
|
|
|
// cout << "FGExternalNet::init()" << endl;
|
2002-02-05 15:57:46 +00:00
|
|
|
|
|
|
|
// Explicitly call the superclass's
|
|
|
|
// init method first.
|
|
|
|
common_init();
|
2002-03-13 06:07:07 +00:00
|
|
|
|
|
|
|
double lon = fgGetDouble( "/position/longitude-deg" );
|
|
|
|
double lat = fgGetDouble( "/position/latitude-deg" );
|
|
|
|
double ground = fgGetDouble( "/environment/ground-elevation-m" );
|
|
|
|
double heading = fgGetDouble("/orientation/heading-deg");
|
|
|
|
|
|
|
|
char cmd[256];
|
|
|
|
|
|
|
|
sprintf( cmd, "/longitude-deg?value=%.8f", lon );
|
|
|
|
new HTTPClient( fdm_host.c_str(), cmd_port, cmd );
|
2002-03-26 13:44:21 +00:00
|
|
|
// cout << "before loop()" << endl;
|
2002-03-13 06:07:07 +00:00
|
|
|
netChannel::loop(0);
|
2002-03-26 13:44:21 +00:00
|
|
|
// cout << "here" << endl;
|
2002-03-13 06:07:07 +00:00
|
|
|
|
|
|
|
sprintf( cmd, "/latitude-deg?value=%.8f", lat );
|
|
|
|
new HTTPClient( fdm_host.c_str(), cmd_port, cmd );
|
|
|
|
netChannel::loop(0);
|
|
|
|
|
|
|
|
sprintf( cmd, "/ground-m?value=%.8f", ground );
|
|
|
|
new HTTPClient( fdm_host.c_str(), cmd_port, cmd );
|
|
|
|
netChannel::loop(0);
|
|
|
|
|
|
|
|
sprintf( cmd, "/heading-deg?value=%.8f", heading );
|
|
|
|
new HTTPClient( fdm_host.c_str(), cmd_port, cmd );
|
|
|
|
netChannel::loop(0);
|
|
|
|
|
2002-07-31 23:24:55 +00:00
|
|
|
SG_LOG( SG_IO, SG_INFO, "before sending reset command." );
|
|
|
|
|
2002-03-13 06:07:07 +00:00
|
|
|
sprintf( cmd, "/reset?value=ground" );
|
|
|
|
new HTTPClient( fdm_host.c_str(), cmd_port, cmd );
|
|
|
|
netChannel::loop(0);
|
2002-07-31 23:24:55 +00:00
|
|
|
|
|
|
|
SG_LOG( SG_IO, SG_INFO, "Remote FDM init() finished." );
|
2001-11-25 00:32:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-06-05 05:22:42 +00:00
|
|
|
// Run an iteration of the EOM.
|
2002-05-11 16:28:50 +00:00
|
|
|
void FGExternalNet::update( double dt ) {
|
2002-03-13 06:07:07 +00:00
|
|
|
int length;
|
|
|
|
int result;
|
|
|
|
|
2002-05-11 16:28:50 +00:00
|
|
|
if (is_suspended())
|
|
|
|
return;
|
|
|
|
|
2002-03-13 06:07:07 +00:00
|
|
|
// Send control positions to remote fdm
|
|
|
|
length = sizeof(ctrls);
|
|
|
|
global2raw( &ctrls );
|
|
|
|
if ( data_client.send( (char *)(& ctrls), length, 0 ) != length ) {
|
2002-08-01 21:51:09 +00:00
|
|
|
SG_LOG( SG_IO, SG_DEBUG, "Error writing data." );
|
2002-07-30 04:37:16 +00:00
|
|
|
} else {
|
2002-08-01 21:51:09 +00:00
|
|
|
SG_LOG( SG_IO, SG_DEBUG, "wrote control data." );
|
2002-03-13 06:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Read next set of FDM data (blocking enabled to maintain 'sync')
|
|
|
|
length = sizeof(fdm);
|
2002-06-05 05:22:42 +00:00
|
|
|
while ( (result = data_server.recv( (char *)(& fdm), length, 0)) >= 0 ) {
|
2002-08-01 21:51:09 +00:00
|
|
|
SG_LOG( SG_IO, SG_DEBUG, "Success reading data." );
|
2002-03-13 06:07:07 +00:00
|
|
|
net2global( &fdm );
|
|
|
|
}
|
2001-11-25 00:32:58 +00:00
|
|
|
}
|