1 // bfi.hxx - Big Flat Interface
3 // Written by David Megginson, started February, 2000.
5 // Copyright (C) 2000 David Megginson - david@megginson.com
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.
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.
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.
26 #include <simgear/compiler.h>
28 FG_USING_NAMESPACE(std);
34 * This class implements the Facade design pattern (GOF p.185) to provide
35 * a single, (deceptively) simple flat interface for the FlightGear
38 * To help cut down on interdependence, subsystems should
39 * use the BFI whenever possible for inter-system communication.
42 * - add selectors to switch the current plane, throttle, brake, etc.
43 * - add more autopilot settings
49 // Initialize before first use.
52 // Reinit if necessary.
53 static void update ();
56 static int getFlightModel ();
57 static void setFlightModel (int flightModel);
59 static string getAircraft ();
60 static void setAircraft (string aircraft);
62 static string getAircraftDir ();
63 static void setAircraftDir (string aircraftDir);
65 // static time_t getTimeGMT ();
66 // static void setTimeGMT (time_t time);
67 static string getDateString ();
68 static void setDateString (string time_string);
71 static string getGMTString ();
73 static bool getHUDVisible ();
74 static void setHUDVisible (bool hudVisible);
76 static bool getPanelVisible ();
77 static void setPanelVisible (bool panelVisible);
79 static int getPanelXOffset ();
80 static void setPanelXOffset (int i);
82 static int getPanelYOffset ();
83 static void setPanelYOffset (int i);
87 static double getLatitude ();
88 static void setLatitude (double latitude);
90 static double getLongitude ();
91 static void setLongitude (double longitude);
93 static double getAltitude ();
94 static void setAltitude (double altitude);
96 static double getAGL ();
100 static double getHeading (); // true heading
101 static void setHeading (double heading);
103 static double getHeadingMag (); // exact magnetic heading
105 static double getPitch ();
106 static void setPitch (double pitch);
108 static double getRoll ();
109 static void setRoll (double roll);
112 static double getRPM ();
113 static void setRPM ( double rpm );
115 static double getEGT ();
116 static double getCHT ();
117 static double getMP ();
120 static double getAirspeed ();
121 static void setAirspeed (double speed);
123 static double getSideSlip ();
125 static double getVerticalSpeed ();
127 static double getSpeedNorth ();
129 static double getSpeedEast ();
131 static double getSpeedDown ();
133 // static void setSpeedNorth (double speed);
134 // static void setSpeedEast (double speed);
135 // static void setSpeedDown (double speed);
139 static double getThrottle ();
140 static void setThrottle (double throttle);
142 static double getMixture ();
143 static void setMixture (double mixture);
145 static double getPropAdvance ();
146 static void setPropAdvance (double pitch);
148 static double getFlaps ();
149 static void setFlaps (double flaps);
151 static double getAileron ();
152 static void setAileron (double aileron);
154 static double getRudder ();
155 static void setRudder (double rudder);
157 static double getElevator ();
158 static void setElevator (double elevator);
160 static double getElevatorTrim ();
161 static void setElevatorTrim (double trim);
163 static double getBrakes ();
164 static void setBrakes (double brake);
166 static double getLeftBrake ();
167 static void setLeftBrake (double brake);
169 static double getRightBrake ();
170 static void setRightBrake (double brake);
172 static double getCenterBrake ();
173 static void setCenterBrake (double brake);
177 static bool getAPAltitudeLock ();
178 static void setAPAltitudeLock (bool lock);
180 static double getAPAltitude ();
181 static void setAPAltitude (double altitude);
183 static bool getAPHeadingLock ();
184 static void setAPHeadingLock (bool lock);
186 static double getAPHeading ();
187 static void setAPHeading (double heading);
189 static double getAPHeadingMag ();
190 static void setAPHeadingMag (double heading);
192 static bool getAPNAV1Lock ();
193 static void setAPNAV1Lock (bool lock);
196 static double getNAV1Freq ();
197 static void setNAV1Freq (double freq);
199 static double getNAV1AltFreq ();
200 static void setNAV1AltFreq (double freq);
202 static double getNAV1Radial ();
204 static double getNAV1SelRadial ();
205 static void setNAV1SelRadial (double radial);
207 static double getNAV1DistDME ();
209 static bool getNAV1TO ();
211 static bool getNAV1FROM ();
213 static bool getNAV1InRange ();
215 static bool getNAV1DMEInRange ();
217 static double getNAV2Freq ();
218 static void setNAV2Freq (double freq);
220 static double getNAV2AltFreq ();
221 static void setNAV2AltFreq (double freq);
223 static double getNAV2Radial ();
225 static double getNAV2SelRadial ();
226 static void setNAV2SelRadial (double radial);
228 static double getNAV2DistDME ();
230 static bool getNAV2TO ();
232 static bool getNAV2FROM ();
234 static bool getNAV2InRange ();
236 static bool getNAV2DMEInRange ();
238 static double getADFFreq ();
239 static void setADFFreq (double freq);
241 static double getADFAltFreq ();
242 static void setADFAltFreq (double freq);
244 static double getADFRotation ();
245 static void setADFRotation (double rot);
248 static string getTargetAirport ();
249 static void setTargetAirport (string targetAirport);
251 static bool getGPSLock ();
252 static void setGPSLock (bool lock);
254 static double getGPSTargetLatitude ();
256 static double getGPSTargetLongitude ();
260 static double getVisibility ();
261 static void setVisibility (double visiblity);
262 static double getWindNorth ();
263 static double getWindEast ();
264 static double getWindDown ();
267 static void setViewAxisLong (double axis);
268 static void setViewAxisLat (double axis);
271 // Time (this varies with time) huh, huh
272 static double getMagVar ();
273 static double getMagDip ();
277 // Will cause a linking error if invoked.