}
}
@SuppressWarnings("unchecked")
private IDevice updateDeviceList(IConfig<?> config, IDevice device, List<? extends IDevice> deviceList) {
IDevice newDevice = null;
if (device != null) {
String deviceName = device.getName().toLowerCase();
IDevice tmpDevice = super.getDevice(deviceName, deviceList);
newDevice = tmpDevice;
if (tmpDevice == null) {
// System.out.println("add device=" + config.getFullPath() + " " + deviceName);
if (device instanceof ISensor) {
ISensor sensor = new SensorModel();
sensor.setName(deviceName);
sensor.setEnabled(true);
((List<ISensor>) deviceList).add(sensor);
newDevice = sensor;
}
if (device instanceof IActuator) {
IActuator actuator = new ActuatorModel();
actuator.setName(deviceName);
actuator.setEnabled(true);
((List<IActuator>) deviceList).add(actuator);
newDevice = actuator;
}
if (device instanceof ITimebase) {
ITimebase timebase = new TimebaseModel();
timebase.setName(deviceName);
timebase.setEnabled(true);
((List<ITimebase>) deviceList).add(timebase);
newDevice = timebase;
}
} else if (device.isEnabled()) {
tmpDevice.setEnabled(true);
} else if (tmpDevice.isEnabled()) {
if (tmpDevice instanceof ISensor) {
config.setSensorEnable(deviceName, true);
}
if (tmpDevice instanceof IActuator) {
config.setActuatorEnable(deviceName, true);