ISensor sensor;
String sensorValueKey;
String sensorName;
double[] sensorValuesArray;
TangoAttribute attribute;
for (int sensorIndex = 0; sensorIndex < sensorsNamesArray.length
&& sensorIndex < sensorsValueKeysArray.length; ++sensorIndex) {
sensorName = sensorsNamesArray[sensorIndex];
sensor = new SensorImpl();
sensor.setName(sensorName);
sensor.setEnabled(true);
scanResult.getSensorsList().add(sensor);
sensorValueKey = sensorsValueKeysArray[sensorIndex];
attribute = new TangoAttribute(scanServerName + "/" + sensorValueKey);
sensorValuesArray = (double[]) attribute.readArray(Double.TYPE);
sensor.setScanServerAttributeName(scanServerProxy.get_name() + "/"
+ sensorValueKey);
pointIndex = 0;
for (double sensorValue : sensorValuesArray) {
// The reading can occur during the scan. Because of this, more values
// can
// have been added since
// scanPointsList was initialized. Hence the test scanPointsList.size()
// >
// pointIndex.
if (scanPointsList.size() > pointIndex) {
scanPoint = scanPointsList.get(pointIndex);
scanPoint.getSensorsValuesMap().put(sensor, sensorValue);
}
++pointIndex;
}
}
// Actuators dimension X
String[] actuatorsXNamesArrayTmp = scanServerProxy.read_attribute("actuators")
.extractStringArray();
// The actuatorsXNamesArrayTmp contains the data twice : once for reading and
// once
// for writing.
String actuatorXName;
String[] actuatorsXNamesArray = new String[actuatorsXNamesArrayTmp.length / 2];
for (int actuatorXIndex = 0; actuatorXIndex < actuatorsXNamesArray.length; ++actuatorXIndex) {
actuatorsXNamesArray[actuatorXIndex] = actuatorsXNamesArrayTmp[actuatorXIndex];
}
String[] actuatorsXValueKeysArray = scanServerProxy.read_attribute(
"actuatorsDataList").extractStringArray();
IActuator actuatorX;
String actuatorXValueKey;
double[] actuatorXValuesArray;
for (int actuatorXIndex = 0; actuatorXIndex < actuatorsXNamesArray.length
&& actuatorXIndex < actuatorsXValueKeysArray.length; ++actuatorXIndex) {
actuatorXName = actuatorsXNamesArray[actuatorXIndex];
actuatorX = new ActuatorImpl();
actuatorX.setName(actuatorXName);
actuatorX.setEnabled(true);
scanResult.getActuatorsXList().add(actuatorX);
actuatorXValueKey = actuatorsXValueKeysArray[actuatorXIndex];
attribute = new TangoAttribute(scanServerName + "/" + actuatorXValueKey);
actuatorXValuesArray = (double[]) attribute.readArray(Double.TYPE);
actuatorX.setScanServerAttributeName(scanServerProxy.get_name() + "/"
+ actuatorXValueKey);
pointIndex = 0;
for (double actuatorXValue : actuatorXValuesArray) {