All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] mmsd: get delivery_report setting
@ 2012-07-06  9:32 Ronald Tessier
  2012-07-06  9:32 ` [PATCH 1/3] service: manage delivery report setting Ronald Tessier
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Ronald Tessier @ 2012-07-06  9:32 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 602 bytes --]

This set of patches concerns mmsd and is related to delivery_report.
Add delivery report flag and API (to set its value) to service.
Get and track the delivery report setting used by oFono in the message manager
and use it in mmsd.

Ronald Tessier (3):
  service: manage delivery report setting
  ofono: Add support for message_manager tracking
  service: use delivery_report in send_req message

 plugins/ofono.c |  135 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/service.c   |   15 +++++++
 src/service.h   |    2 +
 3 files changed, 152 insertions(+)

--
1.7.9.5


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] service: manage delivery report setting
  2012-07-06  9:32 [PATCH 0/3] mmsd: get delivery_report setting Ronald Tessier
@ 2012-07-06  9:32 ` Ronald Tessier
  2012-07-06  9:32 ` [PATCH 2/3] ofono: Add support for message_manager tracking Ronald Tessier
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Ronald Tessier @ 2012-07-06  9:32 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1344 bytes --]

---
 src/service.c |   13 +++++++++++++
 src/service.h |    2 ++
 2 files changed, 15 insertions(+)

diff --git a/src/service.c b/src/service.c
index 83e1fe1..5913a55 100644
--- a/src/service.c
+++ b/src/service.c
@@ -75,6 +75,7 @@ struct mms_service {
 	char *identity;
 	char *path;
 	char *mmsc;
+	gboolean dr;
 	mms_service_bearer_handler_func_t bearer_handler;
 	void *bearer_data;
 	guint bearer_timeout;
@@ -1849,6 +1850,18 @@ int mms_service_set_bearer_handler(struct mms_service *service,
 	return 0;
 }

+int mms_service_set_delivery_report(struct mms_service *service, gboolean dr)
+{
+	DBG("service %p dr %d", service, dr);
+
+	if (service == NULL)
+		return -EINVAL;
+
+	service->dr = dr;
+
+	return 0;
+}
+
 static inline gboolean bearer_is_active(struct mms_service *service)
 {
 	if (service->bearer_setup == TRUE)
diff --git a/src/service.h b/src/service.h
index 56c0585..bafe8c0 100644
--- a/src/service.h
+++ b/src/service.h
@@ -42,6 +42,8 @@ int mms_service_set_bearer_handler(struct mms_service *service,
 				mms_service_bearer_handler_func_t handler,
 							void *user_data);

+int mms_service_set_delivery_report(struct mms_service *service, gboolean dr);
+
 void mms_service_push_notify(struct mms_service *service,
 					unsigned char *data, int len);

--
1.7.9.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] ofono: Add support for message_manager tracking
  2012-07-06  9:32 [PATCH 0/3] mmsd: get delivery_report setting Ronald Tessier
  2012-07-06  9:32 ` [PATCH 1/3] service: manage delivery report setting Ronald Tessier
