Page principale | Paquetages | Hiérarchie des classes | Liste des classes | Répertoires | Liste des fichiers | Membres de classe

TicTacComServer.java

Aller à la documentation de ce fichier.
00001 import java.io.IOException;
00002 
00003 import javax.bluetooth.BluetoothStateException;
00004 import javax.bluetooth.DiscoveryAgent;
00005 import javax.bluetooth.LocalDevice;
00006 import javax.microedition.io.Connector;
00007 import javax.microedition.io.StreamConnectionNotifier;
00008 
00009 /*
00010  * Created on 16 juin 2005
00011  *
00012  * TODO To change the template for this generated file go to
00013  * Window - Preferences - Java - Code Style - Code Templates
00014  */
00015 
00022 public class TicTacComServer extends TicTacCom {
00023 
00024         private StreamConnectionNotifier notifier;
00025         private static String serverUrl = "btspp://localhost:" + RFCOMM_UUID + ";name=rfcommtest;authorize=true";
00026         
00031         public TicTacComServer(TicTacMain p, int r) {
00032                 super(p, r);
00033                 // TODO Auto-generated constructor stub
00034         }
00035 
00036         void initCom() throws IOException {
00037                 conn = notifier.acceptAndOpen(); 
00038         }
00039         
00041         void initAfterThread(){
00042                 try{
00043                         //do{
00044                                 initServer();
00045                         //}while(role!=ROLE_SERVEUR && serviceUrl==null);
00046                         
00047                 }catch (BluetoothStateException e) {        
00048                 System.err.println( "Init "+role+": BluetoothStateException: " + e.getMessage() );    
00049             } catch (IOException e) {        
00050                 System.err.println( "Init "+role+": IOException: " + e.getMessage() );      
00051             }catch (Exception e) {
00052                 System.err.println( "Init "+role+": Exception: " + e.getMessage() );
00053             }
00054                 
00055         }
00056         
00058         void initServer() throws BluetoothStateException, IOException, Exception{
00059         conn = null;
00060         localDevice = LocalDevice.getLocalDevice();
00061         localDevice.setDiscoverable( DiscoveryAgent.GIAC );
00062         
00063         notifier = (StreamConnectionNotifier)Connector.open(serverUrl);  
00064         
00065         initOK=true;
00066         }
00067         
00068 }

Généré le Thu Jun 16 23:45:12 2005 pour TicTacToe3D par  doxygen 1.4.3