mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-10-11 23:58:14 +02:00
test if heartrate is supported before writing preferences
This commit is contained in:
parent
20aa7d9ad9
commit
f2de21a664
@ -376,6 +376,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private MiBandSupport setHeartrateSleepSupport(TransactionBuilder transaction) {
|
private MiBandSupport setHeartrateSleepSupport(TransactionBuilder transaction) {
|
||||||
|
if (supportsHeartRate()) {
|
||||||
LOG.info("Attempting to set heartrate sleep support...");
|
LOG.info("Attempting to set heartrate sleep support...");
|
||||||
BluetoothGattCharacteristic characteristic = getCharacteristic(MiBandService.UUID_CHARACTERISTIC_HEART_RATE_CONTROL_POINT);
|
BluetoothGattCharacteristic characteristic = getCharacteristic(MiBandService.UUID_CHARACTERISTIC_HEART_RATE_CONTROL_POINT);
|
||||||
if (characteristic != null) {
|
if (characteristic != null) {
|
||||||
@ -388,8 +389,11 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
|||||||
transaction.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_HEART_RATE_CONTROL_POINT), stopHeartMeasurementSleep);
|
transaction.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_HEART_RATE_CONTROL_POINT), stopHeartMeasurementSleep);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG.info("Unable to set Wear Location");
|
LOG.info("Unable to set Heartrate sleep support");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else
|
||||||
|
GB.toast(getContext(), "Heart rate is not supported on this device", Toast.LENGTH_LONG, GB.ERROR);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user