From 387fb56b2ab18730e383b907f3828397a2b31fed Mon Sep 17 00:00:00 2001 From: zhongjin Date: Tue, 6 Dec 2022 23:19:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'src/Network/fgcom.cxx'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Network/fgcom.cxx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Network/fgcom.cxx b/src/Network/fgcom.cxx index bcd6f1c..387859f 100644 --- a/src/Network/fgcom.cxx +++ b/src/Network/fgcom.cxx @@ -68,6 +68,15 @@ const int special_freq[] = { // Define some freq who need to be used with NULL_I static FGCom* static_instance = NULL; +static void mesPopup(const std::string& message, int delay) +{ + SGPropertyNode_ptr args(new SGPropertyNode); + args->setStringValue("label", message); + args->setIntValue("delay", (delay) ? delay : 15); + SG_LOG(SG_GENERAL, SG_ALERT, message); + globals->get_commands()->execute("show-message", args); +} + static int iaxc_callback( iaxc_event e ) { @@ -641,10 +650,8 @@ void FGCom::valueChanged(SGPropertyNode *prop) // ensure that we are on the right channel by calling setupCommFrequency //fgSetString("/sim/screen/red","PTT按下,请讲..."); - SGPropertyNode_ptr args(new SGPropertyNode); - args->setStringValue("label", "PTT按下,请讲..."); - args->setIntValue("delay", 5); - globals->get_commands()->execute("show-message", args); + mesPopup("PTT按下,请讲...",5); + setupCommFrequency(); iaxc_output_level_set(0.0);