]> git.mxchange.org Git - flightgear.git/blob - src/Instrumentation/transponder.hxx
Improve transponder instrumentation: new version
[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
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
43 private:
44     enum Mode
45     {
46         MODE_A = 0,
47         MODE_C,
48         MODE_S
49     };
50     
51     enum KnobPosition
52     {
53         KNOB_OFF = 0,
54         KNOB_STANDBY,
55         KNOB_ON,
56         KNOB_ALT,
57         KNOB_TEST
58     };
59     
60     // Inputs
61     SGPropertyNode_ptr _pressureAltitude_node;
62     SGPropertyNode_ptr _busPower_node;
63     SGPropertyNode_ptr _serviceable_node;
64
65     SGPropertyNode_ptr _mode_node;
66     SGPropertyNode_ptr _knob_node;
67     SGPropertyNode_ptr _idCode_node;
68     SGPropertyNode_ptr _digit_node[4];
69     
70     
71     SGPropertyNode_ptr _identBtn_node;
72     bool _identMode;
73
74     // Outputs
75     SGPropertyNode_ptr _altitude_node;
76     SGPropertyNode_ptr _altitudeValid_node;
77     SGPropertyNode_ptr _transmittedId_node;
78     SGPropertyNode_ptr _ident_node;
79
80     // Internal
81     std::string _name;
82     int _num;
83     Mode _mode;
84     double _identTime;
85     int _listener_active;
86     double _requiredBusVolts;
87     std::string _altitudeSourcePath;
88     
89     void valueChanged (SGPropertyNode *);
90     int setMinMax(int val);
91     bool has_power() const;
92 };
93
94 #endif // TRANSPONDER_HXX