1 // kr-87.hxx -- class to impliment the King KR 87 Digital ADF
3 // Written by Curtis Olson, started June 2002.
5 // Copyright (C) 2002 Curtis L. Olson - curt@flightgear.org
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.
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.
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.
28 #include <Main/fgfs.hxx>
29 #include <Main/fg_props.hxx>
31 #include <simgear/compiler.h>
33 #include <simgear/math/interpolater.hxx>
34 #include <simgear/timing/timestamp.hxx>
36 #include <Navaids/navlist.hxx>
37 #include <Sound/beacon.hxx>
38 #include <Sound/morse.hxx>
41 class FGKR_87 : public FGSubsystem
46 SGInterpTable *term_tbl;
47 SGInterpTable *low_tbl;
48 SGInterpTable *high_tbl;
50 SGPropertyNode *lon_node;
51 SGPropertyNode *lat_node;
52 SGPropertyNode *alt_node;
57 string adf_trans_ident;
67 double adf_effective_range;
84 void update (double dt);
86 // Update nav/adf radios based on current postition
90 inline void set_adf_freq( double freq ) {
91 adf_freq = freq; need_update = true;
93 inline void set_adf_alt_freq( double freq ) { adf_alt_freq = freq; }
94 inline void set_adf_rotation( double rot ) { adf_rotation = rot; }
95 inline void set_adf_vol_btn( double val ) {
96 if ( val < 0.0 ) val = 0.0;
97 if ( val > 1.0 ) val = 1.0;
100 inline void set_adf_ident_btn( bool val ) { adf_ident_btn = val; }
103 inline double get_adf_freq () const { return adf_freq; }
104 inline double get_adf_alt_freq () const { return adf_alt_freq; }
105 inline double get_adf_rotation () const { return adf_rotation; }
108 inline bool get_adf_inrange() const { return adf_inrange; }
109 inline double get_adf_lon() const { return adf_lon; }
110 inline double get_adf_lat() const { return adf_lat; }
111 inline double get_adf_heading() const { return adf_heading; }
112 inline double get_adf_vol_btn() const { return adf_vol_btn; }
113 inline bool get_adf_ident_btn() const { return adf_ident_btn; }
117 #endif // _FG_KR_87_HXX