summaryrefslogtreecommitdiffstats
path: root/audio/control.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-10-02 16:48:17 -0300
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-10-02 16:48:17 -0300
commit430814a41d1ba988d35ef33a1202b4dcb2db939c (patch)
treef236ed13ed6f2b5351a2dd63ab684714e205487d /audio/control.c
parent29c9f3163143a8c63b9a3020e85bb5bd7a8cb3ac (diff)
Add property support for control interface.
Diffstat (limited to 'audio/control.c')
-rw-r--r--audio/control.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/audio/control.c b/audio/control.c
index 4792b4ba..2c86ff25 100644
--- a/audio/control.c
+++ b/audio/control.c
@@ -55,6 +55,7 @@
#include "control.h"
#include "sdpd.h"
#include "glib-helper.h"
+#include "dbus-common.h"
#define AVCTP_PSM 23
@@ -933,14 +934,42 @@ static DBusMessage *control_is_connected(DBusConnection *conn,
return reply;
}
+static DBusMessage *control_get_properties(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct audio_device *device = data;
+ DBusMessage *reply;
+ DBusMessageIter iter;
+ DBusMessageIter dict;
+ gboolean value;
+
+ 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 */
+ value = (device->control->session != NULL);
+ dbus_message_iter_append_dict_entry(&dict, "Connected",
+ DBUS_TYPE_BOOLEAN, &value);
+
+ dbus_message_iter_close_container(&iter, &dict);
+
+ return reply;
+}
+
static GDBusMethodTable control_methods[] = {
{ "IsConnected", "", "b", control_is_connected },
+ { "GetProperties", "", "a{sv}",control_get_properties },
{ NULL, NULL, NULL, NULL }
};
static GDBusSignalTable control_signals[] = {
{ "Connected", "" },
{ "Disconnected", "" },
+ { "PropertyChanged", "sv" },
{ NULL, NULL }
};