-bool FGNative::process() {
- FGIOChannel *io = get_io_channel();
- int length = sizeof(*cur_fdm_state);
-
- if ( get_direction() == out ) {
- // cout << "size of cur_fdm_state = " << length << endl;
- buf = *cur_fdm_state;
- if ( ! io->write( (char *)(& buf), length ) ) {
- FG_LOG( FG_IO, FG_ALERT, "Error writing data." );
- return false;
- }
- } else if ( get_direction() == in ) {
- if ( io->read( (char *)(& buf), length ) == length ) {
- FG_LOG( FG_IO, FG_ALERT, "Success reading data." );
- *cur_fdm_state = buf;
- } else {
- FG_LOG( FG_IO, FG_ALERT, "Error reading data." );
- return false;
- }
+bool FGNative::process()
+{
+ FDMShell* fdm = static_cast<FDMShell*>(globals->get_subsystem("flight"));
+ FGInterface* fdmState = fdm->getInterface();
+ if (!fdmState) {
+ return false;
+ }
+
+ SGIOChannel *io = get_io_channel();
+ if ( get_direction() == SG_IO_OUT ) {
+ return fdmState->writeState(io);
+ } else {
+ return fdmState->readState(io);