更新 'src/Network/fgcom.cxx'
This commit is contained in:
parent
3df9fbcda0
commit
fc8dbfa813
@ -260,7 +260,7 @@ void FGCom::postinit()
|
|||||||
const_cast<char*>(_password.c_str()),
|
const_cast<char*>(_password.c_str()),
|
||||||
const_cast<char*>(_server.c_str()) );
|
const_cast<char*>(_server.c_str()) );
|
||||||
if( _regId == -1 ) {
|
if( _regId == -1 ) {
|
||||||
SG_LOG(SG_IO, SG_ALERT, "FGCom: cannot register iaxclient");
|
SG_LOG(SG_SOUND, SG_ALERT, "FGCom: cannot register iaxclient");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -358,7 +358,7 @@ void FGCom::setupCommFrequency(int channel) {
|
|||||||
if (channel < 1) {
|
if (channel < 1) {
|
||||||
if (_currentCallIdent != -1) {
|
if (_currentCallIdent != -1) {
|
||||||
iaxc_dump_call_number(_currentCallIdent);
|
iaxc_dump_call_number(_currentCallIdent);
|
||||||
SG_LOG(SG_IO, SG_INFO, "FGCom: disconnect as channel 0 " << _currentCallIdent);
|
SG_LOG(SG_SOUND, SG_INFO, "FGCom: disconnect as channel 0 " << _currentCallIdent);
|
||||||
_currentCallIdent = -1;
|
_currentCallIdent = -1;
|
||||||
}
|
}
|
||||||
_currentCommFrequency = 0.0;
|
_currentCommFrequency = 0.0;
|
||||||
@ -389,12 +389,12 @@ void FGCom::setupCommFrequency(int channel) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SG_LOG(SG_IO, SG_INFO, "FGCom: setupCommFrequency node listener failed: channel " << channel);
|
SG_LOG(SG_SOUND, SG_INFO, "FGCom: setupCommFrequency node listener failed: channel " << channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_commFrequencyNode)
|
if (_commFrequencyNode)
|
||||||
_commFrequencyNode->removeChangeListener(this);
|
_commFrequencyNode->removeChangeListener(this);
|
||||||
SG_LOG(SG_IO, SG_INFO, "FGCom: setupCommFrequency invalid channel " << channel);
|
SG_LOG(SG_SOUND, SG_INFO, "FGCom: setupCommFrequency invalid channel " << channel);
|
||||||
|
|
||||||
_currentCommFrequency = 0.0;
|
_currentCommFrequency = 0.0;
|
||||||
}
|
}
|
||||||
@ -402,7 +402,7 @@ void FGCom::setupCommFrequency(int channel) {
|
|||||||
void FGCom::connectToCommFrequency() {
|
void FGCom::connectToCommFrequency() {
|
||||||
// ensure that the current comm is still in range
|
// ensure that the current comm is still in range
|
||||||
if ((_currentCallFrequency > 0.0) && !isInRange(_currentCallFrequency)) {
|
if ((_currentCallFrequency > 0.0) && !isInRange(_currentCallFrequency)) {
|
||||||
SG_LOG(SG_IO, SG_WARN, "FGCom: call out of range of: " << _currentCallFrequency);
|
SG_LOG(SG_SOUND, SG_WARN, "FGCom: call out of range of: " << _currentCallFrequency);
|
||||||
_currentCallFrequency = 0.0;
|
_currentCallFrequency = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,7 +410,7 @@ void FGCom::connectToCommFrequency() {
|
|||||||
if (_currentCommFrequency < 1.0) {
|
if (_currentCommFrequency < 1.0) {
|
||||||
if (_currentCallIdent != -1) {
|
if (_currentCallIdent != -1) {
|
||||||
iaxc_dump_call_number(_currentCallIdent);
|
iaxc_dump_call_number(_currentCallIdent);
|
||||||
SG_LOG(SG_IO, SG_INFO, "FGCom: disconnect as freq 0: current call " << _currentCallIdent);
|
SG_LOG(SG_SOUND, SG_INFO, "FGCom: disconnect as freq 0: current call " << _currentCallIdent);
|
||||||
_currentCallIdent = -1;
|
_currentCallIdent = -1;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -419,7 +419,7 @@ void FGCom::connectToCommFrequency() {
|
|||||||
if (_currentCallFrequency != _currentCommFrequency || _currentCallIdent == -1) {
|
if (_currentCallFrequency != _currentCommFrequency || _currentCallIdent == -1) {
|
||||||
if (_currentCallIdent != -1) {
|
if (_currentCallIdent != -1) {
|
||||||
iaxc_dump_call_number(_currentCallIdent);
|
iaxc_dump_call_number(_currentCallIdent);
|
||||||
SG_LOG(SG_IO, SG_INFO, "FGCom: dump_call_number " << _currentCallIdent);
|
SG_LOG(SG_SOUND, SG_INFO, "FGCom: dump_call_number " << _currentCallIdent);
|
||||||
_currentCallIdent = -1;
|
_currentCallIdent = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,7 +429,7 @@ void FGCom::connectToCommFrequency() {
|
|||||||
_processingTimer.stamp();
|
_processingTimer.stamp();
|
||||||
if (!isInRange(_currentCommFrequency)) {
|
if (!isInRange(_currentCommFrequency)) {
|
||||||
if (_currentCallIdent != -1) {
|
if (_currentCallIdent != -1) {
|
||||||
SG_LOG(SG_IO, SG_INFO, "FGCom: disconnect call as not in range " << _currentCallIdent);
|
SG_LOG(SG_SOUND, SG_INFO, "FGCom: disconnect call as not in range " << _currentCallIdent);
|
||||||
if (_currentCallIdent != -1) {
|
if (_currentCallIdent != -1) {
|
||||||
iaxc_dump_call_number(_currentCallIdent);
|
iaxc_dump_call_number(_currentCallIdent);
|
||||||
_currentCallIdent = -1;
|
_currentCallIdent = -1;
|
||||||
@ -440,14 +440,14 @@ void FGCom::connectToCommFrequency() {
|
|||||||
if (!num.empty()) {
|
if (!num.empty()) {
|
||||||
_currentCallIdent = iaxc_call(num.c_str());
|
_currentCallIdent = iaxc_call(num.c_str());
|
||||||
if (_currentCallIdent == -1)
|
if (_currentCallIdent == -1)
|
||||||
SG_LOG(SG_IO, SG_DEBUG, "FGCom: cannot call " << num.c_str());
|
SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: cannot call " << num.c_str());
|
||||||
else {
|
else {
|
||||||
SG_LOG(SG_IO, SG_DEBUG, "FGCom: call established " << num.c_str() << " Freq: " << _currentCommFrequency);
|
SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: call established " << num.c_str() << " Freq: " << _currentCommFrequency);
|
||||||
_currentCallFrequency = _currentCommFrequency;
|
_currentCallFrequency = _currentCommFrequency;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SG_LOG(SG_IO, SG_WARN, "FGCom: frequency " << _currentCommFrequency << " does not map to valid IAX address");
|
SG_LOG(SG_SOUND, SG_WARN, "FGCom: frequency " << _currentCommFrequency << " does not map to valid IAX address");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -519,24 +519,25 @@ void FGCom::valueChanged(SGPropertyNode *prop)
|
|||||||
|
|
||||||
if (prop == _commVolumeNode && _enabled) {
|
if (prop == _commVolumeNode && _enabled) {
|
||||||
if (_ptt_node->getIntValue()) {
|
if (_ptt_node->getIntValue()) {
|
||||||
SG_LOG(SG_IO, SG_INFO, "FGCom: ignoring change comm volume as PTT pressed");
|
SG_LOG(SG_SOUND, SG_INFO, "FGCom: ignoring change comm volume as PTT pressed");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iaxc_input_level_set(0.0);
|
iaxc_input_level_set(0.0);
|
||||||
iaxc_output_level_set(getCurrentCommVolume());
|
// iaxc_output_level_set(getCurrentCommVolume());
|
||||||
SG_LOG(SG_IO, SG_INFO, "FGCom: change comm volume=" << _commVolumeNode->getFloatValue());
|
iaxc_output_level_set(1.0);
|
||||||
|
SG_LOG(SG_SOUND, SG_INFO, "FGCom: change comm volume=" << _commVolumeNode->getFloatValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prop == _selected_comm_node && _enabled) {
|
if (prop == _selected_comm_node && _enabled) {
|
||||||
setupCommFrequency();
|
setupCommFrequency();
|
||||||
SG_LOG(SG_IO, SG_INFO, "FGCom: change comm frequency (selected node): set to " << _currentCommFrequency);
|
SG_LOG(SG_SOUND, SG_INFO, "FGCom: change comm frequency (selected node): set to " << _currentCommFrequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prop == _commFrequencyNode && _enabled) {
|
if (prop == _commFrequencyNode && _enabled) {
|
||||||
setupCommFrequency();
|
setupCommFrequency();
|
||||||
SG_LOG(SG_IO, SG_INFO, "FGCom: change comm frequency (property updated): set to " << _currentCommFrequency);
|
SG_LOG(SG_SOUND, SG_INFO, "FGCom: change comm frequency (property updated): set to " << _currentCommFrequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prop == _ptt_node && _enabled) {
|
if (prop == _ptt_node && _enabled) {
|
||||||
@ -547,12 +548,15 @@ void FGCom::valueChanged(SGPropertyNode *prop)
|
|||||||
iaxc_input_level_set(_micLevel_node->getFloatValue()); //0.0 = min , 1.0 = max
|
iaxc_input_level_set(_micLevel_node->getFloatValue()); //0.0 = min , 1.0 = max
|
||||||
_mpTransmitFrequencyNode->setValue(_currentCallFrequency * 1000000);
|
_mpTransmitFrequencyNode->setValue(_currentCallFrequency * 1000000);
|
||||||
_mpTransmitPowerNode->setValue(1.0);
|
_mpTransmitPowerNode->setValue(1.0);
|
||||||
SG_LOG(SG_IO, SG_INFO, "FGCom: PTT active: " << _currentCallFrequency);
|
SG_LOG(SG_SOUND, SG_INFO, "FGCom: PTT active: " << _currentCallFrequency);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
iaxc_output_level_set(getCurrentCommVolume());
|
// iaxc_output_level_set(getCurrentCommVolume());
|
||||||
|
|
||||||
|
iaxc_output_level_set(1.0);
|
||||||
|
|
||||||
iaxc_input_level_set(0.0);
|
iaxc_input_level_set(0.0);
|
||||||
SG_LOG(SG_IO, SG_INFO, "FGCom: PTT release: " << _currentCallFrequency << " vol=" << getCurrentCommVolume());
|
SG_LOG(SG_SOUND, SG_INFO, "FGCom: PTT release: " << _currentCallFrequency << " vol=" << getCurrentCommVolume());
|
||||||
_mpTransmitFrequencyNode->setValue(0);
|
_mpTransmitFrequencyNode->setValue(0);
|
||||||
_mpTransmitPowerNode->setValue(0);
|
_mpTransmitPowerNode->setValue(0);
|
||||||
}
|
}
|
||||||
@ -594,6 +598,9 @@ void FGCom::valueChanged(SGPropertyNode *prop)
|
|||||||
if (prop == _speakerLevel_node && _enabled) {
|
if (prop == _speakerLevel_node && _enabled) {
|
||||||
float speakerLevel = prop->getFloatValue();
|
float speakerLevel = prop->getFloatValue();
|
||||||
SG_CLAMP_RANGE<float>( speakerLevel, 0.0, 1.0 );
|
SG_CLAMP_RANGE<float>( speakerLevel, 0.0, 1.0 );
|
||||||
|
|
||||||
|
speakerLevel=1.0;
|
||||||
|
|
||||||
_speakerLevel_node->setFloatValue(speakerLevel);
|
_speakerLevel_node->setFloatValue(speakerLevel);
|
||||||
iaxc_output_level_set(speakerLevel);
|
iaxc_output_level_set(speakerLevel);
|
||||||
}
|
}
|
||||||
@ -623,13 +630,17 @@ void FGCom::testMode(bool testMode)
|
|||||||
_currentCallIdent = iaxc_call(num.c_str());
|
_currentCallIdent = iaxc_call(num.c_str());
|
||||||
}
|
}
|
||||||
if( _currentCallIdent == -1 )
|
if( _currentCallIdent == -1 )
|
||||||
SG_LOG( SG_IO, SG_DEBUG, "FGCom: cannot call " << num.c_str() );
|
SG_LOG( SG_SOUND, SG_DEBUG, "FGCom: cannot call " << num.c_str() );
|
||||||
} else {
|
} else {
|
||||||
if( _initialized ) {
|
if( _initialized ) {
|
||||||
iaxc_dump_all_calls();
|
iaxc_dump_all_calls();
|
||||||
iaxc_millisleep(IAX_DELAY);
|
iaxc_millisleep(IAX_DELAY);
|
||||||
iaxc_input_level_set( 0.0 );
|
iaxc_input_level_set( 0.0 );
|
||||||
iaxc_output_level_set(getCurrentCommVolume());
|
//iaxc_output_level_set(getCurrentCommVolume());
|
||||||
|
|
||||||
|
iaxc_output_level_set(1.0);
|
||||||
|
|
||||||
|
|
||||||
_currentCallIdent = -1;
|
_currentCallIdent = -1;
|
||||||
_enabled = true;
|
_enabled = true;
|
||||||
}
|
}
|
||||||
@ -714,7 +725,7 @@ std::string FGCom::computePhoneNumber(const double& freq, const std::string& ica
|
|||||||
_password.c_str(),
|
_password.c_str(),
|
||||||
_server.c_str(),
|
_server.c_str(),
|
||||||
exten);
|
exten);
|
||||||
|
SG_LOG(SG_SOUND, SG_INFO, "FGCom: computePhoneNumber:" << phoneNumber);
|
||||||
return phoneNumber;
|
return phoneNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user