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);