/Users/detro/workspace-nb/JAEBI-BlueToothJ2MEClient/src/org/jaebi/midlet/bt/BtServer.java

Vai alla documentazione di questo file.
00001 
00010 package org.jaebi.midlet.bt;
00011 import java.io.IOException;
00012 import java.io.InputStream;
00013 import java.io.OutputStream;
00014 import java.util.Vector;
00015 import javax.microedition.io.StreamConnection;
00016 import org.jaebi.midlet.bt.btException.BtIOException;
00017 import org.jaebi.midlet.bt.btException.BtInitException;
00018 
00019 
00020 
00033 public class BtServer extends Listener implements Runnable{
00034     
00035     private ConnectionSet connections;
00036     private ConnectionEventHandler connectionEventHandler;
00037     private ConnectionObserver connectionObserver;
00038     
00040     //TODO implementare un metodo destroy per chiudere tutte le connessioni e rilasciare le risorse occupate (distruggere i cp allocati)
00041     public BtServer(StringBuffer url, ConnectionEventHandler handler) throws BtInitException{
00042         super(url);
00043         this.connectionEventHandler = handler;
00044         this.connectionObserver = new ConnectionObserver(this.connectionEventHandler);
00045         this.connections = new ConnectionSet(connectionObserver);
00046         
00047         //faccio partire il thread di ascolto
00048         new Thread(this).start();
00049     }
00050     
00051 
00052     public void removeConnection(StreamConnection conn){
00053         this.connections.removeConnection(conn);
00054     }
00055     
00056     public void run(){
00057         while(!isClosed()){
00058             StreamConnection conn = null ;
00059             conn = listen();
00060             connections.addConnection(conn);
00061         }
00062         
00063     }
00064     
00065     
00066     
00067     
00068 }

Generato il Thu Jun 23 00:02:59 2005 per JAEBI - BlueTooth J2ME Midlet Client da  doxygen 1.4.3