summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-10-02 17:07:09 -0300
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-10-02 17:07:09 -0300
commite34d450d1fbcdcc5b1fa688c80edcfdf1fafb18d (patch)
tree810f206514939cce98f0fce225000c2f04c288c4 /input
parentbd95a9317b206429768786da3d3b42d643a358b3 (diff)
Add property support for input interface.
Diffstat (limited to 'input')
-rw-r--r--input/device.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/input/device.c b/input/device.c
index 292bb779..adcb42ae 100644
--- a/input/device.c
+++ b/input/device.c
@@ -52,6 +52,7 @@
#include "../src/storage.h"
#include "../src/manager.h"
+#include "../src/dbus-common.h"
#include "adapter.h"
#include "device.h"
@@ -981,17 +982,46 @@ static void device_unregister(void *data)
input_device_free(idev);
}
+static DBusMessage *device_get_properties(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct input_device *idev = data;
+ DBusMessage *reply;
+ DBusMessageIter iter;
+ DBusMessageIter dict;
+ dbus_bool_t connected;
+
+ dbus_message_iter_init_append(reply, &iter);
+
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
+ DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
+
+ /* Connected */
+ connected = !!g_slist_find_custom(idev->connections, NULL,
+ (GCompareFunc) is_connected);
+ dbus_message_iter_append_dict_entry(&dict, "Connected",
+ DBUS_TYPE_BOOLEAN, &connected);
+
+ dbus_message_iter_close_container(&iter, &dict);
+
+ return reply;
+}
+
static GDBusMethodTable device_methods[] = {
{ "Connect", "", "", device_connect,
G_DBUS_METHOD_FLAG_ASYNC },
{ "Disconnect", "", "", device_disconnect },
{ "IsConnected", "", "b", device_is_connected },
+ { "GetProperties", "", "a{sv}",device_get_properties },
{ }
};
static GDBusSignalTable device_signals[] = {
{ "Connected", "" },
{ "Disconnected", "" },
+ { "PropertyChanged", "sv" },
{ }
};