<div dir="ltr"><div>This is my first time sending a message to this list, so I apologize if I do not follow the protocols correctly.</div><div><br></div><div>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.</div>
<div><br></div><div>So far I have this: </div><div><br></div><div> <span style="color:rgb(0,0,0)">msg</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">dbus_message_new_method_call</span><span style="color:rgb(0,0,0)">(</span></div>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"org.PulseAudio1"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//Destination</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"/org/pulseaudio/core1"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//Object</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">path</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">to</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">call</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">on</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"org.PulseAudio.Core1"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//Interface</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">to</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">call</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">on</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"ListenForSignal"</span><span style="color:rgb(0,0,0)">);</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//Method</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//Add</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">arguments:</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">s,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">[]</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>db<span style="color:rgb(0,0,0)">us_message_iter_init_append</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">msg</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">&</span><span style="color:rgb(0,0,0)">msgIter</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//string</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">dbus_message_iter_append_basic</span><span style="color:rgb(0,0,0)">(&</span><span style="color:rgb(0,0,0)">msgIter</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">DBUS_TYPE_STRING</span><span style="color:rgb(0,0,0)">,&</span><span style="color:rgb(0,0,0)">signalName</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//empty</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">array</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">to</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">listen</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">to</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">all</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">dbus_message_iter_open_container</span><span style="color:rgb(0,0,0)">(&</span><span style="color:rgb(0,0,0)">msgIter</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(0,0,128)">DBUS_TYPE_ARRAY</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(0,128,0)">"o"</span><span style="color:rgb(0,0,0)">,&</span><span style="color:rgb(0,0,0)">arrayIter</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">dbus_message_iter_close_container</span><span style="color:rgb(0,0,0)">(&</span><span style="color:rgb(0,0,0)">msgIter</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">&</span><span style="color:rgb(0,0,0)">arrayIter</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)"><font face="arial, helvetica, sans-serif">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:</font></span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)"> dbus_bus_add_match</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,0)">system_bus</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"type='signal',interface='org.PulseAudio.Core1'"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">&</span><span style="color:rgb(0,0,0)">err</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)"><br></span></pre><font face="arial, helvetica, sans-serif">It listens on the system bus, but I've also tried listening on the pulse server session bus. I still don't receive anything.<br>
<br><br>Can someone point me in the right direction? Thanks.</font></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)"><br></span></pre></div>