[PATCH 12/12] doc: Add ReportChanged signal description

2012-08-17 Thread Ronald Tessier
---
 doc/message-api.txt |7 +++
 1 file changed, 7 insertions(+)

diff --git a/doc/message-api.txt b/doc/message-api.txt
index 2922e5d..274bb98 100644
--- a/doc/message-api.txt
+++ b/doc/message-api.txt
@@ -31,6 +31,13 @@ Signals  PropertyChanged(string name, variant 
value)
The only expected property change is for the
message status.
 
+   ReportChanged(string type, variant recipient, variant status)
+
+   Signal that is sent when a report has been received and
+   processed. It contains the type of the report
+   ("delivery_report" or other), the recipient concerned
+   and its new status.
+
 Properties string Status [readonly]
 
The status of the message.  Possible values are
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 11/12] test: Add ReportChanged to monitored signals

2012-08-17 Thread Ronald Tessier
---
 test/monitor-mms |   10 ++
 1 file changed, 10 insertions(+)

diff --git a/test/monitor-mms b/test/monitor-mms
index 188d028..ef17a13 100755
--- a/test/monitor-mms
+++ b/test/monitor-mms
@@ -29,6 +29,10 @@ def property_changed(name, value, member, path, interface):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s" % (iface, name, member, value)
 
+def report_changed(type, rec, status, path, interface):
+   iface = interface[interface.rfind(".") + 1:]
+   print "{%s} [%s] <%s> %s : %s" % (iface, path, type, rec, status)
+
 if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
 
@@ -75,5 +79,11 @@ if __name__ == '__main__':
path_keyword="path",
interface_keyword="interface")
 
+   bus.add_signal_receiver(report_changed,
+   bus_name="org.ofono.mms",
+   signal_name = "ReportChanged",
+   path_keyword="path",
+   interface_keyword="interface")
+
mainloop = gobject.MainLoop()
mainloop.run()
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 10/12] service: Send a delivery changed signal

2012-08-17 Thread Ronald Tessier
---
 src/service.c |   48 +---
 1 file changed, 45 insertions(+), 3 deletions(-)

diff --git a/src/service.c b/src/service.c
index 44184cb..ba23b4a 100644
--- a/src/service.c
+++ b/src/service.c
@@ -218,6 +218,40 @@ static void emit_msg_status_changed(const char *path, 
const char *new_status)
g_dbus_send_message(connection, signal);
 }
 
