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
This commit is contained in:
Carlo Lobrano
2016-03-09 11:27:43 +01:00
committed by Aleksander Morgado
parent 7c2d5b1aa3
commit be317e8b80
6 changed files with 256 additions and 1 deletions

View File

@@ -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;
@@ -1212,6 +1213,30 @@ check_support_ready (MMIfaceModemMessaging *self,
interface_initialization_step (ctx);
}
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)
{
@@ -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! */