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