更新 'utils/fgcom/fgcom_external.cxx'

next
zhongjin 11 months ago
parent b99cf00456
commit ac5356befd

@ -211,7 +211,7 @@ int main(int argc, char** argv)
if(isInRange(currentIcao, currentData.lat, currentData.lon, currentData.alt)) { if(isInRange(currentIcao, currentData.lat, currentData.lon, currentData.alt)) {
_connected = lib_call(currentIcao, currentFreq); _connected = lib_call(currentIcao, currentFreq);
SG_LOG( SG_GENERAL, SG_INFO, "Connecting " << currentIcao << " on " << currentFreq << " MHz" ); SG_LOG( SG_GENERAL, SG_INFO, "New Connecting " << currentIcao << " on " << currentFreq << " MHz" );
} else { } else {
if(_connected) { if(_connected) {
_connected = lib_hangup(); _connected = lib_hangup();
@ -251,7 +251,7 @@ int main(int argc, char** argv)
int sessionDuration = 1000; int sessionDuration = 1000;
_p.stamp(); _p.stamp();
if(mode == OBS) { if(mode == OBS) {
SG_LOG( SG_GENERAL, SG_DEBUG, "Entering main loop in mode OBS (max duration: 6 hours)" ); SG_LOG( SG_GENERAL, SG_INFO, "Entering main loop in mode OBS (max duration: 6 hours)" );
sessionDuration *= 2160; // 6 hours for OBS mode sessionDuration *= 2160; // 6 hours for OBS mode
lib_setVolume(0.0, 1.0); lib_setVolume(0.0, 1.0);
lib_setCallerId("::OBS::"); lib_setCallerId("::OBS::");
@ -260,12 +260,12 @@ int main(int argc, char** argv)
lib_setVolume(1.0, 1.0); lib_setVolume(1.0, 1.0);
if(mode == TEST) { if(mode == TEST) {
sessionDuration *= 65; // 65 seconds for TEST mode sessionDuration *= 65; // 65 seconds for TEST mode
SG_LOG( SG_GENERAL, SG_DEBUG, "Entering main loop in mode TEST (max duration: 65 seconds)" ); SG_LOG( SG_GENERAL, SG_INFO, "Entering main loop in mode TEST (max duration: 65 seconds)" );
_airport = "ZZZZ"; _airport = "ZZZZ";
num = computePhoneNumber(_frequency, _airport); num = computePhoneNumber(_frequency, _airport);
} else if(mode == ATC) { } else if(mode == ATC) {
sessionDuration *= 45; // 45 seconds for ATC mode sessionDuration *= 45; // 45 seconds for ATC mode
SG_LOG( SG_GENERAL, SG_DEBUG, "Entering main loop in mode ATC (max duration: 45 seconds)" ); SG_LOG( SG_GENERAL, SG_INFO, "Entering main loop in mode ATC (max duration: 45 seconds)" );
num = computePhoneNumber(_atis, _airport, true); num = computePhoneNumber(_atis, _airport, true);
} }
} }
@ -513,7 +513,7 @@ void lib_setVolume(double input, double output)
{ {
SG_CLAMP_RANGE<double>(input, 0.0, 1.0); SG_CLAMP_RANGE<double>(input, 0.0, 1.0);
SG_CLAMP_RANGE<double>(output, 0.0, 1.0); SG_CLAMP_RANGE<double>(output, 0.0, 1.0);
SG_LOG(SG_GENERAL, SG_DEBUG, "Set volume input=" << input << " , output=" << output); SG_LOG(SG_GENERAL, SG_ALERT, "Set volume input=" << input << " , output=" << output);
iaxc_input_level_set(input); iaxc_input_level_set(input);
iaxc_output_level_set(output); iaxc_output_level_set(output);
} }
@ -577,7 +577,7 @@ bool lib_shutdown()
return true; return true;
} }
// function: lib_call // function: lib_registration
// action: register a user on remote server then return the registration ID // action: register a user on remote server then return the registration ID
int lib_registration() int lib_registration()
@ -598,9 +598,9 @@ int lib_registration()
bool lib_call(std::string icao, double freq) bool lib_call(std::string icao, double freq)
{ {
SG_LOG(SG_GENERAL, SG_DEBUG, "Request new call"); SG_LOG(SG_GENERAL, SG_ALERT, "Request new call");
SG_LOG(SG_GENERAL, SG_DEBUG, " icao: " << icao); SG_LOG(SG_GENERAL, SG_ALERT, " icao: " << icao);
SG_LOG(SG_GENERAL, SG_DEBUG, " freq: " << freq); SG_LOG(SG_GENERAL, SG_ALERT, " freq: " << freq);
lib_hangup(); lib_hangup();
iaxc_millisleep(300); iaxc_millisleep(300);
std::string num = computePhoneNumber(freq, icao); std::string num = computePhoneNumber(freq, icao);
@ -611,7 +611,7 @@ bool lib_call(std::string icao, double freq)
SG_LOG( SG_GENERAL, SG_ALERT, "Warning: cannot call: " << num ); SG_LOG( SG_GENERAL, SG_ALERT, "Warning: cannot call: " << num );
return false; return false;
} }
SG_LOG(SG_GENERAL, SG_DEBUG, "iaxc_call(" << num << ")"); SG_LOG(SG_GENERAL, SG_ALERT, "iaxc_call(" << num << ")");
return true; return true;
} }

Loading…
Cancel
Save