All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] SMS history plugin.
@ 2010-12-29 12:51 Oleg Zhurakivskyy
  2010-12-29 12:51 ` [PATCH 1/9] " Oleg Zhurakivskyy
                   ` (8 more replies)
  0 siblings, 9 replies; 14+ messages in thread
From: Oleg Zhurakivskyy @ 2010-12-29 12:51 UTC (permalink / raw)
  To: ofono

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

Hello,

Please find the SMS history plugin set of patches. The plugin makes it
possible for an application/multiple applications to register for
incoming/outgoing SMS messages and receive them over D-Bus.
The SMS history itself is maintained by a separate application,
which registers to ofonod using this interface.

Regards,
Oleg

Oleg Zhurakivskyy (9):
  SMS history plugin.
  SMS history plugin.
  SMS history plugin documentation.
  SMS history plugin test script.
  oFono smsagent enhancements to permit more flexible parameter set to
    be dispatched.
  oFono smsagent enhancements to permit more flexible parameter set to
    be dispatched.
  Minor modifications due to sms_agent_dispatch_datagram()
    enhancements.
  Minor modifications due to sms_agent_dispatch_datagram()
    enhancements.
  D-Bus rules for SMS history plugin.

 Makefile.am                 |    3 +
 doc/messaging-agent-api.txt |   49 ++++++
 plugins/messaging-agent.c   |  403 +++++++++++++++++++++++++++++++++++++++++++
 plugins/push-notification.c |    2 +-
 plugins/smart-messaging.c   |    4 +-
 src/ofono.conf              |    1 +
 src/smsagent.c              |    5 +
 src/smsagent.h              |    4 +
 test/test-messaging-agent   |   67 +++++++
 9 files changed, 535 insertions(+), 3 deletions(-)
 create mode 100644 doc/messaging-agent-api.txt
 create mode 100644 plugins/messaging-agent.c
 create mode 100644 test/test-messaging-agent


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

* [PATCH 1/9] SMS history plugin.
  2010-12-29 12:51 [PATCH 0/9] SMS history plugin Oleg Zhurakivskyy
@ 2010-12-29 12:51 ` Oleg Zhurakivskyy
  2010-12-29 12:51 ` [PATCH 2/9] " Oleg Zhurakivskyy
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: Oleg Zhurakivskyy @ 2010-12-29 12:51 UTC (permalink / raw)
  To: ofono

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

---
 plugins/messaging-agent.c |  403 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 403 insertions(+), 0 deletions(-)
 create mode 100644 plugins/messaging-agent.c

