aboutsummaryrefslogtreecommitdiff
path: root/src/mm-broadband-modem-mbim.c
diff options
context:
space:
mode:
authorDan Williams <dan@ioncontrol.co>2025-04-19 10:30:58 -0500
committerDan Williams <dan@ioncontrol.co>2025-05-08 20:24:37 -0500
commitb81f23e24aad7d4fb37e837bbdcab4f43bccfc71 (patch)
tree2750873e396cc0176926f4deca31bc6fa835044a /src/mm-broadband-modem-mbim.c
parent9830e3955a3e45ff82c1c76bcba3b53432eaa51e (diff)
base-sms,sms-list,iface-messaging: move MMBaseSms creation to MMBroadbandModem class
This commit moves creation of the MMBaseSms objects out of MMSmsList and up into MMIfaceModemMessaging (which is already a MMBroadbandModem) and the MMBroadbandModem subclasses themselves. This flattens the creation of MMBaseSms objects by passing them down from the object that creates the SMS parts, rather than having a convoluted callback scheme relying on MMSmsList and MMBaseSms having direct knowledge of their owning modem. The goal is to eventually remove usage of MMBaseModem from MMBaseSms and MMSmsList so that we can test them more easily. Signed-off-by: Dan Williams <dan@ioncontrol.co>
Diffstat (limited to 'src/mm-broadband-modem-mbim.c')
-rw-r--r--src/mm-broadband-modem-mbim.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c
index 79de6291..91a18cb2 100644
--- a/src/mm-broadband-modem-mbim.c
+++ b/src/mm-broadband-modem-mbim.c
@@ -9035,24 +9035,33 @@ add_sms_part (MMBroadbandModemMbim *self,
self,
FALSE,
&error);
- if (part) {
- mm_obj_dbg (self, "correctly parsed PDU (%d)", pdu->message_index);
- if (expected_index != SMS_PART_INVALID_INDEX && (expected_index != mm_sms_part_get_index (part))) {
- /* Some Fibocom L850 modems report an invalid part index (always 1) in the response
- * message. Because we know which message part was requested, we can use that value
- * instead to workaround this bug. */
- mm_obj_dbg (self, "Expected SMS part index '%u' but device reports index '%u': using the expected one",
- expected_index, mm_sms_part_get_index (part));
- mm_sms_part_set_index (part, expected_index);
- }
- mm_iface_modem_messaging_take_part (MM_IFACE_MODEM_MESSAGING (self),
- part,
- mm_sms_state_from_mbim_message_status (pdu->message_status),
- MM_SMS_STORAGE_MT);
- } else {
+ if (!part) {
/* Don't treat the error as critical */
mm_obj_dbg (self, "error parsing PDU (%d): %s",
pdu->message_index, error->message);
+ return;
+ }
+
+ mm_obj_dbg (self, "correctly parsed PDU (%d)", pdu->message_index);
+ if (expected_index != SMS_PART_INVALID_INDEX && (expected_index != mm_sms_part_get_index (part))) {
+ /* Some Fibocom L850 modems report an invalid part index (always 1) in the response
+ * message. Because we know which message part was requested, we can use that value
+ * instead to workaround this bug. */
+ mm_obj_dbg (self, "Expected SMS part index '%u' but device reports index '%u': using the expected one",
+ expected_index, mm_sms_part_get_index (part));
+ mm_sms_part_set_index (part, expected_index);
+ }
+
+ if (!mm_iface_modem_messaging_take_part (MM_IFACE_MODEM_MESSAGING (self),
+ mm_broadband_modem_create_sms (MM_BROADBAND_MODEM (self)),
+ part,
+ mm_sms_state_from_mbim_message_status (pdu->message_status),
+ MM_SMS_STORAGE_MT,
+ &error)) {
+ /* Don't treat the error as critical */
+ mm_obj_dbg (self, "error adding SMS (%d): %s",
+ pdu->message_index, error->message);
+ return;
}
}
@@ -9231,7 +9240,7 @@ enable_unsolicited_events_messaging (MMIfaceModemMessaging *_self,
/* Create SMS (Messaging interface) */
static MMBaseSms *
-messaging_create_sms (MMIfaceModemMessaging *self)
+messaging_create_sms (MMBroadbandModem *self)
{
return mm_sms_mbim_new (MM_BASE_MODEM (self),
mm_iface_modem_is_3gpp (MM_IFACE_MODEM (self)));
@@ -10717,7 +10726,6 @@ iface_modem_messaging_init (MMIfaceModemMessagingInterface *iface)
iface->enable_unsolicited_events_finish = common_enable_disable_unsolicited_events_messaging_finish;
iface->disable_unsolicited_events = disable_unsolicited_events_messaging;
iface->disable_unsolicited_events_finish = common_enable_disable_unsolicited_events_messaging_finish;
- iface->create_sms = messaging_create_sms;
}
static void
@@ -10787,6 +10795,7 @@ mm_broadband_modem_mbim_class_init (MMBroadbandModemMbimClass *klass)
/* Do not initialize the MBIM modem through AT commands */
broadband_modem_class->enabling_modem_init = NULL;
broadband_modem_class->enabling_modem_init_finish = NULL;
+ broadband_modem_class->create_sms = messaging_create_sms;
#if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED
g_object_class_install_property (object_class, PROP_QMI_UNSUPPORTED,