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