Linux bluetooth development
 help / color / mirror / Atom feed
From: "Albert Huang" <albert@csail.mit.edu>
To: "BlueZ users" <bluez-users@lists.sourceforge.net>
Subject: Re: [Bluez-users] multithread / multi process use
Date: Tue, 30 Jan 2007 17:15:59 -0500	[thread overview]
Message-ID: <ef9938ec0701301415u4f27bad8i3f165beaafb6161e@mail.gmail.com> (raw)
In-Reply-To: <80236d750701300639w59ec30f0n7eeeca203a513be5@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 800 bytes --]

> 1 .can the daemon  hci manage simultenous requests from variuos
> process/threads without problem ?

yes.  Currently, if one process attempts to start a device inquiry
while one is already in progress, then hcid will raise a DBusException
and refuse to honor the second request.  The second process may still
listen for discovery and name lookup events.

> 2 .where I can find some api docs(if any) about the hcid ?

current document exists, but is difficult to find and not very
beginner friendly.  Downoad the bluez-utils source and look in
hcid/dbus-api.txt  You can use the attached python script as a
starting point.  It's not terribly elegant about detecting when an
inquiry is already in process, but I don't think that hcid is sending
standardized error codes in its exceptions...

-albert

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: inquiry-with-names.py --]
[-- Type: text/x-python; name="inquiry-with-names.py", Size: 823 bytes --]

import gobject
import dbus

import dbus.glib

def onRemoteNameUpdated( address, name ):
    print address, name.encode("utf-8")

def onDiscoveryCompleted():
    print "discovery completed"
    mainloop.quit()

bus = dbus.SystemBus()
bluez = bus.get_object('org.bluez', '/org/bluez')
manager = dbus.Interface(bluez, 'org.bluez.Manager')
obj = bus.get_object('org.bluez', manager.DefaultAdapter())
adapter = dbus.Interface(obj, 'org.bluez.Adapter')
try: 
    adapter.DiscoverDevices()
except dbus.DBusException, e:
    if e.args[0] == "Discover in progress": 
        print "hcid reports existing device discovery already in progress."

adapter.connect_to_signal( 'DiscoveryCompleted', onDiscoveryCompleted )
adapter.connect_to_signal( 'RemoteNameUpdated', onRemoteNameUpdated )

mainloop = gobject.MainLoop()
mainloop.run()

[-- Attachment #3: Type: text/plain, Size: 347 bytes --]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

      reply	other threads:[~2007-01-30 22:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-25 10:29 [Bluez-users] multithread / multi process use Emanuele Novelli
2007-01-25 10:42 ` Marcel Holtmann
2007-01-28  2:30 ` Albert Huang
2007-01-30 14:39   ` Emanuele Novelli
2007-01-30 22:15     ` Albert Huang [this message]

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=ef9938ec0701301415u4f27bad8i3f165beaafb6161e@mail.gmail.com \
    --to=albert@csail.mit.edu \
    --cc=bluez-users@lists.sourceforge.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox