mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 21:06:50 +01:00
Re-enable UUID_PAIR again, when keeping data on device is configured) #250
This should fix data sharing with Mi Fit
This commit is contained in:
parent
e5d178b315
commit
713e9426b9
@ -108,9 +108,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||
enableNotifications(builder, true)
|
||||
.setLowLatency(builder)
|
||||
.readDate(builder) // without reading the data, we get sporadic connection problems, especially directly after turning on BT
|
||||
// this is apparently not needed anymore, and actually causes problems when bonding is not used/does not work
|
||||
// so we simply not use the UUID_PAIR characteristic.
|
||||
// .pair(builder)
|
||||
.pair(builder)
|
||||
.requestDeviceInfo(builder)
|
||||
.sendUserInfo(builder)
|
||||
.checkAuthenticationNeeded(builder, getDevice())
|
||||
@ -320,12 +318,21 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||
* @return
|
||||
*/
|
||||
private MiBandSupport pair(TransactionBuilder transaction) {
|
||||
LOG.info("Attempting to pair MI device...");
|
||||
BluetoothGattCharacteristic characteristic = getCharacteristic(MiBandService.UUID_CHARACTERISTIC_PAIR);
|
||||
if (characteristic != null) {
|
||||
transaction.write(characteristic, new byte[]{2});
|
||||
} else {
|
||||
LOG.info("Unable to pair MI device -- characteristic not available");
|
||||
// this is apparently only needed to get a more strict bond between mobile and mi band,
|
||||
// e.g. such that Mi Fit and Gadgetbridge can coexist without needing to re-pair (with
|
||||
// full device-data-reset).
|
||||
// Unfortunately this extra pairing causes problems when bonding is not used/does not work
|
||||
// so we only do this when configured to keep data on the device
|
||||
|
||||
Prefs prefs = GBApplication.getPrefs();
|
||||
if (prefs.getBoolean(MiBandConst.PREF_MIBAND_DONT_ACK_TRANSFER, false)) {
|
||||
LOG.info("Attempting to pair MI device...");
|
||||
BluetoothGattCharacteristic characteristic = getCharacteristic(MiBandService.UUID_CHARACTERISTIC_PAIR);
|
||||
if (characteristic != null) {
|
||||
transaction.write(characteristic, new byte[]{2});
|
||||
} else {
|
||||
LOG.info("Unable to pair MI device -- characteristic not available");
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user