[pulseaudio-discuss] Receiving signals from server in C
tanu.kaskinen at linux.intel.com
Wed Jun 4 02:06:23 PDT 2014
On Mon, 2014-06-02 at 13:48 +0200, Greg Knoll wrote:
> On Fri, May 30, 2014 at 3:44 PM, Tanu Kaskinen
> <tanu.kaskinen at linux.intel.com> wrote:
> > (Added pulseaudio-discuss back to cc.)
> > On Fri, 2014-05-30 at 15:24 +0200, Greg Knoll wrote:
> >> Thank you for your response,
> >> Yes, I did follow that tutorial. I didn't state it correctly in my
> >> question, but I do only use the session bus to get the server
> >> address. Then I use
> >> *conn = dbus_connection_open(serverAddress, &err);
> >> to get the DBusConnection object and use this to make calls.
> > Ok, I suppose this is not the problem then. Back to the original
> > question:
> >> However, where/how do I listen for the signal? I also tried setting a
> >> dbus match rule:
> >> dbus_bus_add_match(system_bus, "type='signal',interface='org.PulseAudio.Core1'", &err);
> > You don't need to add a match rule (trying to do so won't do anything
> > useful, because the match rules are managed by the bus daemon, and in a
> > peer-to-peer connection there's no bus daemon involved at all). Do you
> > register a message filter with dbus_connection_add_filter()? If not,
> > then that's the problem.
> > By the way, please don't top-post on mailing lists, and also plain text
> > messages are preferred over HTML.
> > --
> > Tanu
> Sorry about the top post.
> I did not register a dbus_connection_add_filter(). I have added a
> DBusHandlerResult function based on the examples here:
> The second one uses an object DBusMessageHandler, which I think is
> from glib/dbus-glib. Maybe I'm wrong there. My function looks like
> DBusHandlerResult listen_to_core_Handler(DBusConnection *connection,
> DBusMessage *message, void *user_data)
> debug_print("Message received from Pulse Core.\n");
> debug_print("Signature:%s\n", dbus_message_get_signature(message));
> and I add a call to dbus_connection_add_filter() in my main thread using:
> dbus_connection_add_filter(PA_bus, listen_to_core_Handler, NULL, NULL);
> Still nothing. I should also say that the signal name string I'm
> using is "org.PulseAudio.Core1.NewModule".
> Thanks for all the help so far.
How do you dispatch incoming messages? Do you integrate the D-Bus
connection with some event loop, or do you manually call
dbus_connection_read_write_dispatch() in a loop or something similar?
More information about the pulseaudio-discuss