|
package skynet.smart;
public class hiloPuerto extends Thread
{
Principal frameAux;
EstadoSmart estadoT = new EstadoSmart();
String literal;
public hiloPuerto(Principal form)
{
this.frameAux = form;
start();
}
public void run(){
try {
// Sleeps para efecto creciente
frameAux.setLabel("Conectando...");
CommSerie bus = new CommSerie();
frameAux.setLabel("Leyendo tarjeta...");
for (int i=1;i<=50;i++){
sleep(2);
frameAux.setProgressValor(i);
}
bus.enviaReset();
sleep(100);
for (int i=51;i<=70;i++){
sleep(2);
frameAux.setProgressValor(i);
}
literal = estadoT.getEstado(bus.leeRespuesta());
frameAux.setLabel(literal);
for (int i=71;i<=100;i++){
sleep(2);
frameAux.setProgressValor(i);
}
System.out.println(literal);
bus.cierraPuerto();
} catch(InterruptedException e){System.out.println("Interrumpido!");
} catch(NullPointerException e) {System.out.println("Puerto ocupado!"); System.exit(-1);}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am a software developer grown with programming paradigm evolution. Think that C is God's Programming Language.