[bluetooth.bluegiga] Fix broken device discovery (#8906)
Signed-off-by: Connor Petty <mistercpp2000+gitsignoff@gmail.com>pull/8913/head
parent
7bff7f1bf3
commit
d83dbb408f
|
@ -127,6 +127,10 @@ public class BlueGigaBluetoothDevice extends BaseBluetoothDevice implements Blue
|
||||||
updateLastSeenTime();
|
updateLastSeenTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAddressType(BluetoothAddressType addressType) {
|
||||||
|
this.addressType = addressType;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean connect() {
|
public boolean connect() {
|
||||||
if (connection != -1) {
|
if (connection != -1) {
|
||||||
|
|
|
@ -141,10 +141,6 @@ public class BlueGigaBridgeHandler extends AbstractBluetoothBridgeHandler<BlueGi
|
||||||
// Our BT address
|
// Our BT address
|
||||||
private @Nullable BluetoothAddress address;
|
private @Nullable BluetoothAddress address;
|
||||||
|
|
||||||
// Map of Bluetooth devices known to this bridge.
|
|
||||||
// This is all devices we have heard on the network - not just things bound to the bridge
|
|
||||||
private final Map<BluetoothAddress, BlueGigaBluetoothDevice> devices = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
// Map of open connections
|
// Map of open connections
|
||||||
private final Map<Integer, BluetoothAddress> connections = new ConcurrentHashMap<>();
|
private final Map<Integer, BluetoothAddress> connections = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@ -707,14 +703,9 @@ public class BlueGigaBridgeHandler extends AbstractBluetoothBridgeHandler<BlueGi
|
||||||
// We use the scan event to add any devices we hear to the devices list
|
// We use the scan event to add any devices we hear to the devices list
|
||||||
// The device gets created, and then manages itself for discovery etc.
|
// The device gets created, and then manages itself for discovery etc.
|
||||||
BluetoothAddress sender = new BluetoothAddress(scanEvent.getSender());
|
BluetoothAddress sender = new BluetoothAddress(scanEvent.getSender());
|
||||||
if (!devices.containsKey(sender)) {
|
BlueGigaBluetoothDevice device = getDevice(sender);
|
||||||
BlueGigaBluetoothDevice device;
|
device.setAddressType(scanEvent.getAddressType());
|
||||||
logger.debug("BlueGiga adding new device to adaptor {}: {}", address, sender);
|
deviceDiscovered(device);
|
||||||
device = new BlueGigaBluetoothDevice(this, new BluetoothAddress(scanEvent.getSender()),
|
|
||||||
scanEvent.getAddressType());
|
|
||||||
devices.put(sender, device);
|
|
||||||
deviceDiscovered(device);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
logger.trace("Ignore BlueGigaScanResponseEvent as initialization is not complete");
|
logger.trace("Ignore BlueGigaScanResponseEvent as initialization is not complete");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue