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 // Reinit if necessary.
50 static void update ();
53 static int getFlightModel ();
54 static time_t getTimeGMT ();
55 static bool getHUDVisible ();
56 static bool getPanelVisible ();
58 static void setFlightModel (int flightModel);
59 static void setTimeGMT (time_t time);
60 static void setHUDVisible (bool hudVisible);
61 static void setPanelVisible (bool panelVisible);
65 static double getLatitude ();
66 static double getLongitude ();
67 static double getAltitude ();
68 static double getAGL ();
70 static void setLatitude (double latitude);
71 static void setLongitude (double longitude);
72 static void setAltitude (double altitude);
76 static double getHeading ();
77 static double getPitch ();
78 static double getRoll ();
80 static void setHeading (double heading);
81 static void setPitch (double pitch);
82 static void setRoll (double roll);
86 static double getAirspeed ();
87 static double getSideSlip ();
88 static double getVerticalSpeed ();
89 static double getSpeedNorth ();
90 static double getSpeedEast ();
91 static double getSpeedDown ();
93 static void setSpeedNorth (double speed);
94 static void setSpeedEast (double speed);
95 static void setSpeedDown (double speed);
99 static double getThrottle ();
100 static double getFlaps ();
101 static double getAileron ();
102 static double getRudder ();
103 static double getElevator ();
104 static double getElevatorTrim ();
105 static double getBrake ();
107 static void setThrottle (double throttle);
108 static void setFlaps (double flaps);
109 static void setAileron (double aileron);
110 static void setRudder (double rudder);
111 static void setElevator (double elevator);
112 static void setElevatorTrim (double trim);
113 static void setBrake (double brake);
117 static bool getAPAltitudeLock ();
118 static double getAPAltitude ();
119 static bool getAPHeadingLock ();
120 static double getAPHeading ();
122 static void setAPAltitudeLock (bool lock);
123 static void setAPAltitude (double altitude);
124 static void setAPHeadingLock (bool lock);
125 static void setAPHeading (double heading);
128 static double getNAV1Freq ();
129 static double getNAV1AltFreq ();
130 static double getNAV1SelRadial ();
131 static double getNAV1Radial ();
133 static double getNAV2Freq ();
134 static double getNAV2AltFreq ();
135 static double getNAV2SelRadial ();
136 static double getNAV2Radial ();
138 static double getADFFreq ();
139 static double getADFAltFreq ();
140 static double getADFRotation ();
142 static void setNAV1Freq (double freq);
143 static void setNAV1AltFreq (double freq);
144 static void setNAV1SelRadial (double radial);
146 static void setNAV2Freq (double freq);
147 static void setNAV2AltFreq (double freq);
148 static void setNAV2SelRadial (double radial);
150 static void setADFFreq (double freq);
151 static void setADFAltFreq (double freq);
152 static void setADFRotation (double rot);
155 static const string getTargetAirport ();
156 static bool getGPSLock ();
157 static double getGPSTargetLatitude ();
158 static double getGPSTargetLongitude ();
160 static void setTargetAirport (const string &targetAirport);
161 static void setGPSLock (bool lock);
162 static void setGPSTargetLatitude (double latitude);
163 static void setGPSTargetLongitude (double longitude);
167 static double getVisibility ();
169 static void setVisibility (double visiblity);
171 // Time (this varies with time) huh, huh
172 static double getMagVar ();
173 static double getMagDip ();
177 // Will cause a linking error if invoked.
180 static void reinit ();
181 static void needReinit () { _needReinit = true; }
182 static bool _needReinit;