Commit Graph
67 Commits
Author SHA1 Message Date
Aleksander Morgado c250fa3797 libmm-glib: remove the `libmm-common.h' header
Both the ModemManager daemon and the mmcli will now include `libmm-glib.h' only.

We also handle two new special `_LIBMM_INSIDE_MM' and `LIBMM_INSIDE_MMCLI'
symbols, which if included before the `libmm-glib.h' library allow us to:

 * Don't include the libmm-glib high level API in the ModemManager daemon, as
   the object names would clash with those in the core.

 * Define some of the methods of helper objects to be included only if compiling
   ModemManager daemon or the mmcli.
2012-10-04 10:17:12 +02:00
Aleksander Morgado 6284737249 sms: don't allow more than 255 parts 2012-09-14 13:12:02 +02:00
Aleksander Morgado d5e57dd8eb sms: fix error message string when failing to parse input text 2012-09-14 13:11:33 +02:00
Aleksander Morgado 2c1ce492ce sms: don't try the generic SMS method if we got a timeout error 2012-09-14 07:05:26 +02:00
Aleksander Morgado e212f6b6ed sms: create SMS parts only when storing or sending
When a user creates an SMS object, we will expose all its properties in DBus
properly, but we will not create the internal list of SMS parts.

The list of SMS parts will be created when the SMS is stored or sent, whatever
comes first. When the message is sent and it was previously stored, the list of
parts is not re-created.

If the message requires multiple parts, the multipart reference is computed as
follows:
 * If the SMS was not stored and is being sent, we just use a random number.
 * If the SMS is being stored, we will use a multipart reference which is not
   being used already in another SMS to the same destination.
2012-09-14 07:05:26 +02:00
Aleksander Morgado 4196ef1a86 sms: don't try to delete parts if SMS not stored 2012-09-14 07:05:26 +02:00
Aleksander Morgado 8612667776 sms,sms-qmi: update timeout when sending an SMS to 30s 2012-09-14 07:05:26 +02:00
Aleksander Morgado a66f971a7c libmm-common: added common utils from core
Moved the utils to play with binary to hex strings into libmm-common.
2012-09-14 07:05:26 +02:00
Aleksander Morgado fbe01c8d6a sms: 'Text' and 'Data' will never be given at the same time
When receiving an SMS, if the encoding is either GSM7 or UCS2, we will treat the
contents of the SMS as text; and if the encoding is either 8BIT or unknown, we
will just dump the contents of the SMS as data.

When creating an SMS, the user is not allowed to give both text and data, only
one can be given. We will use by default 8BIT when data is given, and guess the
best encoding if text is given.

Note that it's still possible to have SMS with neither text nor data, as in
delivery status reports.

This commit also handles the split of the input data in order to make it fit
into singlepart or multipart messages.
2012-09-14 07:05:26 +02:00
Aleksander Morgado 15be01d4fa sms: fix error return when a mandatory parameter missing in dictionary 2012-09-14 07:05:26 +02:00
Aleksander Morgado 1111bfa806 api: new `DeliveryState' property in the SMS interface
Given only for STATUS REPORT SMS messages.
2012-09-14 07:05:25 +02:00
Aleksander Morgado bdf0f9484b sms: allow parts with neither text nor data only in Status Report PDUs 2012-09-14 07:05:25 +02:00
Aleksander Morgado 83ab63138c sms: fix double free when parsing PDUs
If we get an error when telling the SMS list to take the new PDU, the caller is
the one responsible for freeing the part, so avoid doing it twice.

