QNmeaSatelliteInfoSource parses NMEA data but does not distinguish between satellite systems. This results in incorrect reporting of satellites in view and satellites in use if the device supports multiple systems.
The normal pattern for InView/InUse detection is the following:
- Parse InView - save to list.
- Parse InUse (gets only IDs) - use the IDs to extract full info from InView list.
Now when we have multiple systems the following happens:
- Parse InView GPS - save to list.
- Prase InView GLONASS - save to list, overriding InView GPS.
- Parse InUse GPS -> the IDs can't be found.
To fix this issue we do not need to override the list at step 2, but have separate lists for each satellite system. And join all the lists when notifying about data changes.
The satellites can be distinguished by the first letters of the NMEA sentence:
- $GP*** is used for GPS
- $GL*** - for GLONASS
- $GN*** - for a combination of multiple satellite systems
List of talker ids: https://gpsd.gitlab.io/gpsd/NMEA.html#_talker_ids
One problem here is that GSA messages (satellites in use) come as $GNGSA in this case. Each message holds IDs of one satellite system. So if we have GPS and GLONASS working, we will receive 2 consecutive messages.
The trick is to distinguish, which one represents which system. Specially if some of them have no fix (the list of IDs is empty). The System ID field was added only in NMEA 4.11, which is not supported by many devices.
One possible solution is to use the satellite id range to determine the satellite system: https://gpsd.gitlab.io/gpsd/NMEA.html#_satellite_ids
The enum for satellite systems already exists. See QGeoSatelliteInfo::SatelliteSystem. We should probably consider extending it to contain more satellite systems (even untested ones).
Now when we move the QNmeaSatelliteInfoSource into the library and implement virtual methods for nmea parsing, this fix needs to be done before feature freeze for Qt 6.2, as it's a potential BC breaking change (need to add more parameters to the parsing methods)