From f908df2e821ca37b0ecd6269d71d9b4d1dff6382 Mon Sep 17 00:00:00 2001 From: Erik Johansson Date: Sun, 18 Nov 2018 19:22:53 +0100 Subject: [PATCH] Lower case uuid names --- .../health/openscale/core/bluetooth/BluetoothDebug.java | 2 +- .../openscale/core/bluetooth/BluetoothGattUuid.java | 4 +++- .../java/com/health/openscale/BluetoothGattUuidTest.java | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothDebug.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothDebug.java index e2dfa102..f00a70e2 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothDebug.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothDebug.java @@ -105,7 +105,7 @@ public class BluetoothDebug extends BluetoothCommunication { included ? " (included)" : ""); for (BluetoothGattCharacteristic characteristic : service.getCharacteristics()) { - Timber.d("|- characteristic %s #%d: %s%s", + Timber.d("|- characteristic %s (#%d): %s%s", BluetoothGattUuid.prettyPrint(characteristic.getUuid()), characteristic.getInstanceId(), propertiesToString(characteristic.getProperties(), characteristic.getWriteType()), diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothGattUuid.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothGattUuid.java index 5f9a35e7..17532f5d 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothGattUuid.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothGattUuid.java @@ -17,6 +17,7 @@ package com.health.openscale.core.bluetooth; import java.lang.reflect.Field; +import java.util.Locale; import java.util.UUID; public class BluetoothGattUuid { @@ -46,7 +47,8 @@ public class BluetoothGattUuid { if (uuid.equals(field.get(null))) { String name = field.getName(); name = name.substring(name.indexOf('_') + 1); - str = String.format("%s \"%s\"", str, name.replace('_', ' ')); + str = String.format("%s \"%s\"", str, + name.replace('_', ' ').toLowerCase(Locale.US)); break; } } diff --git a/android_app/app/src/test/java/com/health/openscale/BluetoothGattUuidTest.java b/android_app/app/src/test/java/com/health/openscale/BluetoothGattUuidTest.java index b790fb38..e5bebba9 100644 --- a/android_app/app/src/test/java/com/health/openscale/BluetoothGattUuidTest.java +++ b/android_app/app/src/test/java/com/health/openscale/BluetoothGattUuidTest.java @@ -28,13 +28,13 @@ public class BluetoothGattUuidTest { @Test public void prettyPrint() throws Exception { - assertEquals("0x1800 \"GENERIC ACCESS\"", + assertEquals("0x1800 \"generic access\"", BluetoothGattUuid.prettyPrint(BluetoothGattUuid.SERVICE_GENERIC_ACCESS)); - assertEquals("0x2a2b \"CURRENT TIME\"", + assertEquals("0x2a2b \"current time\"", BluetoothGattUuid.prettyPrint(BluetoothGattUuid.CHARACTERISTIC_CURRENT_TIME)); - assertEquals("0x2902 \"CLIENT CHARACTERISTIC CONFIGURATION\"", + assertEquals("0x2902 \"client characteristic configuration\"", BluetoothGattUuid.prettyPrint(BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION)); - assertEquals("0x1801 \"GENERIC ATTRIBUTE\"", + assertEquals("0x1801 \"generic attribute\"", BluetoothGattUuid.prettyPrint(BluetoothGattUuid.fromShortCode(0x1801))); assertEquals("0x0001", BluetoothGattUuid.prettyPrint(BluetoothGattUuid.fromShortCode(0x1)));