/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package mxgstest; import common.Event; import common.EventHandlerInterface; import mxgstest.chapters.*; import mxgstest.egse.Basic; import mxgsegse.MXGSEGSE; import mxgstest.egse.Power; import java.util.Enumeration; //import javax.comm.CommPortIdentifier; import gnu.io.*; import java.io.IOException; import java.io.OutputStream; import java.io.InputStream; import java.util.Arrays; /** * * @author stet */ public class MxgsTest { static Enumeration portList; static CommPortIdentifier portId; static String messageString = "255"; static byte[] ff = new byte[] {(byte)0xFF}; static SerialPort serialPort; static OutputStream outputStream; static InputStream inputStream; /** * @param args the command line arguments * @throws java.lang.Throwable */ public static void main(String[] args) throws Throwable { // TODO code application logic here Output output = new Output(); output.printTestStart(System.getenv("TEST"),""); Basic basic = new Basic(); Power power = new Power(); MXGSEGSE egse = basic.loadEGSE(); // egse.tcp.addHandler(new myAction(), EventHandlerInterface.Preference.EARLY); Chapter5 chapter5 = new Chapter5(egse, output); Chapter6 chapter6 = new Chapter6(egse, output); Chapter8 chapter8 = new Chapter8(egse, output); egse.dhpu.setAutomaticTcLength(false); try { chapter5.run(); } catch(MxgsTestException e) { System.out.println("\nTest Failed\n"); power.powerOffDPU(egse); power.powerOffPSU(egse); System.exit(0); } try { chapter6.run(); } catch(MxgsTestException e) { System.out.println("\nTest Failed\n"); power.powerOffDPU(egse); power.powerOffPSU(egse); System.exit(0); } try { chapter8.run(); } catch(MxgsTestException e) { System.out.println("\nTest Failed\n"); System.exit(0); } output.printTestEnd(); power.powerOffDPU(egse); Thread.sleep(1000); System.exit(0); } static class myAction implements EventHandlerInterface { @Override public void callback(Event event) throws Exception { System.out.println("hej "+Arrays.toString(ff)+" "+Arrays.toString(ff)); try { outputStream.write(ff); } catch (IOException e) {} } } }