Relevant valgrind log:
==7287== Invalid read of size 8
==7287==    at 0x437CE1: mm_sms_part_free (mm-sms-part.c:344)
==7287==    by 0x454D11: mm_iface_modem_messaging_take_part (mm-iface-modem-messaging.c:359)
==7287==    by 0x461234: cds_received (mm-broadband-modem.c:4626)
==7287==    by 0x48A305: parse_unsolicited (mm-at-serial-port.c:256)
==7287==    by 0x48723D: parse_response (mm-serial-port.c:731)
==7287==    by 0x48759B: data_available (mm-serial-port.c:801)
==7287==    by 0x36ADC47694: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3200.4)
==7287==    by 0x36ADC479C7: ??? (in /usr/lib64/libglib-2.0.so.0.3200.4)
==7287==    by 0x36ADC47DC1: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3200.4)
==7287==    by 0x421398: main (main.c:150)
==7287==  Address 0x9840b78 is 24 bytes inside a block of size 104 free'd
==7287==    at 0x4A079AE: free (vg_replace_malloc.c:427)
==7287==    by 0x36ADC4D37E: g_free (in /usr/lib64/libglib-2.0.so.0.3200.4)
==7287==    by 0x36ADC61CCE: g_slice_free1 (in /usr/lib64/libglib-2.0.so.0.3200.4)
==7287==    by 0x437D5A: mm_sms_part_free (mm-sms-part.c:351)
==7287==    by 0x36ADC449EC: g_list_foreach (in /usr/lib64/libglib-2.0.so.0.3200.4)
==7287==    by 0x36ADC44A0A: g_list_free_full (in /usr/lib64/libglib-2.0.so.0.3200.4)
==7287==    by 0x43D8A1: finalize (mm-sms.c:1629)
==7287==    by 0x36AE8145DA: g_object_unref (in /usr/lib64/libgobject-2.0.so.0.3200.4)
==7287==    by 0x43CD52: mm_sms_singlepart_new (mm-sms.c:1376)
==7287==    by 0x43E223: take_singlepart (mm-sms-list.c:236)
==7287==    by 0x43E60D: mm_sms_list_take_part (mm-sms-list.c:338)
==7287==    by 0x454CC7: mm_iface_modem_messaging_take_part (mm-iface-modem-messaging.c:353)
2012-09-14 07:05:25 +02:00
Aleksander Morgado 4f1991e2ba api: new `MessageReference' property in the SMS interface
Message reference allows to match a sent SMS with its corresponding delivery
report, if requested.
2012-09-14 07:05:25 +02:00
Aleksander Morgado 320984a4a0 api: new `DischargeTimestamp' property for Status Report SMS messages 2012-09-14 07:05:25 +02:00
Aleksander Morgado 7faa48ea94 api: new `PduType' property in the SMS interface
It will help deciding the type of message.
2012-09-14 07:05:24 +02:00
Aleksander Morgado 1c119be834 api: new `Sms.DeliveryReportRequest' property
Also allowing the 'delivery-report-request' key in the `Messaging.CreateSms()'
method.
2012-09-14 07:05:24 +02:00
Aleksander Morgado 43650043ea sms: select proper storage when sending SMS from storage
We need to select the correct 'mem2' storage before trying to send from storage.
2012-09-14 07:05:23 +02:00
Aleksander Morgado bddcc2fb07 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).
2012-09-14 07:05:23 +02:00
Aleksander Morgado d75bfa2db9 broadband-modem: allow locking/unlocking either 'mem1' or 'mem2' or both
So that e.g. listing all SMS in a given storage ('mem1' lock) doesn't collide
with storing a new SMS ('mem2' lock).
2012-09-14 07:05:23 +02:00
Aleksander Morgado e6f827ed33 sms: select proper storage when deleting SMS 2012-09-14 07:05:23 +02:00
Aleksander Morgado 667026f0c8 api: Sms.Store() now requires the specific memory storage where to store the SMS
... or MM_SMS_STORAGE_UNKNOWN to store it in the default storage.
2012-09-14 07:05:23 +02:00
Aleksander Morgado 3332ec0c68 sms: try to store/send all parts of a SMS message 2012-09-14 07:05:22 +02:00
Aleksander Morgado b2b7fccdf5 sms: allow users to create multipart SMS messages 2012-09-14 07:05:22 +02:00
Aleksander Morgado 0edb58b738 sms: always export incomplete multipart SMS messages 2012-09-14 07:05:22 +02:00
Aleksander Morgado cb0ce9c6ca sms: either 'text' or 'data' is mandatory 2012-09-14 07:05:22 +02:00
Aleksander Morgado ea87a4556e sms: fix full data setting with `g_variant_new_from_data()'
The `g_variant_new_from_data()' method uses the original array during its
operation, so we need to make sure it is valid as long as the method needs
it, or we'll end up with Valgrind complaining a bit:

==4834== Invalid read of size 1
==4834==    at 0x36ADC75DA5: g_variant_get_byte (in /usr/lib64/libglib-2.0.so.0.3200.4)
==4834==    by 0x3161ABED8C: ??? (in /usr/lib64/libgio-2.0.so.0.3200.4)
==4834==    by 0x3161ABEEA2: ??? (in /usr/lib64/libgio-2.0.so.0.3200.4)
==4834==    by 0x3161ABE844: ??? (in /usr/lib64/libgio-2.0.so.0.3200.4)
==4834==    by 0x3161ABE91E: ??? (in /usr/lib64/libgio-2.0.so.0.3200.4)
==4834==    by 0x3161ABEEA2: ??? (in /usr/lib64/libgio-2.0.so.0.3200.4)
==4834==    by 0x3161AC232E: g_dbus_message_to_blob (in /usr/lib64/libgio-2.0.so.0.3200.4)
==4834==    by 0x3161AB750A: ??? (in /usr/lib64/libgio-2.0.so.0.3200.4)
==4834==    by 0x3161AB9FEF: g_dbus_connection_send_message (in /usr/lib64/libgio-2.0.so.0.3200.4)
==4834==    by 0x3161ABDB22: g_dbus_connection_emit_signal (in /usr/lib64/libgio-2.0.so.0.3200.4)
==4834==    by 0x4C5B8BD: _mm_gdbus_sms_emit_changed (mm-gdbus-sms.c:2291)
==4834==    by 0x36ADC47694: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3200.4)
==4834==  Address 0x939efa0 is 0 bytes inside a block of size 512 free'd
==4834==    at 0x4A079AE: free (vg_replace_malloc.c:427)
==4834==    by 0x36ADC4D37E: g_free (in /usr/lib64/libglib-2.0.so.0.3200.4)
==4834==    by 0x36ADC1CF40: ??? (in /usr/lib64/libglib-2.0.so.0.3200.4)
==4834==    by 0x43C88E: assemble_sms (mm-sms.c:1260)
==4834==    by 0x43CAD6: mm_sms_multipart_take_part (mm-sms.c:1329)
==4834==    by 0x43E2EF: take_multipart (mm-sms-list.c:268)
==4834==    by 0x43E546: mm_sms_list_take_part (mm-sms-list.c:328)
==4834==    by 0x454C8F: mm_iface_modem_messaging_take_part (mm-iface-modem-messaging.c:353)
==4834==    by 0x461DF6: sms_pdu_part_list_ready (mm-broadband-modem.c:5007)
==4834==    by 0x3161A6CFB6: g_simple_async_result_complete (in /usr/lib64/libgio-2.0.so.0.3200.4)
==4834==    by 0x432F82: at_command_parse_response (mm-base-modem-at.c:490)
==4834==    by 0x489F96: handle_response (mm-at-serial-port.c:161)
2012-09-11 16:40:21 +02:00
Aleksander Morgado a973825eac sms: multipart sequence starts with 1; singlepart is always 0 2012-09-07 12:20:14 +02:00
Aleksander Morgado 018d9b458f sms: set state back to UNKNOWN when all SMS parts were deleted 2012-09-06 19:58:02 +02:00
Aleksander Morgado c9a80609d4 sms: transition from Unknown|Stored to Sent when the SMS is sent 2012-09-06 19:58:02 +02:00
Aleksander Morgado a5266406ba sms: use property accessors from parent MmGdbusSms when it simplifies things 2012-09-06 19:58:02 +02:00
Aleksander Morgado 8fd02318ec sms: transition from Unknown to Stored in user-created SMS objects 2012-09-06 19:58:02 +02:00
Aleksander Morgado b03985a019 sms: user-created SMS objects will have either 'text' or 'data' 2012-09-06 19:58:02 +02:00
Aleksander Morgado 98f588867c sms: allow getting list of parts 2012-09-06 19:58:02 +02:00
Aleksander Morgado a90d149ce4 sms: SMS objects need to be create by `create_modem()' in the Messaging iface
So that plugins can subclass the generic SMS object.
2012-09-06 19:58:01 +02:00
Aleksander Morgado db457fdb46 sms: fix setting full text in object 2012-09-06 13:14:42 +02:00
Ben Chan 143674ea3e sms: use g_variant_new_from_data instead of g_variant_new_fixed_array
ModemManager configure script currenty requires glib 2.30.2 or later,
bud g_variant_new_fixed_array requires at least glib 2.32. To maintain
the compatibility with glib 2.30, this patch modifies the code to use
g_variant_new_from_data instead of g_variant_new_fixed_array.
2012-09-06 08:44:34 +02:00
Aleksander Morgado a3d32c552c sms: fix handling of 'data' property for multipart messages
This is the port to git master of the following commit:

