1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-20 07:21:40 +02:00

don't check for mi scale bluetooth device address.

This commit is contained in:
OliE
2017-03-07 19:31:10 +01:00
parent 9c80143ae9
commit 54181116a5

View File

@@ -68,16 +68,15 @@ public class BluetoothMiScale extends BluetoothCommunication {
{ {
@Override @Override
public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) 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)) { if (device.getName().equals(btDeviceName)) {
Log.d("BluetoothMiScale", "Mi Scale found trying to connect..."); Log.d("BluetoothMiScale", "Mi Scale found trying to connect...");
if (scanRecord.length > 30) {
final byte[] weightData = Arrays.copyOfRange(scanRecord, 21, 31); final byte[] weightData = Arrays.copyOfRange(scanRecord, 21, 31);
weightData[0] = 0x62; // Set weight remove to false to come through parse bytes weightData[0] = 0x62; // Set weight remove to false to come through parse bytes
parseBytes(weightData); parseBytes(weightData);
}
bluetoothGatt = device.connectGatt(context, false, gattCallback); bluetoothGatt = device.connectGatt(context, false, gattCallback);
@@ -85,7 +84,6 @@ public class BluetoothMiScale extends BluetoothCommunication {
btAdapter.stopLeScan(scanCallback); btAdapter.stopLeScan(scanCallback);
} }
} }
}
}; };
} }