Search in sources :

Example 1 with DeviceValueMultiPosition

use of org.eclipse.scanning.api.event.scan.DeviceValueMultiPosition in project gda-core by openGDA.

the class NexusSlitsWrapper method setPosition.

@Override
public DeviceValueMultiPosition setPosition(DeviceValueMultiPosition value, IPosition position) throws ScanningException {
    logger.debug("setPosition({}, {}) called on {}", value, position, getName());
    if (value != null) {
        logger.warn("non null setPosition() not expected on {}, ignoring...", getName());
    }
    if (position != null) {
        try {
            DeviceValueMultiPosition currentLocation = getPosition();
            write(value, currentLocation, position);
            return currentLocation;
        } catch (DatasetException e) {
            throw new ScanningException("Could not set position of scannable: " + getName(), e);
        }
    }
    return null;
}
Also used : DeviceValueMultiPosition(org.eclipse.scanning.api.event.scan.DeviceValueMultiPosition) ScanningException(org.eclipse.scanning.api.scan.ScanningException) DatasetException(org.eclipse.january.DatasetException)

Example 2 with DeviceValueMultiPosition

use of org.eclipse.scanning.api.event.scan.DeviceValueMultiPosition in project gda-core by openGDA.

the class NexusSlitsWrapper method getPosition.

// implements IScannable<DeviceValueMultiPosition>
@Override
public DeviceValueMultiPosition getPosition() throws ScanningException {
    DeviceValueMultiPosition position = new DeviceValueMultiPosition();
    try {
        position.put(NXslit.NX_X_GAP, (double) x_gap.getPosition());
        position.put(NXslit.NX_Y_GAP, (double) y_gap.getPosition());
        return position;
    } catch (DeviceException e) {
        throw new ScanningException("Could not get position of scannable: " + getName(), e);
    }
}
Also used : DeviceValueMultiPosition(org.eclipse.scanning.api.event.scan.DeviceValueMultiPosition) ScanningException(org.eclipse.scanning.api.scan.ScanningException) DeviceException(gda.device.DeviceException)

Aggregations

DeviceValueMultiPosition (org.eclipse.scanning.api.event.scan.DeviceValueMultiPosition)2 ScanningException (org.eclipse.scanning.api.scan.ScanningException)2 DeviceException (gda.device.DeviceException)1 DatasetException (org.eclipse.january.DatasetException)1