mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +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 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 final ScanCallback bleScanCallback = new BleScanCallback();
|
||||
|
@ -217,10 +217,12 @@ public final class GBScanEventProcessor implements Runnable {
|
||||
|
||||
String previousName = null;
|
||||
ParcelUuid[] previousUuids = null;
|
||||
boolean firstTime = false;
|
||||
|
||||
if (candidate == null) {
|
||||
// First time we see this device
|
||||
LOG.debug("Found {} for the first time", address);
|
||||
firstTime = true;
|
||||
final GBScanEvent firstEvent = events.get(0);
|
||||
events.remove(0);
|
||||
candidate = new GBDeviceCandidate(firstEvent.getDevice(), firstEvent.getRssi(), firstEvent.getServiceUuids());
|
||||
@ -248,22 +250,22 @@ public final class GBScanEventProcessor implements Runnable {
|
||||
LOG.error("SecurityException on candidate.getDevice().getUuids()");
|
||||
}
|
||||
|
||||
if (Objects.equals(candidate.getName(), previousName) && Arrays.equals(candidate.getServiceUuids(), previousUuids)) {
|
||||
// Neither name nor uuids changed, do not reprocess
|
||||
LOG.trace("Not reprocessing {} due to no changes", address);
|
||||
return false;
|
||||
if (!firstTime) {
|
||||
if (Objects.equals(candidate.getName(), previousName) && Arrays.equals(candidate.getServiceUuids(), previousUuids)) {
|
||||
// Neither name nor uuids changed, do not reprocess
|
||||
LOG.trace("Not reprocessing {} due to no changes", address);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (candidate.isNameKnown()) {
|
||||
if (processCandidate(candidate)) {
|
||||
LOG.info(
|
||||
"Device {} ({}) is supported as '{}' without scanning services",
|
||||
candidate.getDevice(),
|
||||
candidate.getName(),
|
||||
candidate.getDeviceType()
|
||||
);
|
||||
return true;
|
||||
}
|
||||
if (processCandidate(candidate)) {
|
||||
LOG.info(
|
||||
"Device {} ({}) is supported as '{}' without scanning services",
|
||||
candidate.getDevice(),
|
||||
candidate.getName(),
|
||||
candidate.getDeviceType()
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (candidate.getServiceUuids().length == 0 || (candidate.getServiceUuids().length == 1 && candidate.getServiceUuids()[0].equals(ZERO_UUID))) {
|
||||
|
Loading…
Reference in New Issue
Block a user