diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2021-07-30 11:23:17 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-07-30 11:29:36 +0000 |
commit | 13cca037c8b6339b464018924a6b628c283d09fa (patch) | |
tree | 3d939bd2a5266327f159a4d48073c36443145e0b /src | |
parent | ffcfc067242de73fa276b448055b2b890678d840 (diff) | |
download | qtlocation-13cca037c8b6339b464018924a6b628c283d09fa.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
Change-Id: I7eba052034ddb7b64d91a81381d136bf9f2ddeca
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 1267b9321d590daa1f0a91fd050ec11caced849d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy.cpp | 17 |
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); |