TTPA (Mobile)  1.1
BTS SN-IR La Salle Avignon 2018
 Tout Classes Fichiers Fonctions Variables
Fonctions membres publiques | Fonctions de paquetage | Attributs de paquetage | Attributs privés
Référence de la classe com.ttpa.iris.ttpamobile.PeripheriqueBluetooth.TReception
Graphe de collaboration de com.ttpa.iris.ttpamobile.PeripheriqueBluetooth.TReception:
Collaboration graph
[légende]

Liste de tous les membres

Fonctions membres publiques

void run ()
void arreter ()

Fonctions de paquetage

 TReception (Handler h)

Attributs de paquetage

Handler handlerUI

Attributs privés

boolean fini

Documentation des constructeurs et destructeur


Documentation des fonctions membres

Références com.ttpa.iris.ttpamobile.PeripheriqueBluetooth.TReception.fini.

Référencé par com.ttpa.iris.ttpamobile.PeripheriqueBluetooth.deconnecter().

        {
            if(fini == false)
            {
                fini = true;
            }
            try
            {
                Thread.sleep(500);
            }
            catch (InterruptedException e)
            {
                e.printStackTrace();
            }
        }

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");
        }

Documentation des données membres


La documentation de cette classe a été générée à partir du fichier suivant :
 Tout Classes Fichiers Fonctions Variables