]> git.mxchange.org Git - flightgear.git/blob - src/Instrumentation/tacan.hxx
- don't read the channel always from tacan[0] (even if the existence of
[flightgear.git] / src / Instrumentation / tacan.hxx
1 // dme.hxx - distance-measuring equipment.
2 // Written by David Megginson, started 2003.
3 //
4 // This file is in the Public Domain and comes with no warranty.
5
6
7 #ifndef __INSTRUMENTS_TACAN_HXX
8 #define __INSTRUMENTS_TACAN_HXX 1
9
10 #ifndef __cplusplus
11 # error This library requires C++
12 #endif
13
14 #include <simgear/math/point3d.hxx>
15 #include <simgear/props/props.hxx>
16 #include <simgear/structure/subsystem_mgr.hxx>
17
18
19 /**
20  * Model a TACAN radio.
21  *
22  * Input properties:
23  *
24  * /position/longitude-deg
25  * /position/latitude-deg
26  * /position/altitude-ft
27  * /heading
28  * /systems/electrical/outputs/TACAN
29  * /instrumentation/"name"/serviceable
30  * /instrumentation/"name"/frequencies/selected-mhz
31  *
32  * Output properties:
33  *
34  * /instrumentation/"name"/in-range
35  * /instrumentation/"name"/indicated-distance-nm
36  * /instrumentation/"name"/indicated-ground-speed-kt
37  * /instrumentation/"name"/indicated-time-kt
38  */
39 class TACAN : public SGSubsystem, public SGPropertyChangeListener
40 {
41
42 public:
43
44     TACAN ( SGPropertyNode *node );
45     TACAN ();
46     virtual ~TACAN ();
47
48     virtual void init ();
49     virtual void update (double delta_time_sec);
50
51 private:
52
53     void search (double frequency, double longitude_rad,
54                  double latitude_rad, double altitude_m);
55     double searchChannel (const string& channel);
56     void valueChanged (SGPropertyNode *);
57
58     string _name;
59     unsigned int _num;
60
61     SGPropertyNode_ptr _longitude_node;
62     SGPropertyNode_ptr _latitude_node;
63     SGPropertyNode_ptr _altitude_node;
64     SGPropertyNode_ptr _heading_node;
65     SGPropertyNode_ptr _yaw_node;
66     SGPropertyNode_ptr _serviceable_node;
67     SGPropertyNode_ptr _electrical_node;
68     SGPropertyNode_ptr _frequency_node;
69     SGPropertyNode_ptr _display_node;
70     SGPropertyNode_ptr _x_shift_node;
71     SGPropertyNode_ptr _y_shift_node;
72     SGPropertyNode_ptr _rotation_node;
73
74     SGPropertyNode_ptr _in_range_node;
75     SGPropertyNode_ptr _distance_node;
76     SGPropertyNode_ptr _speed_node;
77     SGPropertyNode_ptr _time_node;
78     SGPropertyNode_ptr _bearing_node;
79     SGPropertyNode_ptr _ident_node;
80     SGPropertyNode_ptr _name_node;
81
82     SGPropertyNode_ptr _channel_node;
83     SGPropertyNode_ptr _channel_in0_node;
84     SGPropertyNode_ptr _channel_in1_node;
85     SGPropertyNode_ptr _channel_in2_node;
86     SGPropertyNode_ptr _channel_in3_node;
87     SGPropertyNode_ptr _channel_in4_node;
88
89     SGPropertyNode_ptr _carrier_name_node;              // FIXME unused
90     SGPropertyNode_ptr _tanker_callsign_node;           // FIXME
91     SGPropertyNode_ptr _mp_callsign_node;               // FIXME
92
93     bool _new_frequency;
94     string _channel;
95     double _last_distance_nm;
96     double _frequency_mhz;
97     double _time_before_search_sec;
98
99     bool _mobile_valid;
100     bool _transmitter_valid;
101
102     SGVec3d _transmitter;
103     SGGeod _transmitter_pos;
104     double _transmitter_range_nm;
105     double _transmitter_bearing_deg;
106     double _transmitter_bias;
107     string _transmitter_name;
108     string _transmitter_ident;
109
110     double _mobile_lat, _mobile_lon;
111     double _mobile_elevation_ft;
112     double _mobile_range_nm;
113     double _mobile_bearing_deg;
114     double _mobile_bias;
115     string _mobile_name;
116     string _mobile_ident;
117
118     int _listener_active;
119 };
120
121
122 #endif // __INSTRUMENTS_TACAN_HXX