iface-modem-messaging: need to enable/disable SMS indications
This commit is contained in:
@@ -424,6 +424,7 @@ static void interface_disabling_step (DisablingContext *ctx);
|
||||
|
||||
typedef enum {
|
||||
DISABLING_STEP_FIRST,
|
||||
DISABLING_STEP_DISABLE_UNSOLICITED_EVENTS,
|
||||
DISABLING_STEP_CLEANUP_UNSOLICITED_EVENTS,
|
||||
DISABLING_STEP_LAST
|
||||
} DisablingStep;
|
||||
@@ -478,6 +479,25 @@ mm_iface_modem_messaging_disable_finish (MMIfaceModemMessaging *self,
|
||||
return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
|
||||
}
|
||||
|
||||
static void
|
||||
disable_unsolicited_events_ready (MMIfaceModemMessaging *self,
|
||||
GAsyncResult *res,
|
||||
DisablingContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (self)->disable_unsolicited_events_finish (self, res, &error);
|
||||
if (error) {
|
||||
g_simple_async_result_take_error (ctx->result, error);
|
||||
disabling_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Go on to next step */
|
||||
ctx->step++;
|
||||
interface_disabling_step (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
cleanup_unsolicited_events_ready (MMIfaceModemMessaging *self,
|
||||
GAsyncResult *res,
|
||||
@@ -505,6 +525,19 @@ interface_disabling_step (DisablingContext *ctx)
|
||||
/* Fall down to next step */
|
||||
ctx->step++;
|
||||
|
||||
case DISABLING_STEP_DISABLE_UNSOLICITED_EVENTS:
|
||||
/* Allow cleaning up unsolicited events */
|
||||
if (MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->disable_unsolicited_events &&
|
||||
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->disable_unsolicited_events_finish) {
|
||||
MM_IFACE_MODEM_MESSAGING_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:
|
||||
/* Allow cleaning up unsolicited events */
|
||||
if (MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->cleanup_unsolicited_events &&
|
||||
@@ -551,9 +584,10 @@ static void interface_enabling_step (EnablingContext *ctx);
|
||||
typedef enum {
|
||||
ENABLING_STEP_FIRST,
|
||||
ENABLING_STEP_SETUP_SMS_FORMAT,
|
||||
ENABLING_STEP_SETUP_UNSOLICITED_EVENTS,
|
||||
ENABLING_STEP_LOAD_INITIAL_SMS_PARTS,
|
||||
ENABLING_STEP_STORAGE_DEFAULTS,
|
||||
ENABLING_STEP_SETUP_UNSOLICITED_EVENTS,
|
||||
ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS,
|
||||
ENABLING_STEP_LAST
|
||||
} EnablingStep;
|
||||
|
||||
@@ -631,7 +665,6 @@ mm_iface_modem_messaging_enable_finish (MMIfaceModemMessaging *self,
|
||||
}
|
||||
|
||||
VOID_REPLY_READY_FN (setup_sms_format)
|
||||
VOID_REPLY_READY_FN (setup_unsolicited_events)
|
||||
|
||||
static void load_initial_sms_parts_from_storages (EnablingContext *ctx);
|
||||
|
||||
@@ -707,6 +740,26 @@ set_default_storages_ready (MMIfaceModemMessaging *self,
|
||||
interface_enabling_step (ctx);
|
||||
}
|
||||
|
||||
VOID_REPLY_READY_FN (setup_unsolicited_events)
|
||||
|
||||
static void
|
||||
enable_unsolicited_events_ready (MMIfaceModemMessaging *self,
|
||||
GAsyncResult *res,
|
||||
EnablingContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
/* Not critical! */
|
||||
if (!MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (self)->enable_unsolicited_events_finish (self, res, &error)) {
|
||||
mm_dbg ("Couldn't enable unsolicited events: '%s'", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
/* Go on with next step */
|
||||
ctx->step++;
|
||||
interface_enabling_step (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
interface_enabling_step (EnablingContext *ctx)
|
||||
{
|
||||
@@ -748,19 +801,6 @@ interface_enabling_step (EnablingContext *ctx)
|
||||
/* Fall down to next step */
|
||||
ctx->step++;
|
||||
|
||||
case ENABLING_STEP_SETUP_UNSOLICITED_EVENTS:
|
||||
/* Allow setting up unsolicited events */
|
||||
if (MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->setup_unsolicited_events &&
|
||||
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->setup_unsolicited_events_finish) {
|
||||
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->setup_unsolicited_events (
|
||||
ctx->self,
|
||||
(GAsyncReadyCallback)setup_unsolicited_events_ready,
|
||||
ctx);
|
||||
return;
|
||||
}
|
||||
/* Fall down to next step */
|
||||
ctx->step++;
|
||||
|
||||
case ENABLING_STEP_LOAD_INITIAL_SMS_PARTS:
|
||||
/* Allow loading the initial list of SMS parts */
|
||||
if (MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->load_initial_sms_parts &&
|
||||
@@ -782,6 +822,32 @@ interface_enabling_step (EnablingContext *ctx)
|
||||
ctx);
|
||||
return;
|
||||
|
||||
case ENABLING_STEP_SETUP_UNSOLICITED_EVENTS:
|
||||
/* Allow setting up unsolicited events */
|
||||
if (MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->setup_unsolicited_events &&
|
||||
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->setup_unsolicited_events_finish) {
|
||||
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->setup_unsolicited_events (
|
||||
ctx->self,
|
||||
(GAsyncReadyCallback)setup_unsolicited_events_ready,
|
||||
ctx);
|
||||
return;
|
||||
}
|
||||
/* Fall down to next step */
|
||||
ctx->step++;
|
||||
|
||||
case ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS:
|
||||
/* Allow setting up unsolicited events */
|
||||
if (MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->enable_unsolicited_events &&
|
||||
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->enable_unsolicited_events_finish) {
|
||||
MM_IFACE_MODEM_MESSAGING_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_LAST:
|
||||
/* We are done without errors! */
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
|
Reference in New Issue
Block a user