test_client.java

00001 import ipc.*;
00002 
00003 public class test_client {
00004     public static void main(String args[]) {
00005         //System.setProperty("ipc.ref.file", "/work/daq-1/installed/com/ipc_root.ref");
00006         Partition p= new Partition("SCT");
00007 
00008         org.omg.CORBA.Object obj = p.lookup("SCTSctApiServer", "Test_Server"); 
00009         if (obj == null) System.out.println("Object SCTSctApiServer not found in server Test_Server");
00010         Sct_SctApi.SctApiIPC h = Sct_SctApi.SctApiIPCHelper.narrow(obj);
00011 
00012         if (h==null) {
00013             System.err.println("Error (check SctApi running) obj was " + obj);
00014             return;
00015         }
00016         System.out.println("Found SctApi server");
00017 
00018         h.status();
00019 
00020         Sct_SctApi.Scan scan = null;
00021 
00022         try {
00023           obj = h.createScan(); 
00024           if (obj == null) System.out.println("Couldn't get default Scan");
00025           scan = Sct_SctApi.ScanHelper.narrow(obj);
00026         } catch(org.omg.CORBA.BAD_PARAM e) {
00027           System.out.println(e);
00028         }
00029 
00030         if(scan == null) {
00031             System.err.println("Error getting scan, obj was " + obj);
00032             return;
00033         } else {
00034             System.err.println("Got a scan " + scan);
00035         }
00036 
00037         scan.print();
00038 
00039         scan.configure((short)9, 0.0, 128.0, 1.0);
00040         System.out.println("Configured1");
00041 
00042         scan.configure2((short)9, 0.0, 128.0, 1.0);
00043         System.out.println("Configured2");
00044 
00045         Sct_SctApi.Trigger trig = scan.getTrigger1();
00046         System.out.println("gotTrigger");
00047         trig.print();
00048         System.out.println("print trigger");
00049         trig = scan.getTrigger2();
00050         System.out.println("gotTrigger2");
00051         trig.print();
00052         System.out.println("print trigger");
00053 
00054         scan.setScanVariable1((short)7);
00055         System.out.println("Scan var 1");
00056         scan.setScanVariable2((short)7);
00057         System.out.println("Scan var 2");
00058 
00059         scan.print();
00060 
00061         double points[] = scan.getScanPoints1();
00062         System.out.println("Scan points 1");
00063         points = scan.getScanPoints2();
00064         System.out.println("Scan points 2");
00065 
00066         scan.setNTrigs(1000);
00067 
00068 //          h.initialiseAll(2);
00069 //          h.shutdownAll();
00070 
00071         h.shutdown();
00072     }
00073 }

Generated on Mon Feb 6 14:12:20 2006 for SCT DAQ/DCS Software - Java by  doxygen 1.4.6