aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-01-03 13:23:36 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:14:43 +0100
commit6abcfd54a6c3b45b38c0bc4a999b39f0c683de35 (patch)
tree1ba0b90806976da4461ce92654010aac8f3f4c4f /src
parent863bfe9ecd4a5a9e8fba087ee05de04523f8b9d0 (diff)
iface-modem-cdma: load MEID during initialization
Diffstat (limited to 'src')
-rw-r--r--src/mm-iface-modem-cdma.c39
-rw-r--r--src/mm-iface-modem-cdma.h8
2 files changed, 47 insertions, 0 deletions
diff --git a/src/mm-iface-modem-cdma.c b/src/mm-iface-modem-cdma.c
index ad749909..3d689e5e 100644
--- a/src/mm-iface-modem-cdma.c
+++ b/src/mm-iface-modem-cdma.c
@@ -541,6 +541,7 @@ static void interface_initialization_step (InitializationContext *ctx);
typedef enum {
INITIALIZATION_STEP_FIRST,
+ INITIALIZATION_STEP_MEID,
INITIALIZATION_STEP_LAST
} InitializationStep;
@@ -587,6 +588,28 @@ initialization_context_complete_and_free (InitializationContext *ctx)
}
static void
+load_meid_ready (MMIfaceModemCdma *self,
+ GAsyncResult *res,
+ InitializationContext *ctx)
+{
+ GError *error = NULL;
+ gchar *meid;
+
+ meid = MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->load_meid_finish (self, res, &error);
+ mm_gdbus_modem_cdma_set_meid (ctx->skeleton, meid);
+ g_free (meid);
+
+ if (error) {
+ mm_warn ("couldn't load MEID: '%s'", error->message);
+ g_error_free (error);
+ }
+
+ /* Go on to next step */
+ ctx->step++;
+ interface_initialization_step (ctx);
+}
+
+static void
interface_initialization_step (InitializationContext *ctx)
{
switch (ctx->step) {
@@ -594,6 +617,22 @@ interface_initialization_step (InitializationContext *ctx)
/* Fall down to next step */
ctx->step++;
+ case INITIALIZATION_STEP_MEID:
+ /* MEID value is meant to be loaded only once during the whole
+ * lifetime of the modem. Therefore, if we already have it loaded,
+ * don't try to load it again. */
+ if (!mm_gdbus_modem_cdma_get_meid (ctx->skeleton) &&
+ MM_IFACE_MODEM_CDMA_GET_INTERFACE (ctx->self)->load_meid &&
+ MM_IFACE_MODEM_CDMA_GET_INTERFACE (ctx->self)->load_meid_finish) {
+ MM_IFACE_MODEM_CDMA_GET_INTERFACE (ctx->self)->load_meid (
+ ctx->self,
+ (GAsyncReadyCallback)load_meid_ready,
+ ctx);
+ return;
+ }
+ /* Fall down to next step */
+ ctx->step++;
+
case INITIALIZATION_STEP_LAST:
/* We are done without errors! */
diff --git a/src/mm-iface-modem-cdma.h b/src/mm-iface-modem-cdma.h
index 29b770d3..1ed1c7e7 100644
--- a/src/mm-iface-modem-cdma.h
+++ b/src/mm-iface-modem-cdma.h
@@ -35,6 +35,14 @@ typedef struct _MMIfaceModemCdma MMIfaceModemCdma;
struct _MMIfaceModemCdma {
GTypeInterface g_iface;
+ /* Loading of the MEID property */
+ void (*load_meid) (MMIfaceModemCdma *self,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gchar * (*load_meid_finish) (MMIfaceModemCdma *self,
+ GAsyncResult *res,
+ GError **error);
+
/* OTA activation */
void (* activate) (MMIfaceModemCdma *self,
const gchar *carrier,