Debian Codegraph @

Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericNavComUpdater.nas

raw
1 # Copyright 2018 Stuart Buchanan
2 # This file is part of FlightGear.
3 #
4 # FlightGear is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # FlightGear is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with FlightGear. If not, see <http://www.gnu.org/licenses/>.
16 #
17 # NavCom Interface using Emesary for a simple dual Nav/Com system using standard properties
18 # This updates the properties from Emesary messages.
19
20 var GenericNavComUpdater =
21 {
22 new : func () {
23 var obj = {
24 parents : [
25 GenericNavComUpdater,
26 PropertyUpdater.new(
27 notifications.PFDEventNotification.DefaultType,
28 notifications.PFDEventNotification.NavComData
29 )
30 ],
31 };
32
33 # Hack to handle cases where there is no selected COMM or NAV frequency
34 if (getprop("/instrumentation/com-selected") == nil) setprop("/instrumentation/com-selected", 1);
35 if (getprop("/instrumentation/nav-selected") == nil) setprop("/instrumentation/nav-selected", 1);
36
37 obj.addPropMap("Comm1SelectedFreq", "/instrumentation/comm/frequencies/selected-mhz");
38 obj.addPropMap("Comm1StandbyFreq", "/instrumentation/comm/frequencies/standby-mhz");
39 obj.addPropMap("Comm1Volume", "/instrumentation/comm/volume");
40
41 obj.addPropMap("Comm2SelectedFreq", "/instrumentation/comm[1]/frequencies/selected-mhz");
42 obj.addPropMap("Comm2StandbyFreq", "/instrumentation/comm[1]/frequencies/standby-mhz");
43 obj.addPropMap("Comm2Volume", "/instrumentation/comm[1]/volume");
44
45 obj.addPropMap("CommSelected", "/instrumentation/com-selected");
46
47 obj.addPropMap("Nav1SelectedFreq", "/instrumentation/nav/frequencies/selected-mhz");
48 obj.addPropMap("Nav1StandbyFreq", "/instrumentation/nav/frequencies/standby-mhz");
49 obj.addPropMap("Nav1RadialDeg", "/instrumentation/nav/radials/selected-deg");
50 obj.addPropMap("Nav1Volume", "/instrumentation/nav/volume");
51
52 obj.addPropMap("Nav2SelectedFreq", "/instrumentation/nav[1]/frequencies/selected-mhz");
53 obj.addPropMap("Nav2StandbyFreq", "/instrumentation/nav[1]/frequencies/standby-mhz");
54 obj.addPropMap("Nav2RadialDeg", "/instrumentation/nav[1]/radials/selected-deg");
55 obj.addPropMap("Nav2Volume", "/instrumentation/nav[1]/volume");
56
57 obj.addPropMap("NavSelected", "/instrumentation/nav-selected");
58
59 obj.addPropMap("TransponderMode", "/instrumentation/transponder/inputs/knob-mode");
60 obj.addPropMap("TransponderIdent", "/instrumentation/transponder/inputs/ident-btn");
61 obj.addPropMap("TransponderCode", "/instrumentation/transponder/id-code");
62
63 return obj;
64 },
65 };