Hi,<br><br>I have a basic question about sending and receiving signals.
Most of what i have learnt till now is based on the dbus low level API
tutorial.<br><br>I am using dbus 1.0.2 and a session bus.<br><br>Sending signal:
<br>I send a signal as told in the tutorial, i use dbus_message_append_args() to send some arguments with the message.<br><br>Rcving signal: (this is where i have some questions)<br><br>1. I set a filter function and read the arguements of the message in the filter function.
<br>2. I add a match rule to recv the signal like this<br>dbus_bus_add_match(conn, "type='signal',interface='test.signal.Type'", &dbusError); <br><br>3. And instead of dbus_connection_pop_message as used in the tutorial, do this...
<br>while (dbus_connection_read_write<div>_dispatch (conn, -1) ) ; <br><br>4. In my filter function, i read the message using dbus_message_get_args() and return DBUS_HANDLER_RESULT_HANDLED.<br><br>Questions:<br>
<br>1.
Is this a correct way to recv signals? Do i have to do
dbus_message_unref(message) in the filter function after handling it
before i return?
<br><br>2. I also see that as soon as i call the match rule api, the
filter function gets called. I further found that the message has a
argument which a string, which is 2. Is this expected? I had assumed
that the filter function will only be called when i send a signal and
not before that. Why is this?
<br><br>Seperate point: Also in the tutorial the send signal function
closes the dbus connection and the dbus version 1.0.2 complains about
this. Can someone pls fix the tutorial for this. I assume from the
error message we dont close the connection anymore?
<br><br>Thanks for any help or insights!<br>-Krish</div>