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 FG_USING_NAMESPACE(std);
32 * This class implements the Facade design pattern (GOF p.185) to provide
33 * a single, (deceptively) simple flat interface for the FlightGear
36 * To help cut down on interdependence, subsystems should
37 * use the BFI whenever possible for inter-system communication.
40 * - add selectors to switch the current plane, throttle, brake, etc.
41 * - add more autopilot settings
47 // Reinit if necessary.
48 static void update ();
51 static int getFlightModel ();
52 static time_t getTimeGMT ();
53 static bool getHUDVisible ();
54 static bool getPanelVisible ();
56 static void setFlightModel (int flightModel);
57 static void setTimeGMT (time_t time);
58 static void setHUDVisible (bool hudVisible);
59 static void setPanelVisible (bool panelVisible);
63 static double getLatitude ();
64 static double getLongitude ();
65 static double getAltitude ();
67 static void setLatitude (double latitude);
68 static void setLongitude (double longitude);
69 static void setAltitude (double altitude);
73 static double getHeading ();
74 static double getPitch ();
75 static double getRoll ();
77 static void setHeading (double heading);
78 static void setPitch (double pitch);
79 static void setRoll (double roll);
83 static double getAirspeed ();
84 static double getSideSlip ();
85 static double getVerticalSpeed ();
86 static double getSpeedNorth ();
87 static double getSpeedEast ();
88 static double getSpeedDown ();
90 static void setSpeedNorth (double speed);
91 static void setSpeedEast (double speed);
92 static void setSpeedDown (double speed);
96 static double getThrottle ();
97 static double getFlaps ();
98 static double getAileron ();
99 static double getRudder ();
100 static double getElevator ();
101 static double getElevatorTrim ();
102 static double getBrake ();
104 static void setThrottle (double throttle);
105 static void setFlaps (double flaps);
106 static void setAileron (double aileron);
107 static void setRudder (double rudder);
108 static void setElevator (double elevator);
109 static void setElevatorTrim (double trim);
110 static void setBrake (double brake);
114 static bool getAPAltitudeLock ();
115 static double getAPAltitude ();
116 static bool getAPHeadingLock ();
117 static double getAPHeading ();
119 static void setAPAltitudeLock (bool lock);
120 static void setAPAltitude (double altitude);
121 static void setAPHeadingLock (bool lock);
122 static void setAPHeading (double heading);
126 static const string getTargetAirport ();
127 static bool getGPSLock ();
128 static double getGPSTargetLatitude ();
129 static double getGPSTargetLongitude ();
131 static void setTargetAirport (const string &targetAirport);
132 static void setGPSLock (bool lock);
133 static void setGPSTargetLatitude (double latitude);
134 static void setGPSTargetLongitude (double longitude);
138 static double getVisibility ();
140 static void setVisibility (double visiblity);
142 // Time (this varies with time) huh, huh
143 static double getMagVar ();
144 static double getMagDip ();
148 // Will cause a linking error if invoked.
151 static void reinit ();
152 static void needReinit () { _needReinit = true; }
153 static bool _needReinit;