All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5 v3] Network Time plugin
@ 2011-01-13  9:49 Antti Paila
  2011-01-13  9:49 ` [PATCH 1/5 v3] nettime: Header file for nettime plugins Antti Paila
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Antti Paila @ 2011-01-13  9:49 UTC (permalink / raw)
  To: ofono

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

 This series of patches introduces the network time part of
 the NITZ feature as outlined in 3GPP spec 22.042.
 The plugin is for delivering network indicated time information
 to timed process which is responsible for maintaining the system
 time. The delivery is achieved by timed implementing an interface
 with a method that is called by the nettime plugin with time related
 info as a parameter of the method.

Antti Paila (5):
  nettime: Header file for nettime plugins
  nettime: Network time plugin implementation
  nettime: DBUS and compilation configuration
  nettime: Documentation
  nettime: Mock Timed for testing

 Makefile.am              |    9 +-
 doc/network-time-api.txt |   36 +++++
 include/nettime.h        |    4 +
 plugins/nettime.c        |  317 ++++++++++++++++++++++++++++++++++++++++++++++
 src/ofono.conf           |    2 +
 test/test-nettime        |   35 +++++
 6 files changed, 401 insertions(+), 2 deletions(-)
 create mode 100644 doc/network-time-api.txt
 create mode 100644 plugins/nettime.c
 create mode 100755 test/test-nettime


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

* [PATCH 1/5 v3] nettime: Header file for nettime plugins
  2011-01-13  9:49 [PATCH 0/5 v3] Network Time plugin Antti Paila
@ 2011-01-13  9:49 ` Antti Paila
  2011-01-13 12:58   ` Aki Niemi
  2011-01-13  9:49 ` [PATCH 2/5 v3] nettime: Network time plugin implementation Antti Paila
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 18+ messages in thread
From: Antti Paila @ 2011-01-13  9:49 UTC (permalink / raw)
  To: ofono

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

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

diff --git a/include/nettime.h b/include/nettime.h
index 0f23cc7..2f73e1a 100644
--- a/include/nettime.h
+++ b/include/nettime.h
@@ -31,6 +31,10 @@ struct ofono_network_time;
 struct ofono_nettime_context {
 	struct ofono_nettime_driver *driver;
 	struct ofono_modem *modem;
+	unsigned int timed_watch;
+	gboolean timed_present;
+	struct ofono_netreg *netreg;
+	unsigned int netreg_st_watch;
 	void *data;
 };
 
-- 
1.7.1


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

