Пример #1
0
 public void syncExecute() throws SicsIOException, SicsExecutionException {
   // Clear interrupt flag
   SicsCore.getSicsController().clearInterrupt();
   if (getStatusController() == null) {
     asyncExecute();
   } else {
     // Wait until command is available
     while (getCommandStatus().equals(CommandStatus.BUSY)) {
       sleep("Error occured while waiting for IDLE state");
     }
     // Execute
     asyncExecute();
     int counter = 0;
     while (!statusChanged) {
       sleep("Error occured while waiting for BUSY state");
       counter += TIME_INTERVAL;
       if (counter > TIME_OUT) {
         throw new SicsExecutionException(
             "Time out on syncExecute() where status did not changed whiling execution");
       }
     }
     //			while (getCommandStatus().equals(CommandStatus.BUSY) ||
     // getCommandStatus().equals(CommandStatus.STARTING)) {
     while (!getCommandStatus().equals(CommandStatus.IDLE)) {
       sleep("Error occured while waiting for IDLE state");
     }
   }
   // Check if this device is interrupted
   if (SicsCore.getSicsController().isInterrupted()) {
     SicsCore.getSicsController().clearInterrupt();
     throw new SicsExecutionException("Interrupted");
   }
 }
Пример #2
0
 public void activate() {
   super.activate();
   // Remove old listener (det)
   SicsCore.getSicsManager().monitor().removeStateMonitor(getDeviceName(), this);
   SicsCore.getSicsManager().monitor().removeStateMonitor(getPath(), this);
   // Add new one (anticollider)
   SicsCore.getSicsManager().monitor().addStateMonitor(ID_DEVICE, this);
 }
Пример #3
0
 public void asyncExecute() throws SicsIOException {
   // Reset status change flag
   // [TODO] This may not be thread safe if asyncExecute() is called
   // multiple times when scan hasn't been finished
   statusChanged = false;
   // Send this to the blockable channel
   SicsCore.getDefaultProxy().send("hset " + getPath() + " start", null, ISicsProxy.CHANNEL_SCAN);
   //		SicsCore.getDefaultProxy().send("hset " + getPath() + " start", null);
 }