commit 1c29ce5999d11dee2898e7bf41c00995a00c71d0
Author: Dan Williams <dcbw@redhat.com>
Date:   Mon Aug 27 17:36:49 2012 -0500

    sms: fix handling of 'data' property for multipart messages

    Text was getting concatenated when reconstructing the full message,
    but the data wasn't.  That meant that non-text multipart messages,
    like the binary APN/MMS settings messages that operators often send,
    were broken.
2012-08-31 12:13:45 +02:00
Aleksander Morgado ba4e209745 sms: fix sending SMS messages on some modems
This is the port to git master of the following commit:

commit 65f13f41cfd00cd38f118121a58b83713501f45f
Author: Dan Williams <dcbw@redhat.com>
Date:   Tue Jul 17 16:00:31 2012 -0500

    gsm: fix sending SMS messages on some modems and use PDU by default

    It turns out we really do have to wait for the modem to return the
    ">" prompt before sending the message data, otherwise a number of
    modems will complain about the data and fail the message.  Fix that
    by sending the first bit of the CMGS, waiting for the ">", and then
    sending the rest.

    This also switches all modems over to PDU mode by default if they
    support it, since it's more compatible and most recent modems don't
    even bother to support text mode anyway.
2012-08-24 12:32:29 +02:00
Aleksander Morgado df1f21d17f sms: fix setting multipart specific properties
Don't make them construct-only, so that we can set them whenever needed.
2012-05-06 18:53:03 +02:00
Aleksander Morgado cdd339f802 base-modem: implement new modem-wide cancellable, and rework AT commands
Instead of the `_in_port()' variants, we'll provide more generic
`_full()' methods. These should be used either if we want to send commands
to a specific port, or if we want to use a specific user-provided GCancellable.

