Example #1
0
 public IDynamicController getStatusController() {
   if (statusController == null) {
     if (SicsUtils.getDescendantComponent(getComponent(), NODE_STATUS) == null) {
       // Feedback status node does not exist
       return null;
     }
     statusController = (IDynamicController) getChildController(NODE_STATUS);
     statusController.addComponentListener(
         new DynamicControllerListenerAdapter() {
           public void valueChanged(IDynamicController controller, IComponentData newValue) {
             // Mark status changed
             statusChanged = true;
             // Update controller status
             try {
               CommandStatus commandStatus = getCommandStatus();
               if (commandStatus.equals(CommandStatus.BUSY)) {
                 CommandController.this.setStatus(ControllerStatus.RUNNING);
               } else {
                 CommandController.this.setStatus(ControllerStatus.OK);
               }
             } catch (SicsIOException e) {
               logger.error("Failed to obtain status for command " + getPath(), e);
             }
           }
         });
   }
   return statusController;
 }
Example #2
0
 public void activate() {
   // Listen to the status controller if it is available
   if (SicsUtils.getDescendantComponent(getComponent(), NODE_STATUS) != null) {
     getStatusController();
   }
 }
Example #3
0
 public CommandController(Component component) {
   super(component);
   SicsUtils.getDescendantComponent(component, "NODE_STATUS");
 }