* [PATCH 2/5 v3] nettime: Network time plugin implementation
  2011-01-13  9:49 [PATCH 0/5 v3] Network Time plugin Antti Paila
  2011-01-13  9:49 ` [PATCH 1/5 v3] nettime: Header file for nettime plugins Antti Paila
@ 2011-01-13  9:49 ` Antti Paila
  2011-01-13  9:49 ` [PATCH 3/5 v3] nettime: DBUS and compilation configuration Antti Paila
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 18+ messages in thread
From: Antti Paila @ 2011-01-13  9:49 UTC (permalink / raw)
  To: ofono

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

---
 plugins/nettime.c |  317 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 317 insertions(+), 0 deletions(-)
 create mode 100644 plugins/nettime.c

diff --git a/plugins/nettime.c b/plugins/nettime.c
new file mode 100644
index 0000000..ee24320
--- /dev/null
+++ b/plugins/nettime.c
@@ -0,0 +1,317 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-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 <stdlib.h>
+#include <glib.h>
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include <ofono/plugin.h>
+#include <ofono/log.h>
+#include <ofono/nettime.h>
+#include <ofono/types.h>
+#include <gdbus.h>
+#include "ofono.h"
+
+#include "common.h"
+
+#define TIMED_PATH "/com/meego/time"
+#define TIMED_SERVICE "com.meego.time"
+
+struct nt_data {
+	gboolean time_available;
+	gboolean time_pending;
+
+	time_t nw_time_utc;
+	time_t received;
+
+	int dst;
+	int time_zone;
+
+	const char *mcc;
+	const char *mnc;
+};
+
+static void nettime_register(struct ofono_nettime_context *);
+
+static gboolean encode_time_format(struct ofono_network_time *time,
+				 struct tm *tm)
+{
+	if (time->year < 0)
+		return FALSE;
+
+	tm->tm_year = time->year - 1900;
+	tm->tm_mon = time->mon - 1;
+	tm->tm_mday = time->mday;
+	tm->tm_hour = time->hour;
+	tm->tm_min = time->min;
+	tm->tm_sec = time->sec;
+	tm->tm_gmtoff = time->utcoff;
+	tm->tm_isdst = time->dst;
+
+	return TRUE;
+}
+
+static time_t get_monotonic_time()
+{
+	struct timespec ts;
+	clock_gettime(CLOCK_MONOTONIC, &ts);
+	return ts.tv_sec;
+}
+
+static int fill_time_notification(DBusMessage *msg,
+		struct nt_data *ntd)
+{
+	DBusMessageIter iter, iter_array;
+	time_t utc;
+
+	dbus_message_iter_init_append(msg, &iter);
+	dbus_message_iter_open_container(&iter,
+					DBUS_TYPE_ARRAY,
+					"{sv}",
+					&iter_array);
+
+	if (ntd->time_pending) {
+		if (ntd->time_available) {
+			utc = ntd->nw_time_utc - ntd->received;
+
+			ofono_dbus_dict_append(&iter_array,
+						"UTC",
+						DBUS_TYPE_INT64,
+						&utc);
+			ofono_dbus_dict_append(&iter_array,
+						"DST",
+						DBUS_TYPE_UINT32,
+						&ntd->dst);
+		}
+
+		ofono_dbus_dict_append(&iter_array,
+					"Timezone",
+					DBUS_TYPE_INT32,
+					&ntd->time_zone);
+	}
+
+	ofono_dbus_dict_append(&iter_array,
+			"MobileCountryCode",
+			DBUS_TYPE_STRING,
+			&ntd->mcc);
+	ofono_dbus_dict_append(&iter_array,
+			"MobileNetworkCode",
+			DBUS_TYPE_STRING,
+			&ntd->mnc);
+
+	dbus_message_iter_close_container(&iter, &iter_array);
+	return 0;
+}
+
+static DBusMessage *create_time_notification(
+			struct ofono_nettime_context *context)
+{
+	DBusMessage *message;
+	struct nt_data *ntd = context->data;
+	const char *path = ofono_modem_get_path(context->modem);
+
+	if (path == NULL) {
+		ofono_error("Fetching path for modem failed");
+		return NULL;
+	}
+
+	message = dbus_message_new_method_call(TIMED_SERVICE, TIMED_PATH,
+					"org.ofono.NetworkTime", "Notify");
+	if (message == NULL)
+		return NULL;
+
+	dbus_message_set_no_reply(message, TRUE);
+	fill_time_notification(message, ntd);
+
+	return message;
+}
+
+static void init_time(struct ofono_nettime_context *context)
+{
+	struct nt_data *nt_data = g_new0(struct nt_data, 1);
+
+	nt_data->time_available = FALSE;
+	nt_data->time_pending = FALSE;
+	nt_data->dst = 0;
+	nt_data->time_zone = 0;
+
+	context->data = nt_data;
+}
+
+static int nettime_probe(struct ofono_nettime_context *context)
+{
+	DBG("Network Time Probe for modem: %p", context->modem);
+
+	init_time(context);
+	nettime_register(context);
+
+	return 0;
+}
+
+static void nettime_remove(struct ofono_nettime_context *context)
+{
+	DBG("Network Time Remove for modem: %p", context->modem);
+	g_dbus_remove_watch(ofono_dbus_get_connection(),
+				context->timed_watch);
+	g_free(context->data);
+}
+
+static void notify(int status, int lac, int ci, int tech, const char *mcc,
+			const char *mnc, void *data)
+{
+	struct ofono_nettime_context *context = data;
+	struct nt_data *ntd = context->data;
+	DBusMessage *message;
+
+	if (mcc == NULL || mnc == NULL)
+		return;
+
+	ntd->mcc = mcc;
+	ntd->mnc = mnc;
+
+	if (context->timed_present == FALSE) {
+		DBG("Timed not present. Caching time info");
+		return;
+	}
+
+	message = create_time_notification(context);
+	if (message == NULL) {
+		ofono_error("Failed to create Notification message");
+		return;
+	}
+
+	g_dbus_send_message(ofono_dbus_get_connection(), message);
+	ntd->time_pending = FALSE;
+}
+
+static void nr_st_watch_destroy(void *data)
+{
+	struct ofono_nettime_context *context = data;
+	DBG("");
+
+	context->netreg_st_watch = 0;
+}
+
+static void nettime_info_received(struct ofono_nettime_context *context,
+				struct ofono_network_time *info)
+{
+	struct tm t;
+	struct nt_data *ntd = context->data;
+	const char *mcc, *mnc;
+
+	DBG("Network time notification received, modem: %p",
+			context->modem);
+
+	if (info == NULL)
+		return;
+
+	ntd->received = get_monotonic_time();
+	ntd->time_pending = TRUE;
+
+	ntd->time_available = encode_time_format(info, &t);
+	if (ntd->time_available == TRUE)
+		ntd->nw_time_utc = timegm(&t);
+
+	ntd->dst = info->dst;
+	ntd->time_zone = info->utcoff;
+
+	context->netreg = __ofono_atom_get_data(__ofono_modem_find_atom(
+				context->modem, OFONO_ATOM_TYPE_NETREG));
+
+	mcc = ofono_netreg_get_mcc(context->netreg);
+	mnc = ofono_netreg_get_mnc(context->netreg);
+	if ((mcc == NULL) || (mnc == NULL)) {
+		DBG("Mobile country/network code missing");
+
+		if (context->netreg_st_watch != 0)
+			return;
+
+		context->netreg_st_watch = __ofono_netreg_add_status_watch(
+					context->netreg, notify,
+					context, nr_st_watch_destroy);
+	} else {
+		notify(0, 0, 0, 0, mcc, mnc, context);
+	}
+
+}
+
+static struct ofono_nettime_driver nettime_driver = {
+	.name		= "Network Time",
+	.probe		= nettime_probe,
+	.remove		= nettime_remove,
+	.info_received	= nettime_info_received,
+};
+
+static int nettime_init(void)
+{
+	return ofono_nettime_driver_register(&nettime_driver);
+}
+
+static void nettime_exit(void)
+{
+	ofono_nettime_driver_unregister(&nettime_driver);
+}
+
+static void timed_connect(DBusConnection *connection, void *user_data)
+{
+	struct ofono_nettime_context *context = user_data;
+	const char *mcc, *mnc;
+
+	DBG("");
+
+	context->timed_present = TRUE;
+	mcc = ofono_netreg_get_mcc(context->netreg);
+	mnc = ofono_netreg_get_mnc(context->netreg);
+
+	notify(0, 0, 0, 0, mcc, mnc, context);
+}
+
+static void timed_disconnect(DBusConnection *connection, void *user_data)
+{
+	struct ofono_nettime_context *context = user_data;
+
+	DBG("");
+
+	context->timed_present = FALSE;
+}
+
+static void nettime_register(struct ofono_nettime_context *context)
+{
+	DBusConnection *conn;
+
+	DBG("Registering Network time for modem %s" ,
+		ofono_modem_get_path(context->modem));
+
+	conn = ofono_dbus_get_connection();
+
+	context->timed_watch = g_dbus_add_service_watch(conn, TIMED_SERVICE,
+					timed_connect, timed_disconnect,
+					context, NULL);
+}
+
+OFONO_PLUGIN_DEFINE(nettime, "Network Time Plugin",
+		VERSION, OFONO_PLUGIN_PRIORITY_DEFAULT,
+		nettime_init, nettime_exit)
+
-- 
1.7.1


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

* [PATCH 3/5 v3] nettime: DBUS and compilation configuration
  2011-01-13  9:49 [PATCH 0/5 v3] Network Time plugin Antti Paila
  2011-01-13  9:49 ` [PATCH 1/5 v3] nettime: Header file for nettime plugins Antti Paila
  2011-01-13  9:49 ` [PATCH 2/5 v3] nettime: Network time plugin implementation Antti Paila
@ 2011-01-13  9:49 ` Antti Paila
  2011-01-14  0:22   ` Marcel Holtmann
  2011-01-13  9:49 ` [PATCH 4/5 v3] nettime: Documentation Antti Paila
  2011-01-13  9:49 ` [PATCH 5/5 v3] nettime: Mock Timed for testing Antti Paila
  4 siblings, 1 reply; 18+ messages in thread
From: Antti Paila @ 2011-01-13  9:49 UTC (permalink / raw)
  To: ofono

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

---
 Makefile.am    |    9 +++++++--
 src/ofono.conf |    2 ++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index a68fc36..4e30cc9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -321,6 +321,9 @@ builtin_modules += example_nettime
 builtin_sources += examples/nettime.c
 endif
 
+builtin_modules += nettime
+builtin_sources += plugins/nettime.c
+
 builtin_modules += smart_messaging
 builtin_sources += plugins/smart-messaging.c
 
@@ -386,7 +389,8 @@ doc_files = doc/overview.txt doc/ofono-paper.txt doc/release-faq.txt \
 			doc/phonebook-api.txt doc/radio-settings-api.txt \
 			doc/sim-api.txt doc/stk-api.txt \
 			doc/audio-settings-api.txt doc/text-telephony-api.txt \
-			doc/calypso-modem.txt
+			doc/calypso-modem.txt \
+			doc/network-time-api.txt
 
 
 test_scripts = test/backtrace \
@@ -455,7 +459,8 @@ test_scripts = test/backtrace \
 		test/set-gsm-band \
 		test/set-umts-band \
 		test/lockdown-modem \
-		test/set-call-forwarding
+		test/set-call-forwarding \
+		test/test-nettime
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/src/ofono.conf b/src/ofono.conf
index 0dfa038..c7b2e79 100644
--- a/src/ofono.conf
+++ b/src/ofono.conf
@@ -9,10 +9,12 @@
 
   <policy user="root">
     <allow own="org.ofono"/>
+    <allow own="com.meego"/>
     <allow send_destination="org.ofono"/>
     <allow send_interface="org.ofono.SimToolkitAgent"/>
     <allow send_interface="org.ofono.PushNotificationAgent"/>
     <allow send_interface="org.ofono.SmartMessagingAgent"/>
+    <allow send_interface="org.ofono.NetworkTime"/>
   </policy>
 
   <policy at_console="true">
-- 
1.7.1


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

* [PATCH 4/5 v3] nettime: Documentation
  2011-01-13  9:49 [PATCH 0/5 v3] Network Time plugin Antti Paila
                   ` (2 preceding siblings ...)
  2011-01-13  9:49 ` [PATCH 3/5 v3] nettime: DBUS and compilation configuration Antti Paila
@ 2011-01-13  9:49 ` Antti Paila
  2011-01-13  9:49 ` [PATCH 5/5 v3] nettime: Mock Timed for testing Antti Paila
  4 siblings, 0 replies; 18+ messages in thread
From: Antti Paila @ 2011-01-13  9:49 UTC (permalink / raw)
  To: ofono

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

---
 doc/network-time-api.txt |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)
 create mode 100644 doc/network-time-api.txt

diff --git a/doc/network-time-api.txt b/doc/network-time-api.txt
new file mode 100644
index 0000000..bdefed7
--- /dev/null
+++ b/doc/network-time-api.txt
@@ -0,0 +1,36 @@
+Network time hierarchy
+======================
+
+Interface	org.ofono.NetworkTime
+Object path	[variable]
+
+Methods		void Notify(dict info)
+
+			Notifies the service of current time and date
+			as notified by the cellular network.  The info
+			argument contains a dictionary with the
+			following possible keys:
+
+			int64 UTC [optional]
+				Network time in seconds from epoch
+				normalized to device boot time.
+				Reveicing entity obtains current real
+				time by adding the value from monotonic
+				clock e.g.
+				clock_gettime(CLOCK_MONOTONIC,...).
+
+			int32 Timezone [optional]
+				Current timezone offset in seconds from
+				UTC.
+
+			uint32 DST [optional]
+				Current daylight saving setting in
+				hours.
+
+			string MobileCountryCode
+				The Mobile country code of the
+				current network operator.
+
+			string MobileNetworkCode
+				The Mobile network code of the
+				current network operator.
-- 
1.7.1


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

* [PATCH 5/5 v3] nettime: Mock Timed for testing
  2011-01-13  9:49 [PATCH 0/5 v3] Network Time plugin Antti Paila
                   ` (3 preceding siblings ...)
  2011-01-13  9:49 ` [PATCH 4/5 v3] nettime: Documentation Antti Paila
@ 2011-01-13  9:49 ` Antti Paila
  4 siblings, 0 replies; 18+ messages in thread
