Better check for heartrate support on non-heartrate devices
This commit is contained in:
parent
f1ba50b62a
commit
50dd7f5eba
|
@ -137,12 +137,11 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||||
.notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_ACTIVITY_DATA), enable)
|
.notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_ACTIVITY_DATA), enable)
|
||||||
.notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_BATTERY), enable)
|
.notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_BATTERY), enable)
|
||||||
.notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_SENSOR_DATA), enable);
|
.notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_SENSOR_DATA), enable);
|
||||||
// unconditionally try to get notifications for HR -- will silently fail when characteristic
|
// cannot use supportsHeartrate() here because we don't have that information yet
|
||||||
// is not available. And at this point, we don't even know whether we support it, because
|
BluetoothGattCharacteristic heartrateCharacteristic = getCharacteristic(MiBandService.UUID_CHARACTERISTIC_HEART_RATE_MEASUREMENT);
|
||||||
// no device info is available yet. We would have to do the check in a custom NotifyAction.
|
if (heartrateCharacteristic != null) {
|
||||||
// if (supportsHeartRate()) {
|
builder.notify(heartrateCharacteristic, enable);
|
||||||
builder.notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_HEART_RATE_MEASUREMENT), enable);
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue