22#include <QLocalSocket>
27#include "moc_qgsqtlocationconnection.cpp"
29using namespace Qt::StringLiterals;
35 qRegisterMetaType< QList<QGeoSatelliteInfo> >(
"QList<QGeoSatelliteInfo>" );
37 startSatelliteMonitor();
49 if ( locationDataSource )
65 if ( locationDataSource )
69 if ( mInfo.isValid() )
80 switch ( mInfo.coordinate().type() )
82 case QGeoCoordinate::InvalidCoordinate:
85 case QGeoCoordinate::Coordinate2D:
88 case QGeoCoordinate::Coordinate3D:
120 for (
int i = 0; i < satellites.size(); ++i )
122 const QGeoSatelliteInfo currentSatellite = satellites.at( i );
124 satelliteInfo.
azimuth = currentSatellite.attribute( QGeoSatelliteInfo::Azimuth );
125 satelliteInfo.
elevation = currentSatellite.attribute( QGeoSatelliteInfo::Elevation );
126 satelliteInfo.
id = currentSatellite.satelliteIdentifier();
127 satelliteInfo.
signal = currentSatellite.signalStrength();
141 for (
const QGeoSatelliteInfo ¤tSatellite : satellites )
149 if ( satInView.
id == currentSatellite.satelliteIdentifier() )
151 satInView.
inUse =
true;
161void QgsQtLocationConnection::startGPS()
165 if ( !locationDataSource )
167 locationDataSource = QGeoPositionInfoSource::createDefaultSource(
this );
168 if ( locationDataSource )
170 locationDataSource->setPreferredPositioningMethods( QGeoPositionInfoSource::SatellitePositioningMethods );
171 locationDataSource->setUpdateInterval( 1000 );
176 locationDataSource->startUpdates();
187 locationDataSource->startUpdates();
191void QgsQtLocationConnection::startSatelliteMonitor()
195 if ( !satelliteInfoSource )
197 satelliteInfoSource = QGeoSatelliteInfoSource::createDefaultSource(
this );
198 if ( satelliteInfoSource )
212 satelliteInfoSource->startUpdates();
223 satelliteInfoSource->startUpdates();
@ Unknown
Unknown/other system.
QgsGpsInformation mLastGPSInformation
Last state of the gps related variables (e.g. position, time, ...).
QgsGpsConnection(QIODevice *dev)
Constructor.
Status mStatus
Connection status.
void stateChanged(const QgsGpsInformation &info)
Emitted whenever the GPS state is changed.
void satellitesInViewUpdated(const QList< QGeoSatelliteInfo > &satellites)
Called when the number of satellites in view is updated.
void broadcastConnectionAvailable()
Needed to make QtLocation detected.
QgsQtLocationConnection()
void positionUpdated(const QGeoPositionInfo &info)
Called when the position updated.
void satellitesInUseUpdated(const QList< QGeoSatelliteInfo > &satellites)
Called when the number of satellites in use is updated.
void parseData() override
Parse available data source content.
Encapsulates information relating to a GPS satellite.
double elevation
Elevation of the satellite, in degrees.
bool inUse
true if satellite was used in obtaining the position fix.
int id
Contains the satellite identifier number.
double azimuth
The azimuth of the satellite to true north, in degrees.
#define QgsDebugMsgLevel(str, level)
#define QgsDebugError(str)