From: Antti Paila @ 2011-01-13  9:49 UTC (permalink / raw)
  To: ofono

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

---
 test/test-nettime |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
 create mode 100755 test/test-nettime

diff --git a/test/test-nettime b/test/test-nettime
new file mode 100755
index 0000000..c215902
--- /dev/null
+++ b/test/test-nettime
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+
+import gobject
+import dbus
+import sys
+import time
+import dbus.service
+import dbus.mainloop.glib
+
+
+class NetworkTime(dbus.service.Object):
+	def __init__(self):
+		busName = dbus.service.BusName('com.meego.time',
+					bus = dbus.SystemBus())
+		dbus.service.Object.__init__(self, busName, '/com/meego/time')
+	@dbus.service.method(dbus_interface="org.ofono.NetworkTime",
+					in_signature="a{sv}", out_signature="")
+	def Notify(self, arg):
+		print arg
+		print
+		print "Time from mobile: %d" % arg["UTC"]
+		print "DST: %d" % arg["DST"]
+		print "Timezone: %d" % arg["Timezone"]
+		print "MNC: %s" % arg["MobileNetworkCode"]
+		print "MCC: %s" % arg["MobileCountryCode"]
+
+if __name__ == '__main__':
+	dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+	agent = NetworkTime()
+
+	mainloop = gobject.MainLoop()
+	mainloop.run()
+
+
+
-- 
1.7.1


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

