iface-modem-cdma: new steps to enable/disable unsolicited events
This commit is contained in:
@@ -1102,6 +1102,7 @@ static void interface_disabling_step (DisablingContext *ctx);
|
||||
typedef enum {
|
||||
DISABLING_STEP_FIRST,
|
||||
DISABLING_STEP_PERIODIC_REGISTRATION_CHECKS,
|
||||
DISABLING_STEP_DISABLE_UNSOLICITED_EVENTS,
|
||||
DISABLING_STEP_CLEANUP_UNSOLICITED_EVENTS,
|
||||
DISABLING_STEP_LAST
|
||||
} DisablingStep;
|
||||
@@ -1153,6 +1154,24 @@ mm_iface_modem_cdma_disable_finish (MMIfaceModemCdma *self,
|
||||
return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
|
||||
}
|
||||
|
||||
static void
|
||||
disable_unsolicited_events_ready (MMIfaceModemCdma *self,
|
||||
GAsyncResult *res,
|
||||
DisablingContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->disable_unsolicited_events_finish (self, res, &error);
|
||||
if (error) {
|
||||
mm_dbg ("Couldn't disable unsolicited events: '%s'", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
/* Go on to next step */
|
||||
ctx->step++;
|
||||
interface_disabling_step (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
cleanup_unsolicited_events_ready (MMIfaceModemCdma *self,
|
||||
GAsyncResult *res,
|
||||
@@ -1184,6 +1203,18 @@ interface_disabling_step (DisablingContext *ctx)
|
||||
/* Fall down to next step */
|
||||
ctx->step++;
|
||||
|
||||
case DISABLING_STEP_DISABLE_UNSOLICITED_EVENTS:
|
||||
if (MM_IFACE_MODEM_CDMA_GET_INTERFACE (ctx->self)->disable_unsolicited_events &&
|
||||
MM_IFACE_MODEM_CDMA_GET_INTERFACE (ctx->self)->disable_unsolicited_events_finish) {
|
||||
MM_IFACE_MODEM_CDMA_GET_INTERFACE (ctx->self)->disable_unsolicited_events (
|
||||
ctx->self,
|
||||
(GAsyncReadyCallback)disable_unsolicited_events_ready,
|
||||
ctx);
|
||||
return;
|
||||
}
|
||||
/* Fall down to next step */
|
||||
ctx->step++;
|
||||
|
||||
case DISABLING_STEP_CLEANUP_UNSOLICITED_EVENTS:
|
||||
if (MM_IFACE_MODEM_CDMA_GET_INTERFACE (ctx->self)->cleanup_unsolicited_events &&
|
||||
MM_IFACE_MODEM_CDMA_GET_INTERFACE (ctx->self)->cleanup_unsolicited_events_finish) {
|
||||
@@ -1224,6 +1255,7 @@ static void interface_enabling_step (EnablingContext *ctx);
|
||||
typedef enum {
|
||||
ENABLING_STEP_FIRST,
|
||||
ENABLING_STEP_SETUP_UNSOLICITED_EVENTS,
|
||||
ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS,
|
||||
ENABLING_STEP_RUN_ALL_REGISTRATION_CHECKS,
|
||||
ENABLING_STEP_PERIODIC_REGISTRATION_CHECKS,
|
||||
ENABLING_STEP_LAST
|
||||
@@ -1313,6 +1345,25 @@ setup_unsolicited_events_ready (MMIfaceModemCdma *self,
|
||||
interface_enabling_step (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
enable_unsolicited_events_ready (MMIfaceModemCdma *self,
|
||||
GAsyncResult *res,
|
||||
EnablingContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->enable_unsolicited_events_finish (self, res, &error);
|
||||
if (error) {
|
||||
/* This error shouldn't be treated as critical */
|
||||
mm_dbg ("Enabling unsolicited events failed: '%s'", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
/* Go on to next step */
|
||||
ctx->step++;
|
||||
interface_enabling_step (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
run_all_registration_checks_ready (MMIfaceModemCdma *self,
|
||||
GAsyncResult *res,
|
||||
@@ -1357,6 +1408,18 @@ interface_enabling_step (EnablingContext *ctx)
|
||||
/* Fall down to next step */
|
||||
ctx->step++;
|
||||
|
||||
case ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS:
|
||||
if (MM_IFACE_MODEM_CDMA_GET_INTERFACE (ctx->self)->enable_unsolicited_events &&
|
||||
MM_IFACE_MODEM_CDMA_GET_INTERFACE (ctx->self)->enable_unsolicited_events_finish) {
|
||||
MM_IFACE_MODEM_CDMA_GET_INTERFACE (ctx->self)->enable_unsolicited_events (
|
||||
ctx->self,
|
||||
(GAsyncReadyCallback)enable_unsolicited_events_ready,
|
||||
ctx);
|
||||
return;
|
||||
}
|
||||
/* Fall down to next step */
|
||||
ctx->step++;
|
||||
|
||||
case ENABLING_STEP_RUN_ALL_REGISTRATION_CHECKS:
|
||||
mm_iface_modem_cdma_run_all_registration_checks (ctx->self,
|
||||
(GAsyncReadyCallback)run_all_registration_checks_ready,
|
||||
|
@@ -69,6 +69,15 @@ struct _MMIfaceModemCdma {
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
|
||||
/* Asynchronous enabling of unsolicited events */
|
||||
void (*enable_unsolicited_events) (MMIfaceModemCdma *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean (*enable_unsolicited_events_finish) (MMIfaceModemCdma *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
/* Asynchronous cleaning up of unsolicited events */
|
||||
void (* cleanup_unsolicited_events) (MMIfaceModemCdma *self,
|
||||
GAsyncReadyCallback callback,
|
||||
@@ -77,6 +86,14 @@ struct _MMIfaceModemCdma {
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
/* Asynchronous disabling of unsolicited events */
|
||||
void (*disable_unsolicited_events) (MMIfaceModemCdma *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean (*disable_unsolicited_events_finish) (MMIfaceModemCdma *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
/* OTA activation */
|
||||
void (* activate) (MMIfaceModemCdma *self,
|
||||
const gchar *carrier,
|
||||
|
Reference in New Issue
Block a user