Recent Changes - Search:

ResetDevices

In order to reset a number of Devices you need to create a List of the Devices to reset and make a request to the WSNAsyncWrapper for the Reset.

Creating the List of Nodes by providing a comma separated list (e.g., urn:node:0x1,urn:node:0x2):

	List nodeURNs;
	nodeURNs = Lists.newArrayList(nodeUrnsToReset.split(","));

Make a request to the WSNAsyncWrapper with arguments the List of Devices, the Timeout interval and the Unit of measurement for the Timeout:

	Future resetFuture = wsn.resetNodes(nodeURNs, 10, TimeUnit.SECONDS);

Finally you can get the result of the execution using the get() method on the Future object returned by the previous call:

	try {
	  JobResult resetJobResult = resetFuture.get();
	  resetJobResult.printResults(System.out, csv);
	  System.exit(resetJobResult.getSuccessPercent() < 100 ? 1 : 0);
	} catch (ExecutionException e) {
	  if (e.getCause() instanceof TimeoutException) {
	    log.info("Call timed out. Exiting...");
	  }
	  System.exit(1);
	}
Edit - History - Print - Recent Changes - Search
Page last modified on November 20, 2012, at 10:03 PM