PATCH accept variants on dbus for clock interface

Tim Sander tim01 at iss.tu-darmstadt.de
Wed Feb 22 07:08:45 PST 2012


Hi

This patch corrects the interface so that the "net.connman.Clock" interface 
accepts variant types as advertised in introspection.

diff --git a/src/clock.c b/src/clock.c
index 0d7f870..30bcc0e 100644
--- a/src/clock.c
+++ b/src/clock.c
@@ -179,6 +179,11 @@ static DBusMessage *set_property(DBusConnection *conn,
 		struct timeval tv;
 		dbus_uint64_t newval;
 
+		if (type == DBUS_TYPE_VARIANT) {
+			DBusMessageIter variant=value;
+			dbus_message_iter_recurse(&variant,&value);
+			type = dbus_message_iter_get_arg_type(&value);
+		}
 		if (type != DBUS_TYPE_UINT64)
 			return __connman_error_invalid_arguments(msg);
 
@@ -200,6 +205,11 @@ static DBusMessage *set_property(DBusConnection *conn,
 		const char *strval;
 		enum time_updates newval;
 
+		if (type == DBUS_TYPE_VARIANT) {
+			DBusMessageIter variant=value;
+			dbus_message_iter_recurse(&variant,&value);
+			type = dbus_message_iter_get_arg_type(&value);
+		}
 		if (type != DBUS_TYPE_STRING)
 			return __connman_error_invalid_arguments(msg);
 
@@ -220,6 +230,11 @@ static DBusMessage *set_property(DBusConnection *conn,
 	} else if (g_str_equal(name, "Timezone") == TRUE) {
 		const char *strval;
 
+		if (type == DBUS_TYPE_VARIANT) {
+			DBusMessageIter variant=value;
+			dbus_message_iter_recurse(&variant,&value);
+			type = dbus_message_iter_get_arg_type(&value);
+		}
 		if (type != DBUS_TYPE_STRING)
 			return __connman_error_invalid_arguments(msg);
 
@@ -234,6 +249,11 @@ static DBusMessage *set_property(DBusConnection *conn,
 		const char *strval;
 		enum timezone_updates newval;
 
+		if (type == DBUS_TYPE_VARIANT) {
+			DBusMessageIter variant=value;
+			dbus_message_iter_recurse(&variant,&value);
+			type = dbus_message_iter_get_arg_type(&value);
+		}
 		if (type != DBUS_TYPE_STRING)
 			return __connman_error_invalid_arguments(msg);
 
@@ -254,6 +274,11 @@ static DBusMessage *set_property(DBusConnection *conn,
 	} else if (g_str_equal(name, "Timeservers") == TRUE) {
 		DBusMessageIter entry;
 
+		if (type == DBUS_TYPE_VARIANT) {
+			DBusMessageIter variant=value;
+			dbus_message_iter_recurse(&variant,&value);
+			type = dbus_message_iter_get_arg_type(&value);
+		}
 		if (type != DBUS_TYPE_ARRAY)
 			return __connman_error_invalid_arguments(msg);
 



More information about the connman mailing list