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)
|
enableNotifications(builder, true)
|
||||||
.setLowLatency(builder)
|
.setLowLatency(builder)
|
||||||
.readDate(builder) // without reading the data, we get sporadic connection problems, especially directly after turning on BT
|
.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
|
.pair(builder)
|
||||||
// so we simply not use the UUID_PAIR characteristic.
|
|
||||||
// .pair(builder)
|
|
||||||
.requestDeviceInfo(builder)
|
.requestDeviceInfo(builder)
|
||||||
.sendUserInfo(builder)
|
.sendUserInfo(builder)
|
||||||
.checkAuthenticationNeeded(builder, getDevice())
|
.checkAuthenticationNeeded(builder, getDevice())
|
||||||
@ -320,12 +318,21 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private MiBandSupport pair(TransactionBuilder transaction) {
|
private MiBandSupport pair(TransactionBuilder transaction) {
|
||||||
LOG.info("Attempting to pair MI device...");
|
// this is apparently only needed to get a more strict bond between mobile and mi band,
|
||||||
BluetoothGattCharacteristic characteristic = getCharacteristic(MiBandService.UUID_CHARACTERISTIC_PAIR);
|
// e.g. such that Mi Fit and Gadgetbridge can coexist without needing to re-pair (with
|
||||||
if (characteristic != null) {
|
// full device-data-reset).
|
||||||
transaction.write(characteristic, new byte[]{2});
|
// Unfortunately this extra pairing causes problems when bonding is not used/does not work
|
||||||
} else {
|
// so we only do this when configured to keep data on the device
|
||||||
LOG.info("Unable to pair MI device -- characteristic not available");
|
|
||||||
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user