mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-06-05 21:49:48 +02:00
Do not display paired devices that were not added to Gadgetbridge or have been deleted from Gadgetbridge
Closes #1360
This commit is contained in:
@@ -48,7 +48,7 @@ Please see [FEATURES.md](https://github.com/Freeyourgadget/Gadgetbridge/blob/mas
|
||||
|
||||
## Getting Started (Pebble)
|
||||
|
||||
1. Pair your Pebble through the Android's Bluetooth Settings or Gadgetbridge. Pebble 2 MUST be paired though Gadgetbridge (tap on the + in Control Center)
|
||||
1. Pair your Pebble through Gadgetbridge (tap on the + in Control Center)
|
||||
2. Start Gadgetbridge, tap on the device you want to connect to
|
||||
3. To test, choose "Debug" from the menu and play around
|
||||
|
||||
|
@@ -132,12 +132,7 @@ public class DeviceHelper {
|
||||
GB.toast(context, context.getString(R.string.bluetooth_is_disabled_), Toast.LENGTH_SHORT, GB.WARN);
|
||||
}
|
||||
List<GBDevice> dbDevices = getDatabaseDevices();
|
||||
// these come first, as they have the most information already
|
||||
availableDevices.addAll(dbDevices);
|
||||
if (btAdapter != null) {
|
||||
List<GBDevice> bondedDevices = getBondedDevices(btAdapter);
|
||||
availableDevices.addAll(bondedDevices);
|
||||
}
|
||||
|
||||
Prefs prefs = GBApplication.getPrefs();
|
||||
String miAddr = prefs.getString(MiBandConst.PREF_MIBAND_ADDRESS, "");
|
||||
@@ -264,29 +259,6 @@ public class DeviceHelper {
|
||||
return gbDevice;
|
||||
}
|
||||
|
||||
private @NonNull List<GBDevice> getBondedDevices(@NonNull BluetoothAdapter btAdapter) {
|
||||
Set<BluetoothDevice> pairedDevices = btAdapter.getBondedDevices();
|
||||
if (pairedDevices == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<GBDevice> result = new ArrayList<>(pairedDevices.size());
|
||||
DeviceHelper deviceHelper = DeviceHelper.getInstance();
|
||||
for (BluetoothDevice pairedDevice : pairedDevices) {
|
||||
if (pairedDevice == null) {
|
||||
continue; // just to be safe, see https://github.com/Freeyourgadget/Gadgetbridge/pull/1052
|
||||
}
|
||||
if (pairedDevice.getName() != null && (pairedDevice.getName().startsWith("Pebble-LE ") || pairedDevice.getName().startsWith("Pebble Time LE "))) {
|
||||
continue; // ignore LE Pebble (this is part of the main device now (volatileAddress)
|
||||
}
|
||||
GBDevice device = deviceHelper.toSupportedDevice(pairedDevice);
|
||||
if (device != null) {
|
||||
result.add(device);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to removing the bonding with the given device. Returns true
|
||||
* if bonding was supposedly successful and false if anything went wrong
|
||||
|
Reference in New Issue
Block a user