Campbell-scientific Java PakBus Software Development Kit Manuale Utente Pagina 27

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 30
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 26
Java PakBus® Software Development Kit
{
int available = System.in.available();
while(available > 0)
{
int bytes_read = System.in.read(in_buff);
if(bytes_read > 0)
io_tran.send_data(in_buff, bytes_read);
available = System.in.available();
}
active_links_count = network.check_state();
Thread.sleep(100);
}
}
catch(Exception e)
{
System.out.println("An exception interrupted the
transaction:");
System.out.println(e);
}
} // run
public void on_bytes_received(UserIoTran transaction,
byte[] buff, int buff_len) throws IOException
{
String temp = new String(buff,0,buff_len);
System.out.print(temp);
} // on_bytes_received
public void on_failure(UserIoTran transaction, int reason)
throws IOException
{
System.out.println("User I/O failed: " + reason);
io_tran = null;
complete = true;
} // on_failure
public void on_started(UserIoTran transaction) throws
IOException
{
System.out.println("User I/O Started. Type ^C to quit");
} // on_started
/**
* reference to the PakBus network
*/
private Network network;
/**
* holds the socket used to communicate with the datalogger
*/
private Socket socket;
/**
* set to true when the application has been completed
*/
boolean complete;
19
Vedere la pagina 26
1 2 ... 22 23 24 25 26 27 28 29 30

Commenti su questo manuale

Nessun commento