diff --git a/plugins/messaging-agent.c b/plugins/messaging-agent.c
new file mode 100644
index 0000000..fa93fe8
--- /dev/null
+++ b/plugins/messaging-agent.c
@@ -0,0 +1,403 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <errno.h>
+
+#include <glib.h>
+#include <gdbus.h>
+
+#include <ofono.h>
+#include <smsagent.h>
+
+#define MESSAGING_INTERFACE OFONO_SERVICE ".Messaging"
+#define MESSAGING_AGENT_INTERFACE OFONO_SERVICE ".MessagingAgent"
+
+struct messaging_context_data {
+	struct ofono_history_context *context;
+	GSList *agents;
+};
+
+struct messaging_agent_data {
+	struct messaging_context_data *data;
+	struct sms_agent *agent;
+};
+
+static void messaging_agent_delete(void *data)
+{
+	struct messaging_agent_data *agent_data = data;
+
+	if (!g_slist_find(agent_data->data->agents, agent_data))
+		return;
+
+	DBG("modem=%s: agent=%p",
+		ofono_modem_get_path(agent_data->data->context->modem),
+		agent_data->agent);
+
+	agent_data->data->agents = g_slist_remove(agent_data->data->agents,
+							agent_data);
+	g_free(agent_data);
+}
+
+static void messaging_agents_delete(gpointer user)
+{
+	struct messaging_context_data *data = user;
+
+	DBG("modem=%s", ofono_modem_get_path(data->context->modem));
+
+	while (data->agents) {
+		struct messaging_agent_data *agent_data = data->agents->data;
+		sms_agent_free(agent_data->agent);
+	}
+}
+
+static DBusMessage *messaging_agent_register(DBusConnection *conn,
+						DBusMessage *msg, void *param)
+{
+	const char *agent_path;
+	const char *agent_bus = dbus_message_get_sender(msg);
+	struct messaging_context_data *data = param;
+	struct messaging_agent_data *agent_data;
+	GSList *node;
+
+	if (dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH,
+			&agent_path, DBUS_TYPE_INVALID) == FALSE)
+		return __ofono_error_invalid_args(msg);
+
+	if (!__ofono_dbus_valid_object_path(agent_path))
+		return __ofono_error_invalid_format(msg);
+
+	for (node = data->agents; node; node = g_slist_next(node)) {
+
+		agent_data = node->data;
+
+		if (sms_agent_matches(agent_data->agent, agent_bus,
+					agent_path) == TRUE)
+			return __ofono_error_busy(msg);
+	}
+
+	agent_data = g_try_new0(struct messaging_agent_data, 1);
+	if (agent_data == NULL)
+		return __ofono_error_failed(msg);
+
+	agent_data->data = data;
+	agent_data->agent = sms_agent_new(MESSAGING_AGENT_INTERFACE,
+				dbus_message_get_sender(msg), agent_path);
+	if (agent_data->agent == NULL) {
+		g_free(agent_data);
+		return __ofono_error_failed(msg);
+	}
+
+	data->agents = g_slist_append(data->agents, agent_data);
+
+	DBG("modem=%s: agent=%p %s:%s:%s",
+		ofono_modem_get_path(data->context->modem), agent_data->agent,
+		dbus_message_get_sender(msg), agent_path,
+		MESSAGING_AGENT_INTERFACE);
+
+	sms_agent_set_removed_notify(agent_data->agent, messaging_agent_delete,
+					agent_data);
+
+	return dbus_message_new_method_return(msg);
+}
+
+static DBusMessage *messaging_agent_unregister(DBusConnection *conn,
+						DBusMessage *msg, void *param)
+{
+	const char *agent_path;
+	const char *agent_bus = dbus_message_get_sender(msg);
+	struct messaging_context_data *data = param;
+	GSList *node;
+
+	DBG("");
+
+	if (dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &agent_path,
+				DBUS_TYPE_INVALID) == FALSE)
+		return __ofono_error_invalid_args(msg);
+
+	for (node = data->agents; node; node = g_slist_next(node)) {
+
+		struct messaging_agent_data *agent_data = node->data;
+
+		if (sms_agent_matches(agent_data->agent,
+					agent_bus, agent_path) == FALSE)
+			continue;
+
+		sms_agent_free(agent_data->agent);
+		return dbus_message_new_method_return(msg);
+	}
+
+	return __ofono_error_failed(msg);
+}
+
+struct messaging_agent_dict_entry {
+	char *s;
+	char *v;
+};
+
+static GSList *messaging_agent_dict_entry_append(GSList *l, char *s, char *v)
+{
+	struct messaging_agent_dict_entry *e;
+
+	e = g_try_new0(struct messaging_agent_dict_entry, 1);
+	if (e == NULL)
+		return NULL;
+
+	e->s = g_strdup(s);
+	e->v = g_strdup(v);
+	if (e->s == NULL || e->v == NULL) {
+		g_free(e);
+		return NULL;
+	}
+
+	return g_slist_append(l, e);
+}
+
+static void messaging_agent_dict_delete(GSList *l)
+{
+	while (l) {
+		struct messaging_agent_dict_entry *e = l->data;
+
+		l = g_slist_remove(l, l->data);
+		g_free(e->s);
+		g_free(e->v);
+		g_free(e);
+	}
+}
+
+static void messaging_agent_dict_append_cb(DBusMessageIter *dict, void *param)
+{
+	GSList *node;
+
+	for (node = (GSList *)param; node; node = g_slist_next(node)) {
+
+		struct messaging_agent_dict_entry *e = node->data;
+
+		ofono_dbus_dict_append(dict, e->s, DBUS_TYPE_STRING, &e->v);
+	}
+}
+
+static void messaging_agent_sms_received(struct ofono_history_context *context,
+						const struct ofono_uuid *uuid,
+						const char *from,
+						const struct tm *remote,
+						const struct tm *local,
+						const char *text)
+{
+	GSList *node;
+	GSList *entries = NULL;
+	struct messaging_context_data *data = context->data;
+
+	entries = messaging_agent_dict_entry_append(entries, (char *)"UUID",
+					(char *)ofono_uuid_to_str(uuid));
+
+	for (node = data->agents; node; node = g_slist_next(node)) {
+		struct messaging_agent_data *agent_data = node->data;
+
+		DBG("modem=%s -> agent=%p: text=\"%s\"",
+			ofono_modem_get_path(data->context->modem),
+			agent_data->agent, text);
+
+		sms_agent_dispatch_datagram(agent_data->agent,
+					"MessageReceived",
+					from, remote, local,
+					(unsigned char *)text,
+					strlen(text), NULL, NULL,
+					messaging_agent_dict_append_cb,
+					(void *)entries, NULL);
+	}
+
+	messaging_agent_dict_delete(entries);
+}
+
+static void messaging_agent_sms_send_pending(
+				struct ofono_history_context *context,
+				const struct ofono_uuid *uuid,
+				const char *to, time_t when,
+				const char *text)
+{
+	GSList *node;
+	GSList *entries = NULL;
+	struct messaging_context_data *data = context->data;
+
+	entries = messaging_agent_dict_entry_append(entries, (char *)"UUID",
+					(char *)ofono_uuid_to_str(uuid));
+
+	for (node = data->agents; node; node = g_slist_next(node)) {
+		struct messaging_agent_data *agent_data = node->data;
+
+		DBG("modem=%s -> agent=%p: text=\"%s\"",
+			ofono_modem_get_path(data->context->modem),
+			agent_data->agent, text);
+
+		sms_agent_dispatch_datagram(agent_data->agent,
+						"MessageSendPending",
+						to, localtime(&when),
+						localtime(&when),
+						(unsigned char *)text,
+						strlen(text), NULL, NULL,
+						messaging_agent_dict_append_cb,
+						(void *)entries, NULL);
+	}
+
+	messaging_agent_dict_delete(entries);
+}
+
+#undef _
+#define _(_x) case _x: return #_x
+
+static char *messaging_agent_sms_status(enum ofono_history_sms_status s)
+{
+	switch (s) {
+		_(OFONO_HISTORY_SMS_STATUS_PENDING);
+		_(OFONO_HISTORY_SMS_STATUS_SUBMITTED);
+		_(OFONO_HISTORY_SMS_STATUS_SUBMIT_FAILED);
+		_(OFONO_HISTORY_SMS_STATUS_DELIVERED);
+		_(OFONO_HISTORY_SMS_STATUS_DELIVER_FAILED);
+	}
+	return "OFONO_HISTORY_SMS_STATUS_<UNKNOWN>";
+}
+
+static void messaging_agent_sms_send_status(
+					struct ofono_history_context *context,
+					const struct ofono_uuid *uuid,
+					time_t when,
+					enum ofono_history_sms_status s)
+{
+	GSList *node;
+	GSList *entries = NULL;
+	struct messaging_context_data *data = context->data;
+
+	entries = messaging_agent_dict_entry_append(entries, (char *)"UUID",
+			(char *)ofono_uuid_to_str(uuid));
+	entries = messaging_agent_dict_entry_append(entries, (char *)"Status",
+			(char *)messaging_agent_sms_status(s));
+
+	for (node = data->agents; node; node = g_slist_next(node)) {
+		struct messaging_agent_data *agent_data = node->data;
+
+		DBG("modem=%s -> agent=%p: status=%s",
+			ofono_modem_get_path(data->context->modem),
+			agent_data->agent,
+			messaging_agent_sms_status(s));
+
+		sms_agent_dispatch_datagram(agent_data->agent,
+						"MessageSendStatus",
+						NULL, localtime(&when),
+						localtime(&when), NULL, 0,
+						NULL, NULL,
+						messaging_agent_dict_append_cb,
+						(void *)entries, NULL);
+	}
+
+	messaging_agent_dict_delete(entries);
+}
+
+static GDBusMethodTable messaging_agent_methods[] = {
+	{ "AgentRegister",	"o", "", messaging_agent_register },
+	{ "AgentUnregister",	"o", "", messaging_agent_unregister },
+	{ }
+};
+
+static int messaging_agent_probe(struct ofono_history_context *context)
+{
+	if (context->data) {
+		ofono_error("modem=%s: data already exists: data=%p",
+				ofono_modem_get_path(context->modem),
+				context->data);
+		return -EEXIST;
+	}
+
+	context->data = g_try_new0(struct messaging_context_data, 1);
+	if (context->data == NULL)
+		return -ENOMEM;
+
+	memset(context->data, 0, sizeof(struct messaging_context_data));
+	((struct messaging_context_data *)context->data)->context = context;
+
+	DBG("modem=%s: data=%p", ofono_modem_get_path(context->modem),
+		context->data);
+
+	if (!g_dbus_register_interface(ofono_dbus_get_connection(),
+					ofono_modem_get_path(context->modem),
+					MESSAGING_INTERFACE,
+					messaging_agent_methods,
+					NULL, NULL, context->data, NULL)) {
+		ofono_error("Can't register dbus interface %s",
+				MESSAGING_INTERFACE);
+		return -1;
+	}
+
+	ofono_modem_add_interface(context->modem, MESSAGING_INTERFACE);
+
+	return 0;
+}
+
+static void messaging_agent_remove(struct ofono_history_context *context)
+{
+	DBG("modem=%s data=%p", ofono_modem_get_path(context->modem),
+		context->data);
+
+	messaging_agents_delete(context->data);
+
+	ofono_modem_remove_interface(context->modem, MESSAGING_INTERFACE);
+
+	if (!g_dbus_unregister_interface(ofono_dbus_get_connection(),
+		ofono_modem_get_path(context->modem),
+		MESSAGING_INTERFACE))
+		ofono_error("Can't unregister dbus interface %s",
+				MESSAGING_INTERFACE);
+
+	g_free(context->data);
+}
+
+static struct ofono_history_driver messaging_agent_driver = {
+	.name = "Messaging Agent",
+	.probe = messaging_agent_probe,
+	.remove = messaging_agent_remove,
+	.sms_received = messaging_agent_sms_received,
+	.sms_send_pending = messaging_agent_sms_send_pending,
+	.sms_send_status = messaging_agent_sms_send_status,
+};
+
+static int messaging_agent_init()
+{
+	DBG("");
+
+	ofono_history_driver_register(&messaging_agent_driver);
+
+	return 0;
+}
+
+static void messaging_agent_exit()
+{
+	DBG("");
+
+	ofono_history_driver_unregister(&messaging_agent_driver);
+}
+
+OFONO_PLUGIN_DEFINE(messaging_agent, "Messaging Agent", VERSION,
+			OFONO_PLUGIN_PRIORITY_DEFAULT,
+			messaging_agent_init, messaging_agent_exit)
-- 
1.7.1


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

