mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-18 22:41:44 +02:00
@@ -227,6 +227,10 @@ public abstract class BluetoothCommunication {
|
||||
*/
|
||||
protected void onBluetoothDataChange(BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic gattCharacteristic) {}
|
||||
|
||||
protected boolean doScanWhileConnecting() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Bluetooth machine state to a specific state.
|
||||
*
|
||||
@@ -455,6 +459,10 @@ public abstract class BluetoothCommunication {
|
||||
private void connectGatt(BluetoothDevice device) {
|
||||
Timber.i("Connecting to [%s] (driver: %s)", device.getAddress(), driverName());
|
||||
|
||||
if (!doScanWhileConnecting()) {
|
||||
stopLeScan();
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
bluetoothGatt = device.connectGatt(
|
||||
context, false, gattCallback, BluetoothDevice.TRANSPORT_LE);
|
||||
|
@@ -47,6 +47,12 @@ public class BluetoothMedisanaBS44x extends BluetoothCommunication {
|
||||
return "Medisana BS44x";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean doScanWhileConnecting() {
|
||||
// Medisana seems to have problem connecting if scan is running (see #278 and #353)
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean nextInitCmd(int stateNr) {
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user