mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-02-10 00:46:47 +01:00
Display devices with unknown name during scan
This commit is contained in:
parent
e078ceff0a
commit
9230580a01
@ -104,7 +104,7 @@ public class DiscoveryActivityV2 extends AbstractGBActivity implements AdapterVi
|
|||||||
private final Handler handler = new Handler();
|
private final Handler handler = new Handler();
|
||||||
|
|
||||||
private static final long SCAN_DURATION = 30000; // 30s
|
private static final long SCAN_DURATION = 30000; // 30s
|
||||||
private static final long LIST_REFRESH_THRESHOLD_MS = 2500L;
|
private static final long LIST_REFRESH_THRESHOLD_MS = 1000L;
|
||||||
private long lastListRefresh = System.currentTimeMillis();
|
private long lastListRefresh = System.currentTimeMillis();
|
||||||
|
|
||||||
private final ScanCallback bleScanCallback = new BleScanCallback();
|
private final ScanCallback bleScanCallback = new BleScanCallback();
|
||||||
|
@ -217,10 +217,12 @@ public final class GBScanEventProcessor implements Runnable {
|
|||||||
|
|
||||||
String previousName = null;
|
String previousName = null;
|
||||||
ParcelUuid[] previousUuids = null;
|
ParcelUuid[] previousUuids = null;
|
||||||
|
boolean firstTime = false;
|
||||||
|
|
||||||
if (candidate == null) {
|
if (candidate == null) {
|
||||||
// First time we see this device
|
// First time we see this device
|
||||||
LOG.debug("Found {} for the first time", address);
|
LOG.debug("Found {} for the first time", address);
|
||||||
|
firstTime = true;
|
||||||
final GBScanEvent firstEvent = events.get(0);
|
final GBScanEvent firstEvent = events.get(0);
|
||||||
events.remove(0);
|
events.remove(0);
|
||||||
candidate = new GBDeviceCandidate(firstEvent.getDevice(), firstEvent.getRssi(), firstEvent.getServiceUuids());
|
candidate = new GBDeviceCandidate(firstEvent.getDevice(), firstEvent.getRssi(), firstEvent.getServiceUuids());
|
||||||
@ -248,13 +250,14 @@ public final class GBScanEventProcessor implements Runnable {
|
|||||||
LOG.error("SecurityException on candidate.getDevice().getUuids()");
|
LOG.error("SecurityException on candidate.getDevice().getUuids()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!firstTime) {
|
||||||
if (Objects.equals(candidate.getName(), previousName) && Arrays.equals(candidate.getServiceUuids(), previousUuids)) {
|
if (Objects.equals(candidate.getName(), previousName) && Arrays.equals(candidate.getServiceUuids(), previousUuids)) {
|
||||||
// Neither name nor uuids changed, do not reprocess
|
// Neither name nor uuids changed, do not reprocess
|
||||||
LOG.trace("Not reprocessing {} due to no changes", address);
|
LOG.trace("Not reprocessing {} due to no changes", address);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (candidate.isNameKnown()) {
|
|
||||||
if (processCandidate(candidate)) {
|
if (processCandidate(candidate)) {
|
||||||
LOG.info(
|
LOG.info(
|
||||||
"Device {} ({}) is supported as '{}' without scanning services",
|
"Device {} ({}) is supported as '{}' without scanning services",
|
||||||
@ -264,7 +267,6 @@ public final class GBScanEventProcessor implements Runnable {
|
|||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (candidate.getServiceUuids().length == 0 || (candidate.getServiceUuids().length == 1 && candidate.getServiceUuids()[0].equals(ZERO_UUID))) {
|
if (candidate.getServiceUuids().length == 0 || (candidate.getServiceUuids().length == 1 && candidate.getServiceUuids()[0].equals(ZERO_UUID))) {
|
||||||
LOG.debug("Fetching uuids for {} with sdp", candidate.getDevice().getAddress());
|
LOG.debug("Fetching uuids for {} with sdp", candidate.getDevice().getAddress());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user