// Modified by Cdr. VS Renganthan <vsranga@ada.ernet.in>, 12 Oct 2K
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include <simgear/io/iochannel.hxx>
+#include <simgear/io/sg_socket.hxx>
#include <simgear/constants.h>
#include <Controls/controls.hxx>
FGADA::FGADA( double dt ) {
- set_delta_t( dt );
+// set_delta_t( dt );
}
// for each subsequent iteration through the EOM
void FGADA::init() {
- // explicitly call the superclass's
- // init() method first.
- FGInterface::init();
+ //do init common to all FDM"s
+ common_init();
+
+ //now do ADA-specific init.
// cout << "FGADA::init()" << endl;
copy_to_FGADA();
// Write FGExternal structure from socket to establish connection
int result = fdmsock->write(OutBuffer, nbytes);
- printf("Connection established.\n");
+ printf("Connection established = %d.\n", result);
}
}
// Run an iteration of the EOM. This is essentially a NOP here
// because these values are getting filled in elsewhere based on
// external input.
-bool FGADA::update( int multiloop ) {
+void FGADA::update( double dt ) {
// cout << "FGADA::update()" << endl;
+ if (is_suspended())
+ return;
+
char Buffer[numberofbytes];
char OutBuffer[nbytes];
copy_to_FGADA();
fgGetDouble("/sim/view/offset",view_offset);
- if ( view_offset == 0.0) {
- memcpy (&OutBuffer, &visuals_to_sixdof, sizeof (OutBuffer));
- int result = fdmsock->write(OutBuffer, nbytes);
- }
-
- return true;
+ if ( view_offset == 0.0) {
+ memcpy (&OutBuffer, &visuals_to_sixdof, sizeof (OutBuffer));
+ fdmsock->write(OutBuffer, nbytes);
+ }
}
// Convert from the FGInterface struct to the FGADA struct (output)
bool FGADA::copy_to_FGADA () {
- ground_elevation = scenery.get_cur_elev();
+ ground_elevation = globals->get_scenery()->get_cur_elev();
return true;
}