mm_glib_source: Enable AGPS_MSB only if it's in modem capabilities

This commit is contained in:
Teemu Ikonen 2023-03-16 18:46:21 +02:00
parent 2bb1b70994
commit a4a599a6c5

View file

@ -64,9 +64,10 @@ class ModemManagerGLibNmeaSource(NmeaSource):
if not caps & ModemManager.ModemLocationSource.GPS_NMEA:
raise NmeaSourceNotFoundError(
"Modem does not support NMEA")
self.mlocation.setup_sync(
(ModemManager.ModemLocationSource.GPS_NMEA
| ModemManager.ModemLocationSource.AGPS_MSB), True, None)
enable = ModemManager.ModemLocationSource.GPS_NMEA
if caps & ModemManager.ModemLocationSource.AGPS_MSB:
enable |= ModemManager.ModemLocationSource.AGPS_MSB
self.mlocation.setup_sync(enable, True, None)
else:
raise ModemError("Modem state is: %d" % state)
except AttributeError as e: