66650e4148
FlightGear subsystems -- it isolates some of the config and #ifdef stuff in a single place. 2. Added a new FGSubsystem interface, defined in fgfs.hxx; so far, only FGControls implements it, but if that works, we can start letting it propagate through the system and simplify the code in main.cxx and fg_init.cxx (which is terrifyingly complex for anyone new to the project). 3. Added new src/Main/fgfs_props.[hc]xx files with convenience functions for tying properties under FlightGear. 4. Experimentally modified src/Controls/controls.cxx to tie properties directly (rather than tying to BFI functions). I'd appreciate it if you could get this into CVS as soon as possible, so we can see if the template stuff causes trouble for any other platforms before I add properties to the other subsystems. 5. Miscellaneous superficial modifications to other files. In addition, I've made a couple of further changes: 6. Modified BFI to add support for setting the view axes (i.e. with a joystick hat). 7. Cleaned up bfi.cxx and removed all cout statements.
222 lines
7.2 KiB
C++
222 lines
7.2 KiB
C++
// radiostack.hxx -- class to manage an instance of the radio stack
|
|
//
|
|
// Written by Curtis Olson, started April 2000.
|
|
//
|
|
// Copyright (C) 2000 Curtis L. Olson - curt@flightgear.org
|
|
//
|
|
// 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$
|
|
|
|
|
|
#ifndef _FG_RADIOSTACK_HXX
|
|
#define _FG_RADIOSTACK_HXX
|
|
|
|
|
|
#include <simgear/compiler.h>
|
|
|
|
#include <Navaids/ilslist.hxx>
|
|
#include <Navaids/navlist.hxx>
|
|
|
|
|
|
class FGRadioStack {
|
|
|
|
bool need_update;
|
|
|
|
bool nav1_valid;
|
|
bool nav1_inrange;
|
|
bool nav1_has_dme;
|
|
bool nav1_has_gs;
|
|
bool nav1_loc;
|
|
double nav1_freq;
|
|
double nav1_alt_freq;
|
|
double nav1_radial;
|
|
double nav1_sel_radial;
|
|
double nav1_loclon;
|
|
double nav1_loclat;
|
|
double nav1_x;
|
|
double nav1_y;
|
|
double nav1_z;
|
|
double nav1_loc_dist;
|
|
double nav1_gslon;
|
|
double nav1_gslat;
|
|
double nav1_gs_x;
|
|
double nav1_gs_y;
|
|
double nav1_gs_z;
|
|
double nav1_gs_dist;
|
|
double nav1_dmelon;
|
|
double nav1_dmelat;
|
|
double nav1_dme_x;
|
|
double nav1_dme_y;
|
|
double nav1_dme_z;
|
|
double nav1_dme_dist;
|
|
double nav1_elev;
|
|
double nav1_effective_range;
|
|
double nav1_heading;
|
|
double nav1_target_gs;
|
|
int nav1_offset;
|
|
|
|
bool nav2_valid;
|
|
bool nav2_inrange;
|
|
bool nav2_has_dme;
|
|
bool nav2_has_gs;
|
|
bool nav2_loc;
|
|
double nav2_freq;
|
|
double nav2_alt_freq;
|
|
double nav2_radial;
|
|
double nav2_sel_radial;
|
|
double nav2_loclon;
|
|
double nav2_loclat;
|
|
double nav2_x;
|
|
double nav2_y;
|
|
double nav2_z;
|
|
double nav2_loc_dist;
|
|
double nav2_gslon;
|
|
double nav2_gslat;
|
|
double nav2_gs_x;
|
|
double nav2_gs_y;
|
|
double nav2_gs_z;
|
|
double nav2_gs_dist;
|
|
double nav2_dmelon;
|
|
double nav2_dmelat;
|
|
double nav2_dme_x;
|
|
double nav2_dme_y;
|
|
double nav2_dme_z;
|
|
double nav2_dme_dist;
|
|
double nav2_elev;
|
|
double nav2_effective_range;
|
|
double nav2_heading;
|
|
double nav2_target_gs;
|
|
int nav2_offset;
|
|
|
|
bool adf_valid;
|
|
bool adf_inrange;
|
|
double adf_freq;
|
|
double adf_alt_freq;
|
|
double adf_rotation;
|
|
double adf_lon;
|
|
double adf_lat;
|
|
double adf_elev;
|
|
double adf_effective_range;
|
|
double adf_dist;
|
|
double adf_heading;
|
|
double adf_x;
|
|
double adf_y;
|
|
double adf_z;
|
|
|
|
public:
|
|
|
|
FGRadioStack();
|
|
~FGRadioStack();
|
|
|
|
// Update nav/adf radios based on current postition
|
|
void search( double lon, double lat, double elev );
|
|
|
|
// Update nav/adf radios based on current postition
|
|
void update( double lon, double lat, double elev );
|
|
|
|
// NAV1 Setters
|
|
inline void set_nav1_freq( double freq ) {
|
|
nav1_freq = freq; need_update = true;
|
|
}
|
|
inline void set_nav1_alt_freq( double freq ) { nav1_alt_freq = freq; }
|
|
inline void set_nav1_sel_radial( double radial ) {
|
|
nav1_sel_radial = radial; need_update = true;
|
|
}
|
|
|
|
// NAV2 Setters
|
|
inline void set_nav2_freq( double freq ) {
|
|
nav2_freq = freq; need_update = true;
|
|
}
|
|
inline void set_nav2_alt_freq( double freq ) { nav2_alt_freq = freq; }
|
|
inline void set_nav2_sel_radial( double radial ) {
|
|
nav2_sel_radial = radial; need_update = true;
|
|
}
|
|
|
|
// ADF Setters
|
|
inline void set_adf_freq( double freq ) {
|
|
adf_freq = freq; need_update = true;
|
|
}
|
|
inline void set_adf_alt_freq( double freq ) { adf_alt_freq = freq; }
|
|
inline void set_adf_rotation( double rot ) { adf_rotation = rot; }
|
|
|
|
|
|
// NAV1 Accessors
|
|
inline double get_nav1_freq () const { return nav1_freq; }
|
|
inline double get_nav1_alt_freq () const { return nav1_alt_freq; }
|
|
inline double get_nav1_sel_radial() const { return nav1_sel_radial; }
|
|
|
|
// NAV2 Accessors
|
|
inline double get_nav2_freq () const { return nav2_freq; }
|
|
inline double get_nav2_alt_freq () const { return nav2_alt_freq; }
|
|
inline double get_nav2_sel_radial() const { return nav2_sel_radial; }
|
|
|
|
// ADF Accessors
|
|
inline double get_adf_freq () const { return adf_freq; }
|
|
inline double get_adf_alt_freq () const { return adf_alt_freq; }
|
|
inline double get_adf_rotation () const { return adf_rotation; }
|
|
|
|
// Calculated values.
|
|
inline bool get_nav1_inrange() const { return nav1_inrange; }
|
|
inline bool get_nav1_has_dme() const { return nav1_has_dme; }
|
|
inline bool get_nav1_has_gs() const { return nav1_has_gs; }
|
|
inline bool get_nav1_loc() const { return nav1_loc; }
|
|
inline double get_nav1_loclon() const { return nav1_loclon; }
|
|
inline double get_nav1_loclat() const { return nav1_loclat; }
|
|
inline double get_nav1_loc_dist() const { return nav1_loc_dist; }
|
|
inline double get_nav1_gslon() const { return nav1_gslon; }
|
|
inline double get_nav1_gslat() const { return nav1_gslat; }
|
|
inline double get_nav1_gs_dist() const { return nav1_gs_dist; }
|
|
inline double get_nav1_dmelon() const { return nav1_dmelon; }
|
|
inline double get_nav1_dmelat() const { return nav1_dmelat; }
|
|
inline double get_nav1_dme_dist() const { return nav1_dme_dist; }
|
|
inline double get_nav1_elev() const { return nav1_elev; }
|
|
inline double get_nav1_heading() const { return nav1_heading; }
|
|
inline double get_nav1_radial() const { return nav1_radial; }
|
|
inline double get_nav1_target_gs() const { return nav1_target_gs; }
|
|
|
|
inline bool get_nav2_inrange() const { return nav2_inrange; }
|
|
inline bool get_nav2_has_dme() const { return nav2_has_dme; }
|
|
inline bool get_nav2_has_gs() const { return nav2_has_gs; }
|
|
inline bool get_nav2_loc() const { return nav2_loc; }
|
|
inline double get_nav2_loclon() const { return nav2_loclon; }
|
|
inline double get_nav2_loclat() const { return nav2_loclat; }
|
|
inline double get_nav2_loc_dist() const { return nav2_loc_dist; }
|
|
inline double get_nav2_gslon() const { return nav2_gslon; }
|
|
inline double get_nav2_gslat() const { return nav2_gslat; }
|
|
inline double get_nav2_gs_dist() const { return nav2_gs_dist; }
|
|
inline double get_nav2_dmelon() const { return nav2_dmelon; }
|
|
inline double get_nav2_dmelat() const { return nav2_dmelat; }
|
|
inline double get_nav2_dme_dist() const { return nav2_dme_dist; }
|
|
inline double get_nav2_elev() const { return nav2_elev; }
|
|
inline double get_nav2_heading() const { return nav2_heading; }
|
|
inline double get_nav2_radial() const { return nav2_radial; }
|
|
inline double get_nav2_target_gs() const { return nav2_target_gs; }
|
|
|
|
inline bool get_adf_inrange() const { return adf_inrange; }
|
|
inline double get_adf_lon() const { return adf_lon; }
|
|
inline double get_adf_lat() const { return adf_lat; }
|
|
inline double get_adf_heading() const { return adf_heading; }
|
|
};
|
|
|
|
|
|
extern FGRadioStack *current_radiostack;
|
|
|
|
|
|
// periodic radio station search wrapper
|
|
void fgRadioSearch( void );
|
|
|
|
|
|
#endif // _FG_RADIOSTACK_HXX
|