@ 2012-07-06  9:32 ` Ronald Tessier
  2012-07-06  9:32 ` [PATCH 3/3] service: use delivery_report in send_req message Ronald Tessier
  2012-07-16  7:25 ` [PATCH 0/3] mmsd: get delivery_report setting Denis Kenzior
  3 siblings, 0 replies; 7+ messages in thread
From: Ronald Tessier @ 2012-07-06  9:32 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 5524 bytes --]

---
 plugins/ofono.c |  135 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 135 insertions(+)

diff --git a/plugins/ofono.c b/plugins/ofono.c
index 45fac91..8f2e71f 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -40,6 +40,7 @@
 #define OFONO_SIM_INTERFACE	OFONO_SERVICE ".SimManager"
 #define OFONO_GPRS_INTERFACE	OFONO_SERVICE ".ConnectionManager"
 #define OFONO_CONTEXT_INTERFACE	OFONO_SERVICE ".ConnectionContext"
+#define OFONO_MESSAGE_MANAGER_INTERFACE	OFONO_SERVICE ".MessageManager"
 #define OFONO_PUSH_INTERFACE	OFONO_SERVICE ".PushNotification"
 #define OFONO_AGENT_INTERFACE	OFONO_SERVICE ".PushNotificationAgent"
 
@@ -59,6 +60,7 @@ struct modem_data {
 	dbus_bool_t context_active;
 	char *context_interface;
 	char *context_proxy;
+	dbus_bool_t use_dr;
 };
 
 static GHashTable *modem_list;
@@ -885,6 +887,126 @@ static int get_gprs_properties(struct modem_data *modem)
 	return 0;
 }
 
+static void check_message_mgr_delivery_report(struct modem_data *modem,
+							DBusMessageIter *iter)
+{
+	dbus_bool_t use_dr;
+
+	dbus_message_iter_get_basic(iter, &use_dr);
+
+	if (modem->use_dr == use_dr)
+		return;
+
+	modem->use_dr = use_dr;
+
+	DBG("Use DeliveryReport %d", modem->use_dr);
+
+	mms_service_set_delivery_report(modem->service, modem->use_dr);
+}
+
+static gboolean message_mgr_changed(DBusConnection *connection,
+				DBusMessage *message, void *user_data)
+{
+	struct modem_data *modem;
+	DBusMessageIter iter, value;
+	const char *path, *key;
+
+	if (dbus_message_iter_init(message, &iter) == FALSE)
+		return TRUE;
+
+	path = dbus_message_get_path(message);
+
+	modem = g_hash_table_lookup(modem_list, path);
+	if (modem == NULL)
+		return TRUE;
+
+	dbus_message_iter_get_basic(&iter, &key);
+
+	dbus_message_iter_next(&iter);
+	dbus_message_iter_recurse(&iter, &value);
+
+	if (g_str_equal(key, "UseDeliveryReports") == TRUE)
+		check_message_mgr_delivery_report(modem, &value);
+
+	return TRUE;
+}
+
+static void get_message_mgr_properties_reply(DBusPendingCall *call,
+								void *user_data)
+{
+	struct modem_data *modem = user_data;
+	DBusMessage *reply = dbus_pending_call_steal_reply(call);
+	DBusMessageIter iter, dict;
+	DBusError err;
+
+	dbus_error_init(&err);
+
+	if (dbus_set_error_from_message(&err, reply) == TRUE) {
+		dbus_error_free(&err);
+		goto done;
+	}
+
+	if (dbus_message_has_signature(reply, "a{sv}") == FALSE)
+		goto done;
+
+	if (dbus_message_iter_init(reply, &iter) == FALSE)
+		goto done;
+
+	dbus_message_iter_recurse(&iter, &dict);
+
+	while (dbus_message_iter_get_arg_type(&dict) == DBUS_TYPE_DICT_ENTRY) {
+		DBusMessageIter entry, value;
+		const char *key;
+
+		dbus_message_iter_recurse(&dict, &entry);
+
+		dbus_message_iter_get_basic(&entry, &key);
+		dbus_message_iter_next(&entry);
+
+		dbus_message_iter_recurse(&entry, &value);
+
+		if (g_str_equal(key, "UseDeliveryReports") == TRUE)
+			check_message_mgr_delivery_report(modem, &value);
+
+		dbus_message_iter_next(&dict);
+	}
+
+done:
+	dbus_message_unref(reply);
+}
+
+static int get_message_mgr_properties(struct modem_data *modem)
+{
+	DBusConnection *conn = modem->conn;
+	DBusMessage *msg;
+	DBusPendingCall *call;
+
+	msg = dbus_message_new_method_call(OFONO_SERVICE, modem->path,
+					OFONO_MESSAGE_MANAGER_INTERFACE,
+					"GetProperties");
+	if (msg == NULL)
+		return -ENOMEM;
+
+	dbus_message_set_auto_start(msg, FALSE);
+
+	if (dbus_connection_send_with_reply(conn, msg, &call, -1) == FALSE) {
+		dbus_message_unref(msg);
+		return -EIO;
+	}
+
+	dbus_message_unref(msg);
+
+	if (call == NULL)
+		return -EINVAL;
+
+	dbus_pending_call_set_notify(call, get_message_mgr_properties_reply,
+							modem, NULL);
+
+	dbus_pending_call_unref(call);
+
+	return 0;
+}
+
 static void check_interfaces(struct modem_data *modem, DBusMessageIter *iter)
 {
 	DBusMessageIter entry;
@@ -963,6 +1085,8 @@ static void check_interfaces(struct modem_data *modem, DBusMessageIter *iter)
 		if (modem->has_push == FALSE && modem->has_agent == TRUE)
 			remove_agent(modem);
 	}
+
+	get_message_mgr_properties(modem);
 }
 
 static void create_modem(DBusConnection *conn,
@@ -982,6 +1106,7 @@ static void create_modem(DBusConnection *conn,
 	modem->has_gprs = FALSE;
 	modem->has_push = FALSE;
 	modem->has_agent = FALSE;
+	modem->use_dr = FALSE;
 
 	modem->service = mms_service_create();
 
@@ -1146,6 +1271,7 @@ static guint gprs_changed_watch;
 static guint context_added_watch;
 static guint context_removed_watch;
 static guint context_changed_watch;
+static guint message_mgr_changed_watch;
 
 static void ofono_connect(DBusConnection *conn, void *user_data)
 {
@@ -1188,6 +1314,10 @@ static void ofono_connect(DBusConnection *conn, void *user_data)
 				OFONO_CONTEXT_INTERFACE, "PropertyChanged",
 						context_changed, NULL, NULL);
 
+	message_mgr_changed_watch = g_dbus_add_signal_watch(conn, NULL, NULL,
+			OFONO_MESSAGE_MANAGER_INTERFACE, "PropertyChanged",
+					message_mgr_changed, NULL, NULL);
+
 	get_modems(conn);
 }
 
@@ -1237,6 +1367,11 @@ static void ofono_disconnect(DBusConnection *conn, void *user_data)
 		context_changed_watch = 0;
 	}
 
+	if (message_mgr_changed_watch > 0) {
+		g_dbus_remove_watch(conn, message_mgr_changed_watch);
+		message_mgr_changed_watch = 0;
+	}
+
 	g_hash_table_destroy(modem_list);
 	modem_list = NULL;
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] service: use delivery_report in send_req message
  2012-07-06  9:32 [PATCH 0/3] mmsd: get delivery_report setting Ronald Tessier
  2012-07-06  9:32 ` [PATCH 1/3] service: manage delivery report setting Ronald Tessier
  2012-07-06  9:32 ` [PATCH 2/3] ofono: Add support for message_manager tracking Ronald Tessier
@ 2012-07-06  9:32 ` Ronald Tessier
  2012-07-16  7:25 ` [PATCH 0/3] mmsd: get delivery_report setting Denis Kenzior
  3 siblings, 0 replies; 7+ messages in thread
From: Ronald Tessier @ 2012-07-06  9:32 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 497 bytes --]

---
 src/service.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/service.c b/src/service.c
index 5913a55..e3812a7 100644
--- a/src/service.c
+++ b/src/service.c
@@ -918,6 +918,8 @@ static DBusMessage *send_message(DBusConnection *conn,
 	if (msg->transaction_id == NULL)
 		goto release_msg;
 
+	msg->sr.dr = service->dr;
+
 	request = create_request(MMS_REQUEST_TYPE_POST,
 				result_request_send_conf, NULL, service, msg);
 	if (request == NULL)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] mmsd: get delivery_report setting
  2012-07-06  9:32 [PATCH 0/3] mmsd: get delivery_report setting Ronald Tessier
                   ` (2 preceding siblings ...)
  2012-07-06  9:32 ` [PATCH 3/3] service: use delivery_report in send_req message Ronald Tessier
@ 2012-07-16  7:25 ` Denis Kenzior
  2012-07-17  8:22   ` Ronald Tessier
  3 siblings, 1 reply; 7+ messages in thread
From: Denis Kenzior @ 2012-07-16  7:25 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 518 bytes --]

Hi Ronald,

On 07/06/2012 04:32 AM, Ronald Tessier wrote:
> This set of patches concerns mmsd and is related to delivery_report.
> Add delivery report flag and API (to set its value) to service.
> Get and track the delivery report setting used by oFono in the message manager
> and use it in mmsd.

Maybe I'm not seeing something, but why are we tracking the delivery 
report flag in oFono in mmsd?  I'm guessing you want to synchronize the 
two, but I do not see why you would want to?

Regards,
-Denis

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] mmsd: get delivery_report setting
  2012-07-17  8:22   ` Ronald Tessier