+static void emit_msg_delivery_changed(const char *path, const char *rec,
+   const char *status)
+{
+   DBusMessage *signal;
+   DBusMessageIter iter;
+   DBusMessageIter variant;
+   const char *type = "delivery_report";
+
+   signal = dbus_message_new_signal(path, MMS_MESSAGE_INTERFACE,
+   "ReportChanged");
+   if (signal == NULL)
+   return;
+
+   dbus_message_iter_init_append(signal, &iter);
+
+   dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &type);
+
+   dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
+   DBUS_TYPE_STRING_AS_STRING, &variant);
+
+   dbus_message_iter_append_basic(&variant, DBUS_TYPE_STRING, &rec);
+
+   dbus_message_iter_close_container(&iter, &variant);
+
+   dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
+   DBUS_TYPE_STRING_AS_STRING, &variant);
+
+   dbus_message_iter_append_basic(&variant, DBUS_TYPE_STRING, &status);
+
+   dbus_message_iter_close_container(&iter, &variant);
+
+   g_dbus_send_message(connection, signal);
+}
+
 static DBusMessage *msg_mark_read(DBusConnection *conn,
DBusMessage *msg, void *user_data)
 {
@@ -269,6 +303,10 @@ static const GDBusMethodTable message_methods[] = {
 static const GDBusSignalTable message_signals[] = {
{ GDBUS_SIGNAL("PropertyChanged",
GDBUS_ARGS({ "name", "s" }, { "value", "v" })) },
+   { GDBUS_SIGNAL("ReportChanged",
+   GDBUS_ARGS({ "name", "s" },
+   { "rec", "v" },
+   { "status", "v" })) },
{ }
 };
 
@@ -1369,6 +1407,7 @@ static void process_delivery_ind_notification(struct 
mms_service *service,
char uuid[MMS_META_UUID_LEN + 1];
char *path;
char *to;
+   const char *new_status;
 
if (get_meta_by_msgid(service, di_msg->di.msgid, uuid) == FALSE)
goto bail;
@@ -1381,15 +1420,18 @@ static void process_delivery_ind_notification(struct 
mms_service *service,
 
mms_address_to_string(to);
 
-   g_key_file_set_string(meta, "delivery_status", to,
-   delivery_status[di_msg->di.dr_status - 127]);
+   new_status = delivery_status[di_msg->di.dr_status - 127];
 
-   g_free(to);
+   g_key_file_set_string(meta, "delivery_status", to, new_status);
 
mms_store_meta_close(service->identity, uuid, meta, TRUE);
 
path = g_strdup_printf("%s/%s/%s", MMS_PATH, service->identity, uuid);
 
+   emit_msg_delivery_changed(path, to, new_status);
+
+   g_free(to);
+
g_free(path);
 
 bail:
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 09/12] service: Process delivery_ind notification

2012-08-17 Thread Ronald Tessier
---
 src/service.c |  111 ++---
 1 file changed, 107 insertions(+), 4 deletions(-)

diff --git a/src/service.c b/src/service.c
index b3ecc1e..44184cb 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1300,6 +1300,104 @@ static void emit_service_removed(struct mms_service 
*service)
&service->path, DBUS_TYPE_INVALID);
 }
 
+static gboolean get_meta_by_msgid(struct mms_service *service,
+   const char *msgid,
+   char *uuid)
+{
+   GDir *dir;
+   GKeyFile *meta;
+   const char *file;
+   const char *homedir;
+   const char *service_id;
+   char *service_path;
+
+   homedir = g_get_home_dir();
+   if (homedir == NULL)
+   return FALSE;
+
+   service_id = service->identity;
+
+   service_path = g_strdup_printf("%s/.mms/%s/", homedir, service_id);
+
+   dir = g_dir_open(service_path, 0, NULL);
+   g_free(service_path);
+   if (dir == NULL)
+   return FALSE;
+
+   while ((file = g_dir_read_name(dir)) != NULL) {
+   char *id;
+
+   if (g_str_has_suffix(file, MMS_META_UUID_SUFFIX) == FALSE)
+   continue;
+
+   if (strlen(file) != MMS_META_UUID_LEN +
+   MMS_META_UUID_SUFFIX_LEN)
+   continue;
+
+   strncpy(uuid, file, MMS_META_UUID_LEN);
+   uuid[MMS_META_UUID_LEN] = 0;
+
+   meta = mms_store_meta_open(service_id, uuid);
+   if (meta == NULL)
+   goto bail;
+
+   id = g_key_file_get_string(meta, "info", "id", NULL);
+   if (id == NULL) {
+   mms_store_meta_close(service_id, uuid, meta, FALSE);
+   continue;
+   }
+
+   if (g_strcmp0(msgid, id) == 0) {
+   mms_store_meta_close(service_id, uuid, meta, FALSE);
+   g_dir_close(dir);
+   return TRUE;
+   }
+
+   mms_store_meta_close(service_id, uuid, meta, FALSE);
+   }
+
+bail:
+   g_dir_close(dir);
+
+   return FALSE;
+}
+
+static void process_delivery_ind_notification(struct mms_service *service,
+   struct mms_message *di_msg)
+{
+   GKeyFile *meta;
+   char uuid[MMS_META_UUID_LEN + 1];
+   char *path;
+   char *to;
+
+   if (get_meta_by_msgid(service, di_msg->di.msgid, uuid) == FALSE)
+   goto bail;
+
+   meta = mms_store_meta_open(service->identity, uuid);
+   if (meta == NULL)
+   return;
+
+   to = g_strdup(di_msg->di.to);
+
+   mms_address_to_string(to);
+
+   g_key_file_set_string(meta, "delivery_status", to,
+   delivery_status[di_msg->di.dr_status - 127]);
+
+   g_free(to);
+
+   mms_store_meta_close(service->identity, uuid, meta, TRUE);
+
+   path = g_strdup_printf("%s/%s/%s", MMS_PATH, service->identity, uuid);
+
+   g_free(path);
+
+bail:
+   mms_store_remove(service->identity, di_msg->uuid);
+
+   mms_message_free(di_msg);
+}
+
 static gboolean load_message_from_store(const char *service_id,
const char *uuid, struct mms_message *msg)
 {
@@ -1485,6 +1583,7 @@ register_sr:
}
} else if (msg->type == MMS_MESSAGE_TYPE_DELIVERY_IND) {
request = NULL;
+   process_delivery_ind_notification(service, msg);
} else
request = NULL;
 
@@ -1514,15 +1613,17 @@ static void load_messages(struct mms_service *service)
return;
 
while ((file = g_dir_read_name(dir)) != NULL) {
-   const size_t suffix_len = 7;
char *uuid;
+   size_t uuid_len;
 
-   if (g_str_has_suffix(file, ".status") == FALSE)
+   if (g_str_has_suffix(file, MMS_META_UUID_SUFFIX) == FALSE)
continue;
-   if (strlen(file) - suffix_len == 0)
+
+   uuid_len = strlen(file) - MMS_META_UUID_SUFFIX_LEN;
+   if (uuid_len == 0)
continue;
 
-   uuid = g_strndup(file, strlen(file) - suffix_len);
+   uuid = g_strndup(file, uuid_len);
 
process_message_on_start(service, uuid);
 
@@ -2401,6 +2502,8 @@ void mms_service_push_notify(struct mms_service *service,
 
mms_store_meta_close(service->identity, uuid, meta, TRUE);
 
+   process_delivery_ind_notification(service, msg);
+
return;
}
 
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 08/12] store: Define MMS_META_UUID_XXX len and suffix

2012-08-17 Thread Ronald Tessier
---
 src/store.c |8 +++-
 src/store.h |5 +
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/store.c b/src/store.c
index b09c17b..f1c5714 100644
--- a/src/store.c
+++ b/src/store.c
@@ -42,8 +42,6 @@
 #define TFR
 #endif
 
