/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Module: FGOutputFG.cpp Author: Bertrand Coconnier Date started: 09/10/11 Purpose: Manage output of sim parameters to FlightGear Called by: FGOutput ------------- Copyright (C) 2011 Bertrand Coconnier ------------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Further information about the GNU Lesser General Public License can also be found on the world wide web at http://www.gnu.org. FUNCTIONAL DESCRIPTION -------------------------------------------------------------------------------- This is the place where you create output routines to dump data for perusal later. HISTORY -------------------------------------------------------------------------------- 11/09/07 HDW Added FlightGear Socket Interface 09/10/11 BC Moved the FlightGear socket in a separate class %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% INCLUDES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ #include #include "FGOutputFG.h" #include "FGXMLElement.h" #include "models/FGAuxiliary.h" #include "models/FGPropulsion.h" #include "models/FGFCS.h" #include "models/propulsion/FGPiston.h" #include "models/propulsion/FGElectric.h" #include "models/propulsion/FGTank.h" #if defined(WIN32) && !defined(__CYGWIN__) # include #else # include // htonl() ntohl() #endif #if !defined (min) # define min(X,Y) XGetDebugLevel() > 0) { // Engine status if (Propulsion->GetNumEngines() > FGNetFDM::FG_MAX_ENGINES) cerr << "This vehicle has " << Propulsion->GetNumEngines() << " engines, but the current " << endl << "version of FlightGear's FGNetFDM only supports " << FGNetFDM::FG_MAX_ENGINES << " engines." << endl << "Only the first " << FGNetFDM::FG_MAX_ENGINES << " engines will be used." << endl; // Consumables if (Propulsion->GetNumTanks() > FGNetFDM::FG_MAX_TANKS) cerr << "This vehicle has " << Propulsion->GetNumTanks() << " tanks, but the current " << endl << "version of FlightGear's FGNetFDM only supports " << FGNetFDM::FG_MAX_TANKS << " tanks." << endl << "Only the first " << FGNetFDM::FG_MAX_TANKS << " tanks will be used." << endl; // Gear status if (GroundReactions->GetNumGearUnits() > FGNetFDM::FG_MAX_WHEELS) cerr << "This vehicle has " << GroundReactions->GetNumGearUnits() << " bogeys, but the current " << endl << "version of FlightGear's FGNetFDM only supports " << FGNetFDM::FG_MAX_WHEELS << " bogeys." << endl << "Only the first " << FGNetFDM::FG_MAX_WHEELS << " bogeys will be used." << endl; } } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% bool FGOutputFG::Load(Element* el) { if (!FGOutputSocket::Load(el)) { return false; } // Check if there is a