* [PATCH 2/9] SMS history plugin.
  2010-12-29 12:51 [PATCH 0/9] SMS history plugin Oleg Zhurakivskyy
  2010-12-29 12:51 ` [PATCH 1/9] " Oleg Zhurakivskyy
@ 2010-12-29 12:51 ` Oleg Zhurakivskyy
  2010-12-29 12:51 ` [PATCH 3/9] SMS history plugin documentation Oleg Zhurakivskyy
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: Oleg Zhurakivskyy @ 2010-12-29 12:51 UTC (permalink / raw)
  To: ofono

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

---
 Makefile.am |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index dfdb7bd..d30d2e6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -310,6 +310,9 @@ builtin_sources += plugins/smart-messaging.c
 builtin_modules += push_notification
 builtin_sources += plugins/push-notification.c
 
+builtin_modules += messaging_agent
+builtin_sources += plugins/messaging-agent.c
+
 sbin_PROGRAMS = src/ofonod
 
 src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) src/ofono.ver \
-- 
1.7.1


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

* [PATCH 3/9] SMS history plugin documentation.
  2010-12-29 12:51 [PATCH 0/9] SMS history plugin Oleg Zhurakivskyy
  2010-12-29 12:51 ` [PATCH 1/9] " Oleg Zhurakivskyy
  2010-12-29 12:51 ` [PATCH 2/9] " Oleg Zhurakivskyy
@ 2010-12-29 12:51 ` Oleg Zhurakivskyy
  2010-12-29 12:51 ` [PATCH 4/9] SMS history plugin test script Oleg Zhurakivskyy
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: Oleg Zhurakivskyy @ 2010-12-29 12:51 UTC (permalink / raw)
  To: ofono

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

---
 doc/messaging-agent-api.txt |   49 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)
 create mode 100644 doc/messaging-agent-api.txt

diff --git a/doc/messaging-agent-api.txt b/doc/messaging-agent-api.txt
new file mode 100644
index 0000000..956ec55
--- /dev/null
+++ b/doc/messaging-agent-api.txt
@@ -0,0 +1,49 @@
+Messaging hierarchy
+===============
+
+Service		org.ofono
+Interface	org.ofono.Messaging
+Object path	[variable prefix]/{modem0,modem1,...}
+
+Methods		void AgentRegister(object path)
+
+			Registers an agent which will be notified on SMS events.
+
+		void AgentUnregister(object path)
+
+			Unregisters an agent.
+
+MessagingAgent Hierarchy [experimental]
+===============
+
+Service		unique name
+Interface	org.ofono.MessagingAgent
+Object path	freely definable
+
+Methods		void MessageReceived(array{byte} appointment, dict info)
+
+			Requests the agent to process incoming SMS.
+			The info dictionary contains 'Sender',
+			'LocalSentTime', 'SentTime' and 'UUID' properties.
+
+		void MessageSendPending(array{byte} card, dict info)
+
+			Requests the agent to process outgoing SMS.
+
+			The info dictionary contains 'Sender',
+			'LocalSentTime', 'SentTime' and 'UUID' properties.
+
+		void MessageSendStatus(array{byte} card, dict info)
+
+			Requests the agent to process an outgoing SMS
+			send status notification.
+
+			The info dictionary contains 'Sender',
+			'LocalSentTime', 'SentTime', 'UUID' and 'Status'
+			properties.
+
+		void Release()
+
+			Agent is being released, possibly because of oFono
+			terminating, SMS agent interface is being torn down
+			or modem off.  No UnregisterAgent call is needed.
-- 
1.7.1


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

* [PATCH 4/9] SMS history plugin test script.
  2010-12-29 12:51 [PATCH 0/9] SMS history plugin Oleg Zhurakivskyy
                   ` (2 preceding siblings ...)
  2010-12-29 12:51 ` [PATCH 3/9] SMS history plugin documentation Oleg Zhurakivskyy
@ 2010-12-29 12:51 ` Oleg Zhurakivskyy
  2010-12-29 12:51 ` [PATCH 5/9] oFono smsagent enhancements to permit more flexible parameter set to be dispatched Oleg Zhurakivskyy
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: Oleg Zhurakivskyy @ 2010-12-29 12:51 UTC (permalink / raw)
  To: ofono

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

---
 test/test-messaging-agent |   67 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 67 insertions(+), 0 deletions(-)
 create mode 100644 test/test-messaging-agent

diff --git a/test/test-messaging-agent b/test/test-messaging-agent
new file mode 100644
index 0000000..85d07f2
--- /dev/null
+++ b/test/test-messaging-agent
@@ -0,0 +1,67 @@
+#!/usr/bin/python
+
+import gobject
+import sys
+import dbus
+import dbus.service
+import dbus.mainloop.glib
+
+def message_print(method, data, props):
+	string = ""
+	for byte in data:
+		string += str(byte)
+	print "%s" % method
+	print "%-15s%s" % ("Text", string)
+	for key in props.keys():
+		print "%-15s%s" % (key, props[key])
+
+class MessagingAgent(dbus.service.Object):
+	@dbus.service.method("org.ofono.MessagingAgent",
+					in_signature="", out_signature="")
+	def Release(self):
+		print "Release"
+		mainloop.quit()
+
+	@dbus.service.method("org.ofono.MessagingAgent",
+				in_signature="aya{sv}", out_signature="")
+	def MessageReceived(self, data, props):
+		message_print("MessageReceived", data, props)
+
+	@dbus.service.method("org.ofono.MessagingAgent",
+				in_signature="aya{sv}", out_signature="")
+	def MessageSendPending(self, data, props):
+		message_print("MessageSendPending", data, props)
+
+	@dbus.service.method("org.ofono.MessagingAgent",
+				in_signature="aya{sv}", out_signature="")
+	def MessageSendStatus(self, data, props):
+		message_print("MessageSendStatus", data, props)
+
+if __name__ == '__main__':
+	dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+	bus = dbus.SystemBus()
+
+	manager = dbus.Interface(bus.get_object("org.ofono", "/"),
+						"org.ofono.Manager")
+	modems = manager.GetModems()
+
+	for path, properties in modems:
+		if "org.ofono.Messaging" not in properties["Interfaces"]:
+			continue
+
+		pn = dbus.Interface(bus.get_object('org.ofono', path),
+					'org.ofono.Messaging')
+
+	path = "/test/agent"
+	agent = MessagingAgent(bus, path)
+	pn.AgentRegister(path)
+	print "MessagingAgent registered"
+
+	mainloop = gobject.MainLoop()
+
+	try:
+		mainloop.run()
+	except KeyboardInterrupt:
+		pn.AgentUnregister(path)
+		mainloop.run()
-- 
1.7.1


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

* [PATCH 5/9] oFono smsagent enhancements to permit more flexible parameter set to be dispatched.
  2010-12-29 12:51 [PATCH 0/9] SMS history plugin Oleg Zhurakivskyy
                   ` (3 preceding siblings ...)
  2010-12-29 12:51 ` [PATCH 4/9] SMS history plugin test script Oleg Zhurakivskyy
@ 2010-12-29 12:51 ` Oleg Zhurakivskyy
  2010-12-29 12:51 ` [PATCH 6/9] " Oleg Zhurakivskyy
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: Oleg Zhurakivskyy @ 2010-12-29 12:51 UTC (permalink / raw)
  To: ofono

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

---
 src/smsagent.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/smsagent.c b/src/smsagent.c
index 9d6f21d..12f6da3 100644
--- a/src/smsagent.c
+++ b/src/smsagent.c
@@ -255,6 +255,8 @@ int sms_agent_dispatch_datagram(struct sms_agent *agent, const char *method,
 				const struct tm *local_sent_time,
 				const unsigned char *content, unsigned int len,
 				sms_agent_dispatch_cb cb, void *user_data,
+				sms_agent_dict_append_cb dict_cb,
+				void *dict_cb_data,
 				ofono_destroy_func destroy)
 {
 	struct sms_agent_request *req;
@@ -299,6 +301,9 @@ int sms_agent_dispatch_datagram(struct sms_agent *agent, const char *method,
 
 	ofono_dbus_dict_append(&dict, "Sender", DBUS_TYPE_STRING, &from);
 
+	if (dict_cb)
+		dict_cb(&dict, dict_cb_data);
+
 	dbus_message_iter_close_container(&iter, &dict);
 
 	if (!dbus_connection_send_with_reply(conn, req->msg, &req->call, -1)) {
-- 
1.7.1


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

* [PATCH 6/9] oFono smsagent enhancements to permit more flexible parameter set to be dispatched.
  2010-12-29 12:51 [PATCH 0/9] SMS history plugin Oleg Zhurakivskyy
                   ` (4 preceding siblings ...)
  2010-12-29 12:51 ` [PATCH 5/9] oFono smsagent enhancements to permit more flexible parameter set to be dispatched Oleg Zhurakivskyy
@ 2010-12-29 12:51 ` Oleg Zhurakivskyy
  2011-01-27 13:18   ` Marcel Holtmann
  2010-12-29 12:51 ` [PATCH 7/9] Minor modifications due to sms_agent_dispatch_datagram() enhancements Oleg Zhurakivskyy
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 14+ messages in thread
From: Oleg Zhurakivskyy @ 2010-12-29 12:51 UTC (permalink / raw)
  To: ofono

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

