]> git.mxchange.org Git - flightgear.git/blob - src/Main/bfi.hxx
Sep. 22, 2000 panel updates from David Megginson to make the new config file
[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 const string getAircraft ();
58   static const string getAircraftDir ();
59   static time_t getTimeGMT ();
60   static const string &getGMTString ();
61   static bool getHUDVisible ();
62   static bool getPanelVisible ();
63
64   static void setFlightModel (int flightModel);
65   static void setAircraft (const string &aircraft);
66   static void setAircraftDir (const string &aircraftDir);
67   static void setTimeGMT (time_t time);
68   static void setHUDVisible (bool hudVisible);
69   static void setPanelVisible (bool panelVisible);
70
71
72                                 // Position
73   static double getLatitude ();
74   static double getLongitude ();
75   static double getAltitude ();
76   static double getAGL ();
77
78   static void setLatitude (double latitude);
79   static void setLongitude (double longitude);
80   static void setAltitude (double altitude);
81
82
83                                 // Attitude
84   static double getHeading ();    // true heading
85   static double getHeadingMag (); // exact magnetic heading
86   static double getPitch ();
87   static double getRoll ();
88
89   static void setHeading (double heading);
90   static void setPitch (double pitch);
91   static void setRoll (double roll);
92
93
94                                 // Velocities
95   static double getAirspeed ();
96   static double getSideSlip ();
97   static double getVerticalSpeed ();
98   static double getSpeedNorth ();
99   static double getSpeedEast ();
100   static double getSpeedDown ();
101
102   static void setSpeedNorth (double speed);
103   static void setSpeedEast (double speed);
104   static void setSpeedDown (double speed);
105
106
107                                 // Controls
108   static double getThrottle ();
109   static double getFlaps ();
110   static double getAileron ();
111   static double getRudder ();
112   static double getElevator ();
113   static double getElevatorTrim ();
114   static double getBrakes ();
115   static double getLeftBrake ();
116   static double getRightBrake ();
117   static double getCenterBrake ();
118
119   static void setThrottle (double throttle);
120   static void setFlaps (double flaps);
121   static void setAileron (double aileron);
122   static void setRudder (double rudder);
123   static void setElevator (double elevator);
124   static void setElevatorTrim (double trim);
125   static void setBrakes (double brake);
126   static void setLeftBrake (double brake);
127   static void setRightBrake (double brake);
128   static void setCenterBrake (double brake);
129
130
131                                 // Autopilot
132   static bool getAPAltitudeLock ();
133   static double getAPAltitude ();
134   static bool getAPHeadingLock ();
135   static double getAPHeading ();
136   static double getAPHeadingMag ();
137
138   static void setAPAltitudeLock (bool lock);
139   static void setAPAltitude (double altitude);
140   static void setAPHeadingLock (bool lock);
141   static void setAPHeading (double heading);
142   static void setAPHeadingMag (double heading);
143
144   static bool getAPNAV1Lock ();
145   static void setAPNAV1Lock (bool lock);
146
147                                 // Radio Navigation
148   static double getNAV1Freq ();
149   static double getNAV1AltFreq ();
150   static double getNAV1Radial ();
151   static double getNAV1SelRadial ();
152   static double getNAV1DistDME ();
153   static bool getNAV1TO ();
154   static bool getNAV1FROM ();
155   static bool getNAV1InRange ();
156   static bool getNAV1DMEInRange ();
157
158   static double getNAV2Freq ();
159   static double getNAV2AltFreq ();
160   static double getNAV2Radial ();
161   static double getNAV2SelRadial ();
162   static double getNAV2DistDME ();
163   static bool getNAV2TO ();
164   static bool getNAV2FROM ();
165   static bool getNAV2InRange ();
166   static bool getNAV2DMEInRange ();
167
168   static double getADFFreq ();
169   static double getADFAltFreq ();
170   static double getADFRotation ();
171
172   static void setNAV1Freq (double freq);
173   static void setNAV1AltFreq (double freq);
174   static void setNAV1SelRadial (double radial);
175
176   static void setNAV2Freq (double freq);
177   static void setNAV2AltFreq (double freq);
178   static void setNAV2SelRadial (double radial);
179
180   static void setADFFreq (double freq);
181   static void setADFAltFreq (double freq);
182   static void setADFRotation (double rot);
183
184                                 // GPS
185   static const string getTargetAirport ();
186   static bool getGPSLock ();
187   static double getGPSTargetLatitude ();
188   static double getGPSTargetLongitude ();
189
190   static void setTargetAirport (const string &targetAirport);
191   static void setGPSLock (bool lock);
192   static void setGPSTargetLatitude (double latitude);
193   static void setGPSTargetLongitude (double longitude);
194
195
196                                 // Weather
197   static double getVisibility ();
198   static bool getClouds ();
199   static double getCloudsASL ();
200
201   static void setVisibility (double visiblity);
202   static void setClouds (bool clouds);
203   static void setCloudsASL (double cloudsASL);
204
205
206                                 // Time (this varies with time) huh, huh
207   static double getMagVar (); 
208   static double getMagDip (); 
209
210
211 private:
212                                 // Will cause a linking error if invoked.
213   FGBFI ();
214
215   static void reinit ();
216   static void needReinit () { _needReinit = true; }
217   static bool _needReinit;
218 };
219
220 // end of bfi.hxx