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 ();// ISO 8601 subset
68 static void setDateString (string time_string); // ISO 8601 subset
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 (); // pixels
80 static void setPanelXOffset (int i); // pixels
82 static int getPanelYOffset (); // pixels
83 static void setPanelYOffset (int i); // pixels
87 static double getLatitude (); // degrees
88 static void setLatitude (double latitude); // degrees
90 static double getLongitude (); // degrees
91 static void setLongitude (double longitude); // degrees
93 static double getAltitude (); // feet
94 static void setAltitude (double altitude); // feet
96 static double getAGL (); // feet
100 static double getHeading (); // degrees
101 static void setHeading (double heading); // degrees
103 static double getHeadingMag (); // degrees
105 static double getPitch (); // degrees
106 static void setPitch (double pitch); // degrees
108 static double getRoll (); // degrees
109 static void setRoll (double roll); // degrees
112 static double getRPM (); // revolutions/minute
113 static void setRPM ( double rpm ); // revolutions/minute
115 static double getEGT (); // [unit??]
116 static double getCHT (); // [unit??]
117 static double getMP (); // [unit??]
120 static double getAirspeed (); // knots
121 static void setAirspeed (double speed); // knots
123 static double getSideSlip (); // [unit??]
125 static double getVerticalSpeed (); // feet/second
127 static double getSpeedNorth (); // feet/second
129 static double getSpeedEast (); // feet/second
131 static double getSpeedDown (); // feet/second
133 // static void setSpeedNorth (double speed);
134 // static void setSpeedEast (double speed);
135 // static void setSpeedDown (double speed);
139 static double getThrottle (); // 0.0:1.0
140 static void setThrottle (double throttle); // 0.0:1.0
142 static double getMixture (); // 0.0:1.0
143 static void setMixture (double mixture); // 0.0:1.0
145 static double getPropAdvance (); // 0.0:1.0
146 static void setPropAdvance (double pitch); // 0.0:1.0
148 static double getFlaps (); // 0.0:1.0
149 static void setFlaps (double flaps); // 0.0:1.0
151 static double getAileron (); // -1.0:1.0
152 static void setAileron (double aileron); // -1.0:1.0
154 static double getRudder (); // -1.0:1.0
155 static void setRudder (double rudder); // -1.0:1.0
157 static double getElevator (); // -1.0:1.0
158 static void setElevator (double elevator); // -1.0:1.0
160 static double getElevatorTrim (); // -1.0:1.0
161 static void setElevatorTrim (double trim); // -1.0:1.0
163 static double getBrakes (); // 0.0:1.0
164 static void setBrakes (double brake); // 0.0:1.0
166 static double getLeftBrake (); // 0.0:1.0
167 static void setLeftBrake (double brake); // 0.0:1.0
169 static double getRightBrake (); // 0.0:1.0
170 static void setRightBrake (double brake); // 0.0:1.0
172 static double getCenterBrake (); // 0.0:1.0
173 static void setCenterBrake (double brake); // 0.0:1.0
177 static bool getAPAltitudeLock ();
178 static void setAPAltitudeLock (bool lock);
180 static double getAPAltitude (); // feet
181 static void setAPAltitude (double altitude); // feet
183 static bool getAPHeadingLock ();
184 static void setAPHeadingLock (bool lock);
186 static double getAPHeading (); // degrees
187 static void setAPHeading (double heading); // degrees
189 static double getAPHeadingMag (); // degrees
190 static void setAPHeadingMag (double heading); // degrees
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 (); // degrees
204 static double getNAV1SelRadial (); // degrees
205 static void setNAV1SelRadial (double radial); // degrees
207 static double getNAV1DistDME (); // nautical miles
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 (); // degrees
225 static double getNAV2SelRadial (); // degrees
226 static void setNAV2SelRadial (double radial); // degrees
228 static double getNAV2DistDME (); // nautical miles
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 (); // degrees
245 static void setADFRotation (double rot); // degrees
248 static string getTargetAirport ();
249 static void setTargetAirport (string targetAirport);
251 static bool getGPSLock ();
252 static void setGPSLock (bool lock);
254 static double getGPSTargetLatitude (); // degrees
256 static double getGPSTargetLongitude (); // degrees
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
270 static void setViewAxisLong (double axis);// -1.0:1.0
271 static void setViewAxisLat (double axis); // -1.0:1.0
274 // Time (this varies with time) huh, huh
275 static double getMagVar (); // degrees
276 static double getMagDip (); // degrees
280 // Will cause a linking error if invoked.