]> git.mxchange.org Git - flightgear.git/blob - src/Instrumentation/transponder.hxx
Support for multiple data dirs.
[flightgear.git] / src / Instrumentation / transponder.hxx
1 // transponder.hxx -- class to impliment a transponder
2 //
3 // Written by Roy Vegard Ovesen, started September 2004.
4 //
5 // Copyright (C) 2004  Roy Vegard Ovesen - rvovesen@tiscali.no
6 // Copyright (C) 2013  Clement de l'Hamaide - clemaez@hotmail.fr
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 // General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21
22 #ifndef TRANSPONDER_HXX
23 #define TRANSPONDER_HXX 1
24
25 #ifndef __cplusplus
26 # error This library requires C++
27 #endif
28
29 #include <Main/fg_props.hxx>
30
31 #include <simgear/structure/subsystem_mgr.hxx>
32 #include <simgear/props/tiedpropertylist.hxx>
33
34 class Transponder : public SGSubsystem, public SGPropertyChangeListener
35 {
36 public:
37     Transponder(SGPropertyNode *node);
38     virtual ~Transponder();
39
40     virtual void init ();
41     virtual void update (double dt);
42     virtual void bind();
43     virtual void unbind();
44     
45 private:
46     enum Mode
47     {
48         MODE_A = 0,
49         MODE_C,
50         MODE_S
51     };
52     
53     enum KnobPosition
54     {
55         KNOB_OFF = 0,
56         KNOB_STANDBY,
57         KNOB_TEST,
58         KNOB_GROUND,
59         KNOB_ON,
60         KNOB_ALT
61     };
62     
63     // annunciators, for KT-70 compatability only
64     // these should be replaced with conditionals in the instrument
65     bool getFLAnnunciator() const;
66     bool getAltAnnunciator() const;
67     bool getGroundAnnuciator() const;
68     bool getOnAnnunciator() const;
69     bool getStandbyAnnunciator() const;
70     bool getReplyAnnunciator() const;
71     
72     // Inputs
73     SGPropertyNode_ptr _pressureAltitude_node;
74     SGPropertyNode_ptr _busPower_node;
75     SGPropertyNode_ptr _serviceable_node;
76
77     SGPropertyNode_ptr _mode_node;
78     SGPropertyNode_ptr _knob_node;
79     SGPropertyNode_ptr _idCode_node;
80     SGPropertyNode_ptr _digit_node[4];
81     
82     simgear::TiedPropertyList _tiedProperties;
83     
84     SGPropertyNode_ptr _identBtn_node;
85     bool _identMode;
86     bool _kt70Compat;
87     
88     // Outputs
89     SGPropertyNode_ptr _altitude_node;
90     SGPropertyNode_ptr _altitudeValid_node;
91     SGPropertyNode_ptr _transmittedId_node;
92     SGPropertyNode_ptr _ident_node;
93
94     // Internal
95     std::string _name;
96     int _num;
97     Mode _mode;
98     KnobPosition _knob;
99     double _identTime;
100     int _listener_active;
101     double _requiredBusVolts;
102     std::string _altitudeSourcePath;
103     
104     void valueChanged (SGPropertyNode *);
105     int setMinMax(int val);
106     bool has_power() const;
107 };
108
109 #endif // TRANSPONDER_HXX