21 #include <QLocalSocket>
28 qRegisterMetaType< QList<QGeoSatelliteInfo> >(
"QList<QGeoSatelliteInfo>" );
31 startSatelliteMonitor();
48 if ( locationDataSource )
64 if ( locationDataSource )
69 if ( mInfo.isValid() )
97 QgsDebugMsg(
"Valid QGeoPositionInfo, positionUpdated" );
103 const QList<QGeoSatelliteInfo>& satellites )
107 for (
int i = 0; i < satellites.size(); ++i )
109 QGeoSatelliteInfo currentSatellite = satellites.at( i );
111 satelliteInfo.
azimuth = currentSatellite.attribute( QGeoSatelliteInfo::Azimuth );
112 satelliteInfo.
elevation = currentSatellite.attribute( QGeoSatelliteInfo::Elevation );
113 satelliteInfo.
id = currentSatellite.prnNumber();
114 satelliteInfo.
signal = currentSatellite.signalStrength();
123 const QList<QGeoSatelliteInfo>& satellites )
129 for (
int i = 0; i < satellites.size(); ++i )
131 QGeoSatelliteInfo currentSatellite = satellites.at( i );
139 if ( satInView.
id == currentSatellite.prnNumber() )
141 satInView.
inUse =
true;
151 void QgsQtLocationConnection::startGPS()
153 QgsDebugMsg(
"Starting GPS QtLocation connection" );
155 if ( !locationDataSource )
157 locationDataSource = QGeoPositionInfoSource::createDefaultSource(
this );
158 if ( locationDataSource )
160 locationDataSource->setPreferredPositioningMethods( QGeoPositionInfoSource::SatellitePositioningMethods );
161 locationDataSource->setUpdateInterval( 1000 );
169 locationDataSource->startUpdates();
180 locationDataSource->startUpdates();
184 void QgsQtLocationConnection::startSatelliteMonitor()
186 QgsDebugMsg(
"Starting GPS QtLocation satellite monitor" );
187 if ( !satelliteInfoSource )
189 satelliteInfoSource = QGeoSatelliteInfoSource::createDefaultSource(
this );
190 if ( satelliteInfoSource )
198 const QList<QGeoSatelliteInfo>& ) ),
201 const QList<QGeoSatelliteInfo>& ) ) );
208 const QList<QGeoSatelliteInfo>& ) ),
211 const QList<QGeoSatelliteInfo>& ) ) );
214 satelliteInfoSource->startUpdates();
225 satelliteInfoSource->startUpdates();