diff options
-rw-r--r-- | src/mm-broadband-modem.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 2a778bc1..21598571 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -3973,6 +3973,49 @@ modem_cdma_register_in_network (MMIfaceModemCdma *self, } /*****************************************************************************/ +/* Load location capabilities (Location interface) */ + +static MMModemLocationSource +modem_location_load_capabilities_finish (MMIfaceModemLocation *self, + GAsyncResult *res, + GError **error) +{ + if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) + return MM_MODEM_LOCATION_SOURCE_NONE; + + return (MMModemLocationSource) GPOINTER_TO_UINT (g_simple_async_result_get_op_res_gpointer ( + G_SIMPLE_ASYNC_RESULT (res))); +} + +static void +modem_location_load_capabilities (MMIfaceModemLocation *self, + GAsyncReadyCallback callback, + gpointer user_data) +{ + GSimpleAsyncResult *result; + + result = g_simple_async_result_new (G_OBJECT (self), + callback, + user_data, + modem_location_load_capabilities); + + /* Default location capabilities supported by the generic broadband + * implementation are only LAC-CI in 3GPP-enabled modems. And even this, + * will only be true if the modem supports CREG/CGREG=2 */ + if (!mm_iface_modem_is_3gpp (MM_IFACE_MODEM (self))) + g_simple_async_result_set_op_res_gpointer (result, + GUINT_TO_POINTER (MM_MODEM_LOCATION_SOURCE_NONE), + NULL); + else + g_simple_async_result_set_op_res_gpointer (result, + GUINT_TO_POINTER (MM_MODEM_LOCATION_SOURCE_GSM_LAC_CI), + NULL); + + g_simple_async_result_complete_in_idle (result); + g_object_unref (result); +} + +/*****************************************************************************/ typedef enum { DISABLING_STEP_FIRST, @@ -4951,6 +4994,8 @@ iface_modem_simple_init (MMIfaceModemSimple *iface) static void iface_modem_location_init (MMIfaceModemLocation *iface) { + iface->load_capabilities = modem_location_load_capabilities; + iface->load_capabilities_finish = modem_location_load_capabilities_finish; } static void |