From 0d8cf160e5083b9f1433534b218490b7a1b5ce55 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Thu, 29 Mar 2012 17:20:37 +0200 Subject: broadband: ensure 3GPP location info gets updated when enabling the source Whenever 3GPP location source gets enabled, we'll launch new registration status checks (to get updated LAC/CI) and new operator code/name checks (to get updated MCC/MNC). Additional changes were needed in the HSO plugin, so that the specific location gathering enabling implemented by the HSO modem chains up parent's one first. --- src/mm-broadband-modem.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src') diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 06533f8a..cdaf83f9 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -5703,6 +5703,46 @@ modem_location_load_capabilities (MMIfaceModemLocation *self, g_object_unref (result); } +/*****************************************************************************/ +/* Enable location gathering (Location interface) */ + +static gboolean +enable_location_gathering_finish (MMIfaceModemLocation *self, + GAsyncResult *res, + GError **error) +{ + return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error); +} + +static void +enable_location_gathering (MMIfaceModemLocation *self, + MMModemLocationSource source, + GAsyncReadyCallback callback, + gpointer user_data) +{ + GSimpleAsyncResult *result; + + result = g_simple_async_result_new (G_OBJECT (self), + callback, + user_data, + enable_location_gathering); + + /* 3GPP modems need to re-run registration checks, so that we get up to date + * LAC/CI location information. Note that we don't care for when the + * registration checks get finished. */ + if (mm_iface_modem_is_3gpp (MM_IFACE_MODEM (self))) { + /* Re-run registration to get update LAC/CI */ + mm_iface_modem_3gpp_run_all_registration_checks (MM_IFACE_MODEM_3GPP (self), NULL, NULL); + /* Reload operator, to get MCC/MNC */ + mm_iface_modem_3gpp_reload_current_operator (MM_IFACE_MODEM_3GPP (self)); + } + + /* Done we are */ + g_simple_async_result_set_op_res_gboolean (result, TRUE); + g_simple_async_result_complete_in_idle (result); + g_object_unref (result); +} + /*****************************************************************************/ static void @@ -7215,6 +7255,8 @@ iface_modem_location_init (MMIfaceModemLocation *iface) { iface->load_capabilities = modem_location_load_capabilities; iface->load_capabilities_finish = modem_location_load_capabilities_finish; + iface->enable_location_gathering = enable_location_gathering; + iface->enable_location_gathering_finish = enable_location_gathering_finish; } static void -- cgit v1.2.3-70-g09d2