import java.lang.reflect.*; import java.net.URL; import gw.*; public class RpcConnectivityTestStart { public static double TIMEOUT = 2.0; private GWPort proxy; RpcConnectivityTestStart(String gateway) { try { URL portURL = new URL("http://restsoap:AIIT@" + gateway + "/gw/soap"); GWServiceLocator locator = new GWServiceLocator(); proxy = locator.getGWPort(portURL); } catch (Exception e) { e.printStackTrace(); System.exit(2); } } public void rpcExecute(String addr) { Nx_error_t_Result[] results; try { org.apache.axis.types.UnsignedShort arg_runId = new org.apache.axis.types.UnsignedShort(1); org.apache.axis.types.UnsignedShort arg_testId = new org.apache.axis.types.UnsignedShort(1); org.apache.axis.types.UnsignedShort arg_destination = new org.apache.axis.types.UnsignedShort(0x2aca); org.apache.axis.types.UnsignedShort arg_numPackets = new org.apache.axis.types.UnsignedShort(4); org.apache.axis.types.UnsignedShort arg_sendInterval = new org.apache.axis.types.UnsignedShort(1000); // in ms results = proxy.rpcExecuteconnectivityTestStart( addr, 10.0, // timeout "*", // bridge address arg_runId, arg_testId, arg_destination, arg_numPackets, arg_sendInterval); for (int i = 0; i < results.length; i++) { System.out.println("Mote " + results[i].getAddr() + " Time " + results[i].getTimestamp()); } } catch (Exception e) { e.printStackTrace(); System.exit(2); } } public static void main(String [] args) { if (args.length != 1 && args.length != 2) { System.out.println("Usage: java RpcConnectivityTestStart gateway [mote]"); System.exit(3); } String gateway = args[0]; String mote; if (args.length == 1) mote = "ffffffffffffffff"; else mote = args[1]; RpcConnectivityTestStart stub = new RpcConnectivityTestStart(gateway); stub.rpcExecute(mote); } }