| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectch.aplu.bluetooth.BluetoothFinder
public class BluetoothFinder
Class to perform an inquiry for Bluetooth devices and their services.
 Strategy for fast connection to a device with given device name:
   - Invoke static methods searchPreknownDevice() and searchCachedDevice()
   - If fails, perform an extended search by constructing a BluetoothFinder instance
     with uuids = 0 (no service search)
   - Retrieve Bluetooth address with RemoteDevice.getBluetoothAddress()
   - Declare a connection URL string using the known service protocol, e.g.
     connectionUrl = "btspp://" + address + ":1;authenticate=false;encrypt=false;master=false"
   - Open a stream connection conn = (StreamConnection)Connector.open(connectionUrl)
   - For data transfer open input and/or output streams with
     conn.openInputStream(), conn.openOutputStream()
 
 After an extending search, the callback method BluetoothResponser.notifyBluetoothDeviceSearch()
 is called, where device search information can be retrieved. If a service search is performed, the
 callback methode BluetoothResponder.notifyBluetoothServiceSearch() is called, where service search
 information can be retrieved.
| Field Summary | 
|---|
| 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 | |
|---|---|
BluetoothFinder(int[] uuids,
                boolean isVerbose,
                ch.aplu.bluetooth.BluetoothResponder responder)
Initiates device and service search with given UUIP integer values.  | 
|
BluetoothFinder(int[] uuids,
                int[] attrSet,
                boolean isVerbose,
                ch.aplu.bluetooth.BluetoothResponder responder)
Initiates extensive device and service inquiry with given UUIP integer values.  | 
|
BluetoothFinder(java.lang.String deviceName,
                int[] uuids,
                boolean isVerbose,
                ch.aplu.bluetooth.BluetoothResponder responder)
Same as Bluetoothfinder(int[] uuids, boolean isVerbose), but search only for the given deviceName.  | 
|
BluetoothFinder(java.lang.String deviceName,
                int[] uuids,
                int[] attrSet,
                boolean isVerbose,
                ch.aplu.bluetooth.BluetoothResponder responder)
Same as Bluetoothfinder(int[] uuids, int[] attrSet, boolean isVerbose), but search only for the given deviceName.  | 
|
| Method Summary | |
|---|---|
 void | 
deviceDiscovered(javax.bluetooth.RemoteDevice remoteDevice,
                 javax.bluetooth.DeviceClass deviceClass)
For internal use only.  | 
static java.lang.String | 
getDeviceName(javax.bluetooth.RemoteDevice dev)
Returns device name from given device using RemoteDevice.getFriendlyName().  | 
static javax.bluetooth.DiscoveryAgent | 
getDiscoveryAgent()
Returns the local discovery agent.  | 
static java.lang.String | 
getServiceName(javax.bluetooth.ServiceRecord serviceRecord)
Returns service name from given service record.  | 
 void | 
inquiryCompleted(int inqType)
For internal use only.  | 
static javax.bluetooth.RemoteDevice | 
searchCachedDevice(java.lang.String deviceName)
Searches for device with given name in the 'cached' database, and return it.  | 
static javax.bluetooth.RemoteDevice | 
searchPreknownDevice(java.lang.String deviceName)
Searches for device with given name in the 'preknown' database, and return it.  | 
 void | 
servicesDiscovered(int transID,
                   javax.bluetooth.ServiceRecord[] serviceRecords)
For internal use only.  | 
 void | 
serviceSearchCompleted(int transID,
                       int respCode)
For internal use only.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public BluetoothFinder(java.lang.String deviceName,
                       int[] uuids,
                       boolean isVerbose,
                       ch.aplu.bluetooth.BluetoothResponder responder)
public BluetoothFinder(int[] uuids,
                       int[] attrSet,
                       boolean isVerbose,
                       ch.aplu.bluetooth.BluetoothResponder responder)
BluetoothResponder, 
UUID, 
VerboseWriter
public BluetoothFinder(int[] uuids,
                       boolean isVerbose,
                       ch.aplu.bluetooth.BluetoothResponder responder)
BluetoothResponder, 
UUID, 
VerboseWriter
public BluetoothFinder(java.lang.String deviceName,
                       int[] uuids,
                       int[] attrSet,
                       boolean isVerbose,
                       ch.aplu.bluetooth.BluetoothResponder responder)
| Method Detail | 
|---|
public void deviceDiscovered(javax.bluetooth.RemoteDevice remoteDevice,
                             javax.bluetooth.DeviceClass deviceClass)
deviceDiscovered in interface javax.bluetooth.DiscoveryListenerpublic void inquiryCompleted(int inqType)
inquiryCompleted in interface javax.bluetooth.DiscoveryListener
public void servicesDiscovered(int transID,
                               javax.bluetooth.ServiceRecord[] serviceRecords)
servicesDiscovered in interface javax.bluetooth.DiscoveryListener
public void serviceSearchCompleted(int transID,
                                   int respCode)
serviceSearchCompleted in interface javax.bluetooth.DiscoveryListenerpublic static java.lang.String getDeviceName(javax.bluetooth.RemoteDevice dev)
public static java.lang.String getServiceName(javax.bluetooth.ServiceRecord serviceRecord)
public static javax.bluetooth.DiscoveryAgent getDiscoveryAgent()
public static javax.bluetooth.RemoteDevice searchPreknownDevice(java.lang.String deviceName)
public static javax.bluetooth.RemoteDevice searchCachedDevice(java.lang.String deviceName)
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||