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 const string &getAircraft ();
60 static void setAircraft (const string &aircraft);
62 static const string &getAircraftDir ();
63 static void setAircraftDir (const string &aircraftDir);
65 static time_t getTimeGMT ();
66 static void setTimeGMT (time_t time);
68 static const string &getGMTString ();
70 static bool getHUDVisible ();
71 static void setHUDVisible (bool hudVisible);
73 static bool getPanelVisible ();
74 static void setPanelVisible (bool panelVisible);
76 static int getPanelXOffset ();
77 static void setPanelXOffset (int i);
79 static int getPanelYOffset ();
80 static void setPanelYOffset (int i);
84 static double getLatitude ();
85 static void setLatitude (double latitude);
87 static double getLongitude ();
88 static void setLongitude (double longitude);
90 static double getAltitude ();
91 static void setAltitude (double altitude);
93 static double getAGL ();
97 static double getHeading (); // true heading
98 static void setHeading (double heading);
100 static double getHeadingMag (); // exact magnetic heading
102 static double getPitch ();
103 static void setPitch (double pitch);
105 static double getRoll ();
106 static void setRoll (double roll);
109 static double getRPM ();
110 static void setRPM ( double rpm );
112 static double getEGT ();
113 static double getCHT ();
114 static double getMP ();
117 static double getAirspeed ();
118 static void setAirspeed (double speed);
120 static double getSideSlip ();
122 static double getVerticalSpeed ();
124 static double getSpeedNorth ();
126 static double getSpeedEast ();
128 static double getSpeedDown ();
130 // static void setSpeedNorth (double speed);
131 // static void setSpeedEast (double speed);
132 // static void setSpeedDown (double speed);
136 static double getThrottle ();
137 static void setThrottle (double throttle);
139 static double getMixture ();
140 static void setMixture (double mixture);
142 static double getPropAdvance ();
143 static void setPropAdvance (double pitch);
145 static double getFlaps ();
146 static void setFlaps (double flaps);
148 static double getAileron ();
149 static void setAileron (double aileron);
151 static double getRudder ();
152 static void setRudder (double rudder);
154 static double getElevator ();
155 static void setElevator (double elevator);
157 static double getElevatorTrim ();
158 static void setElevatorTrim (double trim);
160 static double getBrakes ();
161 static void setBrakes (double brake);
163 static double getLeftBrake ();
164 static void setLeftBrake (double brake);
166 static double getRightBrake ();
167 static void setRightBrake (double brake);
169 static double getCenterBrake ();
170 static void setCenterBrake (double brake);
174 static bool getAPAltitudeLock ();
175 static void setAPAltitudeLock (bool lock);
177 static double getAPAltitude ();
178 static void setAPAltitude (double altitude);
180 static bool getAPHeadingLock ();
181 static void setAPHeadingLock (bool lock);
183 static double getAPHeading ();
184 static void setAPHeading (double heading);
186 static double getAPHeadingMag ();
187 static void setAPHeadingMag (double heading);
189 static bool getAPNAV1Lock ();
190 static void setAPNAV1Lock (bool lock);
193 static double getNAV1Freq ();
194 static void setNAV1Freq (double freq);
196 static double getNAV1AltFreq ();
197 static void setNAV1AltFreq (double freq);
199 static double getNAV1Radial ();
201 static double getNAV1SelRadial ();
202 static void setNAV1SelRadial (double radial);
204 static double getNAV1DistDME ();
206 static bool getNAV1TO ();
208 static bool getNAV1FROM ();
210 static bool getNAV1InRange ();
212 static bool getNAV1DMEInRange ();
214 static double getNAV2Freq ();
215 static void setNAV2Freq (double freq);
217 static double getNAV2AltFreq ();
218 static void setNAV2AltFreq (double freq);
220 static double getNAV2Radial ();
222 static double getNAV2SelRadial ();
223 static void setNAV2SelRadial (double radial);
225 static double getNAV2DistDME ();
227 static bool getNAV2TO ();
229 static bool getNAV2FROM ();
231 static bool getNAV2InRange ();
233 static bool getNAV2DMEInRange ();
235 static double getADFFreq ();
236 static void setADFFreq (double freq);
238 static double getADFAltFreq ();
239 static void setADFAltFreq (double freq);
241 static double getADFRotation ();
242 static void setADFRotation (double rot);
245 static const string &getTargetAirport ();
246 static void setTargetAirport (const string &targetAirport);
248 static bool getGPSLock ();
249 static void setGPSLock (bool lock);
251 static double getGPSTargetLatitude ();
253 static double getGPSTargetLongitude ();
257 static double getVisibility ();
258 static void setVisibility (double visiblity);
261 // Time (this varies with time) huh, huh
262 static double getMagVar ();
263 static double getMagDip ();
267 // Will cause a linking error if invoked.