if (message != null) {
if (message.getType() == MessageType.M) {
M_Message msg = (M_Message) message;
for (DeviceInformation di : msg.devices) {
Configuration c = null;
for (Configuration conf : configurations) {
if (conf.getSerialNumber().equalsIgnoreCase(di.getSerialNumber())) {
c = conf;
break;
}
}
if (c != null) {
configurations.remove(c);
}
c = Configuration.create(di);
configurations.add(c);
c.setRoomId(di.getRoomId());
}
} else if (message.getType() == MessageType.C) {
Configuration c = null;
for (Configuration conf : configurations) {
if (conf.getSerialNumber().equalsIgnoreCase(((C_Message) message).getSerialNumber())) {
c = conf;
break;
}
}
if (c == null) {
configurations.add(Configuration.create(message));
} else {
c.setValues((C_Message) message);
}
} else if (message.getType() == MessageType.L) {
Collection<? extends Device> tempDevices = ((L_Message) message).getDevices(configurations);
for (Device d : tempDevices) {