From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 3/3] tools/mpris-player: Forward player signals
Date: Fri, 11 Oct 2013 14:53:24 +0300 [thread overview]
Message-ID: <1381492404-25765-3-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1381492404-25765-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Forward signals received from player in the session bus to the system
bus where bluetoothd can catch them.
---
tools/mpris-player.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/tools/mpris-player.c b/tools/mpris-player.c
index 03b8875..c94330c 100644
--- a/tools/mpris-player.c
+++ b/tools/mpris-player.c
@@ -543,8 +543,8 @@ static void remove_player(DBusConnection *conn, const char *sender)
g_free(owner);
}
-static gboolean properties_changed(DBusConnection *conn,
- DBusMessage *msg, void *user_data)
+static gboolean player_signal(DBusConnection *conn, DBusMessage *msg,
+ void *user_data)
{
DBusMessage *signal;
DBusMessageIter iter, args;
@@ -558,17 +558,15 @@ static gboolean properties_changed(DBusConnection *conn,
if (owner == NULL)
goto done;
- signal = dbus_message_new_signal(path, DBUS_INTERFACE_PROPERTIES,
- "PropertiesChanged");
+ signal = dbus_message_new_signal(path, dbus_message_get_interface(msg),
+ dbus_message_get_member(msg));
if (signal == NULL) {
- fprintf(stderr, "Unable to allocate new %s.PropertisChanged"
- " signal", DBUS_INTERFACE_PROPERTIES);
+ fprintf(stderr, "Unable to allocate new %s.%s signal",
+ dbus_message_get_interface(msg),
+ dbus_message_get_member(msg));
goto done;
}
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
dbus_message_iter_init_append(signal, &args);
append_iter(&args, &iter);
@@ -2512,7 +2510,7 @@ int main(int argc, char *argv[])
{
GOptionContext *context;
GError *error = NULL;
- guint owner_watch, properties_watch;
+ guint owner_watch, properties_watch, signal_watch;
struct sigaction sa;
context = g_option_context_new(NULL);
@@ -2554,10 +2552,14 @@ int main(int argc, char *argv[])
name_owner_changed,
NULL, NULL);
-
properties_watch = g_dbus_add_properties_watch(session, NULL, NULL,
MPRIS_PLAYER_INTERFACE,
- properties_changed,
+ player_signal,
+ NULL, NULL);
+
+ signal_watch = g_dbus_add_signal_watch(session, NULL, NULL,
+ MPRIS_PLAYER_INTERFACE,
+ NULL, player_signal,
NULL, NULL);
memset(&sa, 0, sizeof(sa));
@@ -2578,6 +2580,7 @@ int main(int argc, char *argv[])
g_dbus_remove_watch(session, owner_watch);
g_dbus_remove_watch(session, properties_watch);
+ g_dbus_remove_watch(session, signal_watch);
g_dbus_client_unref(client);
--
1.8.3.1
next prev parent reply other threads:[~2013-10-11 11:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-11 11:53 [PATCH BlueZ 1/3] audio/media: Add support for tracking Seeked signal Luiz Augusto von Dentz
2013-10-11 11:53 ` [PATCH BlueZ 2/3] audio/media: Send status changed if position changes Luiz Augusto von Dentz
2013-10-11 11:53 ` Luiz Augusto von Dentz [this message]
2013-10-15 10:11 ` [PATCH BlueZ 1/3] audio/media: Add support for tracking Seeked signal Luiz Augusto von Dentz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1381492404-25765-3-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox