1 // transmission.hxx -- Transmission class
3 // Written by Alexander Kappes, started March 2002.
4 // Based on nav.hxx by Curtis Olson, started April 2000.
6 // Copyright (C) 2001 David C. Luff - david.luff@nottingham.ac.uk
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #ifndef _FG_TRANSMISSION_HXX
24 #define _FG_TRANSMISSION_HXX
28 #include <simgear/compiler.h>
29 #include <simgear/math/sg_geodesy.hxx>
30 #include <simgear/misc/sgstream.hxx>
31 #include <simgear/magvar/magvar.hxx>
32 #include <simgear/timing/sg_time.hxx>
33 #include <simgear/bucket/newbucket.hxx>
35 #include <Main/fg_props.hxx>
47 // TransPar - a representation of the logic of a parsed speech transmission
52 std::string intention; // landing, crossing
53 std::string intid; // (airport) ID for intention
54 bool request; // is the transmission a request or an answer?
55 int tdir; // turning direction: 1=left, 2=right
57 int VDir; // vertical direction: 1=descent, 2=maintain, 3=climb
65 // FGTransmission - a class to encapsulate a speech transmission
66 class FGTransmission {
68 //int StationType; // Type of ATC station: 1 Approach
70 TransCode Code; // DCL - no idea what this is.
71 std::string TransText; // The text of the spoken transmission
72 std::string MenuText; // An abbreviated version of the text for the menu entry
77 ~FGTransmission(void);
81 inline atc_type get_station() const { return StationType; }
82 inline const TransCode& get_code() { return Code; }
83 inline const std::string& get_transtext() { return TransText; }
84 inline const std::string& get_menutext() { return MenuText; }
86 // Return the parsed logic of the transmission
91 friend std::istream& operator>> ( std::istream&, FGTransmission& );
97 operator >> ( std::istream& in, FGTransmission& a ) {
101 static bool first_time = true;
102 static double julian_date = 0;
103 static const double MJD0 = 2415020.0;
105 julian_date = sgTimeCurrentMJD(0, 0) + MJD0;
108 // Ugly hack alert - eventually we'll use xml format for the transmissions file
111 a.StationType = APPROACH;
113 a.StationType = INVALID;
120 if ( ch != '"' ) a.TransText += ch;
123 in.unsetf(ios::skipws);
125 if ( ch != '"' ) a.TransText += ch;
126 if((ch == '"') || (ch == 0x0A)) {
128 } // we shouldn't need the 0x0A but it makes a nice safely in case someone leaves off the "
130 in.setf(ios::skipws);
134 if ( ch != '"' ) a.MenuText += ch;
137 in.unsetf(ios::skipws);
139 if ( ch != '"' ) a.MenuText += ch;
140 if((ch == '"') || (ch == 0x0A)) {
142 } // we shouldn't need the 0x0A but it makes a nice safely in case someone leaves off the "
144 in.setf(ios::skipws);
146 //cout << "Code = " << a.Code << " Transmission text = " << a.TransText
147 // << " Menu text = " << a.MenuText << endl;
149 return in >> skipeol;
153 #endif // _FG_TRANSMISSION_HXX