From 9c2f4f46bae27635189610f57c4e198dc2cab902 Mon Sep 17 00:00:00 2001 From: zhongjin Date: Wed, 30 Nov 2022 20:35:04 +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 162ee92..ec17466 100644 --- a/src/Network/fgcom.cxx +++ b/src/Network/fgcom.cxx @@ -470,8 +470,8 @@ void FGCom::connectToCommFrequency() { // ensure that the current comm is still in range //zhongjin - SG_LOG(SG_SOUND, SG_INFO, "FGCom: connectToCommFrequency()"); - SG_LOG(SG_SOUND, SG_INFO, "FGCom: _currentCallFrequency=" << _currentCallFrequency); + //SG_LOG(SG_SOUND, SG_INFO, "FGCom: connectToCommFrequency()"); + //SG_LOG(SG_SOUND, SG_INFO, "FGCom: _currentCallFrequency=" << _currentCallFrequency); if ((_currentCallFrequency > 0.0) && !isInRange(_currentCallFrequency)) { @@ -479,9 +479,11 @@ void FGCom::connectToCommFrequency() { _currentCallFrequency = 0.0; } + // don't connected (and disconnect if already connected) when tuned freq is 0 if (_currentCommFrequency < 1.0) { if (_currentCallIdent != -1) { + iaxc_dump_call_number(_currentCallIdent); SG_LOG(SG_SOUND, SG_INFO, "FGCom: disconnect as freq 0: current call " << _currentCallIdent); _currentCallIdent = -1; @@ -490,6 +492,7 @@ void FGCom::connectToCommFrequency() { } if (_currentCallFrequency != _currentCommFrequency || _currentCallIdent == -1) { + if (_currentCallIdent != -1) { iaxc_dump_call_number(_currentCallIdent); SG_LOG(SG_SOUND, SG_INFO, "FGCom: dump_call_number " << _currentCallIdent); @@ -501,6 +504,7 @@ void FGCom::connectToCommFrequency() { std::string num = computePhoneNumber(_currentCommFrequency, getAirportCode(_currentCommFrequency)); _processingTimer.stamp(); + if (!isInRange(_currentCommFrequency)) { if (_currentCallIdent != -1) { SG_LOG(SG_SOUND, SG_INFO, "FGCom: disconnect call as not in range " << _currentCallIdent); @@ -511,11 +515,14 @@ void FGCom::connectToCommFrequency() { } return; } - else - SG_LOG(SG_SOUND, SG_WARN, "FGCom: frequency"); + + SG_LOG(SG_SOUND, SG_INFO, "FGCom: connectToCommFrequency num=" << num); if (!num.empty()) { _currentCallIdent = iaxc_call(num.c_str()); + + SG_LOG(SG_SOUND, SG_INFO, "FGCom: iaxc_call(" << num << ") _currentCallIdent=" << _currentCallIdent); + if (_currentCallIdent == -1) SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: cannot call " << num.c_str()); else {