---
 src/smsagent.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/smsagent.h b/src/smsagent.h
index 39513d6..348d36d 100644
--- a/src/smsagent.h
+++ b/src/smsagent.h
@@ -31,6 +31,8 @@ typedef void (*sms_agent_dispatch_cb)(struct sms_agent *agent,
 					enum sms_agent_result result,
 					void *data);
 
+typedef void (*sms_agent_dict_append_cb)(DBusMessageIter *dict, void *param);
+
 struct sms_agent *sms_agent_new(const char *interface,
 					const char *service, const char *path);
 
@@ -49,4 +51,6 @@ int sms_agent_dispatch_datagram(struct sms_agent *agent, const char *method,
 				const struct tm *local_sent_time,
 				const unsigned char *content, unsigned int len,
 				sms_agent_dispatch_cb cb, void *user_data,
+				sms_agent_dict_append_cb dict_cb,
+				void *dict_cb_data,
 				ofono_destroy_func destroy);
-- 
1.7.1


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

* [PATCH 7/9] Minor modifications due to sms_agent_dispatch_datagram() enhancements.
  2010-12-29 12:51 [PATCH 0/9] SMS history plugin Oleg Zhurakivskyy
                   ` (5 preceding siblings ...)
  2010-12-29 12:51 ` [PATCH 6/9] " Oleg Zhurakivskyy
