1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 12:51:49 -05:00

Fix crash when no logger implemented. Add additional error reporting for GPS positioning.

This commit is contained in:
Jon Beniston 2023-01-02 15:30:34 +00:00
parent 1fd29354fc
commit b70496c1cc
2 changed files with 24 additions and 1 deletions

View File

@ -88,6 +88,12 @@ MainCore *MainCore::instance()
void MainCore::setLoggingOptions()
{
if (!m_logger)
{
qDebug() << "MainCore::setLoggingOptions: No logger.";
return;
}
m_logger->setConsoleMinMessageLevel(m_settings.getConsoleMinLogLevel());
if (m_settings.getUseLogFile())
@ -346,11 +352,15 @@ void MainCore::initPosition()
if (m_positionSource)
{
connect(m_positionSource, &QGeoPositionInfoSource::positionUpdated, this, &MainCore::positionUpdated);
connect(m_positionSource, &QGeoPositionInfoSource::updateTimeout, this, &MainCore::positionUpdateTimeout);
connect(m_positionSource, qOverload<QGeoPositionInfoSource::Error>(&QGeoPositionInfoSource::error), this, &MainCore::positionError);
m_position = m_positionSource->lastKnownPosition();
m_positionSource->setUpdateInterval(1000);
m_positionSource->startUpdates();
}
else
{
qDebug() << "MainCore::initPosition: No position source.";
qWarning() << "MainCore::initPosition: No position source.";
}
}
@ -372,3 +382,13 @@ void MainCore::positionUpdated(const QGeoPositionInfo &info)
}
}
}
void MainCore::positionUpdateTimeout()
{
qWarning() << "MainCore::positionUpdateTimeout: GPS signal lost";
}
void MainCore::positionError(QGeoPositionInfoSource::Error positioningError)
{
qWarning() << "MainCore::positionError: " << positioningError;
}

View File

@ -26,6 +26,7 @@
#include <QDateTime>
#include <QObject>
#include <QGeoPositionInfo>
#include <QGeoPositionInfoSource>
#include "export.h"
#include "settings/mainsettings.h"
@ -889,6 +890,8 @@ public:
public slots:
void positionUpdated(const QGeoPositionInfo &info);
void positionUpdateTimeout();
void positionError(QGeoPositionInfoSource::Error positioningError);
signals:
void deviceSetAdded(int index, DeviceAPI *device);