From 42277fceb9b320d8a86a4c3fcd6066f290a44d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Fri, 6 Sep 2024 21:44:06 +0100 Subject: [PATCH] Casio: Truncate notification message to 250 bytes --- .../devices/casio/gbx100/CasioGBX100DeviceSupport.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casio/gbx100/CasioGBX100DeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casio/gbx100/CasioGBX100DeviceSupport.java index 120efa99b..4729bc04f 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casio/gbx100/CasioGBX100DeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casio/gbx100/CasioGBX100DeviceSupport.java @@ -332,11 +332,11 @@ public class CasioGBX100DeviceSupport extends Casio2C2DSupport implements Shared subtitleBytes = subtitle.getBytes(StandardCharsets.UTF_8); } - // Ensure the sum of all messages is not over 287 bytes, as per #4063 + // Ensure the message is not over 250 bytes, as per #4063 // FIXME: We probably need to take the MTU into account too... byte[] messageBytes = new byte[0]; if (!StringUtils.isNullOrEmpty(message)) { - messageBytes = StringUtils.truncateToBytes(message, 287 - titleBytes.length - senderBytes.length - subtitleBytes.length); + messageBytes = StringUtils.truncateToBytes(message, 250); } byte[] arr = new byte[22];