fixed removing fw/sw attributes if fw/sw is not set
This commit is contained in:
parent
6d97d9466f
commit
017c4f072e
@ -122,17 +122,17 @@ public class DefaultOtaPackageStateService implements OtaPackageStateService {
|
|||||||
newFirmwareId = newDeviceProfile.getFirmwareId();
|
newFirmwareId = newDeviceProfile.getFirmwareId();
|
||||||
}
|
}
|
||||||
if (oldDevice != null) {
|
if (oldDevice != null) {
|
||||||
if (newFirmwareId != null) {
|
|
||||||
OtaPackageId oldFirmwareId = oldDevice.getFirmwareId();
|
OtaPackageId oldFirmwareId = oldDevice.getFirmwareId();
|
||||||
if (oldFirmwareId == null) {
|
if (oldFirmwareId == null) {
|
||||||
DeviceProfile oldDeviceProfile = deviceProfileService.findDeviceProfileById(oldDevice.getTenantId(), oldDevice.getDeviceProfileId());
|
DeviceProfile oldDeviceProfile = deviceProfileService.findDeviceProfileById(oldDevice.getTenantId(), oldDevice.getDeviceProfileId());
|
||||||
oldFirmwareId = oldDeviceProfile.getFirmwareId();
|
oldFirmwareId = oldDeviceProfile.getFirmwareId();
|
||||||
}
|
}
|
||||||
|
if (newFirmwareId != null) {
|
||||||
if (!newFirmwareId.equals(oldFirmwareId)) {
|
if (!newFirmwareId.equals(oldFirmwareId)) {
|
||||||
// Device was updated and new firmware is different from previous firmware.
|
// Device was updated and new firmware is different from previous firmware.
|
||||||
send(device.getTenantId(), device.getId(), newFirmwareId, System.currentTimeMillis(), FIRMWARE);
|
send(device.getTenantId(), device.getId(), newFirmwareId, System.currentTimeMillis(), FIRMWARE);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (oldFirmwareId != null){
|
||||||
// Device was updated and new firmware is not set.
|
// Device was updated and new firmware is not set.
|
||||||
remove(device, FIRMWARE);
|
remove(device, FIRMWARE);
|
||||||
}
|
}
|
||||||
@ -149,17 +149,17 @@ public class DefaultOtaPackageStateService implements OtaPackageStateService {
|
|||||||
newSoftwareId = newDeviceProfile.getSoftwareId();
|
newSoftwareId = newDeviceProfile.getSoftwareId();
|
||||||
}
|
}
|
||||||
if (oldDevice != null) {
|
if (oldDevice != null) {
|
||||||
if (newSoftwareId != null) {
|
|
||||||
OtaPackageId oldSoftwareId = oldDevice.getSoftwareId();
|
OtaPackageId oldSoftwareId = oldDevice.getSoftwareId();
|
||||||
if (oldSoftwareId == null) {
|
if (oldSoftwareId == null) {
|
||||||
DeviceProfile oldDeviceProfile = deviceProfileService.findDeviceProfileById(oldDevice.getTenantId(), oldDevice.getDeviceProfileId());
|
DeviceProfile oldDeviceProfile = deviceProfileService.findDeviceProfileById(oldDevice.getTenantId(), oldDevice.getDeviceProfileId());
|
||||||
oldSoftwareId = oldDeviceProfile.getSoftwareId();
|
oldSoftwareId = oldDeviceProfile.getSoftwareId();
|
||||||
}
|
}
|
||||||
|
if (newSoftwareId != null) {
|
||||||
if (!newSoftwareId.equals(oldSoftwareId)) {
|
if (!newSoftwareId.equals(oldSoftwareId)) {
|
||||||
// Device was updated and new firmware is different from previous firmware.
|
// Device was updated and new firmware is different from previous firmware.
|
||||||
send(device.getTenantId(), device.getId(), newSoftwareId, System.currentTimeMillis(), SOFTWARE);
|
send(device.getTenantId(), device.getId(), newSoftwareId, System.currentTimeMillis(), SOFTWARE);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (oldSoftwareId != null){
|
||||||
// Device was updated and new firmware is not set.
|
// Device was updated and new firmware is not set.
|
||||||
remove(device, SOFTWARE);
|
remove(device, SOFTWARE);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user