From 7c213f5807bda8d960be68c4149be5f49e5adbfc Mon Sep 17 00:00:00 2001 From: Robbert Gurdeep Singh Date: Sat, 6 Mar 2021 20:44:13 +0100 Subject: [PATCH] Huami: show event title for events as reminder The Mi app only has a reminder field and no description field, so I'm assuming we can only send one string. In bffb8e8f876186fe61e7ce73da2b40d89c948e91 it was noticed that the title was not displaying so I'm changing this for all Huami devices. --- .../service/devices/huami/HuamiSupport.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java index f0397e7c9..dc07dbfe2 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java @@ -1876,32 +1876,26 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport { calendar.setTimeInMillis(calendarEvent.getBegin()); byte[] title; - byte[] body; if (calendarEvent.getTitle() != null) { title = calendarEvent.getTitle().getBytes(); } else { title = new byte[]{}; } - if (calendarEvent.getDescription() != null) { - body = calendarEvent.getDescription().getBytes(); - } else { - body = new byte[]{}; - } - int length = 18 + title.length + 1 + body.length + 1; + int length = 1 + 1 + 4 + 6 + 6 + 1 + title.length + 1; + ByteBuffer buf = ByteBuffer.allocate(length); buf.order(ByteOrder.LITTLE_ENDIAN); buf.put((byte) 0x0b); // always 0x0b? - buf.put((byte) iteration); // îd + buf.put((byte) iteration); // id buf.putInt(0x08 | 0x04 | 0x01); // flags 0x01 = enable, 0x04 = end date present, 0x08 = has text calendar.setTimeInMillis(calendarEvent.getBegin()); buf.put(BLETypeConversions.shortCalendarToRawBytes(calendar)); calendar.setTimeInMillis(calendarEvent.getEnd()); buf.put(BLETypeConversions.shortCalendarToRawBytes(calendar)); - buf.put(title); buf.put((byte) 0); // 0 Terminated - buf.put(body); + buf.put(title); buf.put((byte) 0); // 0 Terminated writeToChunked(builder, 2, buf.array());