-#define MMS_SHA1_UUID_LEN 20
-
 static const char *digest_to_str(const unsigned char *digest)
 {
static char buf[MMS_SHA1_UUID_LEN * 2 + 1];
@@ -293,7 +291,7 @@ void mms_store_remove(const char *service_id, const char 
*uuid)
 
unlink(pdu_path);
 
-   meta_path = g_strdup_printf("%s%s", pdu_path, ".status");
+   meta_path = g_strdup_printf("%s%s", pdu_path, MMS_META_UUID_SUFFIX);
 
g_free(pdu_path);
 
@@ -312,7 +310,7 @@ GKeyFile *mms_store_meta_open(const char *service_id, const 
char *uuid)
if (pdu_path == NULL)
return NULL;
 
-   meta_path = g_strdup_printf("%s%s", pdu_path, ".status");
+   meta_path = g_strdup_printf("%s%s", pdu_path, MMS_META_UUID_SUFFIX);
 
g_free(pdu_path);
 
@@ -337,7 +335,7 @@ static void meta_store_sync(const char *service_id, const 
char *uuid,
if (pdu_path == NULL)
return;
 
-   meta_path = g_strdup_printf("%s%s", pdu_path, ".status");
+   meta_path = g_strdup_printf("%s%s", pdu_path, MMS_META_UUID_SUFFIX);
 
g_free(pdu_path);
 
diff --git a/src/store.h b/src/store.h
index ba2c080..fb2ca9f 100644
--- a/src/store.h
+++ b/src/store.h
@@ -19,6 +19,11 @@
  *
  */
 
+#define MMS_SHA1_UUID_LEN 20
+#define MMS_META_UUID_SUFFIX ".status"
+#define MMS_META_UUID_SUFFIX_LEN 7
+#define MMS_META_UUID_LEN (MMS_SHA1_UUID_LEN * 2)
+
 const char *mms_store(const char *service_id, unsigned char *pdu,
unsigned int len);
 const char *mms_store_file(const char *service_id, const char *path);
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 07/12] service: Support delivery_ind notif on start

2012-08-17 Thread Ronald Tessier
---
 src/service.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/service.c b/src/service.c
index 8087477..b3ecc1e 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1357,7 +1357,8 @@ static gboolean load_message_from_store(const char 
*service_id,
else if (strcmp(state, "draft") == 0
&& msg->type == MMS_MESSAGE_TYPE_SEND_REQ)
msg->sr.status = MMS_MESSAGE_STATUS_DRAFT;
-   else if (msg->type != MMS_MESSAGE_TYPE_NOTIFICATION_IND)
+   else if (msg->type != MMS_MESSAGE_TYPE_NOTIFICATION_IND &&
+   msg->type != MMS_MESSAGE_TYPE_DELIVERY_IND)
goto out;
 
success = TRUE;
@@ -1482,6 +1483,8 @@ register_sr:
request = NULL;
mms_message_register(service, msg);
}
+   } else if (msg->type == MMS_MESSAGE_TYPE_DELIVERY_IND) {
+   request = NULL;
} else
request = NULL;
 
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 06/12] service: Support M-Delivery.ind in mms_service_push_notify()

2012-08-17 Thread Ronald Tessier
---
 src/service.c |   31 +++
 1 file changed, 31 insertions(+)

diff --git a/src/service.c b/src/service.c
index ec1b1b9..8087477 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2325,6 +2325,21 @@ static void process_request_queue(struct mms_service 
*service)
bearer_idle_timeout, service);
 }
 
+static void dump_delivery_ind(struct mms_message *msg)
+{
+   char buf[128];
+
+   strftime(buf, 127, "%Y-%m-%dT%H:%M:%S%z", localtime(&msg->di.date));
+   buf[127] = '\0';
+
+   mms_info("MMS version: %u.%u\n", (msg->version & 0x70) >> 4,
+   msg->version & 0x0f);
+   mms_info("Msg ID: %s\n", msg->di.msgid);
+   mms_info("To: %s\n", msg->di.to);
+   mms_info("Date: %s\n", buf);
+   mms_info("Delivery Report status: %d\n", msg->di.dr_status);
+}
+
 static void dump_notification_ind(struct mms_message *msg)
 {
char buf[128];
@@ -2370,6 +2385,22 @@ void mms_service_push_notify(struct mms_service *service,
if (mms_message_decode(data + nread, len - nread, msg) == FALSE)
goto error;
 
+   if (msg->type == MMS_MESSAGE_TYPE_DELIVERY_IND) {
+   msg->uuid = g_strdup(uuid);
+
+   dump_delivery_ind(msg);
+
+   meta = mms_store_meta_open(service->identity, uuid);
+   if (meta == NULL)
+   goto error;
+
+   g_key_file_set_string(meta, "info", "state", "notification");
+
+   mms_store_meta_close(service->identity, uuid, meta, TRUE);
+
+   return;
+   }
+
if (msg->type != MMS_MESSAGE_TYPE_NOTIFICATION_IND)
goto error;
 
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 05/12] service: Add a group [delivery_status] in the msg status

2012-08-17 Thread Ronald Tessier
This group contains an entry for each message recipients. Each recipient
entry will be updated when the corresponding report will be received
and then remove the temporary stored delivery report.
---
 src/service.c |   33 +
 1 file changed, 33 insertions(+)

diff --git a/src/service.c b/src/service.c
index c3dc40a..ec1b1b9 100644
--- a/src/service.c
+++ b/src/service.c
@@ -69,6 +69,17 @@ static const char *ctl_chars = 
"\x01\x02\x03\x04\x05\x06\x07\x08\x0A"
 
 static const char *sep_chars = "()<>@,;:\\\"/[]?={} \t";
 
+static const char *delivery_status[] = {
+   "none",
+   "expired",
+   "retrieved",
+   "rejected",
+   "deferred",
+   "indeterminate",
+   "forwarded",
+   "unreachable"
+};
+
 struct mms_request;
 
 typedef gboolean (*mms_request_result_cb_t) (struct mms_request *request);
@@ -1058,6 +1069,28 @@ static DBusMessage *send_message(DBusConnection *conn,
 
g_key_file_set_string(meta, "info", "state", "draft");
 
+   if (service->use_delivery_reports) {
+   char **tos;
+   int i;
+
+   tos = g_strsplit(msg->sr.to, ",", 0);
+
+   for (i = 0; tos[i] != NULL; i++) {
+   char *to = g_strdup(tos[i]);
+
+   mms_address_to_string(to);
+
+   DBG("%s=%s", to, delivery_status[0]);
+
+   g_key_file_set_string(meta, "delivery_status", to,
+   delivery_status[0]);
+
+   g_free(to);
+   }
+
+   g_strfreev(tos);
+   }
+
mms_store_meta_close(service->identity, msg->uuid, meta, TRUE);
 
if (mms_message_register(service, msg) < 0)
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 04/12] service: Move mms_address_to_string() up

2012-08-17 Thread Ronald Tessier
---
 src/service.c |   26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/service.c b/src/service.c
index b073ca9..c3dc40a 100644
--- a/src/service.c
+++ b/src/service.c
@@ -354,6 +354,19 @@ static gboolean mmap_file(const char *path, void 
**out_pdu, size_t *out_len)
return TRUE;
 }
 
