Browse Source

Get device profile id before the foreach

pull/3767/head
Viacheslav Kukhtyn 6 years ago
committed by Andrew Shvayka
parent
commit
379ba80b2c
  1. 15
      common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java

15
common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java

@ -682,15 +682,14 @@ public class DefaultTransportService implements TransportService {
private void onDeviceUpdate(Device device) {
long deviceIdMSB = device.getId().getId().getMostSignificantBits();
long deviceIdLSB = device.getId().getId().getLeastSignificantBits();
long deviceProfileIdMSB = device.getDeviceProfileId().getId().getMostSignificantBits();
long deviceProfileIdLSB = device.getDeviceProfileId().getId().getLeastSignificantBits();
sessions.forEach((id, md) -> {
if (md.getSessionInfo().getDeviceIdMSB() == deviceIdMSB
&& md.getSessionInfo().getDeviceIdLSB() == deviceIdLSB) {
long deviceProfileIdMSB = device.getDeviceProfileId().getId().getMostSignificantBits();
long deviceProfileIdLSB = device.getDeviceProfileId().getId().getLeastSignificantBits();
if (md.getSessionInfo().getDeviceProfileIdMSB() != deviceProfileIdMSB
&& md.getSessionInfo().getDeviceProfileIdLSB() != deviceProfileIdLSB) {
transportCallbackExecutor.submit(() -> md.getListener().onDeviceUpdate(device));
}
if ((md.getSessionInfo().getDeviceIdMSB() == deviceIdMSB
&& md.getSessionInfo().getDeviceIdLSB() == deviceIdLSB)
&& (md.getSessionInfo().getDeviceProfileIdMSB() != deviceProfileIdMSB
&& md.getSessionInfo().getDeviceProfileIdLSB() != deviceProfileIdLSB)) {
transportCallbackExecutor.submit(() -> md.getListener().onDeviceUpdate(device));
}
});
}

Loading…
Cancel
Save