更新 'utils/fgcom/fgcom_external.cxx'

next
zhongjin 11 months ago
parent a3a285d8e0
commit ea4aa3f2db

@ -206,7 +206,7 @@ int main(int argc, char** argv)
if(currentData.outputVol != previousData.outputVol)
//lib_setVolume(0.0, currentData.outputVol);
iaxc_input_level_set(0.9);
iaxc_input_level_set(0.0);
iaxc_output_level_set(0.8);
@ -275,15 +275,15 @@ int main(int argc, char** argv)
SG_LOG( SG_GENERAL, SG_INFO, "Entering main loop in mode OBS (max duration: 6 hours)" );
sessionDuration *= 2160; // 6 hours for OBS mode
//lib_setVolume(0.0, 1.0);
iaxc_input_level_set(0.1);
iaxc_input_level_set(0.0);
iaxc_output_level_set(0.8);
lib_setCallerId("::OBS::");
num = computePhoneNumber(_frequency, _airport);
} else {
//lib_setVolume(1.0, 1.0);
iaxc_input_level_set(1.0);
iaxc_output_level_set(0.8);
iaxc_input_level_set(9.8);
iaxc_output_level_set(0.8);
if(mode == TEST) {
sessionDuration *= 65; // 65 seconds for TEST mode
@ -530,7 +530,7 @@ std::string computePhoneNumber(double freq, std::string icao, bool atis)
_server.c_str(),
exten);
SG_LOG(SG_SOUND, SG_ALERT, "FGCom: computePhoneNumber:" << phoneNumber << " icao:" << icao);
SG_LOG(SG_SOUND, SG_INFO, "FGCom: computePhoneNumber:" << phoneNumber << " icao:" << icao);
return phoneNumber;
}
@ -542,7 +542,7 @@ void lib_setVolume(double input, double output)
{
SG_CLAMP_RANGE<double>(input, 0.0, 1.0);
SG_CLAMP_RANGE<double>(output, 0.0, 1.0);
SG_LOG(SG_GENERAL, SG_ALERT, "Set volume input=" << input << " , output=" << output);
SG_LOG(SG_GENERAL, SG_INFO, "Set volume input=" << input << " , output=" << output);
iaxc_input_level_set(input);
iaxc_output_level_set(output);
}
@ -553,7 +553,7 @@ void lib_setVolume(double input, double output)
void lib_setSilenceThreshold(double thd)
{
SG_CLAMP_RANGE<double>(thd, -60, 0);
SG_LOG(SG_GENERAL, SG_ALERT, "Set silence threshold=" << thd);
SG_LOG(SG_GENERAL, SG_INFO, "Set silence threshold=" << thd);
iaxc_set_silence_threshold(thd);
}
@ -562,7 +562,7 @@ void lib_setSilenceThreshold(double thd)
void lib_setCallerId(std::string callsign)
{
SG_LOG(SG_GENERAL, SG_DEBUG, "Set caller ID=" << callsign);
SG_LOG(SG_GENERAL, SG_INFO, "Set caller ID=" << callsign);
iaxc_set_callerid (callsign.c_str(), _app.c_str());
}
@ -576,7 +576,7 @@ bool lib_init()
iaxc_set_networking( (iaxc_sendto_t)sendto, (iaxc_recvfrom_t)recvfrom );
#endif
if (iaxc_initialize(4)) {
SG_LOG( SG_GENERAL, SG_ALERT, "Error: cannot initialize IAXClient !\nHINT: Have you checked the mic and speakers ?" );
SG_LOG( SG_GENERAL, SG_INFO, "Error: cannot initialize IAXClient !\nHINT: Have you checked the mic and speakers ?" );
return false;
}
@ -603,7 +603,7 @@ bool lib_init()
bool lib_shutdown()
{
SG_LOG(SG_GENERAL, SG_DEBUG, "Shutdown IAX library");
SG_LOG(SG_GENERAL, SG_INFO, "Shutdown IAX library");
lib_hangup();
if(_registrationId != -1)
iaxc_unregister(_registrationId);
@ -615,10 +615,10 @@ bool lib_shutdown()
int lib_registration()
{
SG_LOG(SG_GENERAL, SG_DEBUG, "Request registration");
SG_LOG(SG_GENERAL, SG_DEBUG, " username: " << _username);
SG_LOG(SG_GENERAL, SG_DEBUG, " password: xxxxxxxx");
SG_LOG(SG_GENERAL, SG_DEBUG, " server: " << _server);
SG_LOG(SG_GENERAL, SG_INFO, "Request registration");
SG_LOG(SG_GENERAL, SG_INFO, " username: " << _username);
SG_LOG(SG_GENERAL, SG_INFO, " password: xxxxxxxx");
SG_LOG(SG_GENERAL, SG_INFO, " server: " << _server);
int regId = iaxc_register( _username.c_str(), _password.c_str(), _server.c_str());
if(regId == -1) {
SG_LOG( SG_GENERAL, SG_ALERT, "Warning: cannot register '" << _username << "' at '" << _server );
@ -631,9 +631,9 @@ int lib_registration()
bool lib_call(std::string icao, double freq)
{
SG_LOG(SG_GENERAL, SG_ALERT, "Request new call");
SG_LOG(SG_GENERAL, SG_ALERT, " icao: " << icao);
SG_LOG(SG_GENERAL, SG_ALERT, " freq: " << freq);
SG_LOG(SG_GENERAL, SG_INFO, "Request new call");
SG_LOG(SG_GENERAL, SG_INFO, " icao: " << icao);
SG_LOG(SG_GENERAL, SG_INFO, " freq: " << freq);
lib_hangup();
iaxc_millisleep(300);
std::string num = computePhoneNumber(freq, icao);
@ -641,29 +641,29 @@ bool lib_call(std::string icao, double freq)
return false;
_callId = iaxc_call(num.c_str());
if(_callId == -1) {
SG_LOG( SG_GENERAL, SG_ALERT, "Warning: cannot call: " << num );
SG_LOG( SG_GENERAL, SG_INFO, "Warning: cannot call: " << num );
return false;
}
SG_LOG(SG_GENERAL, SG_ALERT, "iaxc_call(" << num << ")");
SG_LOG(SG_GENERAL, SG_INFO, "iaxc_call(" << num << ")");
return true;
}
bool lib_directCall(std::string icao, double freq, std::string num)
{
SG_LOG(SG_GENERAL, SG_DEBUG, "Request new call");
SG_LOG(SG_GENERAL, SG_DEBUG, " icao: " << icao);
SG_LOG(SG_GENERAL, SG_DEBUG, " freq: " << freq);
SG_LOG(SG_GENERAL, SG_INFO, "Request new call");
SG_LOG(SG_GENERAL, SG_INFO, " icao: " << icao);
SG_LOG(SG_GENERAL, SG_INFO, " freq: " << freq);
lib_hangup();
iaxc_millisleep(300);
if(num.empty())
return false;
_callId = iaxc_call(num.c_str());
if(_callId == -1) {
SG_LOG( SG_GENERAL, SG_ALERT, "Warning: cannot call: " << num );
SG_LOG( SG_GENERAL, SG_INFO, "Warning: cannot call: " << num );
return false;
}
SG_LOG(SG_GENERAL, SG_DEBUG, "iaxc_call(" << num << ")");
SG_LOG(SG_GENERAL, SG_INFO, "iaxc_call(" << num << ")");
return true;
}
@ -675,7 +675,7 @@ bool lib_hangup()
{
if(!_connected)
return false;
SG_LOG(SG_GENERAL, SG_DEBUG, "Request hangup");
SG_LOG(SG_GENERAL, SG_INFO, "Request hangup");
iaxc_dump_all_calls();
_callId = -1;
return false;
@ -690,7 +690,7 @@ int iaxc_callback(iaxc_event e)
case IAXC_EVENT_TEXT:
if(e.ev.text.type == IAXC_TEXT_TYPE_STATUS ||
e.ev.text.type == IAXC_TEXT_TYPE_IAX)
SG_LOG( SG_GENERAL, SG_INFO, "Message: " << e.ev.text.message );
SG_LOG( SG_GENERAL, SG_ALERT, "Message: " << e.ev.text.message );
break;
}
return 1;

Loading…
Cancel
Save