+static const char *mms_address_to_string(char *mms_address)
+{
+   unsigned int prefix_len;
+
+   if (g_str_has_suffix(mms_address, "/TYPE=PLMN") == TRUE) {
+   prefix_len = strlen(mms_address) - 10;
+
+   mms_address[prefix_len] = '\0';
+   }
+
+   return (const char *) mms_address;
+}
+
 static gboolean send_message_get_recipients(DBusMessageIter *top_iter,
struct mms_message *msg)
 {
@@ -1702,19 +1715,6 @@ static void append_msg_attachments(DBusMessageIter 
*dict, const char *path,
}
 }
 
-static const char *mms_address_to_string(char *mms_address)
-{
-   unsigned int prefix_len;
-
-   if (g_str_has_suffix(mms_address, "/TYPE=PLMN") == TRUE) {
-   prefix_len = strlen(mms_address) - 10;
-
-   mms_address[prefix_len] = '\0';
-   }
-
-   return (const char *) mms_address;
-}
-
 static void append_msg_recipients(DBusMessageIter *dict,
struct mms_message *msg)
 {
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 03/12] service: Store msg_id provided by M-Send.conf PDU

2012-08-17 Thread Ronald Tessier
---
 src/service.c |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/service.c b/src/service.c
index db9c514..b073ca9 100644
--- a/src/service.c
+++ b/src/service.c
@@ -629,7 +629,7 @@ static gboolean result_request_send_conf(struct mms_request 
*request)
 
uuid = request->msg->uuid;
 
-   path = g_strdup_printf("%s/%s/%s", MMS_PATH, service->identity, uuid);
+   path = g_strdup_printf("%s/%s/%s", MMS_PATH, service->identity, uuid);
 
if (request->status != 200)
goto error;
@@ -655,17 +655,21 @@ static gboolean result_request_send_conf(struct 
mms_request *request)
 
mms_debug("response status : %d", msg->sc.rsp_status);
 
-   mms_message_free(msg);
-
munmap(pdu, len);
 
unlink(request->data_path);
 
meta = mms_store_meta_open(service->identity, uuid);
-   if (meta == NULL)
+   if (meta == NULL) {
+   mms_message_free(msg);
+
goto error;
+   }
 
g_key_file_set_string(meta, "info", "state", "sent");
+   g_key_file_set_string(meta, "info", "id", msg->sc.msgid);
+
+   mms_message_free(msg);
 
mms_store_meta_close(service->identity, uuid, meta, TRUE);
 
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 02/12] mmsutil: Decode delivery_ind msg

2012-08-17 Thread Ronald Tessier
---
 src/mmsutil.c |   22 +-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/mmsutil.c b/src/mmsutil.c
index a9a12eb..7042276 100644
--- a/src/mmsutil.c
+++ b/src/mmsutil.c
@@ -964,6 +964,24 @@ static gboolean decode_send_req(struct wsp_header_iter 
*iter,
return TRUE;
 }
 
+static gboolean decode_delivery_ind(struct wsp_header_iter *iter,
+   struct mms_message *out)
+{
+   return mms_parse_headers(iter, MMS_HEADER_MMS_VERSION,
+   HEADER_FLAG_MANDATORY | HEADER_FLAG_PRESET_POS,
+   &out->version,
+   MMS_HEADER_MESSAGE_ID,
+   HEADER_FLAG_MANDATORY, &out->di.msgid,
+   MMS_HEADER_TO,
+   HEADER_FLAG_MANDATORY, &out->di.to,
+   MMS_HEADER_DATE,
+   HEADER_FLAG_MANDATORY, &out->di.date,
+   MMS_HEADER_STATUS,
+   HEADER_FLAG_MANDATORY, &out->di.dr_status,
+   MMS_HEADER_INVALID);
+}
+
+
 #define CHECK_WELL_KNOWN_HDR(hdr)  \
if (wsp_header_iter_next(&iter) == FALSE)   \
return FALSE;   \
@@ -1016,7 +1034,7 @@ gboolean mms_message_decode(const unsigned char *pdu,
case MMS_MESSAGE_TYPE_ACKNOWLEDGE_IND:
return FALSE;
case MMS_MESSAGE_TYPE_DELIVERY_IND:
-   return FALSE;
+   return decode_delivery_ind(&iter, out);
}
 