In addition to this user-provided GCancellable, we keep the internal modem-wide
one.
2012-03-16 14:53:23 +01:00
Aleksander Morgado 22113859c9 messaging: part index may be repeated in different storages 2012-03-16 14:53:21 +01:00
Aleksander Morgado ef9fb0bfac libmm-common: `MMSmsProperties' won't be considered internal any more
Renamed `MMCommonSmsProperties' to `MMSmsProperties', and removed the
`MMSmsProperties' provided in libmm-glib. We'll just use the original one
from libmm-common always.
2012-03-16 14:53:19 +01:00
Aleksander Morgado 17ef077797 sms: include policy authorization checks 2012-03-16 14:53:16 +01:00
Aleksander Morgado 978801ee7b sms: specify storage where the SMS is kept 2012-03-15 14:15:04 +01:00
Aleksander Morgado 4b6792dd62 sms: implement default sending, either from storage or through the generic cmd 2012-03-15 14:15:03 +01:00
Aleksander Morgado ea8b4c80b7 sms: don't allow sending received messages 2012-03-15 14:15:02 +01:00
Aleksander Morgado 4e4078ef2e sms: implement default storing 2012-03-15 14:15:02 +01:00
Aleksander Morgado 572565c1e0 sms: delete() just removes the parts from the storage
It's left to the delete() caller to unexport the SMS object from DBus and such.
2012-03-15 14:15:02 +01:00
Aleksander Morgado a8b3b50f45 sms: 'number' and 'text' are mandatory when creating from properties 2012-03-15 14:15:02 +01:00