Campbell Scientific Java PakBus Software Development Kit User Manual

Page 24

Advertising
background image

Java PakBus® Software Development Kit

// specified by hold_off before we continue
System.out.println("File control succeeded");
reopen_delay = hold_off * 1000;
}
else
{
System.out.println("File control failed: " + outcome);
complete = true;
}
} // on_complete


public void on_complete(
GetProgStatsTran transaction,
int outcome) throws IOException
{
if(outcome == GetProgStatsTran.outcome_success)
{
System.out.println("Program compilation complete:");
System.out.println(" Program Name: " +
datalogger.get_program_name());
System.out.println(" Compile Result: " +
datalogger.get_compile_result());
}
else
System.out.println("Failed to get program stats: " +
outcome);
complete = true;
} // on_complete


/**
* @param args
*/
public static void main(String[] args)
{
try
{
Example6_3 test = new Example6_3(args);
test.run(args);
}
catch(Exception e)
{
System.out.println("Error sending program file: " + e);
}
}


private void run(String[] args) throws Exception
{
// initialise the network
socket = new Socket(args[0],Integer.parseInt(args[1]));
network = new Network(
(short)4079,
socket.getInputStream(),
socket.getOutputStream());
network.add_low_level_logger(
new LowLevelFile(
new FileOutputStream("io$jpakbus.log")));
datalogger = new Datalogger(Short.parseShort(args[2]));
network.add_station(datalogger);

16

Advertising