return FALSE;
@@ -1051,6 +1069,8 @@ void mms_message_free(struct mms_message *msg)
case MMS_MESSAGE_TYPE_ACKNOWLEDGE_IND:
break;
case MMS_MESSAGE_TYPE_DELIVERY_IND:
+   g_free(msg->di.msgid);
+   g_free(msg->di.to);
break;
}
 
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 01/12] mmsutil: Define mms_delivery_ind struct

2012-08-17 Thread Ronald Tessier
---
 src/mmsutil.h |8 
 1 file changed, 8 insertions(+)

diff --git a/src/mmsutil.h b/src/mmsutil.h
index cc3ec67..e32c761 100644
--- a/src/mmsutil.h
+++ b/src/mmsutil.h
@@ -122,6 +122,13 @@ struct mms_notification_resp_ind {
enum mms_message_notify_status notify_status;
 };
 
+struct mms_delivery_ind {
+   enum mms_message_delivery_status dr_status;
+   char *msgid;
+   char *to;
+   time_t date;
+};
+
 struct mms_attachment {
unsigned char *data;
size_t offset;
@@ -143,6 +150,7 @@ struct mms_message {
struct mms_send_req sr;
struct mms_send_conf sc;
struct mms_notification_resp_ind nri;
+   struct mms_delivery_ind di;
};
 };
 
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 00/12] mmsd: Support Delivery Report notification

2012-08-17 Thread Ronald Tessier
These patches concern mmsd and add delivery report notification support.
Add MMS M-Delivery.ind PDU decoding support.
Update meta file of the sent message to store the received msg_id and to add a
group [delivery_status] if delivery_report is requested.
Upon MMS M-Delivery.ind PDU reception, update delivery_status recipient entry
with the received status (this is described in doc/storage.txt) and signal the
new delivery_report status for the recipient concerned.
Modify the monitor_mms test script to add report_changed monitoring.
Update message-api.txt doc to describe new ReportChanged signal.

Ronald Tessier (12):
  mmsutil: Define mms_delivery_ind struct
  mmsutil: Decode delivery_ind msg
  service: Store msg_id provided by M-Send.conf PDU
  service: Move mms_address_to_string() up
  service: Add a group [delivery_status] in the msg status
  service: Support M-Delivery.ind in mms_service_push_notify()
  service: Support delivery_ind notif on start
  store: Define MMS_META_UUID_XXX len and suffix
  service: Process delivery_ind notification
  service: Send a delivery changed signal
  test: Add ReportChanged to monitored signals
  doc: Add ReportChanged signal description

 doc/message-api.txt |7 ++
 src/mmsutil.c   |   22 -
 src/mmsutil.h   |8 ++
 src/service.c   |  260 ++-
 src/store.c |8 +-
 src/store.h |5 +
 test/monitor-mms|   10 ++
 7 files changed, 292 insertions(+), 28 deletions(-)

--
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 1/2] dundee: add timeout to close stalled ppp handshake

2012-08-17 Thread Daniel Wagner
Hi Gustavo,

On Tue, Aug 14, 2012 at 04:14:31AM -0300, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> If something goes wrong the PPP handshake can stall, then we just add a
> timer to return an error after a certain timeout (15 seconds).

Both patches applied.

I also updated the documentation on the interface. The SetProperty() was 
missing.

Thanks,
Daniel
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] dundee: disconnect bluetooth link in case dial fails

2012-08-17 Thread Daniel Wagner
Hi Gustavo,

On Mon, Aug 13, 2012 at 06:52:06PM -0300, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> If the ATD*99# dial fails for some reason, NO CARRIER, for example, we
> need to disconnect the bluetooth link and do further clean up on
> disconnect_callback().

Patch applied.

thanks,
daniel
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 2/2] telit: add additional port for data connection

2012-08-17 Thread Christopher Vogl
Use MDM port for data service and AUX for the AT chat.
Disable DCD so that the modem does not hangup after a data connection.
---
 plugins/telit.c |   55 ++-
 1 files changed, 34 insertions(+), 21 deletions(-)

diff --git a/plugins/telit.c b/plugins/telit.c
index d49ec11..3c3cf4f 100644
--- a/plugins/telit.c
+++ b/plugins/telit.c
@@ -65,8 +65,8 @@ static const char *qss_prefix[] = { "#QSS:", NULL };
 static const char *rsen_prefix[]= { "#RSEN:", NULL };
 
 struct telit_data {
-   GAtChat *chat;
-   GAtChat *aux;
+   GAtChat *chat;  /* AT chat */
+   GAtChat *modem; /* Data port */
struct ofono_sim *sim;
guint sim_inserted_source;
struct ofono_modem *sap_modem;
@@ -305,6 +305,13 @@ static void cfun_enable_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
return;
}
 
+   /*
+* Switch data carrier detect signal off.
+* When the DCD is disabled the modem does not hangup anymore
+* after the data connection.
+*/
+   g_at_chat_send(data->chat, "AT&C0", NULL, NULL, NULL, NULL);
+
ofono_modem_set_powered(m, TRUE);
 
/* Enable sim state notification */
@@ -325,10 +332,19 @@ static int telit_enable(struct ofono_modem *modem)
 
DBG("%p", modem);
 
