1 // dme.hxx -- class to manage an instance of the DME
3 // Written by Curtis Olson, started April 2000.
5 // Copyright (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt
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/fg_props.hxx>
30 #include <simgear/compiler.h>
31 #include <simgear/structure/subsystem_mgr.hxx>
32 // #include <simgear/math/interpolater.hxx>
33 #include <simgear/timing/timestamp.hxx>
35 // #include <Navaids/ilslist.hxx>
36 #include <Navaids/navlist.hxx>
37 // #include <Sound/beacon.hxx>
38 #include <Sound/morse.hxx>
40 // #include "kr_87.hxx" // ADF
41 // #include "kt_70.hxx" // Transponder
42 // #include "navcom.hxx"
44 class FGDME : public SGSubsystem
46 SGPropertyNode *lon_node;
47 SGPropertyNode *lat_node;
48 SGPropertyNode *alt_node;
49 SGPropertyNode *bus_power;
50 SGPropertyNode *navcom1_bus_power, *navcom2_bus_power;
51 SGPropertyNode *navcom1_power_btn, *navcom2_power_btn;
52 SGPropertyNode *navcom1_freq, *navcom2_freq;
64 double effective_range;
73 SGTimeStamp last_time;
83 void update (double dt);
85 // Update dme based on current postition
89 inline void set_freq (double freq) {
90 freq = freq; need_update = true;
95 inline bool has_power() const {
96 return (switch_pos > 0)
97 && (bus_power->getDoubleValue() > 1.0);
99 inline bool navcom1_on() const {
100 return (navcom1_bus_power->getDoubleValue() > 1.0)
101 && navcom1_power_btn->getBoolValue();
103 inline bool navcom2_on() const {
104 return (navcom2_bus_power->getDoubleValue() > 1.0)
105 && navcom2_power_btn->getBoolValue();
107 inline double get_freq () const { return freq; }
109 // Calculated values.
110 inline bool get_inrange () const { return inrange; }
111 inline double get_dist () const { return dist; }
112 inline double get_spd () const { return spd; }
113 inline double get_ete () const { return ete; }
117 #endif // _FG_DME_HXX