From 46a9699f3949820d45d95511551840d7e6f38a76 Mon Sep 17 00:00:00 2001 From: Krisjans Blukis Date: Wed, 28 Jul 2021 17:38:20 +0300 Subject: [PATCH] BluetoothGattUuidBF600: show scale user initials (if set) instead of sale user index; --- .../openscale/core/bluetooth/BluetoothBeurerBF600.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothBeurerBF600.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothBeurerBF600.java index 4311ba18..398d17d5 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothBeurerBF600.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothBeurerBF600.java @@ -148,6 +148,11 @@ public class BluetoothBeurerBF600 extends BluetoothStandardWeightProfile { String initials = parser.getStringValue(); int end = 3 > initials.length() ? initials.length() : 3; initials = initials.substring(0, end); + if (initials.length() == 3) { + if (initials.charAt(0) == 0xff && initials.charAt(1) == 0xff && initials.charAt(2) == 0xff) { + initials = ""; + } + } parser.setOffset(5); int year = parser.getIntValue(FORMAT_UINT16); int month = parser.getIntValue(FORMAT_UINT8); @@ -179,7 +184,8 @@ public class BluetoothBeurerBF600 extends BluetoothStandardWeightProfile { int selectedItem = -1; for (int i = 0; i < userList.size(); ++i) { ScaleUser u = userList.get(i); - choiceStrings[i] = "P-0" + u.getId() + String name = u.getUserName(); + choiceStrings[i] = (name.length() > 0 ? name : String.format("P%02d", u.getId())) + " " + (u.getGender().isMale() ? "male" : "female") + " " + "height:" + u.getBodyHeight() + " birthday:" + dateFormat.format(u.getBirthday())