-   data->chat = open_device(modem, "Modem", "Modem: ");
-   if (data->chat == NULL)
+   data->modem = open_device(modem, "Modem", "Modem: ");
+   if (data->modem == NULL)
return -EINVAL;
 
+   data->chat = open_device(modem, "Aux", "Aux: ");
+   if (data->chat == NULL) {
+   g_at_chat_unref(data->modem);
+   data->modem = NULL;
+   return -EIO;
+   }
+
+   g_at_chat_set_slave(data->modem, data->chat);
+
/*
 * Disable command echo and
 * enable the Extended Error Result Codes
@@ -376,8 +392,6 @@ static void rsen_enable_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
DBG("%p", modem);
 
if (!ok) {
-   g_at_chat_unref(data->aux);
-   data->aux = NULL;
ofono_modem_set_powered(data->sap_modem, FALSE);
sap_close_io(modem);
return;
@@ -411,6 +425,11 @@ static int telit_disable(struct ofono_modem *modem)
struct telit_data *data = ofono_modem_get_data(modem);
DBG("%p", modem);
 
+   g_at_chat_cancel_all(data->modem);
+   g_at_chat_unregister_all(data->modem);
+   g_at_chat_unref(data->modem);
+   data->modem = NULL;
+
g_at_chat_cancel_all(data->chat);
g_at_chat_unregister_all(data->chat);
 
@@ -428,9 +447,6 @@ static void rsen_disable_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
 
DBG("%p", modem);
 
-   g_at_chat_unref(data->aux);
-   data->aux = NULL;
-
sap_close_io(modem);
 
telit_disable(modem);
@@ -486,10 +502,6 @@ static int telit_sap_enable(struct ofono_modem *modem,
g_io_channel_set_buffered(data->hw_io, FALSE);
g_io_channel_set_close_on_unref(data->hw_io, TRUE);
 
-   data->aux = open_device(modem, "Data", "Aux: ");
-   if (data->aux == NULL)
-   goto error;
-
data->bt_io = g_io_channel_unix_new(bt_fd);
if (data->bt_io == NULL)
goto error;
@@ -508,13 +520,13 @@ static int telit_sap_enable(struct ofono_modem *modem,
 
data->sap_modem = sap_modem;
 
-   g_at_chat_register(data->aux, "#RSEN:", telit_rsen_notify,
+   g_at_chat_register(data->chat, "#RSEN:", telit_rsen_notify,
FALSE, modem, NULL);
 
-   g_at_chat_send(data->aux, "AT#NOPT=0", NULL, NULL, NULL, NULL);
+   g_at_chat_send(data->chat, "AT#NOPT=0", NULL, NULL, NULL, NULL);
 
/* Set SAP functionality */
-   g_at_chat_send(data->aux, "AT#RSEN=1,1,0,2,0", rsen_prefix,
+   g_at_chat_send(data->chat, "AT#RSEN=1,1,0,2,0", rsen_prefix,
rsen_enable_cb, modem, NULL);
 
return -EINPROGRESS;
@@ -533,10 +545,7 @@ static int telit_sap_disable(struct ofono_modem *modem)
 
DBG("%p", modem);
 
-   g_at_chat_cancel_all(data->aux);
-   g_at_chat_unregister_all(data->aux);
-
-   g_at_chat_send(data->aux, "AT#RSEN=0", rsen_prefix,
+   g_at_chat_send(data->chat, "AT#RSEN=0", rsen_prefix,
rsen_disable_cb, modem, NULL);
 
return -EINPROGRESS;
@@ -572,7 +581,7 @@ static void telit_post_sim(struct ofono_modem *modem)
 
gprs = ofono_gprs_create(modem, OFONO_VENDOR_TELIT, "atmodem",
data->chat);
-   gc = ofono_gprs_context_create(modem, 0, "atmodem", data->chat);
+   gc = ofono_gprs_context_create(modem, 0, "atmodem", data->modem);
 
if (gprs && gc)
ofono_gprs_add_context(gprs, gc);
@@ -663,6 +672,10 @@ static void telit_remove(struct ofo

[PATCH 2/2] telit: add additional port for data connection

2012-08-17 Thread Christopher Vogl
Use MDM port for data service and AUX for the AT chat.
Disable DCD so that the modem does not hangup after a data connection.
Add vendor for sim and gprs.
---
 plugins/telit.c |   55 ++-
 1 files changed, 34 insertions(+), 21 deletions(-)

diff --git a/plugins/telit.c b/plugins/telit.c
index d49ec11..3c3cf4f 100644
--- a/plugins/telit.c
+++ b/plugins/telit.c
@@ -65,8 +65,8 @@ static const char *qss_prefix[] = { "#QSS:", NULL };
 static const char *rsen_prefix[]= { "#RSEN:", NULL };
 
 struct telit_data {
-   GAtChat *chat;
-   GAtChat *aux;
+   GAtChat *chat;  /* AT chat */
+   GAtChat *modem; /* Data port */
struct ofono_sim *sim;
guint sim_inserted_source;
struct ofono_modem *sap_modem;
@@ -305,6 +305,13 @@ static void cfun_enable_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
return;
}
 
+   /*
+* Switch data carrier detect signal off.
+* When the DCD is disabled the modem does not hangup anymore
+* after the data connection.
+*/
+   g_at_chat_send(data->chat, "AT&C0", NULL, NULL, NULL, NULL);
+
ofono_modem_set_powered(m, TRUE);
 
/* Enable sim state notification */
@@ -325,10 +332,19 @@ static int telit_enable(struct ofono_modem *modem)
 
DBG("%p", modem);
 
-   data->chat = open_device(modem, "Modem", "Modem: ");
-   if (data->chat == NULL)
+   data->modem = open_device(modem, "Modem", "Modem: ");
+   if (data->modem == NULL)
return -EINVAL;
 
+   data->chat = open_device(modem, "Aux", "Aux: ");
+   if (data->chat == NULL) {
+   g_at_chat_unref(data->modem);
+   data->modem = NULL;
+   return -EIO;
+   }
+
+   g_at_chat_set_slave(data->modem, data->chat);
+
/*
 * Disable command echo and
 * enable the Extended Error Result Codes
@@ -376,8 +392,6 @@ static void rsen_enable_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
DBG("%p", modem);
 
if (!ok) {
-   g_at_chat_unref(data->aux);
-   data->aux = NULL;
ofono_modem_set_powered(data->sap_modem, FALSE);
sap_close_io(modem);
return;
@@ -411,6 +425,11 @@ static int telit_disable(struct ofono_modem *modem)
struct telit_data *data = ofono_modem_get_data(modem);
DBG("%p", modem);
 
+   g_at_chat_cancel_all(data->modem);
+   g_at_chat_unregister_all(data->modem);
+   g_at_chat_unref(data->modem);
+   data->modem = NULL;
+
g_at_chat_cancel_all(data->chat);
g_at_chat_unregister_all(data->chat);
 
@@ -428,9 +447,6 @@ static void rsen_disable_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
 
DBG("%p", modem);
 
-   g_at_chat_unref(data->aux);
-   data->aux = NULL;
-
sap_close_io(modem);
 
telit_disable(modem);
@@ -486,10 +502,6 @@ static int telit_sap_enable(struct ofono_modem *modem,
g_io_channel_set_buffered(data->hw_io, FALSE);
g_io_channel_set_close_on_unref(data->hw_io, TRUE);
 
-   data->aux = open_device(modem, "Data", "Aux: ");
-   if (data->aux == NULL)
-   goto error;
-
data->bt_io = g_io_channel_unix_new(bt_fd);
if (data->bt_io == NULL)
goto error;
@@ -508,13 +520,13 @@ static int telit_sap_enable(struct ofono_modem *modem,
 
data->sap_modem = sap_modem;
 
-   g_at_chat_register(data->aux, "#RSEN:", telit_rsen_notify,
+   g_at_chat_register(data->chat, "#RSEN:", telit_rsen_notify,
FALSE, modem, NULL);
 
-   g_at_chat_send(data->aux, "AT#NOPT=0", NULL, NULL, NULL, NULL);
+   g_at_chat_send(data->chat, "AT#NOPT=0", NULL, NULL, NULL, NULL);
 
/* Set SAP functionality */
-   g_at_chat_send(data->aux, "AT#RSEN=1,1,0,2,0", rsen_prefix,
+   g_at_chat_send(data->chat, "AT#RSEN=1,1,0,2,0", rsen_prefix,
rsen_enable_cb, modem, NULL);
 
return -EINPROGRESS;
@@ -533,10 +545,7 @@ static int telit_sap_disable(struct ofono_modem *modem)
 
DBG("%p", modem);
 
-   g_at_chat_cancel_all(data->aux);
-   g_at_chat_unregister_all(data->aux);
-
-   g_at_chat_send(data->aux, "AT#RSEN=0", rsen_prefix,
+   g_at_chat_send(data->chat, "AT#RSEN=0", rsen_prefix,
rsen_disable_cb, modem, NULL);
 
return -EINPROGRESS;
@@ -572,7 +581,7 @@ static void telit_post_sim(struct ofono_modem *modem)
 
gprs = ofono_gprs_create(modem, OFONO_VENDOR_TELIT, "atmodem",
data->chat);
-   gc = ofono_gprs_context_create(modem, 0, "atmodem", data->chat);
+   gc = ofono_gprs_context_create(modem, 0, "atmodem", data->modem);
 
if (gprs && gc)
ofono_gprs_add_context(gprs, gc);
@@ -663,6 +672,10 @@ static

[PATCH 1/2] udevng: rename aux port from Data to Aux for telit.

2012-08-17 Thread Christopher Vogl
Telit software user guide says:
USB AUX doesn't support any flow control method. Therefore, this port
isn't suitable for DATA service port.
We recommend this port should be used only for AT command and URC
processing.
---
 plugins/udevng.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/plugins/udevng.c b/plugins/udevng.c
index 872039a..bd5e5e0 100644
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -615,7 +615,7 @@ static gboolean setup_telit(struct modem_info *modem)
DBG("modem=%s aux=%s gps=%s diag=%s", mdm, aux, gps, diag);
 
ofono_modem_set_string(modem->modem, "Modem", mdm);
-   ofono_modem_set_string(modem->modem, "Data", aux);
+   ofono_modem_set_string(modem->modem, "Aux", aux);
ofono_modem_set_string(modem->modem, "GPS", gps);
 
return TRUE;
-- 
1.7.7.6


--
Scanned by MailScanner.

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 2/8] telit: add additional port for data connection

2012-08-17 Thread Christopher Vogl

Hi Denis and Gustavo,

On 13/08/12 19:03, Denis Kenzior wrote:

Hi Christopher,

CC-ing Gustavo since he wrote much of the SAP bits in this driver...

On 08/13/2012 08:17 AM, Christopher Vogl wrote:

Use MDM port for data service and AUX for the AT chat.
Disable DCD so that the modem does not hangup after a data connection.
Add vendor for sim and gprs.

udevng: rename aux port from Data to Aux for telit.

Telit software user guide says:
USB AUX doesn’t support any flow control method. Therefore, this port
isn’t suitable for DATA service port.
We recommend this port should be used only for AT command
and URC processing.
---
  plugins/telit.c  |   76 
+

  plugins/udevng.c |2 +-
  2 files changed, 54 insertions(+), 24 deletions(-)

diff --git a/plugins/telit.c b/plugins/telit.c
index 853fd44..8446a22 100644
--- a/plugins/telit.c
+++ b/plugins/telit.c
@@ -65,8 +65,8 @@ static const char *qss_prefix[] = { "#QSS:", NULL };
  static const char *rsen_prefix[]= { "#RSEN:", NULL };

  struct telit_data {
-GAtChat *chat;
-GAtChat *aux;
+GAtChat *chat;/* AT chat */
+GAtChat *modem;/* Data port */
  struct ofono_sim *sim;
  struct ofono_modem *sap_modem;
  GIOChannel *bt_io;
@@ -295,6 +295,13 @@ static void cfun_enable_cb(gboolean ok, 
GAtResult *result, gpointer user_data)

  return;
  }

+/*
+ * Switch data carrier detect signal off.
+ * When the DCD is disabled the modem does not hangup anymore
+ * after the data connection.
+ */
+g_at_chat_send(data->chat, "AT&C0", NULL, NULL, NULL, NULL);
+
  ofono_modem_set_powered(m, TRUE);

  /* Enable sim state notification */
@@ -311,10 +318,19 @@ static int telit_enable(struct ofono_modem *modem)

  DBG("%p", modem);

-data->chat = open_device(modem, "Modem", "Modem: ");
-if (data->chat == NULL)
+data->modem = open_device(modem, "Modem", "Modem: ");
+if (data->modem == NULL)
  return -EINVAL;

+data->chat = open_device(modem, "Aux", "Aux: ");
+if (data->chat == NULL) {
+g_at_chat_unref(data->modem);
+data->modem = NULL;
+return -EIO;
+}
+
+g_at_chat_set_slave(data->modem, data->chat);
+


Gustavo, are you OK with these changes? I do not recall whether it 
made a difference on which port the #RSEN was being sent.



  /*
   * Disable command echo and
   * enable the Extended Error Result Codes
@@ -362,8 +378,6 @@ static void rsen_enable_cb(gboolean ok, GAtResult 
*result, gpointer user_data)

  DBG("%p", modem);

  if (!ok) {
-g_at_chat_unref(data->aux);
-data->aux = NULL;
  ofono_modem_set_powered(data->sap_modem, FALSE);
  sap_close_io(modem);
  return;
@@ -380,6 +394,21 @@ static void cfun_disable_cb(gboolean ok, 
GAtResult *result, gpointer user_data)


  DBG("%p", modem);

+GIOChannel *channel = g_at_chat_get_channel(data->modem);
+if(channel) {
+g_io_channel_unref(channel);
+channel = NULL;
+}


Why do you need this part?  What's the reason to manually unref the 
channel?


This is a relict of a workmate desperately trying to find out why the 
modem hangs up after a ppp connection -

which was finally solved by sending '&CO'.
Sorry, this code part does not belong here and I have to be more careful 
when sending patches.





+
+g_at_chat_unref(data->modem);
+data->modem = NULL;
+
+channel = g_at_chat_get_channel(data->chat);
+if(channel) {
+g_io_channel_unref(channel);
+channel = NULL;
+}
+


And here?


  g_at_chat_unref(data->chat);
  data->chat = NULL;

@@ -394,6 +423,9 @@ static int telit_disable(struct ofono_modem *modem)
  struct telit_data *data = ofono_modem_get_data(modem);
  DBG("%p", modem);

+g_at_chat_cancel_all(data->modem);
+g_at_chat_unregister_all(data->modem);
+
  g_at_chat_cancel_all(data->chat);
  g_at_chat_unregister_all(data->chat);

@@ -411,9 +443,6 @@ static void rsen_disable_cb(gboolean ok, 
GAtResult *result, gpointer user_data)


  DBG("%p", modem);

-g_at_chat_unref(data->aux);
-data->aux = NULL;
-
  sap_close_io(modem);

  telit_disable(modem);
@@ -469,10 +498,6 @@ static int telit_sap_enable(struct ofono_modem 
*modem,

  g_io_channel_set_buffered(data->hw_io, FALSE);
  g_io_channel_set_close_on_unref(data->hw_io, TRUE);

-data->aux = open_device(modem, "Data", "Aux: ");
-if (data->aux == NULL)
-goto error;
-
  data->bt_io = g_io_channel_unix_new(bt_fd);
  if (data->bt_io == NULL)
  goto error;
@@ -491,13 +516,13 @@ static int telit_sap_enable(struct ofono_modem 
*modem,


  data->sap_modem = sap_modem;

-g_at_chat_register(data->aux, "#RSEN:", telit_rsen_notify,
+g_at_chat_register(data->chat, "#RSEN:", telit_rsen_notify,
  FALSE, modem, NULL);

-g_at_chat_send(data->aux, "AT#NOPT=0