@ 2010-12-29 12:51 ` Oleg Zhurakivskyy
  2010-12-29 12:51 ` [PATCH 8/9] " Oleg Zhurakivskyy
  2010-12-29 12:51 ` [PATCH 9/9] D-Bus rules for SMS history plugin Oleg Zhurakivskyy
  8 siblings, 0 replies; 14+ messages in thread
From: Oleg Zhurakivskyy @ 2010-12-29 12:51 UTC (permalink / raw)
  To: ofono

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

---
 plugins/push-notification.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/plugins/push-notification.c b/plugins/push-notification.c
index d910f70..75f013b 100644
--- a/plugins/push-notification.c
+++ b/plugins/push-notification.c
@@ -84,7 +84,7 @@ static void push_received(const char *from, const struct tm *remote,
 
 	sms_agent_dispatch_datagram(pn->agent, "ReceiveNotification",
 					from, remote, local, buffer, len,
-					NULL, NULL, NULL);
+					NULL, NULL, NULL, NULL, NULL);
 }
 
 static DBusMessage *push_notification_register_agent(DBusConnection *conn,
-- 
1.7.1


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

* [PATCH 8/9] Minor modifications due to sms_agent_dispatch_datagram() enhancements.
  2010-12-29 12:51 [PATCH 0/9] SMS history plugin Oleg Zhurakivskyy
                   ` (6 preceding siblings ...)
  2010-12-29 12:51 ` [PATCH 7/9] Minor modifications due to sms_agent_dispatch_datagram() enhancements Oleg Zhurakivskyy
@ 2010-12-29 12:51 ` Oleg Zhurakivskyy
  2010-12-29 12:51 ` [PATCH 9/9] D-Bus rules for SMS history plugin Oleg Zhurakivskyy
  8 siblings, 0 replies; 14+ messages in thread
From: Oleg Zhurakivskyy @ 2010-12-29 12:51 UTC (permalink / raw)
  To: ofono

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

---
 plugins/smart-messaging.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugins/smart-messaging.c b/plugins/smart-messaging.c
index e7889f2..4554ab3 100644
--- a/plugins/smart-messaging.c
+++ b/plugins/smart-messaging.c
@@ -87,7 +87,7 @@ static void vcard_received(const char *from, const struct tm *remote,
 
 	sms_agent_dispatch_datagram(sm->agent, "ReceiveBusinessCard",
 					from, remote, local, buffer, len,
-					NULL, NULL, NULL);
+					NULL, NULL, NULL, NULL, NULL);
 }
 
 static void vcal_received(const char *from, const struct tm *remote,
@@ -102,7 +102,7 @@ static void vcal_received(const char *from, const struct tm *remote,
 
 	sms_agent_dispatch_datagram(sm->agent, "ReceiveAppointment",
 					from, remote, local, buffer, len,
-					NULL, NULL, NULL);
+					NULL, NULL, NULL, NULL, NULL);
 }
 
 static DBusMessage *smart_messaging_register_agent(DBusConnection *conn,
-- 
1.7.1


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

* [PATCH 9/9] D-Bus rules for SMS history plugin.
  2010-12-29 12:51 [PATCH 0/9] SMS history plugin Oleg Zhurakivskyy
                   ` (7 preceding siblings ...)
  2010-12-29 12:51 ` [PATCH 8/9] " Oleg Zhurakivskyy
@ 2010-12-29 12:51 ` Oleg Zhurakivskyy
  8 siblings, 0 replies; 14+ messages in thread
