bluetooth
Class StrategoClient

java.lang.Object
  extended by bluetooth.GestionBt
      extended by bluetooth.StrategoClient
All Implemented Interfaces:
java.lang.Runnable, javax.bluetooth.DiscoveryListener

public class StrategoClient
extends GestionBt
implements javax.bluetooth.DiscoveryListener, java.lang.Runnable

Gère le client bluetooth


Field Summary
private  java.util.Vector devicesFound
           
private  javax.bluetooth.DiscoveryAgent discoveryAgent
           
private  java.util.Vector servicesFound
           
private  java.lang.String serviceUrl
           
private  java.lang.Thread thread
           
private  javax.bluetooth.UUID[] uuidSet
           
 
Fields inherited from class bluetooth.GestionBt
_SConnection, input, output, stratego
 
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
StrategoClient(Stratego stratego)
          Constructeur
 
Method Summary
 void deviceDiscovered(javax.bluetooth.RemoteDevice btDevice, javax.bluetooth.DeviceClass cod)
          Cette méthode recherche tous les matériels équipé du bluetooth se trouvant à portée.
 void envoyerCoupJoue(Case cD, Case cA)
          Envoie le coup joue grâce à un OutputStream
 void envoyerPlateau()
          Envoie les données du plateau
 void fermetureFlux()
          Ferme les flux d'entrée et de sortie
 javax.microedition.io.StreamConnection get_SConnection()
           
 java.io.InputStream getInput()
           
 java.io.OutputStream getOutput()
           
 void inquiryCompleted(int discType)
          Cette méthode est appelée lorsque l'enquête est terminée.
 void lirePlateau()
          Récupère les données du plateau
private  void ouvertureFlux()
          Ouvre les flux d'entrée et de sortie
 void run()
          Exécute le thread
 void servicesDiscovered(int transID, javax.bluetooth.ServiceRecord[] servRecord)
          Cette méthode est appelée quand un service Stratego a été découvert pendant la recherche.
 void serviceSearchCompleted(int transID, int responseCode)
          Indique l'état d'achèvement de la découverte de services, est appelée quand la recherche est terminé ou a été résiliée en raison d'une erreur.
 
Methods inherited from class bluetooth.GestionBt
envoyerCoupJoue, lireCoupJoue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

discoveryAgent

private javax.bluetooth.DiscoveryAgent discoveryAgent

uuidSet

private javax.bluetooth.UUID[] uuidSet

serviceUrl

private java.lang.String serviceUrl

devicesFound

private java.util.Vector devicesFound

servicesFound

private java.util.Vector servicesFound

thread

private java.lang.Thread thread
Constructor Detail

StrategoClient

public StrategoClient(Stratego stratego)
Constructeur

Parameters:
stratego - instance du stratego
Method Detail

deviceDiscovered

public void deviceDiscovered(javax.bluetooth.RemoteDevice btDevice,
                             javax.bluetooth.DeviceClass cod)
Cette méthode recherche tous les matériels équipé du bluetooth se trouvant à portée. Les matériels sont ensuite ajoutés à une liste.

Specified by:
deviceDiscovered in interface javax.bluetooth.DiscoveryListener

inquiryCompleted

public void inquiryCompleted(int discType)
Cette méthode est appelée lorsque l'enquête est terminée.

Specified by:
inquiryCompleted in interface javax.bluetooth.DiscoveryListener

servicesDiscovered

public void servicesDiscovered(int transID,
                               javax.bluetooth.ServiceRecord[] servRecord)
Cette méthode est appelée quand un service Stratego a été découvert pendant la recherche. Elle permet notamment de récupérer l'adresse URL du service Stratego.

Specified by:
servicesDiscovered in interface javax.bluetooth.DiscoveryListener

serviceSearchCompleted

public void serviceSearchCompleted(int transID,
                                   int responseCode)
Indique l'état d'achèvement de la découverte de services, est appelée quand la recherche est terminé ou a été résiliée en raison d'une erreur.

Specified by:
serviceSearchCompleted in interface javax.bluetooth.DiscoveryListener

ouvertureFlux

private void ouvertureFlux()
Ouvre les flux d'entrée et de sortie


fermetureFlux

public void fermetureFlux()
Ferme les flux d'entrée et de sortie


envoyerPlateau

public void envoyerPlateau()
Envoie les données du plateau


lirePlateau

public void lirePlateau()
Récupère les données du plateau


envoyerCoupJoue

public void envoyerCoupJoue(Case cD,
                            Case cA)
Envoie le coup joue grâce à un OutputStream

Parameters:
cD - case de départ
cA - case d'arrivée

run

public void run()
Exécute le thread

Specified by:
run in interface java.lang.Runnable

get_SConnection

public javax.microedition.io.StreamConnection get_SConnection()

getOutput

public java.io.OutputStream getOutput()

getInput

public java.io.InputStream getInput()