]> git.mxchange.org Git - flightgear.git/blob - src/Main/bfi.hxx
fec77c60e357a798e831b3155b14eb49ebcb26c0
[flightgear.git] / src / Main / bfi.hxx
1 // bfi.hxx - Big Flat Interface
2 //
3 // Written by David Megginson, started February, 2000.
4 //
5 // Copyright (C) 2000  David Megginson - david@megginson.com
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22
23 #include <time.h>
24 #include <string>
25
26 #include <simgear/compiler.h>
27
28 FG_USING_NAMESPACE(std);
29
30
31 /**
32  * Big Flat Interface
33  *
34  * This class implements the Facade design pattern (GOF p.185) to provide
35  * a single, (deceptively) simple flat interface for the FlightGear
36  * subsystems.  
37  *
38  * To help cut down on interdependence, subsystems should
39  * use the BFI whenever possible for inter-system communication.
40  *
41  * TODO:
42  * - add selectors to switch the current plane, throttle, brake, etc.
43  * - add more autopilot settings
44  */
45 class FGBFI
46 {
47 public:
48
49                                 // Reinit if necessary.
50   static void update ();
51
52                                 // Simulation
53   static int getFlightModel ();
54   static time_t getTimeGMT ();
55   static bool getHUDVisible ();
56   static bool getPanelVisible ();
57
58   static void setFlightModel (int flightModel);
59   static void setTimeGMT (time_t time);
60   static void setHUDVisible (bool hudVisible);
61   static void setPanelVisible (bool panelVisible);
62
63
64                                 // Position
65   static double getLatitude ();
66   static double getLongitude ();
67   static double getAltitude ();
68   static double getAGL ();
69
70   static void setLatitude (double latitude);
71   static void setLongitude (double longitude);
72   static void setAltitude (double altitude);
73
74
75                                 // Attitude
76   static double getHeading ();
77   static double getPitch ();
78   static double getRoll ();
79
80   static void setHeading (double heading);
81   static void setPitch (double pitch);
82   static void setRoll (double roll);
83
84
85                                 // Velocities
86   static double getAirspeed ();
87   static double getSideSlip ();
88   static double getVerticalSpeed ();
89   static double getSpeedNorth ();
90   static double getSpeedEast ();
91   static double getSpeedDown ();
92
93   static void setSpeedNorth (double speed);
94   static void setSpeedEast (double speed);
95   static void setSpeedDown (double speed);
96
97
98                                 // Controls
99   static double getThrottle ();
100   static double getFlaps ();
101   static double getAileron ();
102   static double getRudder ();
103   static double getElevator ();
104   static double getElevatorTrim ();
105   static double getBrake ();
106
107   static void setThrottle (double throttle);
108   static void setFlaps (double flaps);
109   static void setAileron (double aileron);
110   static void setRudder (double rudder);
111   static void setElevator (double elevator);
112   static void setElevatorTrim (double trim);
113   static void setBrake (double brake);
114
115
116                                 // Autopilot
117   static bool getAPAltitudeLock ();
118   static double getAPAltitude ();
119   static bool getAPHeadingLock ();
120   static double getAPHeading ();
121
122   static void setAPAltitudeLock (bool lock);
123   static void setAPAltitude (double altitude);
124   static void setAPHeadingLock (bool lock);
125   static void setAPHeading (double heading);
126
127   static bool getAPNAV1Lock ();
128   static void setAPNAV1Lock (bool lock);
129
130                                 // Radio Navigation
131   static double getNAV1Freq ();
132   static double getNAV1AltFreq ();
133   static double getNAV1Radial ();
134   static double getNAV1SelRadial ();
135   static double getNAV1Dist ();
136
137   static double getNAV2Freq ();
138   static double getNAV2AltFreq ();
139   static double getNAV2Radial ();
140   static double getNAV2SelRadial ();
141   static double getNAV2Dist ();
142
143   static double getADFFreq ();
144   static double getADFAltFreq ();
145   static double getADFRotation ();
146
147   static void setNAV1Freq (double freq);
148   static void setNAV1AltFreq (double freq);
149   static void setNAV1SelRadial (double radial);
150
151   static void setNAV2Freq (double freq);
152   static void setNAV2AltFreq (double freq);
153   static void setNAV2SelRadial (double radial);
154
155   static void setADFFreq (double freq);
156   static void setADFAltFreq (double freq);
157   static void setADFRotation (double rot);
158
159                                 // GPS
160   static const string getTargetAirport ();
161   static bool getGPSLock ();
162   static double getGPSTargetLatitude ();
163   static double getGPSTargetLongitude ();
164
165   static void setTargetAirport (const string &targetAirport);
166   static void setGPSLock (bool lock);
167   static void setGPSTargetLatitude (double latitude);
168   static void setGPSTargetLongitude (double longitude);
169
170
171                                 // Weather
172   static double getVisibility ();
173
174   static void setVisibility (double visiblity);
175
176                                 // Time (this varies with time) huh, huh
177   static double getMagVar (); 
178   static double getMagDip (); 
179
180
181 private:
182                                 // Will cause a linking error if invoked.
183   FGBFI ();
184
185   static void reinit ();
186   static void needReinit () { _needReinit = true; }
187   static bool _needReinit;
188 };
189
190 // end of bfi.hxx