* Re: [PATCH 1/5 v3] nettime: Header file for nettime plugins
  2011-01-13  9:49 ` [PATCH 1/5 v3] nettime: Header file for nettime plugins Antti Paila
@ 2011-01-13 12:58   ` Aki Niemi
  0 siblings, 0 replies; 18+ messages in thread
From: Aki Niemi @ 2011-01-13 12:58 UTC (permalink / raw)
  To: ofono

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

Hi Antti,

2011/1/13 Antti Paila <antti.paila@nokia.com>:
> ---
>  include/nettime.h |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/include/nettime.h b/include/nettime.h
> index 0f23cc7..2f73e1a 100644
> --- a/include/nettime.h
> +++ b/include/nettime.h
> @@ -31,6 +31,10 @@ struct ofono_network_time;
>  struct ofono_nettime_context {
>        struct ofono_nettime_driver *driver;
>        struct ofono_modem *modem;
> +       unsigned int timed_watch;
> +       gboolean timed_present;
> +       struct ofono_netreg *netreg;
> +       unsigned int netreg_st_watch;
>        void *data;

Why are these added to the context as opposed to the plugin's user data?

Cheers,
Aki

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

* Re: [PATCH 3/5 v3] nettime: DBUS and compilation configuration
  2011-01-13  9:49 ` [PATCH 3/5 v3] nettime: DBUS and compilation configuration Antti Paila
@ 2011-01-14  0:22   ` Marcel Holtmann
  2011-01-17  8:17     ` Antti Paila
  0 siblings, 1 reply; 18+ messages in thread
From: Marcel Holtmann @ 2011-01-14  0:22 UTC (permalink / raw)
  To: ofono

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

Hi Antti,

>  Makefile.am    |    9 +++++++--
>  src/ofono.conf |    2 ++
>  2 files changed, 9 insertions(+), 2 deletions(-)

<snip>
 
>    <policy user="root">
>      <allow own="org.ofono"/>
> +    <allow own="com.meego"/>
>      <allow send_destination="org.ofono"/>
>      <allow send_interface="org.ofono.SimToolkitAgent"/>
>      <allow send_interface="org.ofono.PushNotificationAgent"/>
>      <allow send_interface="org.ofono.SmartMessagingAgent"/>
> +    <allow send_interface="org.ofono.NetworkTime"/>
>    </policy>
>  
>    <policy at_console="true">

I am now lost in what you are trying to achieve here. I thought we
agreed that we send a D-Bus method to timed. For that you neither have
to have a well known name nor have a D-Bus interface present.

And surely ofonod will not claim com.meego as service name.

Regards

Marcel



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

* Re: [PATCH 3/5 v3] nettime: DBUS and compilation configuration
  2011-01-14  0:22   ` Marcel Holtmann
@ 2011-01-17  8:17     ` Antti Paila
  2011-01-17 16:09       ` Marcel Holtmann
  0 siblings, 1 reply; 18+ messages in thread
From: Antti Paila @ 2011-01-17  8:17 UTC (permalink / raw)
  To: ofono

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

Hi Marcel,

On Fri, 2011-01-14 at 01:22 +0100, ext Marcel Holtmann wrote:
> Hi Antti,
> 
> >  Makefile.am    |    9 +++++++--
> >  src/ofono.conf |    2 ++
> >  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> <snip>
>  
> >    <policy user="root">
> >      <allow own="org.ofono"/>
> > +    <allow own="com.meego"/>
> >      <allow send_destination="org.ofono"/>
> >      <allow send_interface="org.ofono.SimToolkitAgent"/>
> >      <allow send_interface="org.ofono.PushNotificationAgent"/>
> >      <allow send_interface="org.ofono.SmartMessagingAgent"/>
> > +    <allow send_interface="org.ofono.NetworkTime"/>
> >    </policy>
> >  
> >    <policy at_console="true">
> 
> I am now lost in what you are trying to achieve here. I thought we
> agreed that we send a D-Bus method to timed. For that you neither have
> to have a well known name nor have a D-Bus interface present.

Are you referring to line
'<allow send_interface="org.ofono.NetworkTime"/>'?
This is the interface timed is supposed to implement in order for oFono
to call its Notify method. How else would you do it? 


> And surely ofonod will not claim com.meego as service name.

Yes, sure. That was just left behind from testing, since the mock timed
script needed this for D-Bus access. I'll remove it.

Best Regards,
  Antti


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

* Re: [PATCH 3/5 v3] nettime: DBUS and compilation configuration
  2011-01-17  8:17     ` Antti Paila
@ 2011-01-17 16:09       ` Marcel Holtmann
  2011-01-17 17:02         ` Mika.Liljeberg
  0 siblings, 1 reply; 18+ messages in thread
From: Marcel Holtmann @ 2011-01-17 16:09 UTC (permalink / raw)
  To: ofono

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

Hi Antti,

> > >  Makefile.am    |    9 +++++++--
> > >  src/ofono.conf |    2 ++
> > >  2 files changed, 9 insertions(+), 2 deletions(-)
> > 
> > <snip>
> >  
> > >    <policy user="root">
> > >      <allow own="org.ofono"/>
> > > +    <allow own="com.meego"/>
> > >      <allow send_destination="org.ofono"/>
> > >      <allow send_interface="org.ofono.SimToolkitAgent"/>
> > >      <allow send_interface="org.ofono.PushNotificationAgent"/>
> > >      <allow send_interface="org.ofono.SmartMessagingAgent"/>
> > > +    <allow send_interface="org.ofono.NetworkTime"/>
> > >    </policy>
> > >  
> > >    <policy at_console="true">
> > 
> > I am now lost in what you are trying to achieve here. I thought we
> > agreed that we send a D-Bus method to timed. For that you neither have
> > to have a well known name nor have a D-Bus interface present.
> 
> Are you referring to line
> '<allow send_interface="org.ofono.NetworkTime"/>'?
> This is the interface timed is supposed to implement in order for oFono
> to call its Notify method. How else would you do it? 

actually timed has to expose a proper interface for this. Don't intermix
this with org.ofono. This is a timed details.

And the D-Bus rules to be part of timed and not oFono.

Regards

Marcel



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

* RE: [PATCH 3/5 v3] nettime: DBUS and compilation configuration
  2011-01-17 16:09       ` Marcel Holtmann
@ 2011-01-17 17:02         ` Mika.Liljeberg
  2011-01-17 18:37           ` Denis Kenzior
  0 siblings, 1 reply; 18+ messages in thread
From: Mika.Liljeberg @ 2011-01-17 17:02 UTC (permalink / raw)
  To: ofono

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

Hi,

On a side topic, the policy seems a bit broken to begin with.

> > > <snip>
> > >  
> > > >    <policy user="root">
> > > >      <allow own="org.ofono"/>
> > > >      <allow send_destination="org.ofono"/>

This alone already allows root access to all interfaces behind a connection named org.ofono.

> > > >      <allow send_interface="org.ofono.SimToolkitAgent"/>
> > > >      <allow send_interface="org.ofono.PushNotificationAgent"/>
> > > >      <allow send_interface="org.ofono.SmartMessagingAgent"/>

So these are redundant, unless the whole thing is rewritten as:

	<allow send_destination="org.ofono" send_interface="org.ofono.SimToolkitAgent"/>
	<allow send_destination="org.ofono" send_interface="org.ofono.PushNotificationAgent"/>
	<allow send_destination="org.ofono" send_interface="org.ofono.SmartMessagingAgent"/>

> > > >    </policy>

Br,

	MikaL

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

* Re: [PATCH 3/5 v3] nettime: DBUS and compilation configuration
  2011-01-17 17:02         ` Mika.Liljeberg
@ 2011-01-17 18:37           ` Denis Kenzior
  2011-01-18  7:36             ` Aki Niemi
  0 siblings, 1 reply; 18+ messages in thread
From: Denis Kenzior @ 2011-01-17 18:37 UTC (permalink / raw)
  To: ofono

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

Hi Mika,

> So these are redundant, unless the whole thing is rewritten as:
> 
> 	<allow send_destination="org.ofono" send_interface="org.ofono.SimToolkitAgent"/>
> 	<allow send_destination="org.ofono" send_interface="org.ofono.PushNotificationAgent"/>
> 	<allow send_destination="org.ofono" send_interface="org.ofono.SmartMessagingAgent"/>
> 

The agents are registered by the application, not ofono.  So the
destination is in fact not org.ofono but a system bus connection owned
by the application.  Hence the need to punch holes here.

Regards,
-Denis

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

* Re: [PATCH 3/5 v3] nettime: DBUS and compilation configuration
  2011-01-17 18:37           ` Denis Kenzior
@ 2011-01-18  7:36             ` Aki Niemi
  2011-01-18 14:59               ` Marcel Holtmann
  0 siblings, 1 reply; 18+ messages in thread
From: Aki Niemi @ 2011-01-18  7:36 UTC (permalink / raw)
  To: ofono

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

Hi,

2011/1/17 Denis Kenzior <denkenz@gmail.com>:
>> So these are redundant, unless the whole thing is rewritten as:
>>
>>       <allow send_destination="org.ofono" send_interface="org.ofono.SimToolkitAgent"/>
>>       <allow send_destination="org.ofono" send_interface="org.ofono.PushNotificationAgent"/>
>>       <allow send_destination="org.ofono" send_interface="org.ofono.SmartMessagingAgent"/>
>>
>
> The agents are registered by the application, not ofono.  So the
> destination is in fact not org.ofono but a system bus connection owned
> by the application.  Hence the need to punch holes here.

This means we also need punch a hole for org.ofono.NetworkTime. The
only difference there to the above agent interfaces is that it's a
singleton and comes with no registration API on oFono side. Instead,
there is a custom plugin per agent implementation, like the one for
timed.

Cheers,
Aki

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

* Re: [PATCH 3/5 v3] nettime: DBUS and compilation configuration
  2011-01-18  7:36             ` Aki Niemi
@ 2011-01-18 14:59               ` Marcel Holtmann
  2011-01-19  8:10                 ` Aki Niemi
  0 siblings, 1 reply; 18+ messages in thread
From: Marcel Holtmann @ 2011-01-18 14:59 UTC (permalink / raw)
  To: ofono

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

Hi Aki,

> >> So these are redundant, unless the whole thing is rewritten as:
> >>
> >>       <allow send_destination="org.ofono" send_interface="org.ofono.SimToolkitAgent"/>
> >>       <allow send_destination="org.ofono" send_interface="org.ofono.PushNotificationAgent"/>
> >>       <allow send_destination="org.ofono" send_interface="org.ofono.SmartMessagingAgent"/>
> >>
> >
> > The agents are registered by the application, not ofono.  So the
> > destination is in fact not org.ofono but a system bus connection owned
> > by the application.  Hence the need to punch holes here.
> 
> This means we also need punch a hole for org.ofono.NetworkTime. The
> only difference there to the above agent interfaces is that it's a
> singleton and comes with no registration API on oFono side. Instead,
> there is a custom plugin per agent implementation, like the one for
> timed.

please don't implement org.ofono interface in timed. Just implement a
timed specific (com.nokia.time) interface and punch the whole for that
in the timed D-Bus policy.

The plugin is timed specific since it monitors com.nokia.time and thus
should also target a timed specific API. Not a generic oFono API
description.

Regards

Marcel



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

* Re: [PATCH 3/5 v3] nettime: DBUS and compilation configuration
  2011-01-18 14:59               ` Marcel Holtmann
@ 2011-01-19  8:10                 ` Aki Niemi
  2011-01-20 11:19                   ` Marcel Holtmann
  0 siblings, 1 reply; 18+ messages in thread
From: Aki Niemi @ 2011-01-19  8:10 UTC (permalink / raw)
  To: ofono

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

Hi Marcel,

2011/1/18 Marcel Holtmann <marcel@holtmann.org>:
> please don't implement org.ofono interface in timed. Just implement a
> timed specific (com.nokia.time) interface and punch the whole for that
> in the timed D-Bus policy.

I think there is some disconnect here. The intention is to implement a
similar agent interface as PushNotification and SmartMessaging already
do, with the exception that the one and only agent is known beforehand
and "hard-coded" to the plugin.

This is a generic interface that some other time information sink
could also implement, so it makes sense to have it in the org.ofono
namespace. Regardless of which namespace we use, though, it is oFono
that will be calling methods on this interface, and thus it needs to
have this interface opened in its D-Bus config.

> The plugin is timed specific since it monitors com.nokia.time and thus
> should also target a timed specific API. Not a generic oFono API
> description.

This is really just another agent API in oFono, just one with a
build-time registration mechanism for agents.

Cheers,
Aki

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

* Re: [PATCH 3/5 v3] nettime: DBUS and compilation configuration
  2011-01-19  8:10                 ` Aki Niemi
@ 2011-01-20 11:19                   ` Marcel Holtmann
  2011-01-21 13:28                     ` Antti Paila
  0 siblings, 1 reply; 18+ messages in thread
From: Marcel Holtmann @ 2011-01-20 11:19 UTC (permalink / raw)
  To: ofono

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

Hi Aki,

> > please don't implement org.ofono interface in timed. Just implement a
> > timed specific (com.nokia.time) interface and punch the whole for that
> > in the timed D-Bus policy.
> 
> I think there is some disconnect here. The intention is to implement a
> similar agent interface as PushNotification and SmartMessaging already
> do, with the exception that the one and only agent is known beforehand
> and "hard-coded" to the plugin.

that is not what I said and that is clearly not the intent here.

> This is a generic interface that some other time information sink
> could also implement, so it makes sense to have it in the org.ofono
> namespace. Regardless of which namespace we use, though, it is oFono
> that will be calling methods on this interface, and thus it needs to
> have this interface opened in its D-Bus config.

They will be always specific to the target daemon and that is fine. This
is not up to oFono to define and that is point here.

> > The plugin is timed specific since it monitors com.nokia.time and thus
> > should also target a timed specific API. Not a generic oFono API
> > description.
> 
> This is really just another agent API in oFono, just one with a
> build-time registration mechanism for agents.

It is not. This is timed exposing an API to get notifications from a
cellular stack and then a timed specific plugin inside oFono. It has
nothing to do with an oFono defined D-Bus API.

Regards

Marcel



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

* Re: [PATCH 3/5 v3] nettime: DBUS and compilation configuration
  2011-01-20 11:19                   ` Marcel Holtmann
@ 2011-01-21 13:28                     ` Antti Paila
  2011-01-21 13:31                       ` Marcel Holtmann
  0 siblings, 1 reply; 18+ messages in thread
From: Antti Paila @ 2011-01-21 13:28 UTC (permalink / raw)
  To: ofono

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

Hi,

On Thu, 2011-01-20 at 12:19 +0100, ext Marcel Holtmann wrote:
> Hi Aki,
> 
> > > please don't implement org.ofono interface in timed. Just implement a
> > > timed specific (com.nokia.time) interface and punch the whole for that
> > > in the timed D-Bus policy.
> > 
> > I think there is some disconnect here. The intention is to implement a
> > similar agent interface as PushNotification and SmartMessaging already
> > do, with the exception that the one and only agent is known beforehand
> > and "hard-coded" to the plugin.
> 
> that is not what I said and that is clearly not the intent here.
> 
> > This is a generic interface that some other time information sink
> > could also implement, so it makes sense to have it in the org.ofono
> > namespace. Regardless of which namespace we use, though, it is oFono
> > that will be calling methods on this interface, and thus it needs to
> > have this interface opened in its D-Bus config.
> 
> They will be always specific to the target daemon and that is fine. This
> is not up to oFono to define and that is point here.
> 
> > > The plugin is timed specific since it monitors com.nokia.time and thus
> > > should also target a timed specific API. Not a generic oFono API
> > > description.
> > 
> > This is really just another agent API in oFono, just one with a
> > build-time registration mechanism for agents.
> 
> It is not. This is timed exposing an API to get notifications from a
> cellular stack and then a timed specific plugin inside oFono. It has
> nothing to do with an oFono defined D-Bus API.

As I see, the question at the moment is where to punch the hole in D-Bus
configuration; alternatives being either in ofono or in timed side. I
can see the rationale and reasoning behind both approaches, but in order
to make some progress with this matter we need a decision. So, should we
take a vote or what? After all isn't this a non-functional,
matter-of-taste type of question?

Best Regards,
  Antti


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

* Re: [PATCH 3/5 v3] nettime: DBUS and compilation configuration
  2011-01-21 13:28                     ` Antti Paila
@ 2011-01-21 13:31                       ` Marcel Holtmann
  0 siblings, 0 replies; 18+ messages in thread
From: Marcel Holtmann @ 2011-01-21 13:31 UTC (permalink / raw)
  To: ofono

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

Hi Antti,

> > > > please don't implement org.ofono interface in timed. Just implement a
> > > > timed specific (com.nokia.time) interface and punch the whole for that
> > > > in the timed D-Bus policy.
> > > 
> > > I think there is some disconnect here. The intention is to implement a
> > > similar agent interface as PushNotification and SmartMessaging already
> > > do, with the exception that the one and only agent is known beforehand
> > > and "hard-coded" to the plugin.
> > 
> > that is not what I said and that is clearly not the intent here.
> > 
> > > This is a generic interface that some other time information sink
> > > could also implement, so it makes sense to have it in the org.ofono
> > > namespace. Regardless of which namespace we use, though, it is oFono
> > > that will be calling methods on this interface, and thus it needs to
> > > have this interface opened in its D-Bus config.
> > 
> > They will be always specific to the target daemon and that is fine. This
> > is not up to oFono to define and that is point here.
> > 
> > > > The plugin is timed specific since it monitors com.nokia.time and thus
> > > > should also target a timed specific API. Not a generic oFono API
> > > > description.
> > > 
> > > This is really just another agent API in oFono, just one with a
> > > build-time registration mechanism for agents.
> > 
> > It is not. This is timed exposing an API to get notifications from a
> > cellular stack and then a timed specific plugin inside oFono. It has
> > nothing to do with an oFono defined D-Bus API.
> 
> As I see, the question at the moment is where to punch the hole in D-Bus
> configuration; alternatives being either in ofono or in timed side. I
> can see the rationale and reasoning behind both approaches, but in order
> to make some progress with this matter we need a decision. So, should we
> take a vote or what? After all isn't this a non-functional,
> matter-of-taste type of question?

since it should be com.nokia.timed interface, it should be done all by
timed. The timed plugin inside oFono is just a user.

Regards

Marcel



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

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

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-13  9:49 [PATCH 0/5 v3] Network Time plugin Antti Paila
2011-01-13  9:49 ` [PATCH 1/5 v3] nettime: Header file for nettime plugins Antti Paila
2011-01-13 12:58   ` Aki Niemi
2011-01-13  9:49 ` [PATCH 2/5 v3] nettime: Network time plugin implementation Antti Paila
2011-01-13  9:49 ` [PATCH 3/5 v3] nettime: DBUS and compilation configuration Antti Paila
2011-01-14  0:22   ` Marcel Holtmann
2011-01-17  8:17     ` Antti Paila
2011-01-17 16:09       ` Marcel Holtmann
2011-01-17 17:02         ` Mika.Liljeberg
2011-01-17 18:37           ` Denis Kenzior
2011-01-18  7:36             ` Aki Niemi
2011-01-18 14:59               ` Marcel Holtmann
2011-01-19  8:10                 ` Aki Niemi
2011-01-20 11:19                   ` Marcel Holtmann
2011-01-21 13:28                     ` Antti Paila
2011-01-21 13:31                       ` Marcel Holtmann
2011-01-13  9:49 ` [PATCH 4/5 v3] nettime: Documentation Antti Paila
2011-01-13  9:49 ` [PATCH 5/5 v3] nettime: Mock Timed for testing Antti Paila

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.