From 54181116a5e0c59a1a6ec8e07f385ffc39470c48 Mon Sep 17 00:00:00 2001 From: OliE Date: Tue, 7 Mar 2017 19:31:10 +0100 Subject: [PATCH] don't check for mi scale bluetooth device address. --- .../openscale/core/BluetoothMiScale.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/android_app/app/src/main/java/com/health/openscale/core/BluetoothMiScale.java b/android_app/app/src/main/java/com/health/openscale/core/BluetoothMiScale.java index 6d3ef6ba..61e47aab 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/BluetoothMiScale.java +++ b/android_app/app/src/main/java/com/health/openscale/core/BluetoothMiScale.java @@ -69,21 +69,19 @@ public class BluetoothMiScale extends BluetoothCommunication { @Override public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) { - if (device.getAddress().replace(":", "").startsWith("880f10") || - device.getAddress().replace(":", "").startsWith("880F10")) // Xiaomi - { - if (device.getName().equals(btDeviceName)) { - Log.d("BluetoothMiScale", "Mi Scale found trying to connect..."); + if (device.getName().equals(btDeviceName)) { + Log.d("BluetoothMiScale", "Mi Scale found trying to connect..."); + if (scanRecord.length > 30) { final byte[] weightData = Arrays.copyOfRange(scanRecord, 21, 31); weightData[0] = 0x62; // Set weight remove to false to come through parse bytes parseBytes(weightData); - - bluetoothGatt = device.connectGatt(context, false, gattCallback); - - searchHandler.removeCallbacksAndMessages(null); - btAdapter.stopLeScan(scanCallback); } + + bluetoothGatt = device.connectGatt(context, false, gattCallback); + + searchHandler.removeCallbacksAndMessages(null); + btAdapter.stopLeScan(scanCallback); } } };