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,15 +682,14 @@ 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();
long deviceProfileIdMSB = device.getDeviceProfileId().getId().getMostSignificantBits();
long deviceProfileIdLSB = device.getDeviceProfileId().getId().getLeastSignificantBits();
sessions.forEach((id, md) -> { sessions.forEach((id, md) -> {
if (md.getSessionInfo().getDeviceIdMSB() == deviceIdMSB if ((md.getSessionInfo().getDeviceIdMSB() == deviceIdMSB
&& md.getSessionInfo().getDeviceIdLSB() == deviceIdLSB) { && md.getSessionInfo().getDeviceIdLSB() == deviceIdLSB)
long deviceProfileIdMSB = device.getDeviceProfileId().getId().getMostSignificantBits(); && (md.getSessionInfo().getDeviceProfileIdMSB() != deviceProfileIdMSB
long deviceProfileIdLSB = device.getDeviceProfileId().getId().getLeastSignificantBits(); && md.getSessionInfo().getDeviceProfileIdLSB() != deviceProfileIdLSB)) {
if (md.getSessionInfo().getDeviceProfileIdMSB() != deviceProfileIdMSB transportCallbackExecutor.submit(() -> md.getListener().onDeviceUpdate(device));
&& md.getSessionInfo().getDeviceProfileIdLSB() != deviceProfileIdLSB) {
transportCallbackExecutor.submit(() -> md.getListener().onDeviceUpdate(device));
}
} }
}); });
} }