From: Oleg Zhurakivskyy @ 2010-12-29 12:51 UTC (permalink / raw)
  To: ofono

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

---
 src/ofono.conf |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/ofono.conf b/src/ofono.conf
index 0dfa038..18221f9 100644
--- a/src/ofono.conf
+++ b/src/ofono.conf
@@ -13,6 +13,7 @@
     <allow send_interface="org.ofono.SimToolkitAgent"/>
     <allow send_interface="org.ofono.PushNotificationAgent"/>
     <allow send_interface="org.ofono.SmartMessagingAgent"/>
+    <allow send_interface="org.ofono.MessagingAgent"/>
   </policy>
 
   <policy at_console="true">
-- 
1.7.1


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

* Re: [PATCH 6/9] oFono smsagent enhancements to permit more flexible parameter set to be dispatched.
  2010-12-29 12:51 ` [PATCH 6/9] " Oleg Zhurakivskyy
@ 2011-01-27 13:18   ` Marcel Holtmann
  2011-01-27 14:38     ` oleg.zhurakivskyy
  0 siblings, 1 reply; 14+ messages in thread
From: Marcel Holtmann @ 2011-01-27 13:18 UTC (permalink / raw)
  To: ofono

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

Hi Oleg,

>  src/smsagent.h |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/src/smsagent.h b/src/smsagent.h
> index 39513d6..348d36d 100644
> --- a/src/smsagent.h
> +++ b/src/smsagent.h
> @@ -31,6 +31,8 @@ typedef void (*sms_agent_dispatch_cb)(struct sms_agent *agent,
>  					enum sms_agent_result result,
>  					void *data);
>  
> +typedef void (*sms_agent_dict_append_cb)(DBusMessageIter *dict, void *param);
> +
>  struct sms_agent *sms_agent_new(const char *interface,
>  					const char *service, const char *path);
>  
> @@ -49,4 +51,6 @@ int sms_agent_dispatch_datagram(struct sms_agent *agent, const char *method,
>  				const struct tm *local_sent_time,
>  				const unsigned char *content, unsigned int len,
>  				sms_agent_dispatch_cb cb, void *user_data,
> +				sms_agent_dict_append_cb dict_cb,
> +				void *dict_cb_data,
>  				ofono_destroy_func destroy);

I have a bunch of comments for the other patches, but what is this
about? I don't see any need to it.

Regards

Marcel



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

* RE: [PATCH 6/9] oFono smsagent enhancements to permit more flexible parameter set to be dispatched.
  2011-01-27 13:18   ` Marcel Holtmann
