21 #include <QLocalSocket>    29   qRegisterMetaType< QList<QGeoSatelliteInfo> >( 
"QList<QGeoSatelliteInfo>" );
    31   startSatelliteMonitor();
    43   if ( locationDataSource )
    59   if ( locationDataSource )
    63     if ( mInfo.isValid() )
    91       QgsDebugMsg( QStringLiteral( 
"Valid QGeoPositionInfo, positionUpdated" ) );
    97   const QList<QGeoSatelliteInfo> &satellites )
   101   for ( 
int i = 0; i < satellites.size(); ++i )
   103     QGeoSatelliteInfo currentSatellite = satellites.at( i );
   105     satelliteInfo.
azimuth = currentSatellite.attribute( QGeoSatelliteInfo::Azimuth );
   106     satelliteInfo.
elevation = currentSatellite.attribute( QGeoSatelliteInfo::Elevation );
   107 #if defined(HAVE_QT_MOBILITY_LOCATION )   108     satelliteInfo.
id = currentSatellite.prnNumber();
   109 #else // QtPositioning   110     satelliteInfo.
id = currentSatellite.satelliteIdentifier();
   112     satelliteInfo.
signal = currentSatellite.signalStrength();
   117   QgsDebugMsg( QStringLiteral( 
"satellitesInViewUpdated" ) );
   121   const QList<QGeoSatelliteInfo> &satellites )
   127   for ( 
int i = 0; i < satellites.size(); ++i )
   129     QGeoSatelliteInfo currentSatellite = satellites.at( i );
   131 #if defined(HAVE_QT_MOBILITY_LOCATION )   133 #else // QtPositioning   141 #if defined(HAVE_QT_MOBILITY_LOCATION )   142       if ( satInView.
id == currentSatellite.prnNumber() )
   144       if ( satInView.
id == currentSatellite.satelliteIdentifier() )
   147         satInView.
inUse = 
true;
   154   QgsDebugMsg( QStringLiteral( 
"satellitesInUseUpdated" ) );
   157 void QgsQtLocationConnection::startGPS()
   159   QgsDebugMsg( QStringLiteral( 
"Starting GPS QtLocation connection" ) );
   161   if ( !locationDataSource )
   163     locationDataSource = QGeoPositionInfoSource::createDefaultSource( 
this );
   164     if ( locationDataSource )
   166       locationDataSource->setPreferredPositioningMethods( QGeoPositionInfoSource::SatellitePositioningMethods );  
   167       locationDataSource->setUpdateInterval( 1000 );
   170       QObject::connect( locationDataSource.data(),
   171                         &QGeoPositionInfoSource::positionUpdated,
   175       locationDataSource->startUpdates();
   180       QgsDebugMsg( QStringLiteral( 
"No QtLocation Position Source" ) );
   186     locationDataSource->startUpdates();
   190 void QgsQtLocationConnection::startSatelliteMonitor()
   192   QgsDebugMsg( QStringLiteral( 
"Starting GPS QtLocation satellite monitor" ) );
   194   if ( !satelliteInfoSource )
   196     satelliteInfoSource = QGeoSatelliteInfoSource::createDefaultSource( 
this );
   197     if ( satelliteInfoSource )
   199       QgsDebugMsg( QStringLiteral( 
"satelliteMonitor started" ) );
   203       QObject::connect( satelliteInfoSource.data(),
   204                         &QGeoSatelliteInfoSource::satellitesInUseUpdated,
   211       QObject::connect( satelliteInfoSource.data(),
   212                         &QGeoSatelliteInfoSource::satellitesInViewUpdated,
   217       satelliteInfoSource->startUpdates();
   222       QgsDebugMsg( QStringLiteral( 
"No QtLocation Satellite Source" ) );
   228     satelliteInfoSource->startUpdates();
 void satellitesInUseUpdated(const QList< QGeoSatelliteInfo > &satellites)
Called when the number of satellites in use is updated. 
 
QgsGpsInformation mLastGPSInformation
Last state of the gps related variables (e.g. position, time, ...) 
 
void positionUpdated(const QGeoPositionInfo &info)
Called when the position updated. 
 
void parseData() override
Parse available data source content. 
 
void satellitesInViewUpdated(const QList< QGeoSatelliteInfo > &satellites)
Called when the number of satellites in view is updated. 
 
void stateChanged(const QgsGpsInformation &info)
 
void broadcastConnectionAvailable()
Needed to make QtLocation detected. 
 
Status mStatus
Connection status. 
 
QgsQtLocationConnection()
 
Abstract base class for connection to a GPS device.