From 41632b8eb3d76c46a1dcb5494be304228f85cefe Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sat, 24 Mar 2018 19:28:06 +0100 Subject: [PATCH] Only send dummy AQI to Bip, not to Cor See #1033 --- .../devices/amazfitbip/AmazfitBipSupport.java | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/amazfitbip/AmazfitBipSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/amazfitbip/AmazfitBipSupport.java index 2a888c5ac..189ffdd4d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/amazfitbip/AmazfitBipSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/amazfitbip/AmazfitBipSupport.java @@ -182,28 +182,30 @@ public class AmazfitBipSupport extends MiBand2Support { LOG.error("Error sending current weather", ex); } - try { - TransactionBuilder builder; - builder = performInitialized("Sending air quality index"); - int length = 8; - String aqiString = "(n/a)"; - if (supportsConditionString) { - length += aqiString.getBytes().length + 1; + if (gbDevice.getType() == DeviceType.AMAZFITBIP) { + try { + TransactionBuilder builder; + builder = performInitialized("Sending air quality index"); + int length = 8; + String aqiString = "(n/a)"; + if (supportsConditionString) { + length += aqiString.getBytes().length + 1; + } + ByteBuffer buf = ByteBuffer.allocate(length); + buf.order(ByteOrder.LITTLE_ENDIAN); + buf.put((byte) 4); + buf.putInt(weatherSpec.timestamp); + buf.put((byte) (tz_offset_hours * 4)); + buf.putShort((short) 0); + if (supportsConditionString) { + buf.put(aqiString.getBytes()); + buf.put((byte) 0); + } + builder.write(getCharacteristic(AmazfitBipService.UUID_CHARACTERISTIC_WEATHER), buf.array()); + builder.queue(getQueue()); + } catch (IOException ex) { + LOG.error("Error sending air quality"); } - ByteBuffer buf = ByteBuffer.allocate(length); - buf.order(ByteOrder.LITTLE_ENDIAN); - buf.put((byte) 4); - buf.putInt(weatherSpec.timestamp); - buf.put((byte) (tz_offset_hours * 4)); - buf.putShort((short) 0); - if (supportsConditionString) { - buf.put(aqiString.getBytes()); - buf.put((byte) 0); - } - builder.write(getCharacteristic(AmazfitBipService.UUID_CHARACTERISTIC_WEATHER), buf.array()); - builder.queue(getQueue()); - } catch (IOException ex) { - LOG.error("Error sending air quality"); } try {