Carsten Haese carsten at
Wed Apr 18 14:42:51 CEST 2007

On Wed, 2007-04-18 at 08:39 +0100, Robert Rawlins - Think Blue wrote:
> Hello Chaps,
> I posted about this the other day but I’m still struggling to get any
> form of result from it. Basically I have the following piece of code,
> and according to its API is produces singals when particular events
> occur, but i have no idea how to list for events, I’ve tried all sorts
> of combinations using the signal module but haven’t been able to get
> it working.
> [...]
> import dbus, signal
> [...]
> Now here is a copy of the API documentation that lists the signals
> thrown by the API, this is the one I’m trying to listen for.
>         void RemoteDeviceFound(string address, uint32 class, int16
> rssi)
>                This signal will be send every time an inquiry result
>                has been found by the service daemon. In general they
>                only appear during a device discovery.
> Basically I’m just looking to run a function that will print those
> details to screen. Can anyone help with working out how to listen for
> this signal?

The signal module is for handling process signals the operating system
sends to your python process. The API you're using (dbus, a crucial
detail you neglected to mention before) doesn't send this kind of

Googling for 'python dbus documentation' brings up , which seems to
explain everything you need. You need to get an instance of
dbus.Interface, which you seem to have done, and call its
connect_to_signal() method, which you don't seem to have done.

>  I’d also like to know how i can keep the application running until I
> decided to stop it manually, as the DiscoverDevices() can take a while
> to complete and send out several RemoteDeviceFound() signals in that
> period.

The very first section of the above mentioned documentation talks about
needing a main loop for receiving signals, and it provides example
boilerplate code for how to set up a main loop.

Hope this helps,


More information about the Python-list mailing list