]> git.mxchange.org Git - flightgear.git/blob - src/Main/bfi.hxx
c35a36b96a2d626a944fb250e75e846c27214e6c
[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                                 // Initialize before first use.
50   static void init ();
51
52                                 // Reinit if necessary.
53   static void update ();
54
55                                 // Simulation
56   static int getFlightModel ();
57   static void setFlightModel (int flightModel);
58
59   static const string &getAircraft ();
60   static void setAircraft (const string &aircraft);
61
62   static const string &getAircraftDir ();
63   static void setAircraftDir (const string &aircraftDir);
64
65   static time_t getTimeGMT ();
66   static void setTimeGMT (time_t time);
67
68   static const string &getGMTString ();
69
70   static bool getHUDVisible ();
71   static void setHUDVisible (bool hudVisible);
72
73   static bool getPanelVisible ();
74   static void setPanelVisible (bool panelVisible);
75
76   static int getPanelXOffset ();
77   static void setPanelXOffset (int i);
78
79   static int getPanelYOffset ();
80   static void setPanelYOffset (int i);
81
82
83                                 // Position
84   static double getLatitude ();
85   static void setLatitude (double latitude);
86
87   static double getLongitude ();
88   static void setLongitude (double longitude);
89
90   static double getAltitude ();
91   static void setAltitude (double altitude);
92
93   static double getAGL ();
94
95
96                                 // Attitude
97   static double getHeading ();    // true heading
98   static void setHeading (double heading);
99
100   static double getHeadingMag (); // exact magnetic heading
101
102   static double getPitch ();
103   static void setPitch (double pitch);
104
105   static double getRoll ();
106   static void setRoll (double roll);
107
108                                 // Engine
109   static double getRPM ();
110   static void setRPM ( double rpm );
111
112   static double getEGT ();
113   static double getCHT ();
114   static double getMP ();
115
116                                 // Velocities
117   static double getAirspeed ();
118   static void setAirspeed (double speed);
119
120   static double getSideSlip ();
121
122   static double getVerticalSpeed ();
123
124   static double getSpeedNorth ();
125
126   static double getSpeedEast ();
127
128   static double getSpeedDown ();
129
130 //   static void setSpeedNorth (double speed);
131 //   static void setSpeedEast (double speed);
132 //   static void setSpeedDown (double speed);
133
134
135                                 // Controls
136   static double getThrottle ();
137   static void setThrottle (double throttle);
138
139   static double getMixture ();
140   static void setMixture (double mixture);
141
142   static double getPropAdvance ();
143   static void setPropAdvance (double pitch);
144
145   static double getFlaps ();
146   static void setFlaps (double flaps);
147
148   static double getAileron ();
149   static void setAileron (double aileron);
150
151   static double getRudder ();
152   static void setRudder (double rudder);
153
154   static double getElevator ();
155   static void setElevator (double elevator);
156
157   static double getElevatorTrim ();
158   static void setElevatorTrim (double trim);
159
160   static double getBrakes ();
161   static void setBrakes (double brake);
162
163   static double getLeftBrake ();
164   static void setLeftBrake (double brake);
165
166   static double getRightBrake ();
167   static void setRightBrake (double brake);
168
169   static double getCenterBrake ();
170   static void setCenterBrake (double brake);
171
172
173                                 // Autopilot
174   static bool getAPAltitudeLock ();
175   static void setAPAltitudeLock (bool lock);
176
177   static double getAPAltitude ();
178   static void setAPAltitude (double altitude);
179
180   static bool getAPHeadingLock ();
181   static void setAPHeadingLock (bool lock);
182
183   static double getAPHeading ();
184   static void setAPHeading (double heading);
185
186   static double getAPHeadingMag ();
187   static void setAPHeadingMag (double heading);
188
189   static bool getAPNAV1Lock ();
190   static void setAPNAV1Lock (bool lock);
191
192                                 // Radio Navigation
193   static double getNAV1Freq ();
194   static void setNAV1Freq (double freq);
195
196   static double getNAV1AltFreq ();
197   static void setNAV1AltFreq (double freq);
198
199   static double getNAV1Radial ();
200
201   static double getNAV1SelRadial ();
202   static void setNAV1SelRadial (double radial);
203
204   static double getNAV1DistDME ();
205
206   static bool getNAV1TO ();
207
208   static bool getNAV1FROM ();
209
210   static bool getNAV1InRange ();
211
212   static bool getNAV1DMEInRange ();
213
214   static double getNAV2Freq ();
215   static void setNAV2Freq (double freq);
216
217   static double getNAV2AltFreq ();
218   static void setNAV2AltFreq (double freq);
219
220   static double getNAV2Radial ();
221
222   static double getNAV2SelRadial ();
223   static void setNAV2SelRadial (double radial);
224
225   static double getNAV2DistDME ();
226
227   static bool getNAV2TO ();
228
229   static bool getNAV2FROM ();
230
231   static bool getNAV2InRange ();
232
233   static bool getNAV2DMEInRange ();
234
235   static double getADFFreq ();
236   static void setADFFreq (double freq);
237
238   static double getADFAltFreq ();
239   static void setADFAltFreq (double freq);
240
241   static double getADFRotation ();
242   static void setADFRotation (double rot);
243
244                                 // GPS
245   static const string &getTargetAirport ();
246   static void setTargetAirport (const string &targetAirport);
247
248   static bool getGPSLock ();
249   static void setGPSLock (bool lock);
250
251   static double getGPSTargetLatitude ();
252
253   static double getGPSTargetLongitude ();
254
255
256                                 // Weather
257   static double getVisibility ();
258   static void setVisibility (double visiblity);
259
260
261                                 // Time (this varies with time) huh, huh
262   static double getMagVar (); 
263   static double getMagDip (); 
264
265
266 private:
267                                 // Will cause a linking error if invoked.
268   FGBFI ();
269
270 };
271
272 // end of bfi.hxx