Exemplo n.º 1
0
 public synchronized void saveDevice(final Actor actor, final String deviceName) throws DevFailed {
   final Director dir = actor.getDirector();
   if (dir instanceof RecordingDirector) {
     if (isRecordingStarted(actor)) {
       final boolean autoChangeNX =
           ((RecordingDirector) actor.getDirector()).isAutoChangeNxEntry();
       if (autoChangeNX) {
         incNxEntryNameAndSaveContext(actor);
       }
       final String dataRecorderName =
           ((RecordingDirector) actor.getDirector()).getDataRecorderName();
       ExecutionTracerService.trace(
           actor, "saving device " + deviceName + " on datarecorder " + dataRecorderName);
       final TangoCommand command = new TangoCommand(dataRecorderName, "WriteTangoDeviceData");
       command.execute(deviceName);
       if (DataRecorder.asyncMode) {
         // Bug 22954
         final TangoCommand commandState = new TangoCommand(dataRecorderName, "State");
         logger.debug(
             "DR state :"
                 + TangoConst.Tango_DevStateName[
                     TangoAccess.getCurrentState(commandState).value()]);
         waitEndMoving(command.getDeviceProxy());
         logger.debug(
             "DR state :"
                 + TangoConst.Tango_DevStateName[
                     TangoAccess.getCurrentState(commandState).value()]);
       }
     }
   }
 }
Exemplo n.º 2
0
 public synchronized boolean isRecordingStarted(final String dataRecorderName) throws DevFailed {
   // PASSERELLE-78
   /*boolean result = false;
   final DeviceProxy dev = ProxyFactory.getInstance().createDeviceProxy(
   	dataRecorderName);
   if (dev != null) {
   if (TangoAccess.isCurrentStateEqualStateRequired(dataRecorderName, DevState.ON)) {
       result = false;
   } else {
       result = true;
   }
   }
   return result;
   */
   return !TangoAccess.isCurrentStateEqualStateRequired(dataRecorderName, DevState.ON);
 }
Exemplo n.º 3
0
  public synchronized boolean isRecordingStarted(final Actor actor) throws DevFailed {
    final Director dir = actor.getDirector();
    if (dir instanceof RecordingDirector) {
      final String dataRecorderName =
          ((RecordingDirector) actor.getDirector()).getDataRecorderName();

      // bug 22954
      if (TangoAccess.isCurrentStateEqualStateRequired(dataRecorderName, DevState.ON)) {
        return false;
      } else {
        return true;
      }
    } else {
      return false;
    }
  }
Exemplo n.º 4
0
  public synchronized void setNxEntryNameAndSaveContext(final Actor actor, final String suffix)
      throws DevFailed {
    final Director dir = actor.getDirector();
    if (dir instanceof RecordingDirector) {
      if (isRecordingStarted(actor)) {
        final String dataRecorderName =
            ((RecordingDirector) actor.getDirector()).getDataRecorderName();
        final TangoCommand commandState = new TangoCommand(dataRecorderName, "State");
        /*
         * ExecutionTracerService.trace(actor, "incrementing experiment
         * and acquisition indexes");
         */

        if (!firstRecord) {
          // write post technical data after the first loop
          logger.debug("write post technical data");
          final TangoCommand commandWritePostTechnicalData =
              new TangoCommand(dataRecorderName, "WritePostTechnicalData");
          commandWritePostTechnicalData.execute();
          if (DataRecorder.asyncMode) {
            logger.debug(
                "DR state :"
                    + TangoConst.Tango_DevStateName[
                        TangoAccess.getCurrentState(commandState).value()]);
            waitEndMoving(commandWritePostTechnicalData.getDeviceProxy());
            logger.debug(
                "DR state :"
                    + TangoConst.Tango_DevStateName[
                        TangoAccess.getCurrentState(commandState).value()]);
          }
        } else {
          firstRecord = false;
        }

        if (cancel) {
          cancel = false;
          return;
        }

        // increment indexes
        logger.debug("incrementing experiment and acquisition indexes");
        final TangoCommand commandIncAcq =
            new TangoCommand(dataRecorderName, "IncAcquisitionIndex");
        commandIncAcq.execute();

        final TangoCommand commandExpAcq = new TangoCommand(dataRecorderName, "IncExperimentIndex");
        commandExpAcq.execute();

        // change acquisition name
        final TangoAttribute acqName = new TangoAttribute(dataRecorderName + "/acquisitionName");
        acqName.write(suffix);

        if (cancel) {
          cancel = false;
          return;
        }

        // write user data
        logger.debug("user data ");
        final TangoCommand commandWriteUserData =
            new TangoCommand(dataRecorderName, "WriteUserData");
        commandWriteUserData.execute();
        if (DataRecorder.asyncMode) {
          waitEndMoving(commandWriteUserData.getDeviceProxy());
        }

        if (cancel) {
          cancel = false;
          return;
        }

        // write pre technical data
        logger.debug("write pre technical data");
        final TangoCommand commandWritePreTechnicalData =
            new TangoCommand(dataRecorderName, "WritePreTechnicalData");
        commandWritePreTechnicalData.execute();
        if (DataRecorder.asyncMode) {
          logger.debug(
              "DR state :"
                  + TangoConst.Tango_DevStateName[
                      TangoAccess.getCurrentState(commandState).value()]);
          waitEndMoving(commandWritePreTechnicalData.getDeviceProxy());
          logger.debug(
              "DR state :"
                  + TangoConst.Tango_DevStateName[
                      TangoAccess.getCurrentState(commandState).value()]);
        }
      }
    }
  }