Begin adding radio stack functionality.
This commit is contained in:
parent
c7cac5893f
commit
56ad909452
3 changed files with 209 additions and 0 deletions
|
@ -8,6 +8,7 @@ libCockpit_a_SOURCES = \
|
|||
hud_lat.cxx hud_lon.cxx \
|
||||
hud_scal.cxx hud_tbi.cxx \
|
||||
panel.cxx panel.hxx \
|
||||
radiostack.cxx radiostack.hxx \
|
||||
steam.cxx steam.hxx
|
||||
|
||||
INCLUDES += -I$(top_builddir) -I$(top_builddir)/src
|
||||
|
|
96
src/Cockpit/radiostack.cxx
Normal file
96
src/Cockpit/radiostack.cxx
Normal file
|
@ -0,0 +1,96 @@
|
|||
// radiostack.cxx -- 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$
|
||||
|
||||
|
||||
#include <Navaids/ilslist.hxx>
|
||||
#include <Navaids/navlist.hxx>
|
||||
|
||||
#include "radiostack.hxx"
|
||||
|
||||
|
||||
// Constructor
|
||||
FGRadioStack::FGRadioStack() {
|
||||
need_update = true;
|
||||
}
|
||||
|
||||
|
||||
// Destructor
|
||||
FGRadioStack::~FGRadioStack() {
|
||||
}
|
||||
|
||||
|
||||
// Update nav/adf radios based on current postition
|
||||
void FGRadioStack::update( double lon, double lat, double elev ) {
|
||||
need_update = false;
|
||||
|
||||
FGNav n;
|
||||
|
||||
// nav1
|
||||
if ( current_navlist->query( lon, lat, elev, nav1_freq,
|
||||
&n, &nav1_heading, &nav1_dist) ) {
|
||||
nav1_inrange = true;
|
||||
nav1_lon = n.get_lon();
|
||||
nav1_lat = n.get_lat();
|
||||
nav1_elev = n.get_elev();
|
||||
cout << "Found a vor station in range" << endl;
|
||||
cout << " id = " << n.get_ident() << endl;
|
||||
cout << " heading = " << nav1_heading
|
||||
<< " dist = " << nav1_dist << endl;
|
||||
} else {
|
||||
nav1_inrange = false;
|
||||
cout << "not picking up vor. :-(" << endl;
|
||||
}
|
||||
|
||||
// nav1
|
||||
if ( current_navlist->query( lon, lat, elev, nav2_freq,
|
||||
&n, &nav2_heading, &nav2_dist) ) {
|
||||
nav2_inrange = true;
|
||||
nav2_lon = n.get_lon();
|
||||
nav2_lat = n.get_lat();
|
||||
nav2_elev = n.get_elev();
|
||||
cout << "Found a vor station in range" << endl;
|
||||
cout << " id = " << n.get_ident() << endl;
|
||||
cout << " heading = " << nav2_heading
|
||||
<< " dist = " << nav2_dist << endl;
|
||||
} else {
|
||||
nav2_inrange = false;
|
||||
cout << "not picking up vor. :-(" << endl;
|
||||
}
|
||||
|
||||
// adf
|
||||
double junk;
|
||||
if ( current_navlist->query( lon, lat, elev, adf_freq,
|
||||
&n, &adf_heading, &junk) ) {
|
||||
adf_inrange = true;
|
||||
adf_lon = n.get_lon();
|
||||
adf_lat = n.get_lat();
|
||||
adf_elev = n.get_elev();
|
||||
cout << "Found an adf station in range" << endl;
|
||||
cout << " id = " << n.get_ident() << endl;
|
||||
cout << " heading = " << adf_heading
|
||||
<< " dist = " << junk << endl;
|
||||
} else {
|
||||
adf_inrange = false;
|
||||
cout << "not picking up adf. :-(" << endl;
|
||||
}
|
||||
}
|
||||
|
112
src/Cockpit/radiostack.hxx
Normal file
112
src/Cockpit/radiostack.hxx
Normal file
|
@ -0,0 +1,112 @@
|
|||
// 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>
|
||||
|
||||
|
||||
class FGRadioStack {
|
||||
|
||||
bool need_update;
|
||||
|
||||
bool nav1_inrange;
|
||||
bool nav1_loc;
|
||||
double nav1_freq;
|
||||
double nav1_radial;
|
||||
double nav1_lon;
|
||||
double nav1_lat;
|
||||
double nav1_elev;
|
||||
double nav1_dist;
|
||||
double nav1_heading;
|
||||
|
||||
bool nav2_inrange;
|
||||
double nav2_freq;
|
||||
double nav2_radial;
|
||||
double nav2_lon;
|
||||
double nav2_lat;
|
||||
double nav2_elev;
|
||||
double nav2_dist;
|
||||
double nav2_heading;
|
||||
|
||||
bool adf_inrange;
|
||||
double adf_freq;
|
||||
double adf_lon;
|
||||
double adf_lat;
|
||||
double adf_elev;
|
||||
double adf_heading;
|
||||
|
||||
public:
|
||||
|
||||
FGRadioStack();
|
||||
~FGRadioStack();
|
||||
|
||||
// Update nav/adf radios based on current postition
|
||||
void update( double lon, double lat, double elev );
|
||||
|
||||
inline void set_nav1_freq( double freq ) {
|
||||
nav1_freq = freq; need_update = true;
|
||||
}
|
||||
inline void set_nav1_radial( double radial ) {
|
||||
nav1_radial = radial; need_update = true;
|
||||
}
|
||||
|
||||
inline void set_nav2_freq( double freq ) {
|
||||
nav2_freq = freq; need_update = true;
|
||||
}
|
||||
|
||||
inline void set_nav2_radial( double radial ) {
|
||||
nav2_radial = radial; need_update = true;
|
||||
}
|
||||
|
||||
inline void set_adf_freq( double freq ) {
|
||||
adf_freq = freq; need_update = true;
|
||||
}
|
||||
|
||||
inline bool get_nav1_inrange() const { return nav1_inrange; }
|
||||
inline bool get_nav1_loc() const { return nav1_loc; }
|
||||
inline double get_nav1_radial() const { return nav1_radial; }
|
||||
inline double get_nav1_lon() const { return nav1_lon; }
|
||||
inline double get_nav1_lat() const { return nav1_lat; }
|
||||
inline double get_nav1_elev() const { return nav1_elev; }
|
||||
inline double get_nav1_dist() const { return nav1_dist; }
|
||||
inline double get_nav1_heading() const { return nav1_heading; }
|
||||
|
||||
inline bool get_nav2_inrange() const { return nav2_inrange; }
|
||||
inline double get_nav2_radial() const { return nav2_radial; }
|
||||
inline double get_nav2_lon() const { return nav2_lon; }
|
||||
inline double get_nav2_lat() const { return nav2_lat; }
|
||||
inline double get_nav2_elev() const { return nav2_elev; }
|
||||
inline double get_nav2_dist() const { return nav2_dist; }
|
||||
inline double get_nav2_heading() const { return nav2_heading; }
|
||||
|
||||
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; }
|
||||
};
|
||||
|
||||
|
||||
#endif // _FG_RADIOSTACK_HXX
|
Loading…
Add table
Reference in a new issue