From 1fd92702678bcf4a32f888fe3014c684e0235870 Mon Sep 17 00:00:00 2001 From: curt Date: Fri, 19 Nov 1999 02:10:24 +0000 Subject: [PATCH] Revamping I/O system. --- src/Main/Makefile.am | 6 +- src/Main/fg_init.cxx | 13 +- src/Main/fg_io.cxx | 405 ++++++++++++++++++++++++ src/Main/fg_io.hxx | 51 +++ src/Main/fg_serial.cxx | 641 -------------------------------------- src/Main/fg_serial.hxx | 100 ------ src/Main/main.cxx | 6 +- src/Main/options.cxx | 56 ++-- src/Main/options.hxx | 21 +- src/Network/Makefile.am | 9 +- src/Network/fg_file.cxx | 111 +++++++ src/Network/fg_file.hxx | 76 +++++ src/Network/fg_serial.cxx | 258 +++++++++++++++ src/Network/fg_serial.hxx | 82 +++++ src/Network/garmin.cxx | 405 ++++++++++++++++++++++++ src/Network/garmin.hxx | 63 ++++ src/Network/iochannel.cxx | 62 ++++ src/Network/iochannel.hxx | 59 ++++ src/Network/nmea.cxx | 502 +++++++++++++++++++++++++++++ src/Network/nmea.hxx | 63 ++++ src/Network/protocol.cxx | 76 +++++ src/Network/protocol.hxx | 123 ++++++++ 22 files changed, 2397 insertions(+), 791 deletions(-) create mode 100644 src/Main/fg_io.cxx create mode 100644 src/Main/fg_io.hxx delete mode 100644 src/Main/fg_serial.cxx delete mode 100644 src/Main/fg_serial.hxx create mode 100644 src/Network/fg_file.cxx create mode 100644 src/Network/fg_file.hxx create mode 100644 src/Network/fg_serial.cxx create mode 100644 src/Network/fg_serial.hxx create mode 100644 src/Network/garmin.cxx create mode 100644 src/Network/garmin.hxx create mode 100644 src/Network/iochannel.cxx create mode 100644 src/Network/iochannel.hxx create mode 100644 src/Network/nmea.cxx create mode 100644 src/Network/nmea.hxx create mode 100644 src/Network/protocol.cxx create mode 100644 src/Network/protocol.hxx diff --git a/src/Main/Makefile.am b/src/Main/Makefile.am index dec1571d3..4b0038698 100644 --- a/src/Main/Makefile.am +++ b/src/Main/Makefile.am @@ -25,13 +25,15 @@ bin_SCRIPTS = runfgfs runfgfs.bat fgfs_SOURCES = \ fg_init.cxx fg_init.hxx \ - fg_serial.cxx fg_serial.hxx \ + fg_io.cxx fg_io.hxx \ keyboard.cxx keyboard.hxx \ main.cxx \ options.cxx options.hxx \ splash.cxx splash.hxx \ views.cxx views.hxx +# fg_serial.cxx fg_serial.hxx \ + fgfs_LDADD = \ $(top_builddir)/Simulator/Aircraft/libAircraft.a \ $(top_builddir)/Simulator/Astro/libAstro.a \ @@ -40,7 +42,6 @@ fgfs_LDADD = \ $(top_builddir)/Simulator/Controls/libControls.a \ $(top_builddir)/Simulator/FDM/libFlight.a \ $(top_builddir)/Simulator/FDM/Balloon/libBalloon.a \ - $(top_builddir)/Simulator/FDM/External/libExternal.a \ $(top_builddir)/Simulator/FDM/JSBsim/libJSBsim.a \ $(top_builddir)/Simulator/FDM/LaRCsim/libLaRCsim.a \ $(top_builddir)/Simulator/GUI/libGUI.a \ @@ -56,7 +57,6 @@ fgfs_LDADD = \ $(top_builddir)/Lib/Screen/libScreen.a \ $(top_builddir)/Lib/Math/libMath.a \ $(top_builddir)/Lib/Bucket/libBucket.a \ - $(top_builddir)/Lib/Voronoi/libVoronoi.a \ $(top_builddir)/Lib/Debug/libDebug.a \ -lpu -lfnt -lssg -lsg \ $(top_builddir)/Lib/Misc/libMisc.a \ diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 542273cdb..6aac3191b 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -82,9 +83,9 @@ #endif #include "fg_init.hxx" +#include "fg_io.hxx" #include "options.hxx" #include "views.hxx" -#include "fg_serial.hxx" #if defined(FX) && defined(XMESA) #include @@ -181,7 +182,10 @@ bool fgInitPosition( void ) { // General house keeping initializations bool fgInitGeneral( void ) { string root; + +#if defined(FX) && defined(XMESA) char *mesa_win_state; +#endif FG_LOG( FG_GENERAL, FG_INFO, "General Initialization" ); FG_LOG( FG_GENERAL, FG_INFO, "======= ==============" ); @@ -238,6 +242,9 @@ bool fgInitSubsystems( void ) { } else if ( current_options.get_flight_model() == FGInterface::FG_MAGICCARPET ) { cur_fdm_state = new FGMagicCarpet; + } else if ( current_options.get_flight_model() == + FGInterface::FG_EXTERNAL ) { + cur_fdm_state = new FGExternal; } else { FG_LOG( FG_GENERAL, FG_ALERT, "No flight model, can't init aircraft" ); @@ -499,9 +506,9 @@ bool fgInitSubsystems( void ) { // Autopilot init added here, by Jeff Goeke-Smith fgAPInit(¤t_aircraft); - // Initialize serial ports + // Initialize I/O channels #if ! defined( MACOS ) - fgSerialInit(); + fgIOInit(); #endif FG_LOG( FG_GENERAL, FG_INFO, endl); diff --git a/src/Main/fg_io.cxx b/src/Main/fg_io.cxx new file mode 100644 index 000000000..36a95295c --- /dev/null +++ b/src/Main/fg_io.cxx @@ -0,0 +1,405 @@ +// fg_io.cxx -- higher level I/O channel management routines +// +// Written by Curtis Olson, started November 1999. +// +// Copyright (C) 1999 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 + +// #ifdef FG_HAVE_STD_INCLUDES +// # include +// # include // atoi() +// #else +// # include +// # include // atoi() +// #endif + +#include STL_STRING +// #include STL_IOSTREAM +// #include + +#include +// #include +// #include +#include +#include
+ +#include +#include +#include + +#include +#include +#include + +// #include