]> git.mxchange.org Git - flightgear.git/blob - src/Instrumentation/kt_70.hxx
Performance optimization
[flightgear.git] / src / Instrumentation / kt_70.hxx
1 // kt-70.hxx -- class to impliment the King KT 70 panel-m transponder
2 //
3 // Written by Curtis Olson, started July 2002.
4 //
5 // Copyright (C) 2002  Curtis L. Olson - http://www.flightgear.org/~curt
6 //
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.
11 //
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.
16 //
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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 //
21 // $Id$
22
23
24 #ifndef _FG_KT_70_HXX
25 #define _FG_KT_70_HXX
26
27
28 #include <Main/fg_props.hxx>
29
30 #include <simgear/compiler.h>
31 #include <simgear/structure/subsystem_mgr.hxx>
32 #include <simgear/props/tiedpropertylist.hxx>
33 #include <simgear/math/interpolater.hxx>
34 #include <simgear/timing/timestamp.hxx>
35
36 #include <Navaids/navlist.hxx>
37 #include <Sound/beacon.hxx>
38 #include <Sound/morse.hxx>
39
40
41 class FGKT_70 : public SGSubsystem
42 {
43 private:
44     SGPropertyNode_ptr lon_node;
45     SGPropertyNode_ptr lat_node;
46     SGPropertyNode_ptr alt_node;
47     SGPropertyNode_ptr bus_power;
48     SGPropertyNode_ptr serviceable_node;
49
50     // internal values
51     double r_flash_time;
52
53     // modes
54     bool ident_mode;             // false = normal, true = ident/squawk
55
56     // input and buttons
57     bool ident_btn;
58     bool last_ident_btn;
59     int digit1, digit2, digit3, digit4;
60     int func_knob;              // 0 = OFF, 1 = SBY, 2 = TST, 3 = GND, 4 = ON,
61                                 // 5 = ALT
62
63     // outputs
64     int id_code;
65     int flight_level;
66
67     // annunciators
68     bool fl_ann;                // flight level
69     bool alt_ann;               // altitude
70     bool gnd_ann;               // ground
71     bool on_ann;                // on
72     bool sby_ann;               // standby
73     bool reply_ann;             // reply
74
75     string name;
76     int num;
77     simgear::TiedPropertyList _tiedProperties;
78
79 public:
80
81     FGKT_70(SGPropertyNode *node);
82     ~FGKT_70();
83
84     void init ();
85     void bind ();
86     void unbind ();
87     void update (double dt);
88     void search () { /* empty placeholder */ }
89
90     // internal values
91     inline bool has_power() const {
92         return (func_knob > 0) && (bus_power->getDoubleValue() > 1.0);
93     }
94
95     // input and buttons
96     inline bool get_ident_btn() const { return ident_btn; }
97     inline void set_ident_btn( bool val ) { ident_btn = val; }
98     inline int get_digit1() const { return digit1; }
99     inline void set_digit1( int val ) { digit1 = val; }
100     inline int get_digit2() const { return digit2; }
101     inline void set_digit2( int val ) { digit2 = val; }
102     inline int get_digit3() const { return digit3; }
103     inline void set_digit3( int val ) { digit3 = val; }
104     inline int get_digit4() const { return digit4; }
105     inline void set_digit4( int val ) { digit4 = val; }
106     inline int get_func_knob() const { return func_knob; }
107     inline void set_func_knob( int val ) { func_knob = val; }
108
109     // outputs
110     inline int get_id_code () const { return id_code; }
111     inline void set_id_code( int c ) { id_code = c; }
112     inline int get_flight_level () const { return flight_level; }
113
114     // annunciators
115     inline bool get_fl_ann() const { return fl_ann; }
116     inline bool get_alt_ann() const { return alt_ann; }
117     inline bool get_gnd_ann() const { return gnd_ann; }
118     inline bool get_on_ann() const { return on_ann; }
119     inline bool get_sby_ann() const { return sby_ann; }
120     inline bool get_reply_ann() const { return reply_ann; }
121 };
122
123
124 #endif // _FG_KT_70_HXX