From: Marcel Holtmann <marcel@holtmann.org>
To: Ilya Rubtsov <lusyaru@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: app doesn't recieve signal DeviceDisappeared
Date: Sun, 18 Jan 2009 16:29:14 +0100 [thread overview]
Message-ID: <1232292554.5095.26.camel@californication> (raw)
In-Reply-To: <49696D00.9030604@gmail.com>
Hi Ilya,
> I need help with using Bluez and dbus. Here is my small program in Python:
>
> ------------
>
> import dbus
> import dbus.glib
> import gobject
>
> def device_found(addr, values):
> print 'Found:', addr
>
> def device_disapp(addr):
> print 'Disappeared:', addr
>
> bus = dbus.SystemBus()
> obj = bus.get_object('org.bluez', '/org/bluez/hci0')
> adapter = dbus.Interface(obj, 'org.bluez.Adapter')
> adapter.connect_to_signal('DeviceFound', device_found)
> adapter.connect_to_signal('DeviceDisappeared', device_disapp)
>
> adapter.StartDiscovery()
>
> gobject.threads_init()
> dbus.glib.init_threads()
> main_loop = gobject.MainLoop()
> main_loop.run()
>
>
> -----------
>
> And I have problem with DeviceDisappeared signal. I run program, then it
> finds my bluetooth enabled phone and prints it's address every ~10
> seconds (periodical discovery). Than I turn off bluetooth in phone, but
> Bluez doesn't send signal 'DeviceDisappeared', so program doesn't print
> "Disappeared: ...". What's wrong in my program? Do I have
> misunderstanding of Bluez Adapter API?
this might be a bug. Not many applications are actually making full use
of the DeviceDisappeared signal. Please run dbus-monitor and check if it
is really not present.
On another note, you can _NOT_ hardcode /org/bluez/hci0 path in your
apps. Nowadays they are totally random. Use FindAdapter() instead.
Regards
Marcel
next prev parent reply other threads:[~2009-01-18 15:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-11 3:52 app doesn't recieve signal DeviceDisappeared Ilya Rubtsov
2009-01-18 15:29 ` Marcel Holtmann [this message]
2009-01-18 21:17 ` Ilya Rubtsov
2009-01-19 19:52 ` Tom Patzig
2009-01-23 22:11 ` Luiz Augusto von Dentz
2009-01-26 13:57 ` Tom Patzig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1232292554.5095.26.camel@californication \
--to=marcel@holtmann.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=lusyaru@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.