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:
parent
1fd29354fc
commit
b70496c1cc
@ -88,6 +88,12 @@ MainCore *MainCore::instance()
|
|||||||
|
|
||||||
void MainCore::setLoggingOptions()
|
void MainCore::setLoggingOptions()
|
||||||
{
|
{
|
||||||
|
if (!m_logger)
|
||||||
|
{
|
||||||
|
qDebug() << "MainCore::setLoggingOptions: No logger.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_logger->setConsoleMinMessageLevel(m_settings.getConsoleMinLogLevel());
|
m_logger->setConsoleMinMessageLevel(m_settings.getConsoleMinLogLevel());
|
||||||
|
|
||||||
if (m_settings.getUseLogFile())
|
if (m_settings.getUseLogFile())
|
||||||
@ -346,11 +352,15 @@ void MainCore::initPosition()
|
|||||||
if (m_positionSource)
|
if (m_positionSource)
|
||||||
{
|
{
|
||||||
connect(m_positionSource, &QGeoPositionInfoSource::positionUpdated, this, &MainCore::positionUpdated);
|
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();
|
m_positionSource->startUpdates();
|
||||||
}
|
}
|
||||||
else
|
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;
|
||||||
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QGeoPositionInfo>
|
#include <QGeoPositionInfo>
|
||||||
|
#include <QGeoPositionInfoSource>
|
||||||
|
|
||||||
#include "export.h"
|
#include "export.h"
|
||||||
#include "settings/mainsettings.h"
|
#include "settings/mainsettings.h"
|
||||||
@ -889,6 +890,8 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void positionUpdated(const QGeoPositionInfo &info);
|
void positionUpdated(const QGeoPositionInfo &info);
|
||||||
|
void positionUpdateTimeout();
|
||||||
|
void positionError(QGeoPositionInfoSource::Error positioningError);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void deviceSetAdded(int index, DeviceAPI *device);
|
void deviceSetAdded(int index, DeviceAPI *device);
|
||||||
|
Loading…
Reference in New Issue
Block a user