1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-24 02:46:50 +01:00

Amazfit Neo: fix heartrate sleep packet

This commit is contained in:
NekoBox 2022-08-15 15:07:03 +03:00 committed by Gitea
parent 279af27248
commit dcce900f23
2 changed files with 10 additions and 1 deletions

View File

@ -705,7 +705,7 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport {
* *
* @param builder * @param builder
*/ */
private HuamiSupport setHeartrateSleepSupport(TransactionBuilder builder) { protected HuamiSupport setHeartrateSleepSupport(TransactionBuilder builder) {
final boolean enableHrSleepSupport = MiBandCoordinator.getHeartrateSleepSupport(gbDevice.getAddress()); final boolean enableHrSleepSupport = MiBandCoordinator.getHeartrateSleepSupport(gbDevice.getAddress());
if (characteristicHRControlPoint != null) { if (characteristicHRControlPoint != null) {
builder.notify(characteristicHRControlPoint, true); builder.notify(characteristicHRControlPoint, true);

View File

@ -31,6 +31,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiService; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiService;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitneo.AmazfitNeoFWHelper; import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitneo.AmazfitNeoFWHelper;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandCoordinator;
import nodomain.freeyourgadget.gadgetbridge.model.ActivityUser; import nodomain.freeyourgadget.gadgetbridge.model.ActivityUser;
import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec;
import nodomain.freeyourgadget.gadgetbridge.service.btle.BLETypeConversions; import nodomain.freeyourgadget.gadgetbridge.service.btle.BLETypeConversions;
@ -88,6 +89,14 @@ public class AmazfitNeoSupport extends MiBand5Support {
@Override @Override
public boolean supportsHourlyChime() { return true; } public boolean supportsHourlyChime() { return true; }
@Override
protected AmazfitNeoSupport setHeartrateSleepSupport(TransactionBuilder builder) {
final boolean enableHrSleepSupport = MiBandCoordinator.getHeartrateSleepSupport(gbDevice.getAddress());
LOG.info("Setting Amazfit Neo heartrate sleep support to " + enableHrSleepSupport);
writeToConfiguration(builder, new byte[] {0x06, 0x3c, 0x00, (byte) (enableHrSleepSupport ? 1 : 0 )});
return this;
}
@Override @Override
public HuamiFWHelper createFWHelper(Uri uri, Context context) throws IOException { public HuamiFWHelper createFWHelper(Uri uri, Context context) throws IOException {
return new AmazfitNeoFWHelper(uri, context); return new AmazfitNeoFWHelper(uri, context);