@ 2011-01-27 14:38     ` oleg.zhurakivskyy
  2011-01-27 22:40       ` Marcel Holtmann
  0 siblings, 1 reply; 14+ messages in thread
From: oleg.zhurakivskyy @ 2011-01-27 14:38 UTC (permalink / raw)
  To: ofono

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

Hello Marcel,

That's in order to include the uuid (so we can correlate sms_send_pending and sms_send_status). Possibly, in order to include some other parameters, without affecting the other users of the sms_agent_dispatch_datagram().

Please take a look into the messaging_agent_sms_send_pending(), messaging_agent_sms_send_status() in order to get a better understanding of the use.

Regards,
Oleg
________________________________________
From: ofono-bounces(a)ofono.org [ofono-bounces(a)ofono.org] on behalf of ext Marcel Holtmann [marcel(a)holtmann.org]

> diff --git a/src/smsagent.h b/src/smsagent.h

I have a bunch of comments for the other patches, but what is this
about? I don't see any need to it.

Regards

Marcel

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

* RE: [PATCH 6/9] oFono smsagent enhancements to permit more flexible parameter set to be dispatched.
  2011-01-27 14:38     ` oleg.zhurakivskyy
@ 2011-01-27 22:40       ` Marcel Holtmann
  2011-01-31  8:30         ` Oleg Zhurakivskyy
  0 siblings, 1 reply; 14+ messages in thread
From: Marcel Holtmann @ 2011-01-27 22:40 UTC (permalink / raw)
  To: ofono

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

Hi Oleg,

so first things first, please no top posting on this mailing list.

> That's in order to include the uuid (so we can correlate sms_send_pending and sms_send_status). Possibly, in order to include some other parameters, without affecting the other users of the sms_agent_dispatch_datagram().
> 
> Please take a look into the messaging_agent_sms_send_pending(), messaging_agent_sms_send_status() in order to get a better understanding of the use.

After talking to Kai I have an idea what you are aiming for. I think you
are looking at the wrong API. You should look at the history API. Check
out examples/history.c. That gives you the whole set of incoming and
outgoing SMS and their status. It also includes the UUID for exactly the
propose of proper tracking and storage.

Regards

Marcel



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

* Re: [PATCH 6/9] oFono smsagent enhancements to permit more flexible parameter set to be dispatched.
  2011-01-27 22:40       ` Marcel Holtmann
