]> git.mxchange.org Git - flightgear.git/blob - src/Main/bfi.hxx
dfb438dc7c8ff99488882286b91f2ae02532956f
[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 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.
11 //
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.
16 //
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.
20 //
21 // $Id$
22
23 #include <time.h>
24 #include <string>
25
26 #include <simgear/compiler.h>
27
28 FG_USING_NAMESPACE(std);
29
30
31 /**
32  * Big Flat Interface
33  *
34  * This class implements the Facade design pattern (GOF p.185) to provide
35  * a single, (deceptively) simple flat interface for the FlightGear
36  * subsystems.  
37  *
38  * To help cut down on interdependence, subsystems should
39  * use the BFI whenever possible for inter-system communication.
40  *
41  * TODO:
42  * - add selectors to switch the current plane, throttle, brake, etc.
43  * - add more autopilot settings
44  */
45 class FGBFI
46 {
47 public:
48
49                                 // Reinit if necessary.
50   static void update ();
51
52                                 // Simulation
53   static int getFlightModel ();
54   static time_t getTimeGMT ();
55   static bool getHUDVisible ();
56   static bool getPanelVisible ();
57
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);
62
63
64                                 // Position
65   static double getLatitude ();
66   static double getLongitude ();
67   static double getAltitude ();
68   static double getAGL ();
69
70   static void setLatitude (double latitude);
71   static void setLongitude (double longitude);
72   static void setAltitude (double altitude);
73
74
75                                 // Attitude
76   static double getHeading ();
77   static double getPitch ();
78   static double getRoll ();
79
80   static void setHeading (double heading);
81   static void setPitch (double pitch);
82   static void setRoll (double roll);
83
84
85                                 // Velocities
86   static double getAirspeed ();
87   static double getSideSlip ();
88   static double getVerticalSpeed ();
89   static double getSpeedNorth ();
90   static double getSpeedEast ();
91   static double getSpeedDown ();
92
93   static void setSpeedNorth (double speed);
94   static void setSpeedEast (double speed);
95   static void setSpeedDown (double speed);
96
97
98                                 // Controls
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 ();
106
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);
114
115
116                                 // Autopilot
117   static bool getAPAltitudeLock ();
118   static double getAPAltitude ();
119   static bool getAPHeadingLock ();
120   static double getAPHeading ();
121
122   static void setAPAltitudeLock (bool lock);
123   static void setAPAltitude (double altitude);
124   static void setAPHeadingLock (bool lock);
125   static void setAPHeading (double heading);
126
127                                 // Radio Navigation
128   static double getNAV1Freq ();
129   static double getNAV1AltFreq ();
130   static double getNAV1Radial ();
131
132   static double getNAV2Freq ();
133   static double getNAV2AltFreq ();
134   static double getNAV2Radial ();
135
136   static double getADFFreq ();
137   static double getADFAltFreq ();
138   static double getADFRotation ();
139
140   static void setNAV1Freq (double freq);
141   static void setNAV1AltFreq (double freq);
142   static void setNAV1Radial (double radial);
143
144   static void setNAV2Freq (double freq);
145   static void setNAV2AltFreq (double freq);
146   static void setNAV2Radial (double radial);
147
148   static void setADFFreq (double freq);
149   static void setADFAltFreq (double freq);
150   static void setADFRotation (double rot);
151
152                                 // GPS
153   static const string getTargetAirport ();
154   static bool getGPSLock ();
155   static double getGPSTargetLatitude ();
156   static double getGPSTargetLongitude ();
157
158   static void setTargetAirport (const string &targetAirport);
159   static void setGPSLock (bool lock);
160   static void setGPSTargetLatitude (double latitude);
161   static void setGPSTargetLongitude (double longitude);
162
163
164                                 // Weather
165   static double getVisibility ();
166
167   static void setVisibility (double visiblity);
168
169                                 // Time (this varies with time) huh, huh
170   static double getMagVar (); 
171   static double getMagDip (); 
172
173
174 private:
175                                 // Will cause a linking error if invoked.
176   FGBFI ();
177
178   static void reinit ();
179   static void needReinit () { _needReinit = true; }
180   static bool _needReinit;
181 };
182
183 // end of bfi.hxx