mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-19 06:51:57 +02:00
Lower case uuid names
This commit is contained in:
@@ -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()),
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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)));
|
||||
|
Reference in New Issue
Block a user