Bruce Hellstrom @ ATC Flight Sim.
New module contributed: AV400WSim. Supports communication with external (aka real) Garmin 400/500 WAAS flight sim units. Includes changes to options.cxx and fg_io.cxx to support invoking and configuring the new module.
This commit is contained in:
parent
65607d4a7b
commit
e81479d857
5 changed files with 1213 additions and 2 deletions
|
@ -46,6 +46,7 @@
|
|||
#include <Network/atlas.hxx>
|
||||
#include <Network/AV400.hxx>
|
||||
#include <Network/AV400Sim.hxx>
|
||||
#include <Network/AV400WSim.hxx>
|
||||
#include <Network/garmin.hxx>
|
||||
#include <Network/httpd.hxx>
|
||||
#ifdef FG_JPEG_SERVER
|
||||
|
@ -142,7 +143,13 @@ FGIO::parse_port_config( const string& config )
|
|||
} else if ( protocol == "AV400Sim" ) {
|
||||
FGAV400Sim *av400sim = new FGAV400Sim;
|
||||
io = av400sim;
|
||||
} else if ( protocol == "garmin" ) {
|
||||
} else if ( protocol == "AV400WSimA" ) {
|
||||
FGAV400WSimA *av400wsima = new FGAV400WSimA;
|
||||
io = av400wsima;
|
||||
} else if ( protocol == "AV400WSimB" ) {
|
||||
FGAV400WSimB *av400wsimb = new FGAV400WSimB;
|
||||
io = av400wsimb;
|
||||
} else if ( protocol == "garmin" ) {
|
||||
FGGarmin *garmin = new FGGarmin;
|
||||
io = garmin;
|
||||
} else if ( protocol == "httpd" ) {
|
||||
|
@ -263,6 +270,17 @@ FGIO::parse_port_config( const string& config )
|
|||
|
||||
SGSerial *ch = new SGSerial( device, baud );
|
||||
io->set_io_channel( ch );
|
||||
|
||||
if ( protocol == "AV400WSimB" ) {
|
||||
if ( tokens.size() < 7 ) {
|
||||
SG_LOG( SG_IO, SG_ALERT, "Missing second hz for AV400WSimB.");
|
||||
return NULL;
|
||||
}
|
||||
FGAV400WSimB *fgavb = static_cast<FGAV400WSimB*>(io);
|
||||
string hz2_str = tokens[6];
|
||||
double hz2 = atof(hz2_str.c_str());
|
||||
fgavb->set_hz2(hz2);
|
||||
}
|
||||
} else if ( medium == "file" ) {
|
||||
// file name
|
||||
if ( tokens.size() < 4) {
|
||||
|
|
|
@ -1467,6 +1467,8 @@ struct OptionDesc {
|
|||
{"opengc", true, OPTION_CHANNEL, "", false, "", 0 },
|
||||
{"AV400", true, OPTION_CHANNEL, "", false, "", 0 },
|
||||
{"AV400Sim", true, OPTION_CHANNEL, "", false, "", 0 },
|
||||
{"AV400WSimA", true, OPTION_CHANNEL, "", false, "", 0 },
|
||||
{"AV400WSimB", true, OPTION_CHANNEL, "", false, "", 0 },
|
||||
{"garmin", true, OPTION_CHANNEL, "", false, "", 0 },
|
||||
{"nmea", true, OPTION_CHANNEL, "", false, "", 0 },
|
||||
{"generic", true, OPTION_CHANNEL, "", false, "", 0 },
|
||||
|
|
1046
src/Network/AV400WSim.cxx
Normal file
1046
src/Network/AV400WSim.cxx
Normal file
File diff suppressed because it is too large
Load diff
144
src/Network/AV400WSim.hxx
Normal file
144
src/Network/AV400WSim.hxx
Normal file
|
@ -0,0 +1,144 @@
|
|||
// AV400Sim.hxx -- Garmin 400 series protocal class. This AV400Sim
|
||||
// protocol generates the set of "simulator" commands a garmin 400
|
||||
// series gps would expect as input in simulator mode. The AV400
|
||||
// protocol generates the set of commands that a garmin 400 series gps
|
||||
// would emit.
|
||||
//
|
||||
// Written by Curtis Olson, started Januar 2009.
|
||||
//
|
||||
// Copyright (C) 2009 Curtis L. Olson - http://www.flightgear.org/~curt
|
||||
//
|
||||
// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
|
||||
#ifndef _FG_AV400WSIM_HXX
|
||||
#define _FG_AV400WSIM_HXX
|
||||
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "protocol.hxx"
|
||||
|
||||
using std::string;
|
||||
|
||||
class FlightProperties;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Class FGAV400WSimA handles the input/output over the first serial port.
|
||||
// This is very similar to the way previous Garmin non-WAAS models communicated
|
||||
// but some items have been stripped out and just a minimal amount of
|
||||
// info is necessary to be transmitted over this port.
|
||||
|
||||
class FGAV400WSimA : public FGProtocol {
|
||||
|
||||
char buf[ FG_MAX_MSG_SIZE ];
|
||||
int length;
|
||||
|
||||
public:
|
||||
|
||||
FGAV400WSimA();
|
||||
~FGAV400WSimA();
|
||||
|
||||
bool gen_message();
|
||||
bool parse_message();
|
||||
|
||||
// open hailing frequencies
|
||||
bool open();
|
||||
|
||||
// process work for this port
|
||||
bool process();
|
||||
|
||||
// close the channel
|
||||
bool close();
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Class FGAV400WSimB handles the input/output over the second serial port
|
||||
// which Garmin refers to as the "GPS Port". Some messages are handled on
|
||||
// fixed cycle (usually 1 and 5 Hz) and some immediate responses are needed
|
||||
// to certain messages upon requet by the GPS unit
|
||||
|
||||
class FGAV400WSimB : public FGProtocol {
|
||||
|
||||
char buf[ FG_MAX_MSG_SIZE ];
|
||||
int length;
|
||||
double hz2;
|
||||
int hz2count;
|
||||
int hz2cycles;
|
||||
char flight_phase;
|
||||
string hal;
|
||||
string val;
|
||||
string sbas_sel;
|
||||
bool req_hostid;
|
||||
bool req_raimap;
|
||||
bool req_sbas;
|
||||
int outputctr;
|
||||
|
||||
FlightProperties* fdm;
|
||||
|
||||
static const int SOM_SIZE = 2;
|
||||
static const int DEG_TO_MILLIARCSECS = ( 60.0 * 60.0 * 1000 );
|
||||
|
||||
// Flight Phases
|
||||
static const int PHASE_OCEANIC = 4;
|
||||
static const int PHASE_ENROUTE = 5;
|
||||
static const int PHASE_TERM = 6;
|
||||
static const int PHASE_NONPREC = 7;
|
||||
static const int PHASE_LNAVVNAV = 8;
|
||||
static const int PHASE_LPVLP = 9;
|
||||
|
||||
public:
|
||||
|
||||
FGAV400WSimB();
|
||||
~FGAV400WSimB();
|
||||
|
||||
bool gen_hostid_message();
|
||||
bool gen_sbas_message();
|
||||
|
||||
bool gen_Wh_message();
|
||||
bool gen_Wx_message();
|
||||
|
||||
bool gen_Wt_message();
|
||||
bool gen_Wm_message();
|
||||
bool gen_Wv_message();
|
||||
|
||||
bool verify_checksum( string message, int datachars );
|
||||
string asciitize_message( string message );
|
||||
string buffer_to_string();
|
||||
bool parse_message();
|
||||
|
||||
// open hailing frequencies
|
||||
bool open();
|
||||
|
||||
// process work for this port
|
||||
bool process();
|
||||
|
||||
// close the channel
|
||||
bool close();
|
||||
|
||||
inline double get_hz2() const { return hz2; }
|
||||
inline void set_hz2( double t ) { hz2 = t, hz2cycles = get_hz() / hz2; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // _FG_AV400WSIM_HXX
|
|
@ -19,6 +19,7 @@ libNetwork_a_SOURCES = \
|
|||
atlas.cxx atlas.hxx \
|
||||
AV400.cxx AV400.hxx \
|
||||
AV400Sim.cxx AV400Sim.hxx \
|
||||
AV400WSim.cxx AV400WSim.hxx \
|
||||
garmin.cxx garmin.hxx \
|
||||
lfsglass.cxx lfsglass.hxx lfsglass_data.hxx \
|
||||
httpd.cxx httpd.hxx \
|
||||
|
@ -43,4 +44,4 @@ INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src
|
|||
|
||||
if WITH_HLA
|
||||
SUBDIRS = HLA
|
||||
endif
|
||||
endif
|
||||
|
|
Loading…
Reference in a new issue