[pulseaudio-discuss] Receiving signals from server in C
Tanu Kaskinen
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:
> https://kernel.googlesource.com/pub/scm/bluetooth/bluez/+/utils-3.4/hcid/dbus-error.c
> and
> http://lists.freedesktop.org/archives/dbus/2003-September/000468.html
>
> The second one uses an object DBusMessageHandler, which I think is
> from glib/dbus-glib. Maybe I'm wrong there. My function looks like
> this:
>
> 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?
--
Tanu
More information about the pulseaudio-discuss
mailing list