broadband-modem: load default location reporting capabilities

Currently, only LAC/CI if the modem has 3GPP capabilities.
This commit is contained in:
Aleksander Morgado
2012-01-16 20:02:47 +01:00
parent 03c5f4e6fb
commit 74f29981c8

View File

@@ -3972,6 +3972,49 @@ modem_cdma_register_in_network (MMIfaceModemCdma *self,
ctx);
}
/*****************************************************************************/
/* 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 {
@@ -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