@ 2012-07-17  2:00     ` Denis Kenzior
  0 siblings, 0 replies; 7+ messages in thread
From: Denis Kenzior @ 2012-07-17  2:00 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1181 bytes --]

Hi Ronald,

On 07/17/2012 03:22 AM, Ronald Tessier wrote:
> Hi Denis,
>
> On 07/16/2012 09:25 AM, Denis Kenzior wrote:
>> Hi Ronald,
>>
>> On 07/06/2012 04:32 AM, Ronald Tessier wrote:
>>> This set of patches concerns mmsd and is related to delivery_report.
>>> Add delivery report flag and API (to set its value) to service.
>>> Get and track the delivery report setting used by oFono in the message
>>> manager
>>> and use it in mmsd.
>>
>> Maybe I'm not seeing something, but why are we tracking the delivery
>> report flag in oFono in mmsd? I'm guessing you want to synchronize the
>> two, but I do not see why you would want to?
>>
>> Regards,
>> -Denis
>>
>
> This flag is set by the application layer to request delivery report in
> oFono, since mmsd is an oFono plugin I want to use the same flag for all
> kind of messages (SMS and MMS) and not add a new flag in mmsd.
>
> If you prefer, I define a new flag (with almost the same API and file
> settings mechanism) in mmsd. Let me know.
>

I think that would be a good idea, the two delivery report settings are 
not really related and should be controlled separately.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] mmsd: get delivery_report setting
  2012-07-16  7:25 ` [PATCH 0/3] mmsd: get delivery_report setting Denis Kenzior
