Debian Codegraph @

src/Instrumentation/marker_beacon.hxx

raw symbols SCIP
1 /*
2 * SPDX-License-Identifier: GPL-2.0+
3 * SPDX-FileCopyrightText: 2000 (C) Curtis L. Olson - http://www.flightgear.org/~curt
4 *
5 * marker_beacon.hxx -- class to manage the marker beacons
6 * Written by Curtis Olson, started April 2000.
7 *
8 * Copyright (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of the
13 * License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 *
24 * $Id$
25 */
26
27 #pragma once
28
29 #include <simgear/compiler.h>
30
31 #include <Instrumentation/AbstractInstrument.hxx>
32 #include <Sound/beacon.hxx>
33 #include <simgear/timing/timestamp.hxx>
34
35 class SGSampleGroup;
36
37 class FGMarkerBeacon : public AbstractInstrument,
38 public SGPropertyChangeListener
39 {
40 public:
41 enum fgMkrBeacType {
42 NOBEACON = 0,
43 INNER,
44 MIDDLE,
45 OUTER
46 };
47
48 FGMarkerBeacon(SGPropertyNode *node);
49 ~FGMarkerBeacon();
50
51 // Subsystem API.
52 void bind() override;
53 void init() override;
54 void reinit() override;
55 void unbind() override;
56 void update(double dt) override;
57
58 // Subsystem identification.
59 static const char* staticSubsystemClassId() { return "marker-beacon"; }
60
61 void search ();
62
63 void valueChanged(SGPropertyNode* val) override;
64
65 private:
66 // Inputs
67 SGPropertyNode_ptr audio_btn;
68 SGPropertyNode_ptr audio_vol;
69 SGPropertyNode_ptr sound_working;
70
71 SGPropertyNode_ptr _innerBlinkNode;
72 SGPropertyNode_ptr _middleBlinkNode;
73 SGPropertyNode_ptr _outerBlinkNode;
74
75 bool _audioPropertiesChanged = true;
76
77 // internal periodic station search timer
78 double _time_before_search_sec = 0.0;
79
80 SGTimeStamp _audioStartTime;
81 SGSharedPtr<SGSampleGroup> _audioSampleGroup;
82
83 enum class BlinkMode {
84 BackwardsCompatible, ///< all beacons use the OM blink rate
85 Standard, ///< beacones use the correct blink for their type
86 Continuous ///< blink disabled, so aircraft can do its own blink
87 };
88
89 BlinkMode _blinkMode = BlinkMode::BackwardsCompatible;
90
91 void changeBeaconType(fgMkrBeacType newType);
92
93 void updateAudio();
94 void stopAudio();
95 void updateOutputProperties(bool on);
96
97 fgMkrBeacType _lastBeacon;
98
99 FGBeacon::BeaconTiming _beaconTiming;
100 };