From 1929a75462a72e07c51954f33d0c167ecc21d687 Mon Sep 17 00:00:00 2001 From: Erik Johansson Date: Sat, 6 Oct 2018 20:40:52 +0200 Subject: [PATCH] Log BLE PHY to see if it can give any clue on #330. --- .../core/bluetooth/BluetoothCommunication.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java index 7641792e..a5360d46 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java @@ -639,6 +639,10 @@ public abstract class BluetoothCommunication { stopLeScan(); } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + gatt.readPhy(); + } + connectionEstablished = true; setBtStatus(BT_STATUS_CODE.BT_CONNECTION_ESTABLISHED); @@ -698,6 +702,16 @@ public abstract class BluetoothCommunication { setBtMachineState(BT_MACHINE_STATE.BT_INIT_STATE); } + @Override + public void onPhyRead(BluetoothGatt gatt, int txPhy, int rxPhy, int status) { + Timber.d("Current PHY read: TX=%d, RX=%d, status=%d", txPhy, rxPhy, status); + } + + @Override + public void onPhyUpdate(BluetoothGatt gatt, int txPhy, int rxPhy, int status) { + Timber.d("PHY update: TX=%d, RX=%d, status=%d", txPhy, rxPhy, status); + } + private void postDelayedHandleRequests() { // Wait a short while before starting the next operation as suggested // on the android.jlelse.eu link above.