throws SalsaDeviceException {
if (TangoDeviceHelper.isDeviceRunning(scanServerName)) {
try {
DeviceProxy scanServerProxy = TangoDeviceHelper.getDeviceProxy(scanServerName);
TangoAttribute afterRunActionType = new TangoAttribute(scanServerName + "/afterRunActionType");
afterRunActionType.write(behaviour.getType());
// System.out.println("behaviour.getType()=" +
// behaviour.getType());
if (sensor != null) {
// We need the sensor position.
String sensorName = sensor.getName();
if ((sensorName != null) && !sensorName.trim().equals("")) {
String[] sensorsNamesArray = scanServerProxy.read_attribute("sensors").extractStringArray();
int sensorPosition;
for (sensorPosition = 0; sensorPosition < sensorsNamesArray.length; ++sensorPosition) {
if (sensorName.equals(sensorsNamesArray[sensorPosition])) {
break;
}
}
if (sensorPosition < sensorsNamesArray.length) {
TangoAttribute afterRunActionSensor = new TangoAttribute(scanServerName
+ "/afterRunActionSensor");
afterRunActionSensor.write(sensorPosition);
} else {
throw new SalsaDeviceException("Error : sensor " + sensor.getName()
+ " is unknow on the scan server " + scanServerName + ".");
}
}
}
if (actuator != null) {
// We need the actuator position.
String actuatorName = actuator.getName();
if ((actuatorName != null) && !actuatorName.trim().equals("")) {
String[] actuatorsNamesArray = scanServerProxy.read_attribute("actuators").extractStringArray();
int actuatorPosition;
for (actuatorPosition = 0; actuatorPosition < actuatorsNamesArray.length; ++actuatorPosition) {
if (actuatorName.equals(actuatorsNamesArray[actuatorPosition])) {
break;
}
}
if (actuatorPosition < actuatorsNamesArray.length) {
TangoAttribute afterRunActionActuator = new TangoAttribute(scanServerName
+ "/afterRunActionActuator");
afterRunActionActuator.write(actuatorPosition);
} else {
throw new SalsaDeviceException("Error : actuator " + actuator.getName()
+ " is unknow on the scan server " + scanServerName + ".");
}
}