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 ( 
const QGeoSatelliteInfo ¤tSatellite : satellites )
   130 #if defined(HAVE_QT_MOBILITY_LOCATION )   132 #else // QtPositioning   139 #if defined(HAVE_QT_MOBILITY_LOCATION )   140       if ( satInView.
id == currentSatellite.prnNumber() )
   142       if ( satInView.
id == currentSatellite.satelliteIdentifier() )
   145         satInView.
inUse = 
true;
   152   QgsDebugMsg( QStringLiteral( 
"satellitesInUseUpdated" ) );
   155 void QgsQtLocationConnection::startGPS()
   157   QgsDebugMsg( QStringLiteral( 
"Starting GPS QtLocation connection" ) );
   159   if ( !locationDataSource )
   161     locationDataSource = QGeoPositionInfoSource::createDefaultSource( 
this );
   162     if ( locationDataSource )
   164       locationDataSource->setPreferredPositioningMethods( QGeoPositionInfoSource::SatellitePositioningMethods );  
   165       locationDataSource->setUpdateInterval( 1000 );
   168       QObject::connect( locationDataSource.data(),
   169                         &QGeoPositionInfoSource::positionUpdated,
   173       locationDataSource->startUpdates();
   178       QgsDebugMsg( QStringLiteral( 
"No QtLocation Position Source" ) );
   184     locationDataSource->startUpdates();
   188 void QgsQtLocationConnection::startSatelliteMonitor()
   190   QgsDebugMsg( QStringLiteral( 
"Starting GPS QtLocation satellite monitor" ) );
   192   if ( !satelliteInfoSource )
   194     satelliteInfoSource = QGeoSatelliteInfoSource::createDefaultSource( 
this );
   195     if ( satelliteInfoSource )
   197       QgsDebugMsg( QStringLiteral( 
"satelliteMonitor started" ) );
   201       QObject::connect( satelliteInfoSource.data(),
   202                         &QGeoSatelliteInfoSource::satellitesInUseUpdated,
   209       QObject::connect( satelliteInfoSource.data(),
   210                         &QGeoSatelliteInfoSource::satellitesInViewUpdated,
   215       satelliteInfoSource->startUpdates();
   220       QgsDebugMsg( QStringLiteral( 
"No QtLocation Satellite Source" ) );
   226     satelliteInfoSource->startUpdates();
 
void satellitesInUseUpdated(const QList< QGeoSatelliteInfo > &satellites)
Called when the number of satellites in use is updated. 
 
bool inUse
true if satellite was used in obtaining the position fix. 
 
QgsGpsInformation mLastGPSInformation
Last state of the gps related variables (e.g. position, time, ...) 
 
void positionUpdated(const QGeoPositionInfo &info)
Called when the position updated. 
 
Encapsulates information relating to a GPS satellite. 
 
void parseData() override
Parse available data source content. 
 
int signal
Signal strength (0-99dB), or -1 if not available. 
 
double elevation
Elevation of the satellite, in degrees. 
 
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. 
 
double azimuth
The azimuth of the satellite to true north, in degrees. 
 
QgsQtLocationConnection()
 
int id
Contains the satellite identifier number. 
 
Abstract base class for connection to a GPS device.