summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2013-10-24 09:19:43 +0200
committerAleksander Morgado <aleksander@lanedo.com>2013-10-25 19:49:56 +0200
commit57882f6dad82e605fbe39fe292145939811fe64d (patch)
treed990746f91b8e443e27e7b56504c6a38d64daff5
parent43694e26772ba9c9716e95e1c3607980e4ab5c12 (diff)
downloadModemManager-57882f6dad82e605fbe39fe292145939811fe64d.tar.gz
sms: decide whether to create a 3GPP2 or 3GPP SMS based on caps
Don't rely on receiving a Teleservice ID. If none received, and the modem is CDMA-only, default to WMT.
-rw-r--r--src/mm-sms.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/mm-sms.c b/src/mm-sms.c
index db939aa06..672d5bc9e 100644
--- a/src/mm-sms.c
+++ b/src/mm-sms.c
@@ -270,7 +270,14 @@ generate_cdma_submit_pdus (MMSms *self,
g_assert_not_reached ();
mm_sms_part_set_encoding (part, data ? MM_SMS_ENCODING_8BIT : MM_SMS_ENCODING_UNKNOWN);
mm_sms_part_set_number (part, mm_gdbus_sms_get_number (MM_GDBUS_SMS (self)));
- mm_sms_part_set_cdma_teleservice_id (part, mm_gdbus_sms_get_teleservice_id (MM_GDBUS_SMS (self)));
+
+ /* If creating a CDMA SMS part but we don't have a Teleservice ID, we default to WMT */
+ if (mm_gdbus_sms_get_teleservice_id (MM_GDBUS_SMS (self)) == MM_SMS_CDMA_TELESERVICE_ID_UNKNOWN) {
+ mm_dbg ("Defaulting to WMT teleservice ID when creating SMS part");
+ mm_sms_part_set_cdma_teleservice_id (part, MM_SMS_CDMA_TELESERVICE_ID_WMT);
+ } else
+ mm_sms_part_set_cdma_teleservice_id (part, mm_gdbus_sms_get_teleservice_id (MM_GDBUS_SMS (self)));
+
mm_sms_part_set_cdma_service_category (part, mm_gdbus_sms_get_service_category (MM_GDBUS_SMS (self)));
mm_dbg ("Created SMS part for CDMA SMS");
@@ -288,12 +295,25 @@ static gboolean
generate_submit_pdus (MMSms *self,
GError **error)
{
- /* First; decide which kind of PDU we'll generate. If Teleservice ID given,
- * this will be a 3GPP2 SMS */
- if (mm_gdbus_sms_get_teleservice_id (MM_GDBUS_SMS (self)) != MM_SMS_CDMA_TELESERVICE_ID_UNKNOWN)
- return generate_cdma_submit_pdus (self, error);
- else
+ MMBaseModem *modem;
+ gboolean is_3gpp;
+
+ /* First; decide which kind of PDU we'll generate, based on the current modem caps */
+
+ g_object_get (self,
+ MM_SMS_MODEM, &modem,
+ NULL);
+ g_assert (modem != NULL);
+
+ is_3gpp = mm_iface_modem_is_3gpp (MM_IFACE_MODEM (modem));
+ g_object_unref (modem);
+
+ /* On a 3GPP-capable modem, create always a 3GPP SMS (even if the modem is 3GPP+3GPP2) */
+ if (is_3gpp)
return generate_3gpp_submit_pdus (self, error);
+
+ /* Otherwise, create a 3GPP2 SMS */
+ return generate_cdma_submit_pdus (self, error);
}
/*****************************************************************************/