]> git.mxchange.org Git - flightgear.git/blob - src/Instrumentation/kt_70.hxx
Add aubmodels to AI objects
[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/math/interpolater.hxx>
33 #include <simgear/timing/timestamp.hxx>
34
35 #include <Navaids/navlist.hxx>
36 #include <Sound/beacon.hxx>
37 #include <Sound/morse.hxx>
38
39
40 class FGKT_70 : public SGSubsystem
41 {
42     SGPropertyNode_ptr lon_node;
43     SGPropertyNode_ptr lat_node;
44     SGPropertyNode_ptr alt_node;
45     SGPropertyNode_ptr bus_power;
46     SGPropertyNode_ptr serviceable_node;
47
48     // internal values
49     double r_flash_time;
50
51     // modes
52     bool ident_mode;             // false = normal, true = ident/squawk
53
54     // input and buttons
55     bool ident_btn;
56     bool last_ident_btn;
57     int digit1, digit2, digit3, digit4;
58     int func_knob;              // 0 = OFF, 1 = SBY, 2 = TST, 3 = GND, 4 = ON,
59                                 // 5 = ALT
60
61     // outputs
62     int id_code;
63     int flight_level;
64
65     // annunciators
66     bool fl_ann;                // flight level
67     bool alt_ann;               // altitude
68     bool gnd_ann;               // ground
69     bool on_ann;                // on
70     bool sby_ann;               // standby
71     bool reply_ann;             // reply
72
73     string name;
74     int num;
75
76 public:
77
78     FGKT_70(SGPropertyNode *node);
79     ~FGKT_70();
80
81     void init ();
82     void bind ();
83     void unbind ();
84     void update (double dt);
85     void search () { /* empty placeholder */ }
86
87     // internal values
88     inline bool has_power() const {
89         return (func_knob > 0) && (bus_power->getDoubleValue() > 1.0);
90     }
91
92     // input and buttons
93     inline bool get_ident_btn() const { return ident_btn; }
94     inline void set_ident_btn( bool val ) { ident_btn = val; }
95     inline int get_digit1() const { return digit1; }
96     inline void set_digit1( int val ) { digit1 = val; }
97     inline int get_digit2() const { return digit2; }
98     inline void set_digit2( int val ) { digit2 = val; }
99     inline int get_digit3() const { return digit3; }
100     inline void set_digit3( int val ) { digit3 = val; }
101     inline int get_digit4() const { return digit4; }
102     inline void set_digit4( int val ) { digit4 = val; }
103     inline int get_func_knob() const { return func_knob; }
104     inline void set_func_knob( int val ) { func_knob = val; }
105
106     // outputs
107     inline int get_id_code () const { return id_code; }
108     inline void set_id_code( int c ) { id_code = c; }
109     inline int get_flight_level () const { return flight_level; }
110
111     // annunciators
112     inline bool get_fl_ann() const { return fl_ann; }
113     inline bool get_alt_ann() const { return alt_ann; }
114     inline bool get_gnd_ann() const { return gnd_ann; }
115     inline bool get_on_ann() const { return on_ann; }
116     inline bool get_sby_ann() const { return sby_ann; }
117     inline bool get_reply_ann() const { return reply_ann; }
118 };
119
120
121 #endif // _FG_KT_70_HXX