diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-iface-modem-location.c | 41 | ||||
-rw-r--r-- | src/mm-iface-modem-location.h | 8 |
2 files changed, 48 insertions, 1 deletions
diff --git a/src/mm-iface-modem-location.c b/src/mm-iface-modem-location.c index 898de337..90a9b94e 100644 --- a/src/mm-iface-modem-location.c +++ b/src/mm-iface-modem-location.c @@ -937,8 +937,10 @@ set_supl_server_ready (MMIfaceModemLocation *self, if (!MM_IFACE_MODEM_LOCATION_GET_INTERFACE (self)->set_supl_server_finish (self, res, &error)) g_dbus_method_invocation_take_error (ctx->invocation, error); - else + else { + mm_gdbus_modem_location_set_supl_server (ctx->skeleton, ctx->supl); mm_gdbus_modem_location_complete_set_supl_server (ctx->skeleton, ctx->invocation); + } handle_set_supl_server_context_free (ctx); } @@ -1359,6 +1361,7 @@ typedef enum { INITIALIZATION_STEP_FIRST, INITIALIZATION_STEP_CAPABILITIES, INITIALIZATION_STEP_VALIDATE_CAPABILITIES, + INITIALIZATION_STEP_SUPL_SERVER, INITIALIZATION_STEP_LAST } InitializationStep; @@ -1397,6 +1400,28 @@ initialization_context_complete_and_free_if_cancelled (InitializationContext *ct } static void +load_supl_server_ready (MMIfaceModemLocation *self, + GAsyncResult *res, + InitializationContext *ctx) +{ + GError *error = NULL; + gchar *supl; + + supl = MM_IFACE_MODEM_LOCATION_GET_INTERFACE (self)->load_supl_server_finish (self, res, &error); + if (error) { + mm_warn ("couldn't load SUPL server: '%s'", error->message); + g_error_free (error); + } + + mm_gdbus_modem_location_set_supl_server (ctx->skeleton, supl ? supl : ""); + g_free (supl); + + /* Go on to next step */ + ctx->step++; + interface_initialization_step (ctx); +} + +static void load_capabilities_ready (MMIfaceModemLocation *self, GAsyncResult *res, InitializationContext *ctx) @@ -1458,6 +1483,20 @@ interface_initialization_step (InitializationContext *ctx) /* Fall down to next step */ ctx->step++; + case INITIALIZATION_STEP_SUPL_SERVER: + /* If the modem supports A-GPS, load SUPL server */ + if (ctx->capabilities & MM_MODEM_LOCATION_SOURCE_AGPS && + MM_IFACE_MODEM_LOCATION_GET_INTERFACE (ctx->self)->load_supl_server && + MM_IFACE_MODEM_LOCATION_GET_INTERFACE (ctx->self)->load_supl_server_finish) { + MM_IFACE_MODEM_LOCATION_GET_INTERFACE (ctx->self)->load_supl_server ( + ctx->self, + (GAsyncReadyCallback)load_supl_server_ready, + ctx); + return; + } + /* Fall down to next step */ + ctx->step++; + case INITIALIZATION_STEP_LAST: /* We are done without errors! */ diff --git a/src/mm-iface-modem-location.h b/src/mm-iface-modem-location.h index fde00ced..96fe9b3b 100644 --- a/src/mm-iface-modem-location.h +++ b/src/mm-iface-modem-location.h @@ -42,6 +42,14 @@ struct _MMIfaceModemLocation { GAsyncResult *res, GError **error); + /* Loading of the SuplServer property */ + void (* load_supl_server) (MMIfaceModemLocation *self, + GAsyncReadyCallback callback, + gpointer user_data); + gchar * (* load_supl_server_finish) (MMIfaceModemLocation *self, + GAsyncResult *res, + GError **error); + /* Enable location gathering (async) */ void (* enable_location_gathering) (MMIfaceModemLocation *self, MMModemLocationSource source, |