mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-07-16 18:34:03 +02:00
parent
cce53400f0
commit
41632b8eb3
|
@ -182,28 +182,30 @@ public class AmazfitBipSupport extends MiBand2Support {
|
||||||
LOG.error("Error sending current weather", ex);
|
LOG.error("Error sending current weather", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (gbDevice.getType() == DeviceType.AMAZFITBIP) {
|
||||||
TransactionBuilder builder;
|
try {
|
||||||
builder = performInitialized("Sending air quality index");
|
TransactionBuilder builder;
|
||||||
int length = 8;
|
builder = performInitialized("Sending air quality index");
|
||||||
String aqiString = "(n/a)";
|
int length = 8;
|
||||||
if (supportsConditionString) {
|
String aqiString = "(n/a)";
|
||||||
length += aqiString.getBytes().length + 1;
|
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 {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user