iface-modem-messaging: instead of mem1,mem2,mem3 use just a new default storage

There is no point in specifying a default 'mem1' memory storage, which is used
for reading/listing/deleting, as those are operations that need a specific
'mem1' set each time.

Also, there is no point in specifying separate default 'mem2' and 'mem3' memory
storages, specially because now we allow Sms.Store() to specify a storage.

So, we will now only have a 'default' memory storage, which is applicable for
both 'mem2' and 'mem3' (storing, sending from storage and deleting).
This commit is contained in:
Aleksander Morgado
2012-09-10 18:03:29 +02:00
parent 584fc77bb3
commit bddcc2fb07
10 changed files with 90 additions and 164 deletions

View File

@@ -107,5 +107,13 @@
--> -->
<property name="SupportedStorages" type="au" access="read" /> <property name="SupportedStorages" type="au" access="read" />
<!--
DefaultStorage:
A <link linkend="MMSmsStorage">MMSmsStorage</link> value,
specifying the storage to be used when receiving or storing SMS.
-->
<property name="DefaultStorage" type="u" access="read" />
</interface> </interface>
</node> </node>

View File

@@ -1163,7 +1163,7 @@ mm_broadband_modem_cinterion_new (const gchar *device,
MM_BASE_MODEM_PLUGIN, plugin, MM_BASE_MODEM_PLUGIN, plugin,
MM_BASE_MODEM_VENDOR_ID, vendor_id, MM_BASE_MODEM_VENDOR_ID, vendor_id,
MM_BASE_MODEM_PRODUCT_ID, product_id, MM_BASE_MODEM_PRODUCT_ID, product_id,
MM_IFACE_MODEM_MESSAGING_SMS_MEM3_STORAGE, MM_SMS_STORAGE_MT, MM_IFACE_MODEM_MESSAGING_SMS_DEFAULT_STORAGE, MM_SMS_STORAGE_MT,
NULL); NULL);
} }

View File

@@ -410,9 +410,8 @@ mm_broadband_modem_iridium_new (const gchar *device,
MM_BASE_MODEM_MAX_TIMEOUTS, 3, MM_BASE_MODEM_MAX_TIMEOUTS, 3,
/* Only CS network is supported by the Iridium modem */ /* Only CS network is supported by the Iridium modem */
MM_IFACE_MODEM_3GPP_PS_NETWORK_SUPPORTED, FALSE, MM_IFACE_MODEM_3GPP_PS_NETWORK_SUPPORTED, FALSE,
MM_IFACE_MODEM_MESSAGING_SMS_MEM1_STORAGE, MM_SMS_STORAGE_SM, /* 'ME' storage not supported */
MM_IFACE_MODEM_MESSAGING_SMS_MEM2_STORAGE, MM_SMS_STORAGE_SM, MM_IFACE_MODEM_MESSAGING_SMS_DEFAULT_STORAGE, MM_SMS_STORAGE_SM,
MM_IFACE_MODEM_MESSAGING_SMS_MEM3_STORAGE, MM_SMS_STORAGE_SM,
NULL); NULL);
} }

View File

@@ -432,9 +432,8 @@ mm_broadband_modem_novatel_lte_new (const gchar *device,
MM_BASE_MODEM_PLUGIN, plugin, MM_BASE_MODEM_PLUGIN, plugin,
MM_BASE_MODEM_VENDOR_ID, vendor_id, MM_BASE_MODEM_VENDOR_ID, vendor_id,
MM_BASE_MODEM_PRODUCT_ID, product_id, MM_BASE_MODEM_PRODUCT_ID, product_id,
MM_IFACE_MODEM_MESSAGING_SMS_MEM1_STORAGE, MM_SMS_STORAGE_SM, /* 'ME' storage not supported */
MM_IFACE_MODEM_MESSAGING_SMS_MEM2_STORAGE, MM_SMS_STORAGE_SM, MM_IFACE_MODEM_MESSAGING_SMS_DEFAULT_STORAGE, MM_SMS_STORAGE_SM,
MM_IFACE_MODEM_MESSAGING_SMS_MEM3_STORAGE, MM_SMS_STORAGE_SM,
NULL); NULL);
} }

View File

