All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gprs: Make the ContextAdded return a variant.
@ 2015-12-21 10:10 John Ernberg
  2015-12-21 20:03 ` Denis Kenzior
  0 siblings, 1 reply; 4+ messages in thread
From: John Ernberg @ 2015-12-21 10:10 UTC (permalink / raw)
  To: ofono

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

From: John Ernberg <john.ernberg@actia.se>

This matches the behavior described by the documentation and the signal
value described in the introspection. This was causing a headache when
using stricter D-Bus wrappers like dbus-c++.
---
 src/gprs.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index ba797dd..b583c28 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -1879,7 +1879,17 @@ static void send_context_added_signal(struct ofono_gprs *gprs,
 	const char *path;
 	DBusMessage *signal;
 	DBusMessageIter iter;
+	DBusMessageIter var;
 	DBusMessageIter dict;
+	char typesig[5];
+	char arraysig[6];
+
+	arraysig[0] = DBUS_TYPE_ARRAY;
+	arraysig[1] = typesig[0] = DBUS_DICT_ENTRY_BEGIN_CHAR;
+	arraysig[2] = typesig[1] = DBUS_TYPE_STRING;
+	arraysig[3] = typesig[2] = DBUS_TYPE_VARIANT;
+	arraysig[4] = typesig[3] = DBUS_DICT_ENTRY_END_CHAR;
+	arraysig[5] = typesig[4] = '\0';
 
 	path = __ofono_atom_get_path(gprs->atom);
 	signal = dbus_message_new_signal(path,
@@ -1893,11 +1903,15 @@ static void send_context_added_signal(struct ofono_gprs *gprs,
 	path = context->path;
 	dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, &path);
 
-	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
-					OFONO_PROPERTIES_ARRAY_SIGNATURE,
+	dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
+					arraysig, &var);
+
+	dbus_message_iter_open_container(&var, DBUS_TYPE_ARRAY,
+					typesig,
 					&dict);
 	append_context_properties(context, &dict);
-	dbus_message_iter_close_container(&iter, &dict);
+	dbus_message_iter_close_container(&var, &dict);
+	dbus_message_iter_close_container(&iter, &var);
 
 	g_dbus_send_message(conn, signal);
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH] gprs: Make the ContextAdded return a variant.
@ 2015-12-21 10:10 John Ernberg
  0 siblings, 0 replies; 4+ messages in thread
From: John Ernberg @ 2015-12-21 10:10 UTC (permalink / raw)
  To: ofono

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

From: John Ernberg <john.ernberg@actia.se>

I am not sure if this is the desired way to resolve this issue. This will
break compatibility with Connman and possibly other systems using oFono
through D-Bus.

I do have a patch for Connman that I can send to them if this patch is
accepted, but not for any other potential systems.

It is also possible to change the introspection and the documentation,
the proposed patch is however more in line with the rest of oFono's
D-Bus API.

Discussion regarding this is encouraged before any possible acception
of this patch.

John Ernberg (1):
  gprs: Make the ContextAdded return a variant.

 src/gprs.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

-- 
1.9.1

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

end of thread, other threads:[~2015-12-22  7:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-21 10:10 [PATCH] gprs: Make the ContextAdded return a variant John Ernberg
2015-12-21 20:03 ` Denis Kenzior
2015-12-22  7:11   ` John Ernberg
  -- strict thread matches above, loose matches on Subject: below --
2015-12-21 10:10 John Ernberg

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.