mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-30 20:45:49 +01:00
Live Activity: don't enable notifications every second
This caused the BLE queue to fill up more and more.
This commit is contained in:
parent
d3fd203c6c
commit
6d4d92fd88
@ -179,6 +179,7 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
|
|||||||
private boolean isMusicAppStarted = false;
|
private boolean isMusicAppStarted = false;
|
||||||
private MusicSpec bufferMusicSpec = null;
|
private MusicSpec bufferMusicSpec = null;
|
||||||
private MusicStateSpec bufferMusicStateSpec = null;
|
private MusicStateSpec bufferMusicStateSpec = null;
|
||||||
|
private boolean heartRateNotifyEnabled;
|
||||||
|
|
||||||
public HuamiSupport() {
|
public HuamiSupport() {
|
||||||
this(LOG);
|
this(LOG);
|
||||||
@ -207,6 +208,7 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
|
|||||||
@Override
|
@Override
|
||||||
protected TransactionBuilder initializeDevice(TransactionBuilder builder) {
|
protected TransactionBuilder initializeDevice(TransactionBuilder builder) {
|
||||||
try {
|
try {
|
||||||
|
heartRateNotifyEnabled = false;
|
||||||
boolean authenticate = needsAuth;
|
boolean authenticate = needsAuth;
|
||||||
needsAuth = false;
|
needsAuth = false;
|
||||||
byte authFlags = HuamiService.AUTH_BYTE;
|
byte authFlags = HuamiService.AUTH_BYTE;
|
||||||
@ -871,9 +873,12 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
TransactionBuilder builder = performInitialized("Enable realtime heart rate measurement");
|
TransactionBuilder builder = performInitialized("Enable realtime heart rate measurement");
|
||||||
|
if (heartRateNotifyEnabled != enable) {
|
||||||
BluetoothGattCharacteristic heartrateCharacteristic = getCharacteristic(GattCharacteristic.UUID_CHARACTERISTIC_HEART_RATE_MEASUREMENT);
|
BluetoothGattCharacteristic heartrateCharacteristic = getCharacteristic(GattCharacteristic.UUID_CHARACTERISTIC_HEART_RATE_MEASUREMENT);
|
||||||
if (heartrateCharacteristic != null) {
|
if (heartrateCharacteristic != null) {
|
||||||
builder.notify(heartrateCharacteristic, enable);
|
builder.notify(heartrateCharacteristic, enable);
|
||||||
|
heartRateNotifyEnabled = enable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (enable) {
|
if (enable) {
|
||||||
builder.write(characteristicHRControlPoint, stopHeartMeasurementManual);
|
builder.write(characteristicHRControlPoint, stopHeartMeasurementManual);
|
||||||
|
Loading…
Reference in New Issue
Block a user