summaryrefslogtreecommitdiff
path: root/src/plugins/position/gypsy
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2021-07-30 11:23:17 +0200
committerIvan Solovev <ivan.solovev@qt.io>2021-07-30 13:12:21 +0200
commit1267b9321d590daa1f0a91fd050ec11caced849d (patch)
tree0e3b12762d077f0c690c7928023f8e85d33542d3 /src/plugins/position/gypsy
parent9a6f7a2d31829b541b688b68cff85ffaa1ee2d1c (diff)
downloadqtlocation-1267b9321d590daa1f0a91fd050ec11caced849d.tar.gz
Gypsy plugin: add satellite identifier and satellite system information
Gypsy daemon provides the satellite_id of the available satellites, but this information was never used before. We can also try to determine the satellite system based on the satellite identifier. Task-number: QTBUG-74995 Pick-to: 6.2 Change-Id: I7eba052034ddb7b64d91a81381d136bf9f2ddeca Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/plugins/position/gypsy')
-rw-r--r--src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy.cpp b/src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy.cpp
index abd6c3b6..c473c3f3 100644
--- a/src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy.cpp
+++ b/src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy.cpp
@@ -170,6 +170,21 @@ QGeoSatelliteInfoSourceGypsy::~QGeoSatelliteInfoSourceGypsy()
delete m_engine;
}
+static QGeoSatelliteInfo::SatelliteSystem idToSystem(int prn)
+{
+ if (prn >= 1 && prn <= 32)
+ return QGeoSatelliteInfo::GPS;
+ else if (prn >= 65 && prn <= 96)
+ return QGeoSatelliteInfo::GLONASS;
+ else if (prn >= 193 && prn <= 200)
+ return QGeoSatelliteInfo::QZSS;
+ else if ((prn >= 201 && prn <= 235) || (prn >= 401 && prn <= 437))
+ return QGeoSatelliteInfo::BEIDOU;
+ else if (prn >= 301 && prn <= 336)
+ return QGeoSatelliteInfo::GALILEO;
+ return QGeoSatelliteInfo::Undefined;
+}
+
void QGeoSatelliteInfoSourceGypsy::satellitesChanged(GypsySatellite *satellite,
GPtrArray *satellites)
{
@@ -186,6 +201,8 @@ void QGeoSatelliteInfoSourceGypsy::satellitesChanged(GypsySatellite *satellite,
for (i = 0; i < satellites->len; i++) {
GypsySatelliteDetails *details = (GypsySatelliteDetails *)satellites->pdata[i];
QGeoSatelliteInfo info;
+ info.setSatelliteIdentifier(details->satellite_id);
+ info.setSatelliteSystem(idToSystem(details->satellite_id));
info.setAttribute(QGeoSatelliteInfo::Elevation, details->elevation);
info.setAttribute(QGeoSatelliteInfo::Azimuth, details->azimuth);
info.setSignalStrength(details->snr);