mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-20 15:32:04 +02:00
Lower case uuid names
This commit is contained in:
@@ -105,7 +105,7 @@ public class BluetoothDebug extends BluetoothCommunication {
|
|||||||
included ? " (included)" : "");
|
included ? " (included)" : "");
|
||||||
|
|
||||||
for (BluetoothGattCharacteristic characteristic : service.getCharacteristics()) {
|
for (BluetoothGattCharacteristic characteristic : service.getCharacteristics()) {
|
||||||
Timber.d("|- characteristic %s #%d: %s%s",
|
Timber.d("|- characteristic %s (#%d): %s%s",
|
||||||
BluetoothGattUuid.prettyPrint(characteristic.getUuid()),
|
BluetoothGattUuid.prettyPrint(characteristic.getUuid()),
|
||||||
characteristic.getInstanceId(),
|
characteristic.getInstanceId(),
|
||||||
propertiesToString(characteristic.getProperties(), characteristic.getWriteType()),
|
propertiesToString(characteristic.getProperties(), characteristic.getWriteType()),
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package com.health.openscale.core.bluetooth;
|
package com.health.openscale.core.bluetooth;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class BluetoothGattUuid {
|
public class BluetoothGattUuid {
|
||||||
@@ -46,7 +47,8 @@ public class BluetoothGattUuid {
|
|||||||
if (uuid.equals(field.get(null))) {
|
if (uuid.equals(field.get(null))) {
|
||||||
String name = field.getName();
|
String name = field.getName();
|
||||||
name = name.substring(name.indexOf('_') + 1);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,13 +28,13 @@ public class BluetoothGattUuidTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void prettyPrint() throws Exception {
|
public void prettyPrint() throws Exception {
|
||||||
assertEquals("0x1800 \"GENERIC ACCESS\"",
|
assertEquals("0x1800 \"generic access\"",
|
||||||
BluetoothGattUuid.prettyPrint(BluetoothGattUuid.SERVICE_GENERIC_ACCESS));
|
BluetoothGattUuid.prettyPrint(BluetoothGattUuid.SERVICE_GENERIC_ACCESS));
|
||||||
assertEquals("0x2a2b \"CURRENT TIME\"",
|
assertEquals("0x2a2b \"current time\"",
|
||||||
BluetoothGattUuid.prettyPrint(BluetoothGattUuid.CHARACTERISTIC_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));
|
BluetoothGattUuid.prettyPrint(BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION));
|
||||||
assertEquals("0x1801 \"GENERIC ATTRIBUTE\"",
|
assertEquals("0x1801 \"generic attribute\"",
|
||||||
BluetoothGattUuid.prettyPrint(BluetoothGattUuid.fromShortCode(0x1801)));
|
BluetoothGattUuid.prettyPrint(BluetoothGattUuid.fromShortCode(0x1801)));
|
||||||
assertEquals("0x0001",
|
assertEquals("0x0001",
|
||||||
BluetoothGattUuid.prettyPrint(BluetoothGattUuid.fromShortCode(0x1)));
|
BluetoothGattUuid.prettyPrint(BluetoothGattUuid.fromShortCode(0x1)));
|
||||||
|
Reference in New Issue
Block a user