diff options
author | Carlo Lobrano <c.lobrano@gmail.com> | 2016-03-09 11:27:43 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2016-03-09 14:43:08 +0100 |
commit | be317e8b80cd984149ea152c9d00c6bb814e7c88 (patch) | |
tree | b59255b3611d3be0804a0f081e298c967d4b44c5 /src/mm-iface-modem-messaging.c | |
parent | 7c2d5b1aa358c4edb94203d7de586d489b656576 (diff) |
broadband-modem: fix +CPMS empty parameter support
* Add new async virtual method init_current_storages to
MMIfaceModemMessaging
* Add logic of init_current_storages to MMBroadbandModem
* Add step "INIT_CURRENT_STORAGES" in MMIfaceModemMessaging
initialization in order to load and store current SMS
storages for mem1 and mem2.
* Add usage of current sms storage value for mem1 in place
of an empty string parameter when the command AT+CPMS
is used.
https://bugs.freedesktop.org/show_bug.cgi?id=93135
Diffstat (limited to 'src/mm-iface-modem-messaging.c')
-rw-r--r-- | src/mm-iface-modem-messaging.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/mm-iface-modem-messaging.c b/src/mm-iface-modem-messaging.c index d2ef6e86..0cff1f2e 100644 --- a/src/mm-iface-modem-messaging.c +++ b/src/mm-iface-modem-messaging.c @@ -1057,6 +1057,7 @@ typedef enum { INITIALIZATION_STEP_CHECK_SUPPORT, INITIALIZATION_STEP_FAIL_IF_UNSUPPORTED, INITIALIZATION_STEP_LOAD_SUPPORTED_STORAGES, + INITIALIZATION_STEP_INIT_CURRENT_STORAGES, INITIALIZATION_STEP_LAST } InitializationStep; @@ -1213,6 +1214,30 @@ check_support_ready (MMIfaceModemMessaging *self, } static void +init_current_storages_ready (MMIfaceModemMessaging *self, + GAsyncResult *res, + InitializationContext *ctx) +{ + StorageContext *storage_ctx; + GError *error = NULL; + + storage_ctx = get_storage_context (self); + if (!MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (self)->init_current_storages_finish ( + self, + res, + &error)) { + mm_dbg ("Couldn't initialize current storages: '%s'", error->message); + g_error_free (error); + } else { + mm_dbg ("Current storages initialized"); + } + + /* Go on to next step */ + ctx->step++; + interface_initialization_step (ctx); +} + +static void interface_initialization_step (InitializationContext *ctx) { /* Don't run new steps if we're cancelled */ @@ -1284,6 +1309,18 @@ interface_initialization_step (InitializationContext *ctx) /* Fall down to next step */ ctx->step++; + case INITIALIZATION_STEP_INIT_CURRENT_STORAGES: + if (MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->init_current_storages && + MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->init_current_storages_finish) { + MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->init_current_storages ( + ctx->self, + (GAsyncReadyCallback)init_current_storages_ready, + ctx); + return; + } + /* Fall down to next step */ + ctx->step++; + case INITIALIZATION_STEP_LAST: /* We are done without errors! */ |