iface-modem-cdma: load MEID during initialization
This commit is contained in:
@@ -541,6 +541,7 @@ static void interface_initialization_step (InitializationContext *ctx);
|
|||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
INITIALIZATION_STEP_FIRST,
|
INITIALIZATION_STEP_FIRST,
|
||||||
|
INITIALIZATION_STEP_MEID,
|
||||||
INITIALIZATION_STEP_LAST
|
INITIALIZATION_STEP_LAST
|
||||||
} InitializationStep;
|
} InitializationStep;
|
||||||
|
|
||||||
@@ -586,6 +587,28 @@ initialization_context_complete_and_free (InitializationContext *ctx)
|
|||||||
g_free (ctx);
|
g_free (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
|
static void
|
||||||
interface_initialization_step (InitializationContext *ctx)
|
interface_initialization_step (InitializationContext *ctx)
|
||||||
{
|
{
|
||||||
@@ -594,6 +617,22 @@ interface_initialization_step (InitializationContext *ctx)
|
|||||||
/* Fall down to next step */
|
/* Fall down to next step */
|
||||||
ctx->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:
|
case INITIALIZATION_STEP_LAST:
|
||||||
/* We are done without errors! */
|
/* We are done without errors! */
|
||||||
|
|
||||||
|
@@ -35,6 +35,14 @@ typedef struct _MMIfaceModemCdma MMIfaceModemCdma;
|
|||||||
struct _MMIfaceModemCdma {
|
struct _MMIfaceModemCdma {
|
||||||
GTypeInterface g_iface;
|
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 */
|
/* OTA activation */
|
||||||
void (* activate) (MMIfaceModemCdma *self,
|
void (* activate) (MMIfaceModemCdma *self,
|
||||||
const gchar *carrier,
|
const gchar *carrier,
|
||||||
|
Reference in New Issue
Block a user