21 #include <QLocalSocket> 28 qRegisterMetaType< QList<QGeoSatelliteInfo> >(
"QList<QGeoSatelliteInfo>" );
30 startSatelliteMonitor();
47 if ( locationDataSource )
63 if ( locationDataSource )
67 if ( mInfo.isValid() )
95 QgsDebugMsg(
"Valid QGeoPositionInfo, positionUpdated" );
105 for (
int i = 0; i < satellites.
size(); ++i )
107 QGeoSatelliteInfo currentSatellite = satellites.
at( i );
109 satelliteInfo.
azimuth = currentSatellite.attribute( QGeoSatelliteInfo::Azimuth );
110 satelliteInfo.
elevation = currentSatellite.attribute( QGeoSatelliteInfo::Elevation );
111 #if defined(HAVE_QT_MOBILITY_LOCATION ) 112 satelliteInfo.
id = currentSatellite.prnNumber();
113 #else // QtPositioning 114 satelliteInfo.
id = currentSatellite.satelliteIdentifier();
116 satelliteInfo.
signal = currentSatellite.signalStrength();
131 for (
int i = 0; i < satellites.
size(); ++i )
133 QGeoSatelliteInfo currentSatellite = satellites.
at( i );
135 #if defined(HAVE_QT_MOBILITY_LOCATION ) 137 #else // QtPositioning 145 #if defined(HAVE_QT_MOBILITY_LOCATION ) 146 if ( satInView.
id == currentSatellite.prnNumber() )
148 if ( satInView.
id == currentSatellite.satelliteIdentifier() )
151 satInView.
inUse =
true;
161 void QgsQtLocationConnection::startGPS()
163 QgsDebugMsg(
"Starting GPS QtLocation connection" );
165 if ( !locationDataSource )
167 locationDataSource = QGeoPositionInfoSource::createDefaultSource(
this );
168 if ( locationDataSource )
170 locationDataSource->setPreferredPositioningMethods( QGeoPositionInfoSource::SatellitePositioningMethods );
171 locationDataSource->setUpdateInterval( 1000 );
179 locationDataSource->startUpdates();
190 locationDataSource->startUpdates();
194 void QgsQtLocationConnection::startSatelliteMonitor()
196 QgsDebugMsg(
"Starting GPS QtLocation satellite monitor" );
198 if ( !satelliteInfoSource )
200 satelliteInfoSource = QGeoSatelliteInfoSource::createDefaultSource(
this );
201 if ( satelliteInfoSource )
225 satelliteInfoSource->startUpdates();
236 satelliteInfoSource->startUpdates();
void satellitesInUseUpdated(const QList< QGeoSatelliteInfo > &satellites)
Called when the number of satellites in use is updated.
Status mStatus
Connection status.
void positionUpdated(const QGeoPositionInfo &info)
Called when the position updated.
const T & at(int i) const
QString number(int n, int base)
int count(const T &value) const
void append(const T &value)
Abstract base class for connection to a GPS device.
void satellitesInViewUpdated(const QList< QGeoSatelliteInfo > &satellites)
Called when the number of satellites in view is updated.
QgsGPSInformation mLastGPSInformation
Last state of the gps related variables (e.g.
void broadcastConnectionAvailable()
Needed to make QtLocation detected.
void stateChanged(const QgsGPSInformation &info)
QgsQtLocationConnection()
void parseData()
Parse available data source content.
~QgsQtLocationConnection()
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)