SR22TNavComUpdater.nas 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. var SR22TNavComUpdater =
  20. {
  21. new : func () {
  22. var obj = {
  23. parents : [
  24. SR22TNavComUpdater,
  25. PropertyUpdater.new(
  26. notifications.PFDEventNotification.DefaultType,
  27. notifications.PFDEventNotification.NavComData
  28. )
  29. ],
  30. };
  31. # Hack to handle cases where there is no selected COMM or NAV frequency
  32. if (getprop("/instrumentation/com-selected") == nil) setprop("/instrumentation/com-selected", 1);
  33. if (getprop("/instrumentation/nav-selected") == nil) setprop("/instrumentation/nav-selected", 1);
  34. obj.addPropMap("Comm1SelectedFreq", "/instrumentation/comm/frequencies/selected-mhz");
  35. obj.addPropMap("Comm1StandbyFreq", "/instrumentation/comm/frequencies/standby-mhz");
  36. obj.addPropMap("Comm1AirportID", "/instrumentation/comm/airport-id");
  37. obj.addPropMap("Comm1StationName", "/instrumentation/comm/station-name");
  38. obj.addPropMap("Comm1StationType", "/instrumentation/comm/station-type");
  39. obj.addPropMap("Comm1Volume", "/instrumentation/comm/volume");
  40. obj.addPropMap("Comm1Serviceable", "/instrumentation/comm/serviceable");
  41. obj.addPropMap("Comm2SelectedFreq", "/instrumentation/comm[1]/frequencies/selected-mhz");
  42. obj.addPropMap("Comm2StandbyFreq", "/instrumentation/comm[1]/frequencies/standby-mhz");
  43. obj.addPropMap("Comm2AirportID", "/instrumentation/comm[1]/airport-id");
  44. obj.addPropMap("Comm2StationName", "/instrumentation/comm[1]/station-name");
  45. obj.addPropMap("Comm2StationType", "/instrumentation/comm[1]/station-type");
  46. obj.addPropMap("Comm2Volume", "/instrumentation/comm[1]/volume");
  47. obj.addPropMap("Comm2Serviceable", "/instrumentation/comm[1]/serviceable");
  48. obj.addPropMap("CommSelected", "/instrumentation/com-selected");
  49. obj.addPropMap("Nav1SelectedFreq", "/instrumentation/nav/frequencies/selected-mhz");
  50. obj.addPropMap("Nav1StandbyFreq", "/instrumentation/nav/frequencies/standby-mhz");
  51. obj.addPropMap("Nav1ID", "/instrumentation/nav/nav-id");
  52. obj.addPropMap("Nav1RadialDeg", "/instrumentation/nav/radials/selected-deg");
  53. obj.addPropMap("Nav1Volume", "/instrumentation/nav/volume");
  54. obj.addPropMap("Nav1AudioID", "/instrumentation/nav/audio-btn");
  55. obj.addPropMap("Nav1Serviceable", "/instrumentation/nav/operable");
  56. obj.addPropMap("Nav2SelectedFreq", "/instrumentation/nav[1]/frequencies/selected-mhz");
  57. obj.addPropMap("Nav2StandbyFreq", "/instrumentation/nav[1]/frequencies/standby-mhz");
  58. obj.addPropMap("Nav2ID", "/instrumentation/nav[1]/nav-id");
  59. obj.addPropMap("Nav2RadialDeg", "/instrumentation/nav[1]/radials/selected-deg");
  60. obj.addPropMap("Nav2Volume", "/instrumentation/nav[1]/volume");
  61. obj.addPropMap("Nav2AudioID", "/instrumentation/nav[1]/audio-btn");
  62. obj.addPropMap("Nav2Serviceable", "/instrumentation/nav[1]/operable");
  63. obj.addPropMap("NavSelected", "/instrumentation/nav-selected");
  64. obj.addPropMap("TransponderMode", "/instrumentation/transponder/inputs/knob-mode");
  65. obj.addPropMap("TransponderIdent", "/instrumentation/transponder/inputs/ident-btn");
  66. obj.addPropMap("TransponderCode", "/instrumentation/transponder/id-code");
  67. return obj;
  68. },
  69. };