example.bluetooth.demo
Class BTServiceSearcher

java.lang.Object
  extended by example.bluetooth.demo.BTServiceSearcher
All Implemented Interfaces:
javax.bluetooth.DiscoveryListener

public class BTServiceSearcher
extends java.lang.Object
implements javax.bluetooth.DiscoveryListener

Facade for JSR82, connecting via the btspp protocol. This class simplifies searching for services on a device that can only search for one device at the time. It is based on the BlueToothFacade class found in the BlueGammon game.


Field Summary
static java.lang.String BT_PROTOCOL
          Protocol
protected  java.lang.Object DEVICE_LOCK
          Device Discovery lock
protected  java.util.Vector m_devices
          Device lookup result
protected  javax.bluetooth.ServiceRecord m_record
          Service lookup result
protected  java.util.Hashtable m_servers
          service id / server instance map
protected  java.lang.Object SERVICE_LOCK
          Service Discovery lock
 
Fields inherited from interface javax.bluetooth.DiscoveryListener
INQUIRY_COMPLETED, INQUIRY_ERROR, INQUIRY_TERMINATED, SERVICE_SEARCH_COMPLETED, SERVICE_SEARCH_DEVICE_NOT_REACHABLE, SERVICE_SEARCH_ERROR, SERVICE_SEARCH_NO_RECORDS, SERVICE_SEARCH_TERMINATED
 
Constructor Summary
BTServiceSearcher()
           
 
Method Summary
 void deviceDiscovered(javax.bluetooth.RemoteDevice btDevice, javax.bluetooth.DeviceClass cod)
           
 javax.bluetooth.ServiceRecord findServiceOnDevice(java.lang.String serviceNumber, javax.bluetooth.RemoteDevice device)
           
 javax.bluetooth.ServiceRecord findServiceOnDevice(java.lang.String serviceNumber, javax.bluetooth.RemoteDevice device, int[] attr)
           
 void inquiryCompleted(int discType)
           
 void servicesDiscovered(int transID, javax.bluetooth.ServiceRecord[] records)
           
 void serviceSearchCompleted(int transID, int respCode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BT_PROTOCOL

public static final java.lang.String BT_PROTOCOL
Protocol

See Also:
Constant Field Values

m_servers

protected java.util.Hashtable m_servers
service id / server instance map


DEVICE_LOCK

protected final java.lang.Object DEVICE_LOCK
Device Discovery lock


SERVICE_LOCK

protected final java.lang.Object SERVICE_LOCK
Service Discovery lock


m_devices

protected java.util.Vector m_devices
Device lookup result


m_record

protected javax.bluetooth.ServiceRecord m_record
Service lookup result

Constructor Detail

BTServiceSearcher

public BTServiceSearcher()
Method Detail

findServiceOnDevice

public javax.bluetooth.ServiceRecord findServiceOnDevice(java.lang.String serviceNumber,
                                                         javax.bluetooth.RemoteDevice device,
                                                         int[] attr)
                                                  throws java.io.IOException
Throws:
java.io.IOException

findServiceOnDevice

public javax.bluetooth.ServiceRecord findServiceOnDevice(java.lang.String serviceNumber,
                                                         javax.bluetooth.RemoteDevice device)
                                                  throws java.io.IOException
Throws:
java.io.IOException

servicesDiscovered

public void servicesDiscovered(int transID,
                               javax.bluetooth.ServiceRecord[] records)
Specified by:
servicesDiscovered in interface javax.bluetooth.DiscoveryListener

serviceSearchCompleted

public void serviceSearchCompleted(int transID,
                                   int respCode)
Specified by:
serviceSearchCompleted in interface javax.bluetooth.DiscoveryListener

deviceDiscovered

public void deviceDiscovered(javax.bluetooth.RemoteDevice btDevice,
                             javax.bluetooth.DeviceClass cod)
Specified by:
deviceDiscovered in interface javax.bluetooth.DiscoveryListener

inquiryCompleted

public void inquiryCompleted(int discType)
Specified by:
inquiryCompleted in interface javax.bluetooth.DiscoveryListener