diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-29 17:20:37 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-29 17:20:37 +0200 |
commit | 0d8cf160e5083b9f1433534b218490b7a1b5ce55 (patch) | |
tree | 6a35fb89aa53777b96cf063a0c2249ae0e0b285b /src | |
parent | 3cea187a9449c3aefe0a1a381a9477c6aff83745 (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-broadband-modem.c | 42 |
1 files changed, 42 insertions, 0 deletions
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 @@ -5704,6 +5704,46 @@ modem_location_load_capabilities (MMIfaceModemLocation *self, } /*****************************************************************************/ +/* 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 setup_ports (MMBroadbandModem *self) @@ -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 |