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 const string getAircraft ();
55 static const string getAircraftDir ();
56 static time_t getTimeGMT ();
57 static bool getHUDVisible ();
58 static bool getPanelVisible ();
60 static void setFlightModel (int flightModel);
61 static void setAircraft (const string &aircraft);
62 static void setAircraftDir (const string &aircraftDir);
63 static void setTimeGMT (time_t time);
64 static void setHUDVisible (bool hudVisible);
65 static void setPanelVisible (bool panelVisible);
69 static double getLatitude ();
70 static double getLongitude ();
71 static double getAltitude ();
72 static double getAGL ();
74 static void setLatitude (double latitude);
75 static void setLongitude (double longitude);
76 static void setAltitude (double altitude);
80 static double getHeading ();
81 static double getPitch ();
82 static double getRoll ();
84 static void setHeading (double heading);
85 static void setPitch (double pitch);
86 static void setRoll (double roll);
90 static double getAirspeed ();
91 static double getSideSlip ();
92 static double getVerticalSpeed ();
93 static double getSpeedNorth ();
94 static double getSpeedEast ();
95 static double getSpeedDown ();
97 static void setSpeedNorth (double speed);
98 static void setSpeedEast (double speed);
99 static void setSpeedDown (double speed);
103 static double getThrottle ();
104 static double getFlaps ();
105 static double getAileron ();
106 static double getRudder ();
107 static double getElevator ();
108 static double getElevatorTrim ();
109 static double getBrake ();
111 static void setThrottle (double throttle);
112 static void setFlaps (double flaps);
113 static void setAileron (double aileron);
114 static void setRudder (double rudder);
115 static void setElevator (double elevator);
116 static void setElevatorTrim (double trim);
117 static void setBrake (double brake);
121 static bool getAPAltitudeLock ();
122 static double getAPAltitude ();
123 static bool getAPHeadingLock ();
124 static double getAPHeading ();
126 static void setAPAltitudeLock (bool lock);
127 static void setAPAltitude (double altitude);
128 static void setAPHeadingLock (bool lock);
129 static void setAPHeading (double heading);
131 static bool getAPNAV1Lock ();
132 static void setAPNAV1Lock (bool lock);
135 static double getNAV1Freq ();
136 static double getNAV1AltFreq ();
137 static double getNAV1Radial ();
138 static double getNAV1SelRadial ();
139 static double getNAV1DistDME ();
141 static double getNAV2Freq ();
142 static double getNAV2AltFreq ();
143 static double getNAV2Radial ();
144 static double getNAV2SelRadial ();
145 static double getNAV2DistDME ();
147 static double getADFFreq ();
148 static double getADFAltFreq ();
149 static double getADFRotation ();
151 static void setNAV1Freq (double freq);
152 static void setNAV1AltFreq (double freq);
153 static void setNAV1SelRadial (double radial);
155 static void setNAV2Freq (double freq);
156 static void setNAV2AltFreq (double freq);
157 static void setNAV2SelRadial (double radial);
159 static void setADFFreq (double freq);
160 static void setADFAltFreq (double freq);
161 static void setADFRotation (double rot);
164 static const string getTargetAirport ();
165 static bool getGPSLock ();
166 static double getGPSTargetLatitude ();
167 static double getGPSTargetLongitude ();
169 static void setTargetAirport (const string &targetAirport);
170 static void setGPSLock (bool lock);
171 static void setGPSTargetLatitude (double latitude);
172 static void setGPSTargetLongitude (double longitude);
176 static double getVisibility ();
177 static bool getClouds ();
178 static double getCloudsASL ();
180 static void setVisibility (double visiblity);
181 static void setClouds (bool clouds);
182 static void setCloudsASL (double cloudsASL);
185 // Time (this varies with time) huh, huh
186 static double getMagVar ();
187 static double getMagDip ();
191 // Will cause a linking error if invoked.
194 static void reinit ();
195 static void needReinit () { _needReinit = true; }
196 static bool _needReinit;