@@ -753,10 +753,8 @@ mm_broadband_modem_novatel_new (const gchar *device,
MM_BASE_MODEM_PLUGIN, plugin, MM_BASE_MODEM_PLUGIN, plugin,
MM_BASE_MODEM_VENDOR_ID, vendor_id, MM_BASE_MODEM_VENDOR_ID, vendor_id,
MM_BASE_MODEM_PRODUCT_ID, product_id, MM_BASE_MODEM_PRODUCT_ID, product_id,
/* Use SM storage always */ /* 'ME' storage not supported */
MM_IFACE_MODEM_MESSAGING_SMS_MEM1_STORAGE, MM_SMS_STORAGE_SM, MM_IFACE_MODEM_MESSAGING_SMS_DEFAULT_STORAGE, MM_SMS_STORAGE_SM,
MM_IFACE_MODEM_MESSAGING_SMS_MEM2_STORAGE, MM_SMS_STORAGE_SM,
MM_IFACE_MODEM_MESSAGING_SMS_MEM3_STORAGE, MM_SMS_STORAGE_SM,
NULL); NULL);
} }

View File

@@ -4919,10 +4919,10 @@ messaging_load_supported_storages (MMIfaceModemMessaging *self,
} }
/*****************************************************************************/ /*****************************************************************************/
/* Set preferred storages (Messaging interface) */ /* Set default storage (Messaging interface) */
static gboolean static gboolean
messaging_set_preferred_storages_finish (MMIfaceModemMessaging *self, messaging_set_default_storage_finish (MMIfaceModemMessaging *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -4956,29 +4956,11 @@ wms_set_routes_ready (QmiClientWms *client,
} }
static void static void
messaging_set_preferred_storages (MMIfaceModemMessaging *self, messaging_set_default_storage (MMIfaceModemMessaging *self,
MMSmsStorage mem1, MMSmsStorage storage,
MMSmsStorage mem2,
MMSmsStorage mem3,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
/* In QMI, we don't need to specify neither a default 'mem1' storage (the
* one used for listing, reading, deleting) nor a default 'mem2' storage
* (the one used for writing/sending), as the QMI operations allow to
* pass the specific storage directly in the command, as opposed to the
* AT-way which is specifying the storage first and then performing an
* operation on the default storage.
*
* Whenever a list/read/delete/write/send operation is received, we'll just
* read the corresponding property to know in which storage to perform the
* action.
*
* But for 'mem3', we do need to specify custom 'routes' to identify to
* which storage the incoming messages should be transferred, so we'll use
* that one.
*/
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
QmiClient *client = NULL; QmiClient *client = NULL;
QmiMessageWmsSetRoutesInput *input; QmiMessageWmsSetRoutesInput *input;
@@ -4993,7 +4975,7 @@ messaging_set_preferred_storages (MMIfaceModemMessaging *self,
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
messaging_set_preferred_storages); messaging_set_default_storage);
/* Build routes array and add it as input /* Build routes array and add it as input
* Just worry about Class 0 and Class 1 messages for now */ * Just worry about Class 0 and Class 1 messages for now */
@@ -5001,7 +4983,7 @@ messaging_set_preferred_storages (MMIfaceModemMessaging *self,
routes_array = g_array_sized_new (FALSE, FALSE, sizeof (route), 2); routes_array = g_array_sized_new (FALSE, FALSE, sizeof (route), 2);
route.message_type = QMI_WMS_MESSAGE_TYPE_POINT_TO_POINT; route.message_type = QMI_WMS_MESSAGE_TYPE_POINT_TO_POINT;
route.message_class = QMI_WMS_MESSAGE_CLASS_0; route.message_class = QMI_WMS_MESSAGE_CLASS_0;
route.storage = mm_sms_storage_to_qmi_storage_type (mem3); route.storage = mm_sms_storage_to_qmi_storage_type (storage);
route.receipt_action = QMI_WMS_RECEIPT_ACTION_STORE_AND_NOTIFY; route.receipt_action = QMI_WMS_RECEIPT_ACTION_STORE_AND_NOTIFY;
g_array_append_val (routes_array, route); g_array_append_val (routes_array, route);
route.message_class = QMI_WMS_MESSAGE_CLASS_1; route.message_class = QMI_WMS_MESSAGE_CLASS_1;
@@ -5932,8 +5914,8 @@ iface_modem_messaging_init (MMIfaceModemMessaging *iface)
iface->load_supported_storages_finish = messaging_load_supported_storages_finish; iface->load_supported_storages_finish = messaging_load_supported_storages_finish;
iface->setup_sms_format = NULL; iface->setup_sms_format = NULL;
iface->setup_sms_format_finish = NULL; iface->setup_sms_format_finish = NULL;
iface->set_preferred_storages = messaging_set_preferred_storages; iface->set_default_storage = messaging_set_default_storage;
iface->set_preferred_storages_finish = messaging_set_preferred_storages_finish; iface->set_default_storage_finish = messaging_set_default_storage_finish;
iface->load_initial_sms_parts = load_initial_sms_parts; iface->load_initial_sms_parts = load_initial_sms_parts;
iface->load_initial_sms_parts_finish = load_initial_sms_parts_finish; iface->load_initial_sms_parts_finish = load_initial_sms_parts_finish;
iface->setup_unsolicited_events = messaging_setup_unsolicited_events; iface->setup_unsolicited_events = messaging_setup_unsolicited_events;

View File

@@ -88,9 +88,7 @@ enum {
PROP_MODEM_CDMA_EVDO_NETWORK_SUPPORTED, PROP_MODEM_CDMA_EVDO_NETWORK_SUPPORTED,
PROP_MODEM_MESSAGING_SMS_LIST, PROP_MODEM_MESSAGING_SMS_LIST,
PROP_MODEM_MESSAGING_SMS_PDU_MODE, PROP_MODEM_MESSAGING_SMS_PDU_MODE,
PROP_MODEM_MESSAGING_SMS_MEM1_STORAGE, PROP_MODEM_MESSAGING_SMS_DEFAULT_STORAGE,
PROP_MODEM_MESSAGING_SMS_MEM2_STORAGE,
PROP_MODEM_MESSAGING_SMS_MEM3_STORAGE,
PROP_MODEM_SIMPLE_STATUS, PROP_MODEM_SIMPLE_STATUS,
PROP_LAST PROP_LAST
}; };
@@ -164,9 +162,7 @@ struct _MMBroadbandModemPrivate {
GObject *modem_messaging_dbus_skeleton; GObject *modem_messaging_dbus_skeleton;
MMBearerList *modem_messaging_sms_list; MMBearerList *modem_messaging_sms_list;
gboolean modem_messaging_sms_pdu_mode; gboolean modem_messaging_sms_pdu_mode;
MMSmsStorage modem_messaging_sms_mem1_storage; MMSmsStorage modem_messaging_sms_default_storage;
MMSmsStorage modem_messaging_sms_mem2_storage;
MMSmsStorage modem_messaging_sms_mem3_storage;
/* Implementation helpers */ /* Implementation helpers */
gboolean sms_supported_modes_checked; gboolean sms_supported_modes_checked;
GHashTable *known_sms_parts; GHashTable *known_sms_parts;
@@ -4315,10 +4311,10 @@ mm_broadband_modem_lock_sms_storages (MMBroadbandModem *self,
} }
/*****************************************************************************/ /*****************************************************************************/
/* Set preferred SMS storage (Messaging interface) */ /* Set default SMS storage (Messaging interface) */
static gboolean static gboolean
modem_messaging_set_preferred_storages_finish (MMIfaceModemMessaging *self, modem_messaging_set_default_storage_finish (MMIfaceModemMessaging *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -4342,42 +4338,33 @@ cpms_set_ready (MMBroadbandModem *self,
} }
static void static void
modem_messaging_set_preferred_storages (MMIfaceModemMessaging *_self, modem_messaging_set_default_storage (MMIfaceModemMessaging *_self,
MMSmsStorage mem1, MMSmsStorage storage,
MMSmsStorage mem2,
MMSmsStorage mem3,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
MMBroadbandModem *self = MM_BROADBAND_MODEM (_self); MMBroadbandModem *self = MM_BROADBAND_MODEM (_self);
gchar *cmd; gchar *cmd;
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
gchar *mem1_str; gchar *mem_str;
gchar *mem2_str;
gchar *mem3_str;
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
modem_messaging_set_preferred_storages); modem_messaging_set_default_storage);
/* Set defaults as current */ /* Set defaults as current */
self->priv->current_sms_mem1_storage = mem1; self->priv->current_sms_mem2_storage = storage;
self->priv->current_sms_mem2_storage = mem2;
mem1_str = g_ascii_strup (mm_sms_storage_get_string (mem1), -1); mem_str = g_ascii_strup (mm_sms_storage_get_string (storage), -1);
mem2_str = g_ascii_strup (mm_sms_storage_get_string (mem2), -1); cmd = g_strdup_printf ("+CPMS=\"\",\"%s\",\"%s\"", mem_str, mem_str);
mem3_str = g_ascii_strup (mm_sms_storage_get_string (mem3), -1);
cmd = g_strdup_printf ("+CPMS=\"%s\",\"%s\",\"%s\"", mem1_str, mem2_str, mem3_str);
mm_base_modem_at_command (MM_BASE_MODEM (self), mm_base_modem_at_command (MM_BASE_MODEM (self),
cmd, cmd,
3, 3,
FALSE, FALSE,
(GAsyncReadyCallback)cpms_set_ready, (GAsyncReadyCallback)cpms_set_ready,
result); result);
g_free (mem1_str); g_free (mem_str);
g_free (mem2_str);
g_free (mem3_str);
g_free (cmd); g_free (cmd);
} }
@@ -4562,8 +4549,7 @@ sms_part_ready (MMBroadbandModem *self,
mm_iface_modem_messaging_take_part (MM_IFACE_MODEM_MESSAGING (self), mm_iface_modem_messaging_take_part (MM_IFACE_MODEM_MESSAGING (self),
part, part,
MM_SMS_STATE_RECEIVED, MM_SMS_STATE_RECEIVED,
/* use default reception (mem3) storage */ self->priv->modem_messaging_sms_default_storage);
self->priv->modem_messaging_sms_mem3_storage);
} else { } else {
/* Don't treat the error as critical */ /* Don't treat the error as critical */
mm_dbg ("Error parsing PDU (%d): %s", ctx->idx, error->message); mm_dbg ("Error parsing PDU (%d): %s", ctx->idx, error->message);
@@ -7863,14 +7849,8 @@ set_property (GObject *object,
case PROP_MODEM_MESSAGING_SMS_PDU_MODE: case PROP_MODEM_MESSAGING_SMS_PDU_MODE:
self->priv->modem_messaging_sms_pdu_mode = g_value_get_boolean (value); self->priv->modem_messaging_sms_pdu_mode = g_value_get_boolean (value);
break; break;
case PROP_MODEM_MESSAGING_SMS_MEM1_STORAGE: case PROP_MODEM_MESSAGING_SMS_DEFAULT_STORAGE:
self->priv->modem_messaging_sms_mem1_storage = g_value_get_enum (value); self->priv->modem_messaging_sms_default_storage = g_value_get_enum (value);
break;
case PROP_MODEM_MESSAGING_SMS_MEM2_STORAGE:
self->priv->modem_messaging_sms_mem2_storage = g_value_get_enum (value);
break;
case PROP_MODEM_MESSAGING_SMS_MEM3_STORAGE:
self->priv->modem_messaging_sms_mem3_storage = g_value_get_enum (value);
break; break;
case PROP_MODEM_SIMPLE_STATUS: case PROP_MODEM_SIMPLE_STATUS:
g_clear_object (&self->priv->modem_simple_status); g_clear_object (&self->priv->modem_simple_status);
@@ -7951,14 +7931,8 @@ get_property (GObject *object,
case PROP_MODEM_MESSAGING_SMS_PDU_MODE: case PROP_MODEM_MESSAGING_SMS_PDU_MODE:
g_value_set_boolean (value, self->priv->modem_messaging_sms_pdu_mode); g_value_set_boolean (value, self->priv->modem_messaging_sms_pdu_mode);
break; break;
case PROP_MODEM_MESSAGING_SMS_MEM1_STORAGE: case PROP_MODEM_MESSAGING_SMS_DEFAULT_STORAGE:
g_value_set_enum (value, self->priv->modem_messaging_sms_mem1_storage); g_value_set_enum (value, self->priv->modem_messaging_sms_default_storage);
break;
case PROP_MODEM_MESSAGING_SMS_MEM2_STORAGE:
g_value_set_enum (value, self->priv->modem_messaging_sms_mem2_storage);
break;
case PROP_MODEM_MESSAGING_SMS_MEM3_STORAGE:
g_value_set_enum (value, self->priv->modem_messaging_sms_mem3_storage);
break; break;
case PROP_MODEM_SIMPLE_STATUS: case PROP_MODEM_SIMPLE_STATUS:
g_value_set_object (value, self->priv->modem_simple_status); g_value_set_object (value, self->priv->modem_simple_status);
@@ -7986,9 +7960,9 @@ mm_broadband_modem_init (MMBroadbandModem *self)
self->priv->modem_cdma_evdo_registration_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN; self->priv->modem_cdma_evdo_registration_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
self->priv->modem_cdma_cdma1x_network_supported = TRUE; self->priv->modem_cdma_cdma1x_network_supported = TRUE;
self->priv->modem_cdma_evdo_network_supported = TRUE; self->priv->modem_cdma_evdo_network_supported = TRUE;
self->priv->modem_messaging_sms_mem1_storage = MM_SMS_STORAGE_ME; self->priv->modem_messaging_sms_default_storage = MM_SMS_STORAGE_ME;
self->priv->modem_messaging_sms_mem2_storage = MM_SMS_STORAGE_ME; self->priv->current_sms_mem1_storage = MM_SMS_STORAGE_UNKNOWN;
self->priv->modem_messaging_sms_mem3_storage = MM_SMS_STORAGE_ME; self->priv->current_sms_mem2_storage = MM_SMS_STORAGE_UNKNOWN;
} }
static void static void
@@ -8224,8 +8198,8 @@ iface_modem_messaging_init (MMIfaceModemMessaging *iface)
iface->check_support_finish = modem_messaging_check_support_finish; iface->check_support_finish = modem_messaging_check_support_finish;
iface->load_supported_storages = modem_messaging_load_supported_storages; iface->load_supported_storages = modem_messaging_load_supported_storages;
iface->load_supported_storages_finish = modem_messaging_load_supported_storages_finish; iface->load_supported_storages_finish = modem_messaging_load_supported_storages_finish;
iface->set_preferred_storages = modem_messaging_set_preferred_storages; iface->set_default_storage = modem_messaging_set_default_storage;
iface->set_preferred_storages_finish = modem_messaging_set_preferred_storages_finish; iface->set_default_storage_finish = modem_messaging_set_default_storage_finish;
iface->setup_sms_format = modem_messaging_setup_sms_format; iface->setup_sms_format = modem_messaging_setup_sms_format;
iface->setup_sms_format_finish = modem_messaging_setup_sms_format_finish; iface->setup_sms_format_finish = modem_messaging_setup_sms_format_finish;
iface->load_initial_sms_parts = modem_messaging_load_initial_sms_parts; iface->load_initial_sms_parts = modem_messaging_load_initial_sms_parts;
@@ -8354,16 +8328,8 @@ mm_broadband_modem_class_init (MMBroadbandModemClass *klass)
MM_IFACE_MODEM_MESSAGING_SMS_PDU_MODE); MM_IFACE_MODEM_MESSAGING_SMS_PDU_MODE);
g_object_class_override_property (object_class, g_object_class_override_property (object_class,
PROP_MODEM_MESSAGING_SMS_MEM1_STORAGE, PROP_MODEM_MESSAGING_SMS_DEFAULT_STORAGE,
MM_IFACE_MODEM_MESSAGING_SMS_MEM1_STORAGE); MM_IFACE_MODEM_MESSAGING_SMS_DEFAULT_STORAGE);
g_object_class_override_property (object_class,
PROP_MODEM_MESSAGING_SMS_MEM2_STORAGE,
MM_IFACE_MODEM_MESSAGING_SMS_MEM2_STORAGE);
g_object_class_override_property (object_class,
PROP_MODEM_MESSAGING_SMS_MEM3_STORAGE,
MM_IFACE_MODEM_MESSAGING_SMS_MEM3_STORAGE);
g_object_class_override_property (object_class, g_object_class_override_property (object_class,
PROP_MODEM_SIMPLE_STATUS, PROP_MODEM_SIMPLE_STATUS,

View File

@@ -719,14 +719,14 @@ load_initial_sms_parts_ready (MMIfaceModemMessaging *self,
} }
static void static void
set_preferred_storages_ready (MMIfaceModemMessaging *self, set_default_storage_ready (MMIfaceModemMessaging *self,
GAsyncResult *res, GAsyncResult *res,
EnablingContext *ctx) EnablingContext *ctx)
{ {
GError *error = NULL; GError *error = NULL;
if (!MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (self)->set_preferred_storages_finish (self, res, &error)) { if (!MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (self)->set_default_storage_finish (self, res, &error)) {
mm_dbg ("Couldn't set preferred storages: '%s'", error->message); mm_dbg ("Couldn't set default storage: '%s'", error->message);
g_error_free (error); g_error_free (error);
} }
@@ -838,39 +838,34 @@ interface_enabling_step (EnablingContext *ctx)
case ENABLING_STEP_STORAGE_DEFAULTS: case ENABLING_STEP_STORAGE_DEFAULTS:
/* Set storage defaults */ /* Set storage defaults */
if (MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->set_preferred_storages && if (MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->set_default_storage &&
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->set_preferred_storages_finish) { MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->set_default_storage_finish) {
StorageContext *storage_ctx; StorageContext *storage_ctx;
MMSmsStorage default_mem1 = MM_SMS_STORAGE_UNKNOWN; MMSmsStorage default_storage = MM_SMS_STORAGE_UNKNOWN;
MMSmsStorage default_mem2 = MM_SMS_STORAGE_UNKNOWN;
MMSmsStorage default_mem3 = MM_SMS_STORAGE_UNKNOWN;
GError *error = NULL; GError *error = NULL;
mm_dbg ("Setting default preferred storages..."); mm_dbg ("Setting default storage...");
g_object_get (ctx->self, g_object_get (ctx->self,
MM_IFACE_MODEM_MESSAGING_SMS_MEM1_STORAGE, &default_mem1, MM_IFACE_MODEM_MESSAGING_SMS_DEFAULT_STORAGE, &default_storage,
MM_IFACE_MODEM_MESSAGING_SMS_MEM2_STORAGE, &default_mem2,
MM_IFACE_MODEM_MESSAGING_SMS_MEM3_STORAGE, &default_mem3,
NULL); NULL);
g_assert (default_mem1 != MM_SMS_STORAGE_UNKNOWN); g_assert (default_storage != MM_SMS_STORAGE_UNKNOWN);
g_assert (default_mem2 != MM_SMS_STORAGE_UNKNOWN);
g_assert (default_mem3 != MM_SMS_STORAGE_UNKNOWN);
/* Check if the requested storages are really supported */ /* Check if the requested storages are really supported */
storage_ctx = get_storage_context (ctx->self); storage_ctx = get_storage_context (ctx->self);
if (!is_storage_supported (storage_ctx->supported_mem1, default_mem1, "reading/listing/deleting", &error) || if (!is_storage_supported (storage_ctx->supported_mem2, default_storage, "storing", &error) ||
!is_storage_supported (storage_ctx->supported_mem2, default_mem2, "storing", &error) || !is_storage_supported (storage_ctx->supported_mem3, default_storage, "receiving", &error)) {
!is_storage_supported (storage_ctx->supported_mem3, default_mem3, "receiving", &error)) {
g_simple_async_result_take_error (ctx->result, error); g_simple_async_result_take_error (ctx->result, error);
enabling_context_complete_and_free (ctx); enabling_context_complete_and_free (ctx);
return; return;
} }
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->set_preferred_storages ( mm_gdbus_modem_messaging_set_default_storage (ctx->skeleton, default_storage);
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->set_default_storage (
ctx->self, ctx->self,
default_mem1, default_mem2, default_mem3, default_storage,
(GAsyncReadyCallback)set_preferred_storages_ready, (GAsyncReadyCallback)set_default_storage_ready,
ctx); ctx);
return; return;
} }
@@ -1231,6 +1226,7 @@ mm_iface_modem_messaging_initialize (MMIfaceModemMessaging *self,
NULL); NULL);
if (!skeleton) { if (!skeleton) {
skeleton = mm_gdbus_modem_messaging_skeleton_new (); skeleton = mm_gdbus_modem_messaging_skeleton_new ();
mm_gdbus_modem_messaging_set_supported_storages (skeleton, NULL);
g_object_set (self, g_object_set (self,
MM_IFACE_MODEM_MESSAGING_DBUS_SKELETON, skeleton, MM_IFACE_MODEM_MESSAGING_DBUS_SKELETON, skeleton,
@@ -1294,27 +1290,9 @@ iface_modem_messaging_init (gpointer g_iface)
g_object_interface_install_property g_object_interface_install_property
(g_iface, (g_iface,
g_param_spec_enum (MM_IFACE_MODEM_MESSAGING_SMS_MEM1_STORAGE, g_param_spec_enum (MM_IFACE_MODEM_MESSAGING_SMS_DEFAULT_STORAGE,
"SMS mem1 storage", "SMS default storage",
"Default storage to be used when listing/reading/deleting SMS messages", "Default storage to be used when storing/receiving SMS messages",
MM_TYPE_SMS_STORAGE,
MM_SMS_STORAGE_ME,
G_PARAM_READWRITE));
g_object_interface_install_property
(g_iface,
g_param_spec_enum (MM_IFACE_MODEM_MESSAGING_SMS_MEM2_STORAGE,
"SMS mem2 storage",
"Default storage to be used when writing/sending SMS messages",
MM_TYPE_SMS_STORAGE,
MM_SMS_STORAGE_ME,
G_PARAM_READWRITE));
g_object_interface_install_property
(g_iface,
g_param_spec_enum (MM_IFACE_MODEM_MESSAGING_SMS_MEM3_STORAGE,
"SMS mem3 storage",
"Default storage to be used when receiving SMS messages",
MM_TYPE_SMS_STORAGE, MM_TYPE_SMS_STORAGE,
MM_SMS_STORAGE_ME, MM_SMS_STORAGE_ME,
G_PARAM_READWRITE)); G_PARAM_READWRITE));

View File

@@ -31,9 +31,7 @@
#define MM_IFACE_MODEM_MESSAGING_DBUS_SKELETON "iface-modem-messaging-dbus-skeleton" #define MM_IFACE_MODEM_MESSAGING_DBUS_SKELETON "iface-modem-messaging-dbus-skeleton"
#define MM_IFACE_MODEM_MESSAGING_SMS_LIST "iface-modem-messaging-sms-list" #define MM_IFACE_MODEM_MESSAGING_SMS_LIST "iface-modem-messaging-sms-list"
#define MM_IFACE_MODEM_MESSAGING_SMS_PDU_MODE "iface-modem-messaging-sms-pdu-mode" #define MM_IFACE_MODEM_MESSAGING_SMS_PDU_MODE "iface-modem-messaging-sms-pdu-mode"
#define MM_IFACE_MODEM_MESSAGING_SMS_MEM1_STORAGE "iface-modem-messaging-sms-mem1-storage" #define MM_IFACE_MODEM_MESSAGING_SMS_DEFAULT_STORAGE "iface-modem-messaging-sms-default-storage"
#define MM_IFACE_MODEM_MESSAGING_SMS_MEM2_STORAGE "iface-modem-messaging-sms-mem2-storage"
#define MM_IFACE_MODEM_MESSAGING_SMS_MEM3_STORAGE "iface-modem-messaging-sms-mem3-storage"
typedef struct _MMIfaceModemMessaging MMIfaceModemMessaging; typedef struct _MMIfaceModemMessaging MMIfaceModemMessaging;
@@ -63,14 +61,12 @@ struct _MMIfaceModemMessaging {
GArray **mem3, GArray **mem3,
GError **error); GError **error);
/* Set preferred storages (async) */ /* Set default storage (async) */
void (* set_preferred_storages) (MMIfaceModemMessaging *self, void (* set_default_storage) (MMIfaceModemMessaging *self,
MMSmsStorage mem1, MMSmsStorage storage,
MMSmsStorage mem2,
MMSmsStorage mem3,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
gboolean (*set_preferred_storages_finish) (MMIfaceModemMessaging *self, gboolean (*set_default_storage_finish) (MMIfaceModemMessaging *self,
GAsyncResult *res, GAsyncResult *res,
GError **error); GError **error);

View File

@@ -187,7 +187,7 @@ handle_store (MMSms *self,
if (ctx->storage == MM_SMS_STORAGE_UNKNOWN) { if (ctx->storage == MM_SMS_STORAGE_UNKNOWN) {
/* We'll set now the proper storage, taken from the default mem2 one */ /* We'll set now the proper storage, taken from the default mem2 one */
g_object_get (self->priv->modem, g_object_get (self->priv->modem,
MM_IFACE_MODEM_MESSAGING_SMS_MEM2_STORAGE, &ctx->storage, MM_IFACE_MODEM_MESSAGING_SMS_DEFAULT_STORAGE, &ctx->storage,
NULL); NULL);
g_assert (ctx->storage != MM_SMS_STORAGE_UNKNOWN); g_assert (ctx->storage != MM_SMS_STORAGE_UNKNOWN);
} }