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