br.org.fito.j8051.bluetooth
Class BluetoothConnection

java.lang.Object
  extended by br.org.fito.j8051.bluetooth.BluetoothConnection
All Implemented Interfaces:
java.lang.Runnable

public class BluetoothConnection
extends java.lang.Object
implements java.lang.Runnable

Class thats represents a bluetooth connection, providing communications functions.
Classe que representa uma conexão bluetooth, forncecendo funcionalidades de comunicacao.


Constructor Summary
BluetoothConnection(javax.bluetooth.ServiceRecord record, ResponseListener respList)
          Create an instance of BluetoohConnection with a ServiceRecord and a ResponseLiestener objects.
 
Method Summary
 void close()
          Close a phisical connection with the bluetooth device.
 void enviarMensagem(java.lang.String msg, int processo, int prioridade)
          Send a message to the microcontroler A message is composed by a identification of the process, the priority and the message i`ts self.
 void open()
          Open a phisical connection whith the bluetooth device.
 void run()
          Overide method of Thread class that starts messages between cellphone and the microcontroller.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BluetoothConnection

public BluetoothConnection(javax.bluetooth.ServiceRecord record,
                           ResponseListener respList)
Create an instance of BluetoohConnection with a ServiceRecord and a ResponseLiestener objects.
Cria um instância de BluetoothConnection a partir dos objetos ServiceRecord e ResponseListener.

Parameters:
record -
respList -
See Also:
ResponseListener
Method Detail

open

public void open()
          throws java.lang.Exception
Open a phisical connection whith the bluetooth device.
Abre uma conexão física com o dispositivo Bluetooth.

Throws:
java.lang.Exception

close

public void close()
           throws java.lang.Exception
Close a phisical connection with the bluetooth device.
Fecha a conexão física com o dispositivo Bluetooth.

Throws:
java.lang.Exception

enviarMensagem

public void enviarMensagem(java.lang.String msg,
                           int processo,
                           int prioridade)
                    throws java.lang.Exception
Send a message to the microcontroler A message is composed by a identification of the process, the priority and the message i`ts self.
Envia uma mensagem para o microcontrolador. Uma mensagem é composta pela identificação do processo, da prioridade e da própia mensagem.

Parameters:
msg -
processo -
prioridade -
Throws:
java.lang.Exception

run

public void run()
Overide method of Thread class that starts messages between cellphone and the microcontroller.
Metodo sobrecarregado da classe Thread, que inicia a troca de mensagens entre o microcontrolador e o celular.

Specified by:
run in interface java.lang.Runnable