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 6d54bfa2..f5bdd0d7 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 @@ -74,13 +74,28 @@ public class BluetoothDebug extends BluetoothCommunication { return names.substring(0, names.length() - 2); } + private String writeTypeToString(int type) { + if (type == BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE) { + return "no response"; + } + if (type == BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT) { + return "default"; + } + if (type == BluetoothGattCharacteristic.WRITE_TYPE_SIGNED) { + return "signed"; + } + return String.format("unknown type %d", type); + } + private void logService(BluetoothGattService service, boolean included) { Timber.d("Service %s%s", service.getUuid(), included ? " (included)" : ""); for (BluetoothGattCharacteristic characteristic : service.getCharacteristics()) { - Timber.d("|- characteristic %s (instance %d): %s (permissions=0x%x)", + Timber.d("|- characteristic %s (instance %d): %s, write type: %s (permissions=0x%x)", characteristic.getUuid(), characteristic.getInstanceId(), - propertiesToString(characteristic.getProperties()), characteristic.getPermissions()); + propertiesToString(characteristic.getProperties()), + writeTypeToString(characteristic.getWriteType()), + characteristic.getPermissions()); byte[] value = characteristic.getValue(); if (value != null && value.length > 0) { Timber.d("|--> value: %s (%s)", byteInHex(value),