]> git.mxchange.org Git - flightgear.git/blob - src/ATCDCL/atis.hxx
ATCDCL cleanup, part II.
[flightgear.git] / src / ATCDCL / atis.hxx
1 // atis.hxx -- ATIS class
2 //
3 // Written by David Luff, started October 2001.
4 // Based on nav.hxx by Curtis Olson, started April 2000.
5 //
6 // Copyright (C) 2001  David C. Luff - david.luff@nottingham.ac.uk
7 //
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.
12 //
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.
17 //
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.
21
22
23 #ifndef _FG_ATIS_HXX
24 #define _FG_ATIS_HXX
25
26 #include <string>
27 #include <iosfwd>
28
29 #include <simgear/compiler.h>
30 #include <simgear/timing/sg_time.hxx>
31
32 #include "ATC.hxx"
33
34 //DCL - a complete guess for now.
35 #define FG_ATIS_DEFAULT_RANGE 30
36         
37 typedef std::map<std::string,std::string> MSS;
38
39 class FGATIS : public FGATC {
40         
41         //atc_type type;
42
43         // The actual ATIS transmission
44         // This is generated from the prevailing conditions when required.
45         // This is the version with markup, suitable for voice synthesis:
46         std::string transmission;
47         
48         // Same as above, but in a form more readable as text.
49         std::string transmission_readable;
50
51         // for failure modeling
52         std::string trans_ident;                // transmitted ident
53         double old_volume;
54         bool atis_failed;               // atis failed?
55         time_t msg_time;                // for moderating error messages
56         time_t cur_time;
57         int msg_OK;
58         int attention;
59         
60         bool _prev_display;             // Previous value of _display flag
61         MSS _remap;                     // abbreviations to be expanded
62
63         std::string _commbase;
64
65         // Aircraft position
66         // ATIS is actually a special case in that unlike other ATC eg.tower it doesn't actually know about
67         // or the whereabouts of the aircraft it is transmitting to.  However, to ensure consistancy of
68         // operation with the other ATC classes the ATIS class must calculate range to the aircraft in order
69         // to decide whether to render the transmission - hence the users plane details must be stored.
70         //SGPropertyNode_ptr airplane_lon_node; 
71         //SGPropertyNode_ptr airplane_lat_node;
72         //SGPropertyNode_ptr airplane_elev_node; 
73         
74 public:
75         
76         FGATIS(const std::string& commbase);
77         ~FGATIS(void);
78         virtual void Init();
79         void attend (int);
80
81         //run the ATIS instance
82         void Update(double dt);
83         
84         //inline void set_type(const atc_type tp) {type = tp;}
85         inline const std::string& get_trans_ident() { return trans_ident; }
86         
87 protected:
88     virtual FGATCVoice* GetVoicePointer();
89
90 private:
91
92         // Generate the ATIS transmission text:
93         int GenTransmission(const int regen, const int special);
94         
95         // Put the text into the property tree
96         // (and in debug mode, print it on the console):
97         void TreeOut(int msgOK);
98
99         friend std::istream& operator>> ( std::istream&, FGATIS& );
100
101 };
102
103 typedef int (FGATIS::*int_getter)() const;
104
105 #endif // _FG_ATIS_HXX