From 8eae6ac1af8390dc4788c2893014a5da2312a9e2 Mon Sep 17 00:00:00 2001 From: hbeni Date: Fri, 19 Feb 2021 23:55:33 +0100 Subject: [PATCH] - Allow COMn_VLT to be literal strings "true" or "false" - FGFS: simplify protocol file. the "operable" property is a common one and honors powered, turned on and serviceable. see: https://forum.flightgear.org/viewtopic.php?p=382015#p382015 - FGFS: Support standard squelch property --- client/fgfs/Protocol/fgcom-mumble.xml | 35 ++++------------------- client/mumble-plugin/lib/io_UDPServer.cpp | 7 ++++- 2 files changed, 12 insertions(+), 30 deletions(-) diff --git a/client/fgfs/Protocol/fgcom-mumble.xml b/client/fgfs/Protocol/fgcom-mumble.xml index c9471bbc..7538063c 100644 --- a/client/fgfs/Protocol/fgcom-mumble.xml +++ b/client/fgfs/Protocol/fgcom-mumble.xml @@ -54,25 +54,13 @@ COM1_CWKHZ=%s /instrumentation/comm[0]/frequencies/selected-channel-width-khz - - com1-powered - string - COM1_VLT=%s - /system/electrical/outputs/comm[0] - com1-powerbutton string COM1_PBT=%s - /instrumentation/comm[0]/power-btn + /instrumentation/comm[0]/operable + - - com1-serviceable - string - COM1_SRV=%s - /instrumentation/comm[0]/serviceable - - com1-ptt string COM1_PTT=%s @@ -94,7 +82,7 @@ com1-squelch string COM1_SQC=%s - /instrumentation/comm[0]/squelch + /instrumentation/comm[0]/cutoff-signal-quality @@ -110,23 +98,12 @@ COM2_CWKHZ=%s /instrumentation/comm[1]/frequencies/selected-channel-width-khz - - com2-powered - string - COM2_VLT=%s - /system/electrical/outputs/comm[1] - com2-powerbutton string COM2_PBT=%s - /instrumentation/comm[1]/power-btn - - - com2-serviceable - string - COM2_SRV=%s - /instrumentation/comm[1]/serviceable + /instrumentation/comm[1]/operable + com2-ptt @@ -150,7 +127,7 @@ com2-squelch string COM1_SQC=%s - /instrumentation/comm[1]/squelch + /instrumentation/comm[1]/cutoff-signal-quality diff --git a/client/mumble-plugin/lib/io_UDPServer.cpp b/client/mumble-plugin/lib/io_UDPServer.cpp index 31dd4ed7..7e37c687 100644 --- a/client/mumble-plugin/lib/io_UDPServer.cpp +++ b/client/mumble-plugin/lib/io_UDPServer.cpp @@ -252,7 +252,12 @@ std::map fgcom_udp_parseMsg(char buffer[MAXLINE] } if (radio_var == "VLT") { float oldValue = fgcom_local_client[iid].radios[radio_id].volts; - fgcom_local_client[iid].radios[radio_id].volts = std::stof(token_value); + if (token_value == "true" || token_value == "false") { + // support literal strings in case aircraft sends just a boolean as string + fgcom_local_client[iid].radios[radio_id].volts = (token_value == "true")? true : false; + } else { + fgcom_local_client[iid].radios[radio_id].volts = std::stof(token_value); + } // do not send right now: if (fgcom_local_client[iid].radios[radio_id].volts != oldValue ) parseResult[iid].radioData.insert(radio_id); } if (radio_var == "PBT") {