mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-02-17 12:56:48 +01:00
Mi Band 2/Bip/Cor: Only enable notification on realtime hr characteristic when live activity is used
This commit is contained in:
parent
2f443ad419
commit
82ad7abf62
@ -271,10 +271,6 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
||||
builder.notify(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_3_CONFIGURATION), enable);
|
||||
builder.notify(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_6_BATTERY_INFO), enable);
|
||||
builder.notify(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_DEVICEEVENT), enable);
|
||||
BluetoothGattCharacteristic heartrateCharacteristic = getCharacteristic(GattCharacteristic.UUID_CHARACTERISTIC_HEART_RATE_MEASUREMENT);
|
||||
if (heartrateCharacteristic != null) {
|
||||
builder.notify(heartrateCharacteristic, enable);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
@ -752,11 +748,15 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
||||
}
|
||||
try {
|
||||
TransactionBuilder builder = performInitialized("Enable realtime heart rate measurement");
|
||||
BluetoothGattCharacteristic heartrateCharacteristic = getCharacteristic(GattCharacteristic.UUID_CHARACTERISTIC_HEART_RATE_MEASUREMENT);
|
||||
if (heartrateCharacteristic != null) {
|
||||
builder.notify(heartrateCharacteristic, enable);
|
||||
}
|
||||
if (enable) {
|
||||
builder.write(characteristicHRControlPoint, stopHeartMeasurementManual);
|
||||
builder.write(characteristicHRControlPoint, startHeartMeasurementContinuous);
|
||||
} else {
|
||||
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_HEART_RATE_CONTROL_POINT), stopHeartMeasurementContinuous);
|
||||
builder.write(characteristicHRControlPoint, stopHeartMeasurementContinuous);
|
||||
}
|
||||
builder.queue(getQueue());
|
||||
enableRealtimeSamplesTimer(enable);
|
||||
|
Loading…
x
Reference in New Issue
Block a user