ScanState state = ScanState.STOPPED;
if (TangoDeviceHelper.isDeviceRunning(scanServerName)) {
try {
DeviceProxy scanServerProxy = TangoDeviceHelper.getDeviceProxy(scanServerName);
if (scanServerProxy != null) {
DevState devstate = scanServerProxy.state();
if (devstate.value() == DevState.ON.value()) {
state = ScanState.STOPPED;
} else if (devstate.value() == DevState.MOVING.value()
|| devstate.value() == DevState.RUNNING.value()) {
state = ScanState.RUNNING;
} else if (devstate.value() == DevState.STANDBY.value()) {
state = ScanState.PAUSED;
}
else if (devstate.value() == DevState.ALARM.value() || devstate.value() == DevState.FAULT.value()) {
state = ScanState.ABORT;
} else {
state = ScanState.STOPPED;
}
}