diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-02-16 20:35:56 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:15:06 +0100 |
commit | 3dd5ec64ccc845b6c3018fb3b221c29dc586384c (patch) | |
tree | e0a798d3be124e551af80eb80063742b3ad815c0 /src/mm-iface-modem-messaging.c | |
parent | 5ee0f23efaff26b7db1e01b1dfdec22b05931a30 (diff) |
iface-modem-messaging: need to enable/disable SMS indications
Diffstat (limited to 'src/mm-iface-modem-messaging.c')
-rw-r--r-- | src/mm-iface-modem-messaging.c | 96 |
1 files changed, 81 insertions, 15 deletions
diff --git a/src/mm-iface-modem-messaging.c b/src/mm-iface-modem-messaging.c index 08795cff..78c75af2 100644 --- a/src/mm-iface-modem-messaging.c +++ b/src/mm-iface-modem-messaging.c @@ -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; @@ -479,6 +480,25 @@ mm_iface_modem_messaging_disable_finish (MMIfaceModemMessaging *self, } 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, DisablingContext *ctx) @@ -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); |