2000-02-26 18:01:13 +00:00
|
|
|
// bfi.hxx - Big Flat Interface
|
|
|
|
//
|
|
|
|
// Written by David Megginson, started February, 2000.
|
|
|
|
//
|
|
|
|
// Copyright (C) 2000 David Megginson - david@megginson.com
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
|
|
|
|
#include <time.h>
|
|
|
|
#include <string>
|
|
|
|
|
2000-04-27 21:57:08 +00:00
|
|
|
#include <simgear/compiler.h>
|
|
|
|
|
2000-02-26 18:01:13 +00:00
|
|
|
FG_USING_NAMESPACE(std);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Big Flat Interface
|
|
|
|
*
|
|
|
|
* This class implements the Facade design pattern (GOF p.185) to provide
|
|
|
|
* a single, (deceptively) simple flat interface for the FlightGear
|
|
|
|
* subsystems.
|
|
|
|
*
|
|
|
|
* To help cut down on interdependence, subsystems should
|
|
|
|
* use the BFI whenever possible for inter-system communication.
|
|
|
|
*
|
|
|
|
* TODO:
|
|
|
|
* - add selectors to switch the current plane, throttle, brake, etc.
|
|
|
|
* - add more autopilot settings
|
|
|
|
*/
|
|
|
|
class FGBFI
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2000-07-03 20:09:56 +00:00
|
|
|
// Initialize before first use.
|
|
|
|
static void init ();
|
|
|
|
|
2000-02-26 18:01:13 +00:00
|
|
|
// Reinit if necessary.
|
|
|
|
static void update ();
|
|
|
|
|
|
|
|
// Simulation
|
|
|
|
static int getFlightModel ();
|
2000-05-06 21:47:53 +00:00
|
|
|
static const string getAircraft ();
|
|
|
|
static const string getAircraftDir ();
|
2000-02-26 18:01:13 +00:00
|
|
|
static time_t getTimeGMT ();
|
2000-09-22 17:20:56 +00:00
|
|
|
static const string &getGMTString ();
|
2000-02-26 18:01:13 +00:00
|
|
|
static bool getHUDVisible ();
|
|
|
|
static bool getPanelVisible ();
|
|
|
|
|
|
|
|
static void setFlightModel (int flightModel);
|
2000-05-06 21:47:53 +00:00
|
|
|
static void setAircraft (const string &aircraft);
|
|
|
|
static void setAircraftDir (const string &aircraftDir);
|
2000-02-26 18:01:13 +00:00
|
|
|
static void setTimeGMT (time_t time);
|
|
|
|
static void setHUDVisible (bool hudVisible);
|
|
|
|
static void setPanelVisible (bool panelVisible);
|
|
|
|
|
|
|
|
|
|
|
|
// Position
|
|
|
|
static double getLatitude ();
|
|
|
|
static double getLongitude ();
|
|
|
|
static double getAltitude ();
|
2000-04-28 20:08:22 +00:00
|
|
|
static double getAGL ();
|
2000-02-26 18:01:13 +00:00
|
|
|
|
|
|
|
static void setLatitude (double latitude);
|
|
|
|
static void setLongitude (double longitude);
|
|
|
|
static void setAltitude (double altitude);
|
|
|
|
|
|
|
|
|
|
|
|
// Attitude
|
2000-05-15 16:33:42 +00:00
|
|
|
static double getHeading (); // true heading
|
|
|
|
static double getHeadingMag (); // exact magnetic heading
|
2000-02-26 18:01:13 +00:00
|
|
|
static double getPitch ();
|
|
|
|
static double getRoll ();
|
|
|
|
|
|
|
|
static void setHeading (double heading);
|
|
|
|
static void setPitch (double pitch);
|
|
|
|
static void setRoll (double roll);
|
|
|
|
|
2000-09-29 22:02:32 +00:00
|
|
|
// Engine
|
|
|
|
static double getRPM ();
|
|
|
|
static void setRPM ( double rpm );
|
2000-10-04 22:22:21 +00:00
|
|
|
static double getEGT ();
|
2000-02-26 18:01:13 +00:00
|
|
|
|
|
|
|
// Velocities
|
|
|
|
static double getAirspeed ();
|
|
|
|
static double getSideSlip ();
|
|
|
|
static double getVerticalSpeed ();
|
|
|
|
static double getSpeedNorth ();
|
|
|
|
static double getSpeedEast ();
|
|
|
|
static double getSpeedDown ();
|
|
|
|
|
|
|
|
static void setSpeedNorth (double speed);
|
|
|
|
static void setSpeedEast (double speed);
|
|
|
|
static void setSpeedDown (double speed);
|
|
|
|
|
|
|
|
|
|
|
|
// Controls
|
|
|
|
static double getThrottle ();
|
2000-10-04 22:22:21 +00:00
|
|
|
static double getMixture ();
|
|
|
|
static double getPropAdvance ();
|
2000-02-26 18:01:13 +00:00
|
|
|
static double getFlaps ();
|
|
|
|
static double getAileron ();
|
|
|
|
static double getRudder ();
|
|
|
|
static double getElevator ();
|
|
|
|
static double getElevatorTrim ();
|
2000-07-23 00:11:04 +00:00
|
|
|
static double getBrakes ();
|
2000-07-14 15:46:27 +00:00
|
|
|
static double getLeftBrake ();
|
|
|
|
static double getRightBrake ();
|
2000-07-23 00:11:04 +00:00
|
|
|
static double getCenterBrake ();
|
2000-02-26 18:01:13 +00:00
|
|
|
|
|
|
|
static void setThrottle (double throttle);
|
2000-10-04 22:22:21 +00:00
|
|
|
static void setMixture (double mixture);
|
|
|
|
static void setPropAdvance (double pitch);
|
2000-02-26 18:01:13 +00:00
|
|
|
static void setFlaps (double flaps);
|
|
|
|
static void setAileron (double aileron);
|
|
|
|
static void setRudder (double rudder);
|
|
|
|
static void setElevator (double elevator);
|
|
|
|
static void setElevatorTrim (double trim);
|
2000-07-23 00:11:04 +00:00
|
|
|
static void setBrakes (double brake);
|
2000-07-14 15:46:27 +00:00
|
|
|
static void setLeftBrake (double brake);
|
|
|
|
static void setRightBrake (double brake);
|
2000-07-23 00:11:04 +00:00
|
|
|
static void setCenterBrake (double brake);
|
2000-02-26 18:01:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Autopilot
|
|
|
|
static bool getAPAltitudeLock ();
|
|
|
|
static double getAPAltitude ();
|
|
|
|
static bool getAPHeadingLock ();
|
2000-07-23 00:11:04 +00:00
|
|
|
static double getAPHeading ();
|
2000-05-14 04:18:12 +00:00
|
|
|
static double getAPHeadingMag ();
|
2000-02-26 18:01:13 +00:00
|
|
|
|
|
|
|
static void setAPAltitudeLock (bool lock);
|
|
|
|
static void setAPAltitude (double altitude);
|
|
|
|
static void setAPHeadingLock (bool lock);
|
2000-07-23 00:11:04 +00:00
|
|
|
static void setAPHeading (double heading);
|
2000-05-14 04:18:12 +00:00
|
|
|
static void setAPHeadingMag (double heading);
|
2000-02-26 18:01:13 +00:00
|
|
|
|
User-visible
- knobs now continue to rotate when you hold down the mouse
- the middle mouse button makes knobs rotate much faster
- there are NAV1, NAV2, and ADF radios that can be tuned using the mouse
- there are standby frequencies for NAV1 and NAV2, and buttons to swap
- there is a crude, rather silly-looking DME, hard-wired to NAV1
- there is a crude, rather silly-looking autopilot that can lock
the heading (to the bug on the gyro), can lock to NAV1, and can lock
the current altitude
- the knobs for changing the radials on NAV1 and NAV2 look much better
and are in the right place
- tuning into an ILS frequency doesn't change the displayed radial for
NAV1
Code
- I've created a new module, sp_panel.[ch]xx, that constructs the
default single-prop panel; this works entirely outside of FGPanel,
so it is possible to construct similar modules for other sorts of
panels; all code specific to the default panel has been removed from
panel.cxx
- current_panel is now a pointer
- radiostack.[ch]xx keeps track both of the actual radial and of the
selected radial (they will differ with ILS); the NAV gauges should
not spin around automatically to show the actual radial (we need to
do something similar with the autopilot)
- the panel is initialized fairly early
- make sure that standby frequencies also get initialized
- I've started combining and clipping small textures to save texture
memory; there's a lot more to do, but at least I've made a start
2000-05-02 18:26:00 +00:00
|
|
|
static bool getAPNAV1Lock ();
|
|
|
|
static void setAPNAV1Lock (bool lock);
|
|
|
|
|
2000-04-27 22:45:48 +00:00
|
|
|
// Radio Navigation
|
|
|
|
static double getNAV1Freq ();
|
|
|
|
static double getNAV1AltFreq ();
|
|
|
|
static double getNAV1Radial ();
|
User-visible
- knobs now continue to rotate when you hold down the mouse
- the middle mouse button makes knobs rotate much faster
- there are NAV1, NAV2, and ADF radios that can be tuned using the mouse
- there are standby frequencies for NAV1 and NAV2, and buttons to swap
- there is a crude, rather silly-looking DME, hard-wired to NAV1
- there is a crude, rather silly-looking autopilot that can lock
the heading (to the bug on the gyro), can lock to NAV1, and can lock
the current altitude
- the knobs for changing the radials on NAV1 and NAV2 look much better
and are in the right place
- tuning into an ILS frequency doesn't change the displayed radial for
NAV1
Code
- I've created a new module, sp_panel.[ch]xx, that constructs the
default single-prop panel; this works entirely outside of FGPanel,
so it is possible to construct similar modules for other sorts of
panels; all code specific to the default panel has been removed from
panel.cxx
- current_panel is now a pointer
- radiostack.[ch]xx keeps track both of the actual radial and of the
selected radial (they will differ with ILS); the NAV gauges should
not spin around automatically to show the actual radial (we need to
do something similar with the autopilot)
- the panel is initialized fairly early
- make sure that standby frequencies also get initialized
- I've started combining and clipping small textures to save texture
memory; there's a lot more to do, but at least I've made a start
2000-05-02 18:26:00 +00:00
|
|
|
static double getNAV1SelRadial ();
|
2000-05-12 20:07:51 +00:00
|
|
|
static double getNAV1DistDME ();
|
2000-09-22 17:20:56 +00:00
|
|
|
static bool getNAV1TO ();
|
|
|
|
static bool getNAV1FROM ();
|
2000-05-15 16:33:42 +00:00
|
|
|
static bool getNAV1InRange ();
|
|
|
|
static bool getNAV1DMEInRange ();
|
2000-04-27 22:45:48 +00:00
|
|
|
|
|
|
|
static double getNAV2Freq ();
|
|
|
|
static double getNAV2AltFreq ();
|
|
|
|
static double getNAV2Radial ();
|
User-visible
- knobs now continue to rotate when you hold down the mouse
- the middle mouse button makes knobs rotate much faster
- there are NAV1, NAV2, and ADF radios that can be tuned using the mouse
- there are standby frequencies for NAV1 and NAV2, and buttons to swap
- there is a crude, rather silly-looking DME, hard-wired to NAV1
- there is a crude, rather silly-looking autopilot that can lock
the heading (to the bug on the gyro), can lock to NAV1, and can lock
the current altitude
- the knobs for changing the radials on NAV1 and NAV2 look much better
and are in the right place
- tuning into an ILS frequency doesn't change the displayed radial for
NAV1
Code
- I've created a new module, sp_panel.[ch]xx, that constructs the
default single-prop panel; this works entirely outside of FGPanel,
so it is possible to construct similar modules for other sorts of
panels; all code specific to the default panel has been removed from
panel.cxx
- current_panel is now a pointer
- radiostack.[ch]xx keeps track both of the actual radial and of the
selected radial (they will differ with ILS); the NAV gauges should
not spin around automatically to show the actual radial (we need to
do something similar with the autopilot)
- the panel is initialized fairly early
- make sure that standby frequencies also get initialized
- I've started combining and clipping small textures to save texture
memory; there's a lot more to do, but at least I've made a start
2000-05-02 18:26:00 +00:00
|
|
|
static double getNAV2SelRadial ();
|
2000-05-12 20:07:51 +00:00
|
|
|
static double getNAV2DistDME ();
|
2000-09-22 17:20:56 +00:00
|
|
|
static bool getNAV2TO ();
|
|
|
|
static bool getNAV2FROM ();
|
2000-05-15 16:33:42 +00:00
|
|
|
static bool getNAV2InRange ();
|
|
|
|
static bool getNAV2DMEInRange ();
|
2000-04-27 22:45:48 +00:00
|
|
|
|
|
|
|
static double getADFFreq ();
|
|
|
|
static double getADFAltFreq ();
|
|
|
|
static double getADFRotation ();
|
|
|
|
|
|
|
|
static void setNAV1Freq (double freq);
|
|
|
|
static void setNAV1AltFreq (double freq);
|
User-visible
- knobs now continue to rotate when you hold down the mouse
- the middle mouse button makes knobs rotate much faster
- there are NAV1, NAV2, and ADF radios that can be tuned using the mouse
- there are standby frequencies for NAV1 and NAV2, and buttons to swap
- there is a crude, rather silly-looking DME, hard-wired to NAV1
- there is a crude, rather silly-looking autopilot that can lock
the heading (to the bug on the gyro), can lock to NAV1, and can lock
the current altitude
- the knobs for changing the radials on NAV1 and NAV2 look much better
and are in the right place
- tuning into an ILS frequency doesn't change the displayed radial for
NAV1
Code
- I've created a new module, sp_panel.[ch]xx, that constructs the
default single-prop panel; this works entirely outside of FGPanel,
so it is possible to construct similar modules for other sorts of
panels; all code specific to the default panel has been removed from
panel.cxx
- current_panel is now a pointer
- radiostack.[ch]xx keeps track both of the actual radial and of the
selected radial (they will differ with ILS); the NAV gauges should
not spin around automatically to show the actual radial (we need to
do something similar with the autopilot)
- the panel is initialized fairly early
- make sure that standby frequencies also get initialized
- I've started combining and clipping small textures to save texture
memory; there's a lot more to do, but at least I've made a start
2000-05-02 18:26:00 +00:00
|
|
|
static void setNAV1SelRadial (double radial);
|
2000-04-27 22:45:48 +00:00
|
|
|
|
|
|
|
static void setNAV2Freq (double freq);
|
|
|
|
static void setNAV2AltFreq (double freq);
|
User-visible
- knobs now continue to rotate when you hold down the mouse
- the middle mouse button makes knobs rotate much faster
- there are NAV1, NAV2, and ADF radios that can be tuned using the mouse
- there are standby frequencies for NAV1 and NAV2, and buttons to swap
- there is a crude, rather silly-looking DME, hard-wired to NAV1
- there is a crude, rather silly-looking autopilot that can lock
the heading (to the bug on the gyro), can lock to NAV1, and can lock
the current altitude
- the knobs for changing the radials on NAV1 and NAV2 look much better
and are in the right place
- tuning into an ILS frequency doesn't change the displayed radial for
NAV1
Code
- I've created a new module, sp_panel.[ch]xx, that constructs the
default single-prop panel; this works entirely outside of FGPanel,
so it is possible to construct similar modules for other sorts of
panels; all code specific to the default panel has been removed from
panel.cxx
- current_panel is now a pointer
- radiostack.[ch]xx keeps track both of the actual radial and of the
selected radial (they will differ with ILS); the NAV gauges should
not spin around automatically to show the actual radial (we need to
do something similar with the autopilot)
- the panel is initialized fairly early
- make sure that standby frequencies also get initialized
- I've started combining and clipping small textures to save texture
memory; there's a lot more to do, but at least I've made a start
2000-05-02 18:26:00 +00:00
|
|
|
static void setNAV2SelRadial (double radial);
|
2000-04-27 22:45:48 +00:00
|
|
|
|
|
|
|
static void setADFFreq (double freq);
|
|
|
|
static void setADFAltFreq (double freq);
|
|
|
|
static void setADFRotation (double rot);
|
2000-02-26 18:01:13 +00:00
|
|
|
|
|
|
|
// GPS
|
2000-10-10 17:45:04 +00:00
|
|
|
static const string &getTargetAirport ();
|
2000-02-26 18:01:13 +00:00
|
|
|
static bool getGPSLock ();
|
|
|
|
static double getGPSTargetLatitude ();
|
|
|
|
static double getGPSTargetLongitude ();
|
|
|
|
|
|
|
|
static void setTargetAirport (const string &targetAirport);
|
|
|
|
static void setGPSLock (bool lock);
|
|
|
|
|
|
|
|
// Weather
|
|
|
|
static double getVisibility ();
|
2000-05-06 21:47:53 +00:00
|
|
|
static bool getClouds ();
|
|
|
|
static double getCloudsASL ();
|
2000-02-26 18:01:13 +00:00
|
|
|
|
|
|
|
static void setVisibility (double visiblity);
|
2000-05-06 21:47:53 +00:00
|
|
|
static void setClouds (bool clouds);
|
|
|
|
static void setCloudsASL (double cloudsASL);
|
|
|
|
|
2000-02-26 18:01:13 +00:00
|
|
|
|
2000-03-29 00:15:58 +00:00
|
|
|
// Time (this varies with time) huh, huh
|
|
|
|
static double getMagVar ();
|
|
|
|
static double getMagDip ();
|
|
|
|
|
2000-02-26 18:01:13 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Will cause a linking error if invoked.
|
|
|
|
FGBFI ();
|
|
|
|
|
|
|
|
static void reinit ();
|
|
|
|
static void needReinit () { _needReinit = true; }
|
|
|
|
static bool _needReinit;
|
|
|
|
};
|
|
|
|
|
|
|
|
// end of bfi.hxx
|