@ 2012-07-17  8:22   ` Ronald Tessier
  2012-07-17  2:00     ` Denis Kenzior
  0 siblings, 1 reply; 7+ messages in thread
From: Ronald Tessier @ 2012-07-17  8:22 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 957 bytes --]

Hi Denis,

On 07/16/2012 09:25 AM, Denis Kenzior wrote:
> Hi Ronald,
>
> On 07/06/2012 04:32 AM, Ronald Tessier wrote:
>> This set of patches concerns mmsd and is related to delivery_report.
>> Add delivery report flag and API (to set its value) to service.
>> Get and track the delivery report setting used by oFono in the message
>> manager
>> and use it in mmsd.
>
> Maybe I'm not seeing something, but why are we tracking the delivery
> report flag in oFono in mmsd?  I'm guessing you want to synchronize the
> two, but I do not see why you would want to?
>
> Regards,
> -Denis
>

This flag is set by the application layer to request delivery report in 
oFono, since mmsd is an oFono plugin I want to use the same flag for all 
kind of messages (SMS and MMS) and not add a new flag in mmsd.

If you prefer, I define a new flag (with almost the same API and file 
settings mechanism) in mmsd. Let me know.

Regards,

Ronald

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-07-17  8:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-06  9:32 [PATCH 0/3] mmsd: get delivery_report setting Ronald Tessier
2012-07-06  9:32 ` [PATCH 1/3] service: manage delivery report setting Ronald Tessier
2012-07-06  9:32 ` [PATCH 2/3] ofono: Add support for message_manager tracking Ronald Tessier
2012-07-06  9:32 ` [PATCH 3/3] service: use delivery_report in send_req message Ronald Tessier
2012-07-16  7:25 ` [PATCH 0/3] mmsd: get delivery_report setting Denis Kenzior
2012-07-17  8:22   ` Ronald Tessier
2012-07-17  2:00     ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.