From 9a106667d25b3f147c7ec366b0824e3ac4f86d82 Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Tue, 31 May 2016 22:33:38 +0200 Subject: [PATCH] Setting the wear location appears to fail for amazfit #274 So as a test, disable that for amazfit. Let's see what happens next. --- .../service/devices/miband/MiBandSupport.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBandSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBandSupport.java index 444e59ee9..527f704d8 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBandSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBandSupport.java @@ -361,10 +361,18 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport { LOG.info("Attempting to set wear location..."); BluetoothGattCharacteristic characteristic = getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT); if (characteristic != null) { - int location = MiBandCoordinator.getWearLocation(getDevice().getAddress()); - transaction.write(characteristic, new byte[]{ - MiBandService.COMMAND_SET_WEAR_LOCATION, - (byte) location + transaction.add(new ConditionalWriteAction() { + @Override + protected byte[] checkCondition() { + if (getDeviceInfo() != null && getDeviceInfo().isAmazFit()) { + return null; + } + int location = MiBandCoordinator.getWearLocation(getDevice().getAddress()); + return new byte[]{ + MiBandService.COMMAND_SET_WEAR_LOCATION, + (byte) location + }; + } }); } else { LOG.info("Unable to set Wear Location");