Module bluetooth :: Class DeviceDiscoverer
[show private | hide private]
[frames | no frames]

Class DeviceDiscoverer


DeviceDiscoverer

availability: GNU/Linux

Skeleton class for finer control of the device discovery process.

To implement asynchronous device discovery (e.g. if you want to do something *as soon as* a device is discovered), subclass DeviceDiscoverer and override device_discovered() and inquiry_complete()
Method Summary
  __init__(self)
TODO
  cancel_inquiry(self)
Call this method to cancel an inquiry in process.
  device_discovered(self, address, device_class, name)
Called when a bluetooth device is discovered.
  fileno(self)
  find_devices(self, lookup_names, duration, flush_cache)
find_devices( lookup_names=True, service_name=None, duration=8, flush_cache=True ) Call this method to initiate the device discovery process lookup_names - set to True if you want to lookup the user-friendly names for each device found.
  inquiry_complete(self)
Called when an inquiry started by find_devices has completed.
  pre_inquiry(self)
Called just after find_devices is invoked, but just before the inquiry is started.
  process_event(self)
Waits for one event to happen, and proceses it.
  process_inquiry(self)
Repeatedly calls process_event() until the device inquiry has completed.

Method Details

__init__(self)
(Constructor)

TODO

cancel_inquiry(self)

Call this method to cancel an inquiry in process. inquiry_complete will still be called.

device_discovered(self, address, device_class, name)

Called when a bluetooth device is discovered.

address is the bluetooth address of the device

device_class is the Class of Device, as specified in [1]
             passed in as a 3-byte string

name is the user-friendly name of the device if lookup_names was set
     when the inquiry was started.  otherwise None

This method exists to be overriden.

[1] https://www.bluetooth.org/foundry/assignnumb/document/baseband

find_devices(self, lookup_names=True, duration=8, flush_cache=True)

find_devices( lookup_names=True, service_name=None, 
               duration=8, flush_cache=True )

Call this method to initiate the device discovery process

lookup_names - set to True if you want to lookup the user-friendly 
               names for each device found.

service_name - set to the name of a service you're looking for.
               only devices with a service of this name will be 
               returned in device_discovered() NOT YET IMPLEMENTED


ADVANCED PARAMETERS:  (don't change these unless you know what 
                    you're doing)

duration - the number of 1.2 second units to spend searching for
           bluetooth devices.  If lookup_names is True, then the 
           inquiry process can take a lot longer.

flush_cache - return devices discovered in previous inquiries

inquiry_complete(self)

Called when an inquiry started by find_devices has completed.

pre_inquiry(self)

Called just after find_devices is invoked, but just before the inquiry is started.

This method exists to be overriden

process_event(self)

Waits for one event to happen, and proceses it. The event will be either a device discovery, or an inquiry completion.

process_inquiry(self)

Repeatedly calls process_event() until the device inquiry has completed.

Generated by Epydoc 2.1 on Tue May 9 02:23:39 2006 http://epydoc.sf.net