summaryrefslogtreecommitdiff
path: root/gdbus
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2012-10-04 04:26:27 -0300
committerMarcel Holtmann <marcel@holtmann.org>2012-11-26 14:44:48 +0100
commitcc3872fd91934e04a0384e3d33a7b78b6183dc37 (patch)
treed135f80ef647754d4b016594f27f81ee78b4a8fd /gdbus
parent1fc1d90c294a350a194b816795cd94123ca5dd3d (diff)
downloadconnman-cc3872fd91934e04a0384e3d33a7b78b6183dc37.tar.gz
connman-cc3872fd91934e04a0384e3d33a7b78b6183dc37.tar.bz2
connman-cc3872fd91934e04a0384e3d33a7b78b6183dc37.zip
gdbus: Add skeleton of DBus.Properties interface
This interface is responsible for handling properties of all objects in a given path. Right now it only registers itself, doing nothing useful. A conversion to this new layout will be done by subsequent patches. org.freedesktop.org.DBus.Properties spec can be found at http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties
Diffstat (limited to 'gdbus')
-rw-r--r--gdbus/object.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/gdbus/object.c b/gdbus/object.c
index 24e8285d..6c115281 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -507,6 +507,48 @@ static const GDBusMethodTable introspect_methods[] = {
{ }
};
+static DBusMessage *properties_get(DBusConnection *connection,
+ DBusMessage *message, void *user_data)
+{
+ return NULL;
+}
+
+static DBusMessage *properties_get_all(DBusConnection *connection,
+ DBusMessage *message, void *user_data)
+{
+ return NULL;
+}
+
+static DBusMessage *properties_set(DBusConnection *connection,
+ DBusMessage *message, void *user_data)
+{
+ return dbus_message_new_method_return(message);
+}
+
+static const GDBusMethodTable properties_methods[] = {
+ { GDBUS_METHOD("Get",
+ GDBUS_ARGS({ "interface", "s" }, { "name", "s" }),
+ GDBUS_ARGS({ "value", "v" }),
+ properties_get) },
+ { GDBUS_ASYNC_METHOD("Set", NULL,
+ GDBUS_ARGS({ "interface", "s" }, { "name", "s" },
+ { "value", "v" }),
+ properties_set) },
+ { GDBUS_METHOD("GetAll",
+ GDBUS_ARGS({ "interface", "s" }),
+ GDBUS_ARGS({ "properties", "a{sv}" }),
+ properties_get_all) },
+ { }
+};
+
+static const GDBusSignalTable properties_signals[] = {
+ { GDBUS_SIGNAL("PropertiesChanged",
+ GDBUS_ARGS({ "interface", "s" },
+ { "changed_properties", "a{sv}" },
+ { "invalidated_properties", "as"})) },
+ { }
+};
+
static void add_interface(struct generic_data *data, const char *name,
const GDBusMethodTable *methods,
const GDBusSignalTable *signals,
@@ -557,6 +599,9 @@ static struct generic_data *object_path_ref(DBusConnection *connection,
add_interface(data, DBUS_INTERFACE_INTROSPECTABLE,
introspect_methods, NULL, NULL, data, NULL);
+ add_interface(data, DBUS_INTERFACE_PROPERTIES, properties_methods,
+ properties_signals, NULL, data, NULL);
+
return data;
}
@@ -596,6 +641,7 @@ static void object_path_unref(DBusConnection *connection, const char *path)
return;
remove_interface(data, DBUS_INTERFACE_INTROSPECTABLE);
+ remove_interface(data, DBUS_INTERFACE_PROPERTIES);
invalidate_parent_data(connection, path);