[pulseaudio-discuss] Receiving signals from server in C

Greg Knoll gregknoll at gmail.com
Fri May 30 05:19:11 PDT 2014


This is my first time sending a message to this list, so I apologize if I
do not follow the protocols correctly.

I have successfully called other methods by first getting a DBUS session
connection and using the server_lookup1 object.  However, I am having
trouble receiving signals from the pulse server using the !ListenForSignal
method in C/C++.    If I want, for instance, to listen for new modules.
 The documentation says that the ListenForSignal method takes a string and
an array of object paths as arguments, sa[o], but that the array can be
empty to receive messages from all objects.

So far I have this:

       msg = dbus_message_new_method_call(

            "org.PulseAudio1", 				//Destination

            "/org/pulseaudio/core1",                    //Object path to call on

            "org.PulseAudio.Core1",                     //Interface to call on

            "ListenForSignal");                         //Method



    //Add arguments: s, []

    dbus_message_iter_init_append(msg, &msgIter);


        //string

        dbus_message_iter_append_basic(&msgIter, DBUS_TYPE_STRING,&signalName);


        //empty array to listen to all

        dbus_message_iter_open_container(&msgIter,DBUS_TYPE_ARRAY,"o",&arrayIter);

        dbus_message_iter_close_container(&msgIter, &arrayIter);


I don't get any errors from DBUS about incorrect signatures or objects
not being found.  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);


It listens on the system bus, but I've also tried listening on the pulse
server session bus.  I still don't receive anything.


Can someone point me in the right direction?  Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20140530/6f6be7b3/attachment-0001.html>


More information about the pulseaudio-discuss mailing list