From: Inaky Perez-Gonzalez <[email protected]>

Currently this only returns the state of the SMS message and the
destination number. Note we make the @receiver field in 'struct
tx_queue_entry' be always filled out in __ofono_sms_txq_submit() as
now it is always needed for the properties, not only when a Status
Report is requested.
---
 src/sms.c |   39 +++++++++++++++++++++++++++++++++------
 1 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/src/sms.c b/src/sms.c
index a595f7d..0aa058b 100644
--- a/src/sms.c
+++ b/src/sms.c
@@ -524,7 +524,35 @@ static void __ofono_sms_tx_state_set(struct tx_queue_entry 
*entry,
                entry->stch_cb(entry->data, state_new);
 }
 
+static DBusMessage *dbus_sms_msg_get_properties(
+       DBusConnection * conn, DBusMessage *dbus_msg, void *_sms_msg)
+{
+       struct tx_queue_entry *sms_msg = _sms_msg;
+       DBusMessage *reply;
+       DBusMessageIter iter;
+       DBusMessageIter dict;
+       const char *str;
+
+       reply = dbus_message_new_method_return(dbus_msg);
+       if (!reply)
+               return NULL;
+
+       dbus_message_iter_init_append(reply, &iter);
 
+       dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+                                        OFONO_PROPERTIES_ARRAY_SIGNATURE,
+                                        &dict);
+
+       str = ofono_sms_tx_state_to_string(sms_msg->state);
+       ofono_dbus_dict_append(&dict, "State", DBUS_TYPE_STRING, &str);
+
+       str = sms_address_to_string(&sms_msg->receiver);
+       ofono_dbus_dict_append(&dict, "To", DBUS_TYPE_STRING, &str);
+
+       dbus_message_iter_close_container(&iter, &dict);
+
+       return reply;
+}
 
 static void sms_msg_cancel(struct tx_queue_entry *);
 /*
@@ -548,6 +576,8 @@ static DBusMessage *dbus_sms_msg_cancel(
 
 static
 GDBusMethodTable sms_msg_methods[] = {
+       { "GetProperties",      "",     "a{sv}",
+         dbus_sms_msg_get_properties, 0 },
        { "Cancel",             "",     "",
          dbus_sms_msg_cancel, 0 },
        { }
@@ -1687,13 +1717,10 @@ struct tx_queue_entry *__ofono_sms_txq_submit(
        void *data, ofono_destroy_func destroy)
 {
        struct tx_queue_entry *entry = tx_queue_entry_new(list);
+       struct sms *head = list->data;
 
-       if (flags & OFONO_SMS_SUBMIT_FLAG_REQUEST_SR) {
-               struct sms *head = list->data;
-
-               memcpy(&entry->receiver, &head->submit.daddr,
-                               sizeof(entry->receiver));
-       }
+       memcpy(&entry->receiver, &head->submit.daddr,
+               sizeof(entry->receiver));
 
        entry->msg_id = msg_id;
        entry->flags = flags;
-- 
1.6.6.1

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to