@ 2011-01-31  8:30         ` Oleg Zhurakivskyy
  0 siblings, 0 replies; 14+ messages in thread
From: Oleg Zhurakivskyy @ 2011-01-31  8:30 UTC (permalink / raw)
  To: ofono

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


Hello Marcel,

On 01/28/2011 12:40 AM, ext Marcel Holtmann wrote:

> After talking to Kai I have an idea what you are aiming for. I think you
> are looking at the wrong API. You should look at the history API. Check
> out examples/history.c. That gives you the whole set of incoming and
> outgoing SMS and their status. It also includes the UUID for exactly the
> propose of proper tracking and storage.

Please take a look into plugins/messaging-agent.c, this API is already 
being used in order to receive the SMS events.

The smsagent.c API is just used for dispatching those events to the 
registered agents.

Regards,
Oleg

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

end of thread, other threads:[~2011-01-31  8:30 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-29 12:51 [PATCH 0/9] SMS history plugin Oleg Zhurakivskyy
2010-12-29 12:51 ` [PATCH 1/9] " Oleg Zhurakivskyy
2010-12-29 12:51 ` [PATCH 2/9] " Oleg Zhurakivskyy
2010-12-29 12:51 ` [PATCH 3/9] SMS history plugin documentation Oleg Zhurakivskyy
2010-12-29 12:51 ` [PATCH 4/9] SMS history plugin test script Oleg Zhurakivskyy
2010-12-29 12:51 ` [PATCH 5/9] oFono smsagent enhancements to permit more flexible parameter set to be dispatched Oleg Zhurakivskyy
2010-12-29 12:51 ` [PATCH 6/9] " Oleg Zhurakivskyy
2011-01-27 13:18   ` Marcel Holtmann
2011-01-27 14:38     ` oleg.zhurakivskyy
2011-01-27 22:40       ` Marcel Holtmann
2011-01-31  8:30         ` Oleg Zhurakivskyy
2010-12-29 12:51 ` [PATCH 7/9] Minor modifications due to sms_agent_dispatch_datagram() enhancements Oleg Zhurakivskyy
2010-12-29 12:51 ` [PATCH 8/9] " Oleg Zhurakivskyy
2010-12-29 12:51 ` [PATCH 9/9] D-Bus rules for SMS history plugin Oleg Zhurakivskyy

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.