]> git.mxchange.org Git - flightgear.git/blob - src/Cockpit/kt_70.hxx
Guard against update(...) getting called before init(...)
[flightgear.git] / src / Cockpit / 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 - curt@flightgear.org
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., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22
23
24 #ifndef _FG_KT_70_HXX
25 #define _FG_KT_70_HXX
26
27
28 #include <Main/fgfs.hxx>
29 #include <Main/fg_props.hxx>
30
31 #include <simgear/compiler.h>
32
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 FGSubsystem
42 {
43     SGPropertyNode *lon_node;
44     SGPropertyNode *lat_node;
45     SGPropertyNode *alt_node;
46     SGPropertyNode *bus_power;
47     SGPropertyNode *serviceable_node;
48
49     // internal values
50     double r_flash_time;
51
52     // modes
53     bool ident_mode;             // false = normal, true = ident/squawk
54
55     // input and buttons
56     bool ident_btn;
57     bool last_ident_btn;
58     int digit1, digit2, digit3, digit4;
59     int func_knob;              // 0 = OFF, 1 = SBY, 2 = TST, 3 = GND, 4 = ON,
60                                 // 5 = ALT
61
62     // outputs
63     int id_code;
64     int flight_level;
65
66     // annunciators
67     bool fl_ann;                // flight level
68     bool alt_ann;               // altitude
69     bool gnd_ann;               // ground
70     bool on_ann;                // on
71     bool sby_ann;               // standby
72     bool reply_ann;             // reply
73
74 public:
75
76     FGKT_70();
77     ~FGKT_70();
78
79     void init ();
80     void bind ();
81     void unbind ();
82     void update (double dt);
83     void search () { /* empty placeholder */ }
84
85     // internal values
86     inline bool has_power() const {
87         return (func_knob > 0) && (bus_power->getDoubleValue() > 1.0);
88     }
89
90     // input and buttons
91     inline bool get_ident_btn() const { return ident_btn; }
92     inline void set_ident_btn( bool val ) { ident_btn = val; }
93     inline int get_digit1() const { return digit1; }
94     inline void set_digit1( int val ) { digit1 = val; }
95     inline int get_digit2() const { return digit2; }
96     inline void set_digit2( int val ) { digit2 = val; }
97     inline int get_digit3() const { return digit3; }
98     inline void set_digit3( int val ) { digit3 = val; }
99     inline int get_digit4() const { return digit4; }
100     inline void set_digit4( int val ) { digit4 = val; }
101     inline int get_func_knob() const { return func_knob; }
102     inline void set_func_knob( int val ) { func_knob = val; }
103
104     // outputs
105     inline int get_id_code () const { return id_code; }
106     inline void set_id_code( int c ) { id_code = c; }
107     inline int get_flight_level () const { return flight_level; }
108
109     // annunciators
110     inline bool get_fl_ann() const { return fl_ann; }
111     inline bool get_alt_ann() const { return alt_ann; }
112     inline bool get_gnd_ann() const { return gnd_ann; }
113     inline bool get_on_ann() const { return on_ann; }
114     inline bool get_sby_ann() const { return sby_ann; }
115     inline bool get_reply_ann() const { return reply_ann; }
116 };
117
118
119 #endif // _FG_KT_70_HXX