parent
c7ce929aa2
commit
0a5a9912a5
|
@ -16,6 +16,7 @@ import java.time.Duration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
@ -152,11 +153,10 @@ public class BluetoothDiscoveryService extends AbstractDiscoveryService implemen
|
||||||
public void deviceDiscovered(BluetoothDevice device) {
|
public void deviceDiscovered(BluetoothDevice device) {
|
||||||
logger.debug("Discovered bluetooth device '{}': {}", device.getName(), device);
|
logger.debug("Discovered bluetooth device '{}': {}", device.getName(), device);
|
||||||
|
|
||||||
DiscoveryCache cache = discoveryCaches.computeIfAbsent(device.getAddress(), addr -> new DiscoveryCache());
|
DiscoveryCache cache = Objects
|
||||||
if (cache != null) {
|
.requireNonNull(discoveryCaches.computeIfAbsent(device.getAddress(), addr -> new DiscoveryCache()));
|
||||||
cache.handleDiscovery(device);
|
cache.handleDiscovery(device);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static ThingUID createThingUIDWithBridge(DiscoveryResult result, BluetoothAdapter adapter) {
|
private static ThingUID createThingUIDWithBridge(DiscoveryResult result, BluetoothAdapter adapter) {
|
||||||
return new ThingUID(result.getThingTypeUID(), adapter.getUID(), result.getThingUID().getId());
|
return new ThingUID(result.getThingTypeUID(), adapter.getUID(), result.getThingUID().getId());
|
||||||
|
|
Loading…
Reference in New Issue