fixing APRS-IS lib

This commit is contained in:
Peter Buchegger 2022-03-19 23:51:18 +01:00
parent 00603fe2c3
commit 4a39c5e2f2
3 changed files with 25 additions and 15 deletions

View file

@ -42,7 +42,13 @@ bool AprsIsTask::loop(System &system) {
bool AprsIsTask::connect(System &system) {
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, getName(), "connecting to APRS-IS server: %s on port: %d", system.getUserConfig()->aprs_is.server, system.getUserConfig()->aprs_is.port);
if (!_aprs_is.connect(system.getUserConfig()->aprs_is.server, system.getUserConfig()->aprs_is.port)) {
APRS_IS::ConnectionStatus status = _aprs_is.connect(system.getUserConfig()->aprs_is.server, system.getUserConfig()->aprs_is.port);
if (status == APRS_IS::ERROR_CONNECTION) {
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, getName(), "Something went wrong on connecting! Is the server reachable?");
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, getName(), "Connection failed.");
return false;
} else if (status == APRS_IS::ERROR_PASSCODE) {
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, getName(), "User can not be verified with passcode!");
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, getName(), "Connection failed.");
return false;
}