// Error strategies.
if (config.getScanAddOn() != null
&& config.getScanAddOn().getErrorStrategy() != null) {
IErrorStrategy errorStrat = config.getScanAddOn().getErrorStrategy();
IErrorStrategyItem[] categoriesESI = new IErrorStrategyItem[] {
errorStrat.getActuatorsErrorStrategy(),
errorStrat.getSensorsErrorStrategy(),
errorStrat.getTimebasesErrorStrategy(),
errorStrat.getHooksErrorStrategy() };
String[] categoriesStr = new String[] { "actuators", "sensors", "timebases",
"hooks" };
for (int i = 0; i < categoriesStr.length; i++) {
String cat = categoriesStr[i];
IErrorStrategyItem esi = categoriesESI[i];
double errorStrategyTimeOut = esi.getTimeOut();
int errorStrategyRetryCount = esi.getRetryCount();
double errorStrategyRetryTimeOut = esi.getTimeBetweenRetries();
int errorStrategyType = esi.getStrategy().ordinal();
// Time out.
String catAttribute = cat + "TimeOut";
actionName = "write_attribute(\"" + catAttribute + "\","
+ errorStrategyTimeOut + ")";
scanServerProxy.write_attribute(new DeviceAttribute(catAttribute,
errorStrategyTimeOut));
// Retry count.
catAttribute = cat + "RetryCount";
actionName = "write_attribute(\"" + catAttribute + "\","
+ errorStrategyRetryCount + ")";
scanServerProxy.write_attribute(new DeviceAttribute(catAttribute,
errorStrategyRetryCount));
// Retry time out.
catAttribute = cat + "RetryTimeOut";
actionName = "write_attribute(\"" + catAttribute + "\","
+ errorStrategyRetryCount + ")";
scanServerProxy.write_attribute(new DeviceAttribute(catAttribute,
errorStrategyRetryTimeOut));
// Error strategy.
catAttribute = cat + "ErrorStrategy";
actionName = "write_attribute(\"" + catAttribute + "\","
+ errorStrategyType + ")";
scanServerProxy.write_attribute(new DeviceAttribute(catAttribute,
errorStrategyType));
}
// Context validation error strategy.
int erreurStrategyValue = errorStrat.getContextValidationStrategy().ordinal();
actionName = "write_attribute(\"contextValidationErrorStrategy\","
+ erreurStrategyValue + ")";
scanServerProxy.write_attribute(new DeviceAttribute(
"contextValidationErrorStrategy", erreurStrategyValue));
String value = errorStrat.getContextValidationDevice();
// System.out.println("context validation=" + value);
actionName = "write_attribute(\"contextValidation\"," + value + ")";
if (value != null && !value.isEmpty()) {
scanServerProxy.write_attribute(new DeviceAttribute("contextValidation",
value));