]> git.mxchange.org Git - flightgear.git/blob - src/ATCDCL/ATISmgr.hxx
ATCDCL cleanup, part II.
[flightgear.git] / src / ATCDCL / ATISmgr.hxx
1 // ATISmgr.hxx - definition of FGATISMgr
2 // - a global management class for FlightGear generated ATIS
3 //
4 // Written by David Luff, started February 2002.
5 //
6 // Copyright (C) 2002  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 #ifndef _FG_ATCMGR_HXX
23 #define _FG_ATCMGR_HXX
24
25 #include <simgear/structure/subsystem_mgr.hxx>
26
27 #include <string>
28 #include <list>
29 #include <map>
30
31 #include "ATC.hxx"
32
33 namespace flightgear
34 {
35     class CommStation;
36 }
37
38 typedef struct
39 {
40     SGPropertyNode_ptr freq;
41     FGATC* station;
42 } CommRadioData;
43
44 class FGATISMgr : public SGSubsystem
45 {
46
47 private:
48     // A vector containing all comm radios
49     typedef std::vector<CommRadioData> radio_list_type;
50     radio_list_type radios;
51
52     // Any member function of FGATISMgr is permitted to leave this iterator pointing
53     // at any point in or at the end of the list.
54     // Hence any new access must explicitly first check for atc_list.end() before dereferencing.
55
56     // Position of the Users Aircraft
57     SGGeod _aircraftPos;
58
59     // Pointers to current users position
60     SGPropertyNode_ptr lon_node;
61     SGPropertyNode_ptr lat_node;
62     SGPropertyNode_ptr elev_node;
63
64     unsigned int _currentUnit;
65     unsigned int _maxCommRadios;
66         
67     // Voice related stuff
68     bool voice;                 // Flag - true if we are using voice
69 #ifdef ENABLE_AUDIO_SUPPORT
70     FGATCVoice* voice1;
71 #endif
72
73 public:
74     FGATISMgr();
75     ~FGATISMgr();
76
77     void init();
78
79     void bind();
80
81     void unbind();
82
83     void update(double dt);
84
85     // Return a pointer to an appropriate voice for a given type of ATC
86     // creating the voice if necessary - i.e. make sure exactly one copy
87     // of every voice in use exists in memory.
88     //
89     // TODO - in the future this will get more complex and dole out country/airport
90     // specific voices, and possible make sure that the same voice doesn't get used
91     // at different airports in quick succession if a large enough selection are available.
92     FGATCVoice* GetVoicePointer(const atc_type& type);
93
94 private:
95     // Search the specified radio for stations on the same frequency and in range.
96     void FreqSearch(const unsigned int unit);
97 };
98
99 #endif  // _FG_ATCMGR_HXX