Disable heartrate in charts fow now, fix notification for manual hr

This commit is contained in:
cpfeiffer 2016-02-27 23:18:44 +01:00
parent d6dfc3b6ec
commit 3ff31cd73b
2 changed files with 9 additions and 3 deletions

View File

@ -79,7 +79,7 @@ public abstract class AbstractChartFragment extends AbstractGBFragment {
} }
}; };
private boolean mChartDirty = true; private boolean mChartDirty = true;
private boolean supportsHeartrateChart = true; private boolean supportsHeartrateChart = false;
public boolean isChartDirty() { public boolean isChartDirty() {
return mChartDirty; return mChartDirty;

View File

@ -137,9 +137,12 @@ 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);
if (supportsHeartRate()) { // unconditionally try to get notifications for HR -- will silently fail when characteristic
// is not available. And at this point, we don't even know whether we support it, because
// no device info is available yet. We would have to do the check in a custom NotifyAction.
// if (supportsHeartRate()) {
builder.notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_HEART_RATE_MEASUREMENT), enable); builder.notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_HEART_RATE_MEASUREMENT), enable);
} // }
return this; return this;
} }
@ -533,6 +536,9 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
if (supportsHeartRate()) { if (supportsHeartRate()) {
try { try {
TransactionBuilder builder = performInitialized("HeartRateTest"); TransactionBuilder builder = performInitialized("HeartRateTest");
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_HEART_RATE_CONTROL_POINT), stopHeartMeasurementContinuous);
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_HEART_RATE_CONTROL_POINT), stopHeartMeasurementManual);
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_HEART_RATE_CONTROL_POINT), stopHeartMeasurementSleep);
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_HEART_RATE_CONTROL_POINT), startHeartMeasurementManual); builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_HEART_RATE_CONTROL_POINT), startHeartMeasurementManual);
builder.queue(getQueue()); builder.queue(getQueue());
} catch (IOException ex) { } catch (IOException ex) {