Fonctions membres publiques | |
void | run () |
void | arreter () |
Fonctions de paquetage | |
TReception (Handler h) | |
Attributs de paquetage | |
Handler | handlerUI |
Attributs privés | |
boolean | fini |
com.ttpa.iris.ttpamobile.PeripheriqueBluetooth.TReception.TReception | ( | Handler | h | ) | [package] |
Références com.ttpa.iris.ttpamobile.PeripheriqueBluetooth.CODE_DECONNEXION, com.ttpa.iris.ttpamobile.PeripheriqueBluetooth.CODE_RECEPTION, com.ttpa.iris.ttpamobile.PeripheriqueBluetooth.TReception.fini, com.ttpa.iris.ttpamobile.PeripheriqueBluetooth.getAdresse(), com.ttpa.iris.ttpamobile.PeripheriqueBluetooth.getNom(), com.ttpa.iris.ttpamobile.PeripheriqueBluetooth.handler, com.ttpa.iris.ttpamobile.PeripheriqueBluetooth.TReception.handlerUI, et com.ttpa.iris.ttpamobile.PeripheriqueBluetooth.receiveStream.
{ System.out.println("<Bluetooth> Attente reception"); while(!fini) { try { if(receiveStream.available() > 0) { byte buffer[] = new byte[100]; int k = receiveStream.read(buffer, 0, 100); if(k > 0) { byte rawdata[] = new byte[k]; for(int i=0;i<k;i++) rawdata[i] = buffer[i]; String data = new String(rawdata); System.out.println("<Bluetooth> Reception " + data); Message msg = Message.obtain(); /*msg.what = Peripherique.CODE_RECEPTION; msg.obj = data; handlerUI.sendMessage(msg);*/ //Message msg = handlerUI.obtainMessage(); Bundle b = new Bundle(); b.putString("nom", getNom()); b.putString("adresse", getAdresse()); b.putInt("etat", CODE_RECEPTION); b.putString("donnees", data); msg.setData(b); handlerUI.sendMessage(msg); } } try { Thread.sleep(250); } catch (InterruptedException e) { e.printStackTrace(); } } catch (IOException e) { //System.out.println("<Socket> error read"); e.printStackTrace(); } } Message msg = Message.obtain(); //msg.arg1 = CODE_DECONNEXION; Bundle b = new Bundle(); b.putString("nom", getNom()); b.putString("adresse", getAdresse()); b.putInt("etat", CODE_DECONNEXION); b.putString("donnees", ""); msg.setData(b); handler.sendMessage(msg); System.out.println("<Bluetooth> Fin reception"); }
boolean com.ttpa.iris.ttpamobile.PeripheriqueBluetooth.TReception.fini [private] |
Handler com.ttpa.iris.ttpamobile.PeripheriqueBluetooth.TReception.handlerUI [package] |