On Tue, Jun 17, 2014 at 10:31 AM, Tanu Kaskinen <tanu.kaskinen at linux.intel.com> wrote: > On Fri, 2014-06-13 at 17:17 +0200, Greg Knoll wrote: >> I think first it would be good to know that I'm correctly registering >> with ListenForSignal. First I use >> >> conn = dbus_connection_open(serverAddress, &err); >> >> to get a connection to PulseAudio. Then I call the message: >> >> 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); >> >> >> //call dbus function >> >> debug_print(" >...Listening for signal %s...\n",signalName); >> >> dbus_connection_send_with_reply_and_block (conn, msg, -1, &err); >> >> with signalName = "org.PulseAudio.Core1.NewModule" >> >> Is this correct if I want to be notified when all new modules are loaded? > > Yes, looks correct. > >> If so, I then call dbus_connection_pop_message on the private >> connection in the main loop. > > How do you wait for incoming messages? > > Typically you shouldn't call dbus_connection_pop_message() (even the > documentation of that function says that). If you have a main loop, you > should integrate the DBusConnection with the main loop. If you don't > have a main loop in your program, you can use > dbus_connection_read_write_dispatch(). > >>Do I need to add a match? > > As already discussed in this thread: no, you don't need to add a match. > > -- > Tanu > Thank you for the reply and I apologize for accidentally top posting again. I do have a main loop, but not a glib main loop. I am running a while() loop in a QtThread. I use dbus_connection_read_write_dispatch() already in this loop for the system bus, and successfully use dbus_connection_pop_message() for system bus messages. I tried the same method (without using dbus_connection_pop_message() as you suggested) for the PA connection, and then used dbus_connection_add_filter() to add a DBusHandleMessageFunction. I still get nothing. What exactly do you mean by integrating the DBusConnection with the main loop? Do you mean registering watch functions (dbus_connection_set_watch_functions()) and object paths (dbus_connection_register_object_path), etc? I realize your job isn't to teach me DBUS, so thank you for all your help.