FlightGear
next
AV400WSim.hxx
Go to the documentation of this file.
1
// AV400Sim.hxx -- Garmin 400 series protocal class. This AV400Sim
2
// protocol generates the set of "simulator" commands a garmin 400
3
// series gps would expect as input in simulator mode. The AV400
4
// protocol generates the set of commands that a garmin 400 series gps
5
// would emit.
6
//
7
// Written by Curtis Olson, started Januar 2009.
8
//
9
// Copyright (C) 2009 Curtis L. Olson - http://www.flightgear.org/~curt
10
//
11
// This program is free software; you can redistribute it and/or
12
// modify it under the terms of the GNU General Public License as
13
// published by the Free Software Foundation; either version 2 of the
14
// License, or (at your option) any later version.
15
//
16
// This program is distributed in the hope that it will be useful, but
17
// WITHOUT ANY WARRANTY; without even the implied warranty of
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
// General Public License for more details.
20
//
21
// You should have received a copy of the GNU General Public License
22
// along with this program; if not, write to the Free Software
23
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24
//
25
// $Id$
26
27
#pragma once
28
29
#include <simgear/compiler.h>
30
#include <stdlib.h>
31
#include <string.h>
32
33
#include <string>
34
35
#include "
protocol.hxx
"
36
37
class
FlightProperties
;
38
40
// Class FGAV400WSimA handles the input/output over the first serial port.
41
// This is very similar to the way previous Garmin non-WAAS models communicated
42
// but some items have been stripped out and just a minimal amount of
43
// info is necessary to be transmitted over this port.
44
45
class
FGAV400WSimA
:
public
FGProtocol
{
46
47
char
buf[
FG_MAX_MSG_SIZE
];
48
int
length;
49
50
public
:
51
52
FGAV400WSimA
();
53
~FGAV400WSimA
();
54
55
bool
gen_message
();
56
bool
parse_message
();
57
58
// open hailing frequencies
59
bool
open
();
60
61
// process work for this port
62
bool
process
();
63
64
// close the channel
65
bool
close
();
66
};
67
69
// Class FGAV400WSimB handles the input/output over the second serial port
70
// which Garmin refers to as the "GPS Port". Some messages are handled on
71
// fixed cycle (usually 1 and 5 Hz) and some immediate responses are needed
72
// to certain messages upon requet by the GPS unit
73
74
class
FGAV400WSimB
:
public
FGProtocol
{
75
76
char
buf[
FG_MAX_MSG_SIZE
];
77
int
length;
78
double
hz2;
79
int
hz2count;
80
int
hz2cycles;
81
char
flight_phase;
82
std::string hal;
83
std::string val;
84
std::string sbas_sel;
85
bool
req_hostid;
86
bool
req_sbas;
87
int
outputctr;
88
89
FlightProperties
* fdm;
90
91
static
const
int
SOM_SIZE = 2;
92
static
const
int
DEG_TO_MILLIARCSECS = ( 60 * 60 * 1000 );
93
94
// Flight Phases
95
static
const
int
PHASE_OCEANIC = 4;
96
static
const
int
PHASE_ENROUTE = 5;
97
static
const
int
PHASE_TERM = 6;
98
static
const
int
PHASE_NONPREC = 7;
99
static
const
int
PHASE_LNAVVNAV = 8;
100
static
const
int
PHASE_LPVLP = 9;
101
102
public
:
103
104
FGAV400WSimB
();
105
~FGAV400WSimB
();
106
107
bool
gen_hostid_message
();
108
bool
gen_sbas_message
();
109
110
bool
gen_Wh_message
();
111
bool
gen_Wx_message
();
112
113
bool
gen_Wt_message
();
114
bool
gen_Wm_message
();
115
bool
gen_Wv_message
();
116
117
bool
verify_checksum
( std::string message,
int
datachars );
118
std::string
asciitize_message
( std::string message );
119
std::string
buffer_to_string
();
120
bool
parse_message
();
121
122
// open hailing frequencies
123
bool
open
();
124
125
// process work for this port
126
bool
process
();
127
128
// close the channel
129
bool
close
();
130
131
inline
double
get_hz2
()
const
{
return
hz2; }
132
inline
void
set_hz2
(
double
t ) { hz2 = t, hz2cycles =
get_hz
() / hz2; }
133
134
};
FGAV400WSimA::~FGAV400WSimA
~FGAV400WSimA()
Definition
AV400WSim.cxx:44
FGAV400WSimA::gen_message
bool gen_message()
Definition
AV400WSim.cxx:49
FGAV400WSimA::open
bool open()
Definition
AV400WSim.cxx:183
FGAV400WSimA::close
bool close()
Definition
AV400WSim.cxx:233
FGAV400WSimA::parse_message
bool parse_message()
Definition
AV400WSim.cxx:112
FGAV400WSimA::process
bool process()
Definition
AV400WSim.cxx:204
FGAV400WSimA::FGAV400WSimA
FGAV400WSimA()
Definition
AV400WSim.cxx:41
FGAV400WSimB::set_hz2
void set_hz2(double t)
Definition
AV400WSim.hxx:132
FGAV400WSimB::gen_Wh_message
bool gen_Wh_message()
Definition
AV400WSim.cxx:327
FGAV400WSimB::gen_Wv_message
bool gen_Wv_message()
Definition
AV400WSim.cxx:565
FGAV400WSimB::verify_checksum
bool verify_checksum(std::string message, int datachars)
Definition
AV400WSim.cxx:619
FGAV400WSimB::asciitize_message
std::string asciitize_message(std::string message)
Definition
AV400WSim.cxx:642
FGAV400WSimB::gen_Wt_message
bool gen_Wt_message()
Definition
AV400WSim.cxx:412
FGAV400WSimB::parse_message
bool parse_message()
Definition
AV400WSim.cxx:674
FGAV400WSimB::~FGAV400WSimB
~FGAV400WSimB()
Definition
AV400WSim.cxx:263
FGAV400WSimB::gen_sbas_message
bool gen_sbas_message()
Definition
AV400WSim.cxx:301
FGAV400WSimB::process
bool process()
Definition
AV400WSim.cxx:825
FGAV400WSimB::get_hz2
double get_hz2() const
Definition
AV400WSim.hxx:131
FGAV400WSimB::gen_Wx_message
bool gen_Wx_message()
Definition
AV400WSim.cxx:371
FGAV400WSimB::buffer_to_string
std::string buffer_to_string()
Definition
AV400WSim.cxx:662
FGAV400WSimB::open
bool open()
Definition
AV400WSim.cxx:804
FGAV400WSimB::close
bool close()
Definition
AV400WSim.cxx:1021
FGAV400WSimB::gen_hostid_message
bool gen_hostid_message()
Definition
AV400WSim.cxx:268
FGAV400WSimB::gen_Wm_message
bool gen_Wm_message()
Definition
AV400WSim.cxx:516
FGAV400WSimB::FGAV400WSimB
FGAV400WSimB()
Definition
AV400WSim.cxx:246
FGProtocol::get_hz
double get_hz() const
Definition
protocol.hxx:68
FGProtocol::FGProtocol
FGProtocol()
Definition
protocol.cxx:30
FlightProperties
Encapsulate the FDM properties in some getter/setter helpers.
Definition
flightProperties.hxx:44
protocol.hxx
FG_MAX_MSG_SIZE
#define FG_MAX_MSG_SIZE
Definition
protocol.hxx:33
src
Network
AV400WSim.hxx
Generated on Tue Jun 3 2025 12:58:40 for FlightGear by
1.13.2