]> git.mxchange.org Git - flightgear.git/blob - src/Main/bfi.hxx
dadebcfeb6142fe322530f241f31f9f2f3712d09
[flightgear.git] / src / Main / bfi.hxx
1 // bfi.hxx - Big Flat Interface
2 //
3 // Written by David Megginson, started February, 2000.
4 //
5 // Copyright (C) 2000  David Megginson - david@megginson.com
6 //
7 // THIS INTERFACE IS DEPRECATED; USE THE PROPERTY MANAGER INSTEAD.
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License as
11 // published by the Free Software Foundation; either version 2 of the
12 // License, or (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 // General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 //
23 // $Id$
24
25 #include <time.h>
26 #include <string>
27
28 #include <simgear/compiler.h>
29
30 SG_USING_NAMESPACE(std);
31
32 // Uncomment the appropriate line to get the desired heading hold
33 // autopilot behavior
34
35 // #define DEFAULT_AP_HEADING_LOCK FGAutopilot::FG_TRUE_HEADING_LOCK
36 #define DEFAULT_AP_HEADING_LOCK FGAutopilot::FG_DG_HEADING_LOCK
37
38 /**
39  * Big Flat Interface
40  *
41  * This class implements the Facade design pattern (GOF p.185) to provide
42  * a single, (deceptively) simple flat interface for the FlightGear
43  * subsystems.  
44  *
45  * To help cut down on interdependence, subsystems should
46  * use the BFI whenever possible for inter-system communication.
47  *
48  * TODO:
49  * - add selectors to switch the current plane, throttle, brake, etc.
50  * - add more autopilot settings
51  */
52 class FGBFI
53 {
54 public:
55
56                                 // Initialize before first use.
57   static void init ();
58
59                                 // Reinit if necessary.
60   static void update ();
61
62                                 // Simulation
63   static string getAircraftDir ();
64   static void setAircraftDir (string aircraftDir);
65
66   static double getViewOffset ();
67   static void setViewOffset (double offset);
68   static double getGoalViewOffset ();
69   static void setGoalViewOffset (double offset);
70
71   static string getDateString ();// ISO 8601 subset
72   static void setDateString (string time_string); // ISO 8601 subset
73
74                                 // deprecated
75   static string getGMTString ();
76
77                                 // Position
78   static double getLatitude (); // degrees
79   static void setLatitude (double latitude); // degrees
80
81   static double getLongitude (); // degrees
82   static void setLongitude (double longitude); // degrees
83
84   static double getAltitude (); // feet
85   static void setAltitude (double altitude); // feet
86
87   static double getAGL ();      // feet
88
89
90                                 // Attitude
91   static double getHeading ();    // degrees
92   static void setHeading (double heading); // degrees
93
94   static double getHeadingMag (); // degrees
95
96   static double getPitch ();    // degrees
97   static void setPitch (double pitch); // degrees
98
99   static double getRoll ();     // degrees
100   static void setRoll (double roll); // degrees
101
102                                 // Engine
103   static double getRPM ();      // revolutions/minute
104   static void setRPM ( double rpm ); // revolutions/minute
105
106   static double getEGT ();      // deg Fahrenheit
107   static double getCHT ();      // deg Fahrenheit
108   static double getMP ();       // inches mercury
109   static double getFuelFlow (); // gals/hr
110
111                                  // Consumables
112   static double getTank1Fuel (); // gals
113   static void setTank1Fuel( double gals );
114   static double getTank2Fuel (); // gals
115   static void setTank2Fuel( double gals );
116
117                                 // Velocities
118   static double getAirspeed (); // knots
119   static void setAirspeed (double speed); // knots
120
121   static double getSideSlip (); // [unit??]
122
123   static double getVerticalSpeed (); // feet/second
124
125   static double getSpeedNorth (); // feet/second
126
127   static double getSpeedEast (); // feet/second
128
129   static double getSpeedDown (); // feet/second
130
131 //   static void setSpeedNorth (double speed);
132 //   static void setSpeedEast (double speed);
133 //   static void setSpeedDown (double speed);
134
135
136                                 // Autopilot
137   static bool getAPAltitudeLock ();
138   static void setAPAltitudeLock (bool lock);
139
140   static bool getAPGSLock ();
141   static void setAPGSLock (bool lock);
142
143   static double getAPAltitude (); // feet
144   static void setAPAltitude (double altitude); // feet
145
146   static double getAPClimb (); // fpm
147   static void setAPClimb (double rate); // fpm
148
149   static bool getAPHeadingLock ();
150   static void setAPHeadingLock (bool lock);
151
152   static double getAPHeadingBug (); // degrees
153   static void setAPHeadingBug (double heading); // degrees
154
155   static bool getAPWingLeveler ();
156   static void setAPWingLeveler (bool lock);
157
158   static bool getAPNAV1Lock ();
159   static void setAPNAV1Lock (bool lock);
160
161   static bool getAPAutoThrottleLock ();
162   static void setAPAutoThrottleLock (bool lock);
163
164   static double getAPRudderControl ();
165   static void setAPRudderControl (double value);
166   static double getAPElevatorControl ();
167   static void setAPElevatorControl (double value);
168   static double getAPThrottleControl ();
169   static void setAPThrottleControl (double value);
170
171
172                                 // GPS
173   static string getTargetAirport ();
174   static void setTargetAirport (string targetAirport);
175
176   static bool getGPSLock ();
177   static void setGPSLock (bool lock);
178
179   static double getGPSTargetLatitude (); // degrees
180
181   static double getGPSTargetLongitude (); // degrees
182
183
184                                 // Weather
185   static double getVisibility ();// meters
186   static void setVisibility (double visiblity); // meters
187   static double getWindNorth (); // feet/second
188   static void setWindNorth (double speed); // feet/second
189   static double getWindEast (); // feet/second
190   static void setWindEast (double speed); // feet/second
191   static double getWindDown (); // feet/second
192   static void setWindDown (double speed); // feet/second
193
194                                 // View
195   static double getFOV ();      // degrees
196   static void setFOV (double fov); // degrees
197   static void setViewAxisLong (double axis);// -1.0:1.0
198   static void setViewAxisLat (double axis); // -1.0:1.0
199
200
201                                 // Time (this varies with time) huh, huh
202   static double getMagVar ();   // degrees
203   static double getMagDip ();   // degrees
204
205
206 private:
207                                 // Will cause a linking error if invoked.
208   FGBFI ();
209
210 };
211
212 // end of bfi.hxx