org.coffeecrew.mobile.oop.util
Class OOPFinder

java.lang.Object
  extended by org.coffeecrew.mobile.oop.util.OOPFinder
All Implemented Interfaces:
javax.bluetooth.DiscoveryListener

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

This class is used to locate the remote Obex object passing service url. The main purpose is that BlueCove does not implement the selectService() method. This is a workaround, that should work on all implementations that support at least basic discovery mechanisms. To transfer objects (you do not need this, but if you're interestet in the connection url, this is the way to retrieve it) Basic usage is:

    OOPFinder oopf = new OOPFinder();
    System.out.println("Connection: " + oopf.getConnectionURL());
 

Since:
0.1

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
OOPFinder()
          Creates a new instance of OOPFinder, which is used to locate a remote Obex object passing service
 
Method Summary
 void deviceDiscovered(javax.bluetooth.RemoteDevice remoteDevice, javax.bluetooth.DeviceClass cod)
          Implementation as defined in the interface javax.bluetooth.DiscoveryListener this code is called from the implementation when a device was discovered.
 void findServices()
          This actually locates the Obex object passing service
 java.lang.String getConnectionURL()
          Fetches the connection URL which is needed to connect to the Obex object passing service.
 void inquire()
          Executes the actual device inquiry.
 void inquiryCompleted(int discType)
          Implementation as defined in the interface javax.bluetooth.DiscoveryListener this code is called from the implementation when an inquiry is completed.
 void servicesDiscovered(int transID, javax.bluetooth.ServiceRecord[] servRecord)
          Implementation as defined in the interface javax.bluetooth.DiscoveryListener this code is called from the implementation when a service was discovered.
 void serviceSearchCompleted(int transID, int respCode)
          Implementation as defined in the interface javax.bluetooth.DiscoveryListener this code is called from the implementation when the service search finished.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OOPFinder

public OOPFinder()
Creates a new instance of OOPFinder, which is used to locate a remote Obex object passing service

Method Detail

inquire

public void inquire()
Executes the actual device inquiry.


inquiryCompleted

public void inquiryCompleted(int discType)
Implementation as defined in the interface javax.bluetooth.DiscoveryListener this code is called from the implementation when an inquiry is completed.

Specified by:
inquiryCompleted in interface javax.bluetooth.DiscoveryListener
Parameters:
discType - How the inquiry completed; either INQUIRY_COMLETED, INQUIRY_ERROR or INQUIRY_TERMINATED

servicesDiscovered

public void servicesDiscovered(int transID,
                               javax.bluetooth.ServiceRecord[] servRecord)
Implementation as defined in the interface javax.bluetooth.DiscoveryListener this code is called from the implementation when a service was discovered.

Specified by:
servicesDiscovered in interface javax.bluetooth.DiscoveryListener
Parameters:
transID - Transaction ID, that is posted back from the service search
servRecord - The service record containing information from the remote device

serviceSearchCompleted

public void serviceSearchCompleted(int transID,
                                   int respCode)
Implementation as defined in the interface javax.bluetooth.DiscoveryListener this code is called from the implementation when the service search finished.

Specified by:
serviceSearchCompleted in interface javax.bluetooth.DiscoveryListener
Parameters:
transID - The transaction ID that identifies the request that initiated the service search
respCode - The status response code of the transaction

deviceDiscovered

public void deviceDiscovered(javax.bluetooth.RemoteDevice remoteDevice,
                             javax.bluetooth.DeviceClass cod)
Implementation as defined in the interface javax.bluetooth.DiscoveryListener this code is called from the implementation when a device was discovered.

Specified by:
deviceDiscovered in interface javax.bluetooth.DiscoveryListener
Parameters:
remoteDevice - The remote device found during the inquiry
cod - The class of device, the remote device represents (e.g. mobile, laptop, ...)

getConnectionURL

public java.lang.String getConnectionURL()
Fetches the connection URL which is needed to connect to the Obex object passing service.

Returns:
The connection URL where the Obex object passing service was located or null if no service could be found

findServices

public void findServices()
This actually locates the Obex object passing service