br.org.fito.j8051.bluetooth
Class BluetoothEngine

java.lang.Object
  extended by br.org.fito.j8051.bluetooth.BluetoothEngine
All Implemented Interfaces:
javax.bluetooth.DiscoveryListener

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

Suports class for the Bluetooth system This class have some functions for devices and services search and suport for creation of the BluetoothConnection Object.
Classe de suporte ao sistema Bluetooth. Esta classe contém diversas funcionalidades para a busca de dispositivos e serviços bluetooth e suporte para a criação do objeto BluetoothConnection.


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
BluetoothEngine(ResponseListener respList)
          Creates a new instance os BluetoothEngine.
 
Method Summary
 void cancelarBuscaDispositivos()
          Cancel the device search.
 void cancelarBuscaServicos()
          Cancel the service search.
 void deviceDiscovered(javax.bluetooth.RemoteDevice remoteDevice, javax.bluetooth.DeviceClass deviceClass)
           
 BluetoothConnection getBluetoothConnection(javax.bluetooth.RemoteDevice remoteDevice)
          Given a RemoteDevice object, creates a bluetooth connection.
 void inquiryCompleted(int discType)
           
 java.util.Vector procurarDispositivos(boolean novaBusca)
          Search for bluetooth devices, returning a list of RemoteDevices of all devices found.
 void servicesDiscovered(int i, javax.bluetooth.ServiceRecord[] serviceRecord)
           
 void serviceSearchCompleted(int transID, int respCode)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BluetoothEngine

public BluetoothEngine(ResponseListener respList)
                throws java.lang.Exception
Creates a new instance os BluetoothEngine.
Cria uma nova instancia de BluetoothEngine

Throws:
java.lang.Exception
Method Detail

procurarDispositivos

public java.util.Vector procurarDispositivos(boolean novaBusca)
                                      throws java.lang.Exception
Search for bluetooth devices, returning a list of RemoteDevices of all devices found. If the "new search(nova busca)" flag is setted true, do a new device search else try to get the results of the last search on the cache.
Procura por dispositivos bluetooth, retornando uma lista de RemoteDevice de todos dispositivos encontrados. Se a flag novaBusca estiver true, faz uma nova busa de dispositivos, senao tenta antes pegar os dispositivos que estao em cache, resultante de outras pesquisas.

Throws:
java.lang.Exception

getBluetoothConnection

public BluetoothConnection getBluetoothConnection(javax.bluetooth.RemoteDevice remoteDevice)
                                           throws java.lang.Exception
Given a RemoteDevice object, creates a bluetooth connection.
Dado um objeto RemoteDevice, cria uma conexao bluetooth.

Throws:
java.lang.Exception

cancelarBuscaDispositivos

public void cancelarBuscaDispositivos()
                               throws java.lang.Exception
Cancel the device search.
Cancela uma busca por dispositivos.

Throws:
java.lang.Exception

cancelarBuscaServicos

public void cancelarBuscaServicos()
                           throws java.lang.Exception
Cancel the service search.
Cancela uma bsuca por servicos.

Throws:
java.lang.Exception

deviceDiscovered

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

servicesDiscovered

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

serviceSearchCompleted

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

inquiryCompleted

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