1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-19 15:01:53 +02:00

Lower case uuid names

This commit is contained in:
Erik Johansson
2018-11-18 19:22:53 +01:00
parent 00fae52440
commit f908df2e82
3 changed files with 8 additions and 6 deletions

View File

@@ -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()),

View File

@@ -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;
}
}

View File

@@ -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)));