aboutsummaryrefslogtreecommitdiff
path: root/src/mm-base-sms.c
AgeCommit message (Collapse)Author
2025-05-08base-sms: remove MODEM propertyDan Williams
No longer depend on MMBaseModem since everything that specifically uses it is now removed. Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08base-sms,sms-list: use signals to set multipart referenceDan Williams
Instead of going through the messaging interface, which just asks the MMSmsList anyway, just go straight to the list. Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08base-sms: reduce possibility of leaking multipart referenceDan Williams
Move error paths after getting a multipart reference to before getting one, to reduce the possiblity that we get a reference from the MMSmsList that ultimately doesn't end up getting used. Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08base-sms: pass supported storages in at creation timeDan Williams
They won't change, and this lets us get rid of one more usage of MMIfaceModemMessaging. Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08base-sms: pass SMS default storage at creation time and update as neededDan Williams
Instead of getting it from the MMIfaceModemMessaging when the SMS is stored. This flattens dependencies between MMBaseSms and MMIfaceModemMessaging. Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08base-sms,sms-list,iface-messaging: move MMBaseSms creation to ↵Dan Williams
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>
2025-05-08base-sms,sms-at: split AT-specific SMS code into MMSmsAtDan Williams
Simplify MMBaseSms (making it easier to use from testcases) by splitting the AT-specific code into MMSmsAt rather than keeping it in the base class. Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08base-sms,iface-modem-messaging: move lock/unlock logic into the interfaceDan Williams
Allows us to test things that rely on MMBaseSms more easily.. Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08base-sms: determine 3GPP vs. CDMA at creation timeDan Williams
It won't ever change over the lifetime of the BaseSMS. Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08Move log parent and connection property binding to helperDan Williams
Continues removing usage of MMBaseModem in a bunch of files by splitting out bits of its usage to separate interfaces. Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08auth-provider: move auth provider logic into each classDan Williams
Rather than make all of them rely on MMBaseModem for it. This lets us disentangle dependencies for easier unit testing. For interfaces, rather than casting directly to MMBaseModem use intermediate interfaces (MMIfaceAuth and MMIfaceOpLock) that tests can fake out. Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-03-11treewide: Fix typosGuido Günther
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2024-09-09mm-base-sms: cmp by reference & numberKyle Evans
Messages from different senders can have the same reference. Stale messages from the same sender can also conflict. Consider the number of the sender and also the max parts when assigning parts to a base sms. Ref 3gpp specification section 9.2.3.24.1 Fixes #757 Signed-off-by: Kyle Evans <kvans32@gmail.com>
2024-04-23base-modem: support non-serial ports when peeking the best AT portAleksander Morgado
When we don't care about the type of AT port to use, prefer the QMI or MBIM based ones if any available.
2024-04-23base-modem-at: switch to use the MMIfacePortAt by defaultAleksander Morgado
The whole codebase is updated to assume the MMBaseModem AT operations require an object implementing the MMIfacePortAt interface, instead of a MMPortSerialAt object. In the places where we know the port is a MMPortSerialAt, e.g. when we query explicitly for the primary or secondary serial AT port, we will use an explicit MM_IFACE_PORT_AT() cast when calling the AT command method. In the places where we get_best_at_port() we're going to assume that we don't know the port type. This method will be updated in a follow up commit to support the MMIfacePortAt interface as well.
2024-04-10base-sms: ensure send/store always uses the same portAleksander Morgado
When sending or storing an SMS, the per-part operation is itself split into two steps: first we send the AT command specifying the index, and then we send the actual PDU data with a raw command. We must ensure that the raw command is sent exactly in the same port as the AT command.
2024-04-10base-sms: refactor send/store/delete implementationsAleksander Morgado
No functional change.
2023-10-27core: ensure all errors returned in DBus operations are normalizedAleksander Morgado
We want to ensure that all errors reported via DBus operations are normalized to MM-specific errors. We don't want to return QMI or MBIM specific errors, as those are protocol specific and we don't want DBus clients to need to rely on knowing which is the protocol in use by the device.
2022-11-30base-sms: improve logging of user operationsAleksander Morgado
2022-11-30base-sms: refactor memory management in handlersAleksander Morgado
Use g_auto* helpers where needed, and switch to use the slice allocator for the handler operation contexts.
2022-09-13charsets: move mm_sms_part_3gpp_util_split_text to mm_charset_util_split_textAndrey Skvortsov
2022-07-24base-sms: don't clear parts on send/store errorAleksander Morgado
The part generation logic is independent to whether the SMS send or store operation failed, so just avoid doing the parts cleanup. E.g. if we created the parts for store() but storing failed, the same parts could still be used for send() successfully.
2022-07-24base-sms: fix segfault when storing already sent messagesAleksander Morgado
The internal list of parts in the base SMS object is created either when the message is sent or when the message is stored. The daemon should not expect the list of SMS parts to be empty upon a store() operation requested via DBus, as the list of parts may have already been created during send(). Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/598
2021-03-04sms: common timeout of 180s for the send operationAleksander Morgado
On low signal quality conditions, the process of sending the SMS to the network may take a really long time, way more than the 30s used as default in some implementations. We now define a common timeout value of 180s for this operation in all protocols. Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/328
2020-04-08sms-part-3gpp: port to use object loggingAleksander Morgado
2020-04-08base-sms: port to use object loggingAleksander Morgado
2020-04-08base-sms: set dbus id as soon as object is createdAleksander Morgado
2020-01-30base-sms: fix warnings with -WshadowAleksander Morgado
mm-base-sms.c: In function ‘mm_base_sms_new_from_properties’: mm-base-sms.c:1831:51: error: declaration of ‘properties’ shadows a global declaration [-Werror=shadow] 1831 | MMSmsProperties *properties, | ~~~~~~~~~~~~~~~~~^~~~~~~~~~ mm-base-sms.c:53:20: note: shadowed declaration is here 53 | static GParamSpec *properties[PROP_LAST]; | ^~~~~~~~~~
2020-01-30base-sms: fix warnings with -WshadowAleksander Morgado
mm-base-sms.c: In function ‘generate_3gpp_submit_pdus’: mm-base-sms.c:153:19: error: declaration of ‘i’ shadows a previous local [-Werror=shadow] 153 | guint i = 0; | ^ mm-base-sms.c:102:11: note: shadowed declaration is here 102 | guint i; | ^
2019-07-19sms: initialize common fields early for multipart messagesAleksander Morgado
Do not wait until all parts are received in order to initialize all fields that are common to all parts in the SMS message, do it as soon as the first part is received. https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/137
2019-07-09base-sms: wait up to 60s when sending SMS messagesAleksander Morgado
The operation sending the raw data of the SMS may timeout because the current value of 10s is too low. When this happens, we may end up marking the modem as invalid if the operation takes much longer, as in https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/133 <debug> [1561707204.192676] (ttyUSB3): --> 'AT+CMGS=22<CR>' <debug> [1561707204.207212] (ttyUSB3): <-- '<CR><LF>> ' <debug> [1561707204.207562] (ttyUSB3) device open count is 3 (open) <debug> [1561707204.207695] (ttyUSB3) device open count is 2 (close) <debug> [1561707204.207841] (ttyUSB3): --> '0021000B9164xxxxxxxxFx00000AEDF6989D06D1CB733A\26' <debug> [1561707204.261028] (ttyUSB3): <-- '<CR><LF>' <debug> [1561707205.197464] (ttyUSB3) device open count is 3 (open) <debug> [1561707207.197763] loading signal quality... <debug> [1561707207.197990] (ttyUSB3) device open count is 4 (open) <debug> [1561707210.199337] (ttyUSB3) device open count is 5 (open) <debug> [1561707214.197198] (ttyUSB3) device open count is 4 (close) <debug> [1561707214.197443] (ttyUSB3): --> 'AT+CGACT?<CR>' <debug> [1561707215.196530] (ttyUSB3) device open count is 5 (open) <warn> [1561707217.196750] checking if connected failed: Couldn't check current list of active PDP contexts: Serial command timed out <debug> [1561707217.196928] (ttyUSB3) device open count is 4 (close) <warn> [1561707217.197065] (tty/ttyUSB3) at port timed out 2 consecutive times <debug> [1561707217.197187] (ttyUSB3): --> 'AT+CIND?<CR>' <debug> [1561707220.198180] (ttyUSB3) device open count is 5 (open) <debug> [1561707222.196792] (ttyUSB3) device open count is 6 (open) <debug> [1561707222.196983] (ttyUSB3) device open count is 5 (close) <warn> [1561707222.197125] (tty/ttyUSB3) at port timed out 3 consecutive times <debug> [1561707222.197257] (ttyUSB3): --> 'AT+CGACT?<CR>' <debug> [1561707225.198384] (ttyUSB3) device open count is 6 (open) <warn> [1561707225.198616] checking if connected failed: Couldn't check current list of active PDP contexts: Serial command timed out <debug> [1561707225.198703] (ttyUSB3) device open count is 5 (close) <warn> [1561707225.198814] (tty/ttyUSB3) at port timed out 4 consecutive times <debug> [1561707225.199437] (ttyUSB3): --> 'AT+CGACT?<CR>' <warn> [1561707228.196747] checking if connected failed: Couldn't check current list of active PDP contexts: Serial command timed out <debug> [1561707228.196915] (ttyUSB3) device open count is 4 (close) <warn> [1561707228.197050] (tty/ttyUSB3) at port timed out 5 consecutive times <debug> [1561707228.197175] (ttyUSB3): --> 'AT+CGACT?<CR>' <debug> [1561707230.197709] (ttyUSB3) device open count is 5 (open) <warn> [1561707231.197089] checking if connected failed: Couldn't check current list of active PDP contexts: Serial command timed out <debug> [1561707231.197256] (ttyUSB3) device open count is 4 (close) <warn> [1561707231.197387] (tty/ttyUSB3) at port timed out 6 consecutive times <debug> [1561707231.197519] (ttyUSB3): --> 'AT+CSQ<CR>' <debug> [1561707234.199671] Couldn't refresh signal quality: 'Serial command timed out' <debug> [1561707234.199897] (ttyUSB3) device open count is 5 (open) <debug> [1561707234.200038] (ttyUSB3) device open count is 4 (close) <warn> [1561707234.200161] (tty/ttyUSB3) at port timed out 7 consecutive times <debug> [1561707234.200291] (ttyUSB3): --> 'AT+CGACT?<CR>' <debug> [1561707235.197071] (ttyUSB3) device open count is 5 (open) <debug> [1561707237.198460] Signal quality value not updated in 60s, marking as not being recent <warn> [1561707237.198846] checking if connected failed: Couldn't check current list of active PDP contexts: Serial command timed out <debug> [1561707237.198949] (ttyUSB3) device open count is 4 (close) <warn> [1561707237.199060] (tty/ttyUSB3) at port timed out 8 consecutive times <debug> [1561707237.199636] (ttyUSB3): --> 'AT+CGACT?<CR>' <debug> [1561707240.198778] (ttyUSB3) device open count is 5 (open) <warn> [1561707240.199031] checking if connected failed: Couldn't check current list of active PDP contexts: Serial command timed out <debug> [1561707240.199127] (ttyUSB3) device open count is 4 (close) <warn> [1561707240.199244] (tty/ttyUSB3) at port timed out 9 consecutive times <debug> [1561707240.199363] (ttyUSB3): --> 'AT+CNSMOD?<CR>' <debug> [1561707243.198163] Couldn't refresh access technologies: 'Serial command timed out' <debug> [1561707243.198294] Periodic signal quality checks scheduled in 30s <debug> [1561707243.198402] (ttyUSB3) device open count is 3 (close) <error> [1561707243.198528] (tty/ttyUSB3) at port timed out 10 consecutive times, marking modem '/org/freedesktop/ModemManager1/Modem/0' as invalid <debug> [1561707243.198699] (ttyUSB3): --> 'AT+CGACT?<CR>' Or we may end up aborting other actions that the modem is doing... <debug> [1560473069.956036] (ttyACM2): --> 'AT+CMGS=70<CR>' <debug> [1560473069.963667] Added CALL at '/org/freedesktop/ModemManager1/Call/1' <debug> [1560473069.977937] (ttyACM2): <-- '<CR><LF>> ' <debug> [1560473069.978558] (ttyACM2) device open count is 3 (open) <debug> [1560473069.978812] (ttyACM2) device open count is 2 (close) <debug> [1560473069.979152] (ttyACM2): --> '0001000D8......................\26' <debug> [1560473080.317049] (ttyACM2): --> 'ATD123456789;<CR>' <debug> [1560473092.293458] (ttyACM2): <-- '<CR><LF>+CMGS: 1<CR><LF><CR><LF>OK<CR><LF>' <warn> [1560473092.293854] Couldn't start call : 'Couldn't start the call: Unhandled response '+CMGS: 1'' <info> [1560473092.293936] Call state changed: dialing -> terminated (unknown) <debug> [1560473092.293987] Cleaning up in-call unsolicited events... So, update the raw data sending timeout to a much longer value.
2019-06-03port-serial-at: raw commands always run nextAleksander Morgado
We use the raw commands exclusively when we're sending SMS data to the device. Until this change, all raw commands were added at the tail of the queue of pending commands, and that meant that if any unrelated AT command was interleaved between e.g. our AT+CGMS and the actual SMS data sent, the operation would have failed. With this fix, we're making sure that all raw commands are added at the head of the queue, so we're making sure that the next command picked after e.g. CGMS is actually the raw SMS data to be sent. We would be avoiding issues like this one, where an outgoing voice call attempt gets in the way before we send the SMS data: [1556246081.786284] (ttyACM2): --> 'AT+CMGS=70<CR>' [1556246081.814861] (ttyACM2): <-- '<CR><LF>> ' [1556246081.819382] (ttyACM2): --> 'ATD1234567890;<CR>' [1556246081.839685] (ttyACM2): <-- '<CR><LF>> ' [1556246081.840123] Couldn't start call : 'Couldn't start the call: Unhandled response '> '' [1556246081.856254] (ttyACM2): --> '0001000D810.............. [1556246081.922470] (ttyACM2): <-- '<CR><LF>+CME ERROR: 4<CR><LF>'
2018-10-18core: use g_clear_pointer() to avoid explicitly checking and resetting pointersBen Chan
2018-10-18core: remove unnecessary NULL checks for g_free()Ben Chan
g_free() already check if the given pointer is NULL and does nothing on a NULL pointer.
2018-04-24all: drop unused variablesLubomir Rintel
Keeps build with GCC 8 happy. mm-base-call.c:758:18: warning: variable 'response' set but not used [-Wunused-but-set-variable] mm-base-call.c:822:18: warning: variable 'response' set but not used [-Wunused-but-set-variable] mm-base-sms.c:908:18: warning: variable 'response' set but not used [-Wunused-but-set-variable] mm-sms-list.c:331:25: warning: variable 'ctx' set but not used [-Wunused-but-set-variable] mm-iface-modem-messaging.c:1210:21: warning: variable 'storage_ctx' set but not used [-Wunused-but-set-variable] huawei/mm-plugin-huawei.c:183:18: warning: variable 'response' set but not used [-Wunused-but-set-variable] ublox/mm-plugin-ublox.c:161:24: warning: variable 'response' set but not used [-Wunused-but-set-variable] ublox/mm-plugin-ublox.c:159:24: warning: variable 'ctx' set but not used [-Wunused-but-set-variable] icera/mm-modem-helpers-icera.c:218:25: warning: variable 'first_free' set but not used [-Wunused-but-set-variable] novatel/mm-common-novatel.c:50:18: warning: variable 'response' set but not used [-Wunused-but-set-variable]
2017-07-03base-sms: port mm_base_sms_delete to use GTaskBen Chan
2017-07-03base-sms: port sms_delete to use GTaskBen Chan
2017-07-03base-sms: port sms_send to use GTaskBen Chan
2017-07-03base-sms: port sms_store to use GTaskBen Chan
2014-07-06sms: rename 'MMSms' to 'MMBaseSms'Aleksander Morgado
Just so that we don't have same header names in src/ and /libmm-glib.