broadband-modem: implement ESN retrieval

This commit is contained in:
Aleksander Morgado
2012-01-04 10:49:07 +01:00
parent 0c6b505a6b
commit 14269e1138

View File

@@ -2673,6 +2673,39 @@ setup_ps_registration (MMIfaceModem3gpp *self,
ctx);
}
/*****************************************************************************/
/* ESN (CDMA) */
static gchar *
load_esn_finish (MMIfaceModemCdma *self,
GAsyncResult *res,
GError **error)
{
gchar *esn;
esn = g_strdup (mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, error));
if (!esn)
return NULL;
mm_dbg ("loaded ESN: %s", esn);
return esn;
}
static void
load_esn (MMIfaceModemCdma *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
mm_dbg ("loading ESN...");
mm_base_modem_at_command (MM_BASE_MODEM (self),
"+GSN",
3,
TRUE,
NULL, /* cancellable */
callback,
user_data);
}
/*****************************************************************************/
typedef enum {
@@ -3567,6 +3600,9 @@ iface_modem_3gpp_init (MMIfaceModem3gpp *iface)
static void
iface_modem_cdma_init (MMIfaceModemCdma *iface)
{
/* Initialization steps */
iface->load_esn = load_esn;
iface->load_esn_finish = load_esn_finish;
}
static void