19#include "moc_qgsqtlocationconnection.cpp" 
   22#include <QLocalSocket> 
   30  qRegisterMetaType< QList<QGeoSatelliteInfo> >( 
"QList<QGeoSatelliteInfo>" );
 
   32  startSatelliteMonitor();
 
 
   44  if ( locationDataSource )
 
 
   60  if ( locationDataSource )
 
   64    if ( mInfo.isValid() )
 
   75      switch ( mInfo.coordinate().type() )
 
   77        case QGeoCoordinate::InvalidCoordinate:
 
   80        case QGeoCoordinate::Coordinate2D:
 
   83        case QGeoCoordinate::Coordinate3D:
 
  106      QgsDebugMsgLevel( QStringLiteral( 
"Valid QGeoPositionInfo, positionUpdated" ), 2 );
 
 
  112  const QList<QGeoSatelliteInfo> &satellites )
 
  116  for ( 
int i = 0; i < satellites.size(); ++i )
 
  118    const QGeoSatelliteInfo currentSatellite = satellites.at( i );
 
  120    satelliteInfo.
azimuth = currentSatellite.attribute( QGeoSatelliteInfo::Azimuth );
 
  121    satelliteInfo.
elevation = currentSatellite.attribute( QGeoSatelliteInfo::Elevation );
 
  122    satelliteInfo.
id = currentSatellite.satelliteIdentifier();
 
  123    satelliteInfo.
signal = currentSatellite.signalStrength();
 
 
  132  const QList<QGeoSatelliteInfo> &satellites )
 
  138  for ( 
const QGeoSatelliteInfo ¤tSatellite : satellites )
 
  146      if ( satInView.id == currentSatellite.satelliteIdentifier() )
 
  148        satInView.inUse = 
true;
 
 
  158void QgsQtLocationConnection::startGPS()
 
  160  QgsDebugMsgLevel( QStringLiteral( 
"Starting GPS QtLocation connection" ), 2 );
 
  162  if ( !locationDataSource )
 
  164    locationDataSource = QGeoPositionInfoSource::createDefaultSource( 
this );
 
  165    if ( locationDataSource )
 
  167      locationDataSource->setPreferredPositioningMethods( QGeoPositionInfoSource::SatellitePositioningMethods );  
 
  168      locationDataSource->setUpdateInterval( 1000 );
 
  171      QObject::connect( locationDataSource.data(),
 
  172                        &QGeoPositionInfoSource::positionUpdated,
 
  176      locationDataSource->startUpdates();
 
  181      QgsDebugError( QStringLiteral( 
"No QtLocation Position Source" ) );
 
  187    locationDataSource->startUpdates();
 
  191void QgsQtLocationConnection::startSatelliteMonitor()
 
  193  QgsDebugMsgLevel( QStringLiteral( 
"Starting GPS QtLocation satellite monitor" ), 2 );
 
  195  if ( !satelliteInfoSource )
 
  197    satelliteInfoSource = QGeoSatelliteInfoSource::createDefaultSource( 
this );
 
  198    if ( satelliteInfoSource )
 
  204      QObject::connect( satelliteInfoSource.data(),
 
  205                        &QGeoSatelliteInfoSource::satellitesInUseUpdated,
 
  212      QObject::connect( satelliteInfoSource.data(),
 
  213                        &QGeoSatelliteInfoSource::satellitesInViewUpdated,
 
  218      satelliteInfoSource->startUpdates();
 
  223      QgsDebugError( QStringLiteral( 
"No QtLocation Satellite Source" ) );
 
  229    satelliteInfoSource->startUpdates();
 
@ Unknown
Unknown/other system.
 
Abstract base class for connections to a GPS device.
 
QgsGpsInformation mLastGPSInformation
Last state of the gps related variables (e.g. position, time, ...)
 
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.
 
int signal
Signal strength (0-99dB), or -1 if not available.
 
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)