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 ();
69 static void setLatitude (double latitude);
70 static void setLongitude (double longitude);
71 static void setAltitude (double altitude);
75 static double getHeading ();
76 static double getPitch ();
77 static double getRoll ();
79 static void setHeading (double heading);
80 static void setPitch (double pitch);
81 static void setRoll (double roll);
85 static double getAirspeed ();
86 static double getSideSlip ();
87 static double getVerticalSpeed ();
88 static double getSpeedNorth ();
89 static double getSpeedEast ();
90 static double getSpeedDown ();
92 static void setSpeedNorth (double speed);
93 static void setSpeedEast (double speed);
94 static void setSpeedDown (double speed);
98 static double getThrottle ();
99 static double getFlaps ();
100 static double getAileron ();
101 static double getRudder ();
102 static double getElevator ();
103 static double getElevatorTrim ();
104 static double getBrake ();
106 static void setThrottle (double throttle);
107 static void setFlaps (double flaps);
108 static void setAileron (double aileron);
109 static void setRudder (double rudder);
110 static void setElevator (double elevator);
111 static void setElevatorTrim (double trim);
112 static void setBrake (double brake);
116 static bool getAPAltitudeLock ();
117 static double getAPAltitude ();
118 static bool getAPHeadingLock ();
119 static double getAPHeading ();
121 static void setAPAltitudeLock (bool lock);
122 static void setAPAltitude (double altitude);
123 static void setAPHeadingLock (bool lock);
124 static void setAPHeading (double heading);
128 static const string getTargetAirport ();
129 static bool getGPSLock ();
130 static double getGPSTargetLatitude ();
131 static double getGPSTargetLongitude ();
133 static void setTargetAirport (const string &targetAirport);
134 static void setGPSLock (bool lock);
135 static void setGPSTargetLatitude (double latitude);
136 static void setGPSTargetLongitude (double longitude);
140 static double getVisibility ();
142 static void setVisibility (double visiblity);
144 // Time (this varies with time) huh, huh
145 static double getMagVar ();
146 static double getMagDip ();
150 // Will cause a linking error if invoked.
153 static void reinit ();
154 static void needReinit () { _needReinit = true; }
155 static bool _needReinit;