gnss: handle locked SIM

ModemManager Location service is only available after SIM unlock
and network registration.
Track service separately to avoid an assert error and crashes.
GNSS assistance data is uploaded when the service becomes available.
This commit is contained in:
Dylan Van Assche
2021-08-11 17:11:01 +02:00
parent 75570e45da
commit ef94492b30
3 changed files with 27 additions and 7 deletions

View File

@@ -32,10 +32,7 @@ static void add_modem(struct EG25Manager *manager, GDBusObject *object)
g_assert(MM_IS_OBJECT (object));
manager->mm_modem = mm_object_get_modem(MM_OBJECT(object));
manager->mm_location = mm_object_get_modem_location(MM_OBJECT(object));
g_assert_nonnull(manager->mm_modem);
g_assert_nonnull(manager->mm_location);
if (manager->modem_state == EG25_STATE_RESUMING) {
if (manager->modem_recovery_timer) {
@@ -63,6 +60,16 @@ static void add_modem(struct EG25Manager *manager, GDBusObject *object)
g_signal_connect(gdbus_modem, "state-changed", G_CALLBACK(state_changed_cb), manager);
}
static void add_modem_location(struct EG25Manager *manager, GDBusObject *object)
{
const gchar *path;
path = g_dbus_object_get_object_path(object);
g_message("Adding new modem with location capabilities `%s'", path);
manager->mm_location = mm_object_get_modem_location(MM_OBJECT(object));
g_assert_nonnull(manager->mm_location);
}
static void interface_added_cb (struct EG25Manager *manager,
GDBusObject *object,
GDBusInterface *interface)
@@ -75,6 +82,9 @@ static void interface_added_cb (struct EG25Manager *manager,
if (g_strcmp0(info->name, MM_DBUS_INTERFACE_MODEM) == 0)
add_modem(manager, object);
if (g_strcmp0(info->name, MM_DBUS_INTERFACE_MODEM_LOCATION) == 0)
add_modem_location(manager, object);
}