Get device profile id before the foreach

This commit is contained in:
Viacheslav Kukhtyn 2020-11-20 20:05:52 +02:00 committed by Andrew Shvayka
parent aa816d61ab
commit 379ba80b2c

View File

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