From de46555e370cd86b90541e9b7406503e9d66a886 Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Mon, 24 Oct 2016 00:23:59 +0200 Subject: [PATCH] Mi2: display heart rate result from Debug screen as a toast #323 --- .../service/devices/miband/MiBand2Support.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBand2Support.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBand2Support.java index 16380cb5e..d16edfc12 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBand2Support.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBand2Support.java @@ -87,6 +87,7 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport { private static final Logger LOG = LoggerFactory.getLogger(MiBand2Support.class); private final DeviceInfoProfile deviceInfoProfile; + private final HeartRateProfile heartRateProfile; private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -120,6 +121,8 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport { deviceInfoProfile = new DeviceInfoProfile<>(this); addSupportedProfile(deviceInfoProfile); + heartRateProfile = new HeartRateProfile(this); + addSupportedProfile(heartRateProfile); LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(getContext()); IntentFilter intentFilter = new IntentFilter(); @@ -675,8 +678,8 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport { if (supportsHeartRate()) { try { TransactionBuilder builder = performInitialized("HeartRateTest"); - HeartRateProfile profile = new HeartRateProfile<>(this); - profile.requestHeartRateMeasurement(builder); + heartRateProfile.requestHeartRateMeasurement(builder); +// profile.resetEnergyExpended(builder); // 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), startHeartMeasurementManual);