mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-19 15:01:53 +02:00
don't check for mi scale bluetooth device address.
This commit is contained in:
@@ -69,21 +69,19 @@ 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") ||
|
if (device.getName().equals(btDeviceName)) {
|
||||||
device.getAddress().replace(":", "").startsWith("880F10")) // Xiaomi
|
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);
|
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);
|
|
||||||
|
|
||||||
searchHandler.removeCallbacksAndMessages(null);
|
|
||||||
btAdapter.stopLeScan(scanCallback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bluetoothGatt = device.connectGatt(context, false, gattCallback);
|
||||||
|
|
||||||
|
searchHandler.removeCallbacksAndMessages(null);
|
||||||
|
btAdapter.stopLeScan(scanCallback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user