diff --git a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/BLECommonService.kt b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/BLECommonService.kt index d8b1edd5c2..9e059045ea 100644 --- a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/BLECommonService.kt +++ b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/BLECommonService.kt @@ -105,9 +105,11 @@ class BLECommonService @Inject internal constructor( scheduledDisconnection?.cancel(false) scheduledDisconnection = null - if (bluetoothAdapter == null || bluetoothGatt == null) { + if (bluetoothAdapter == null || bluetoothGatt == null || uartIndicate == null) { aapsLogger.error("disconnect is not possible: (mBluetoothAdapter == null) " + (bluetoothAdapter == null)) aapsLogger.error("disconnect is not possible: (mBluetoothGatt == null) " + (bluetoothGatt == null)) + aapsLogger.error("disconnect is not possible: (uartIndicate == null) " + (uartIndicate == null)) + isConnected = false return } bluetoothGatt?.setCharacteristicNotification(uartIndicate, false) diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkBLE.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkBLE.kt index 0a557d79ed..ef8d8bb34e 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkBLE.kt +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkBLE.kt @@ -43,6 +43,7 @@ class RileyLinkBLE @Inject constructor(private val context: Context) { private val gattDebugEnabled = true private var manualDisconnect = false + //val bluetoothAdapter: BluetoothAdapter = BluetoothAdapter.getDefaultAdapter() val bluetoothAdapter: BluetoothAdapter? get() = (context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter private val bluetoothGattCallback: BluetoothGattCallback var rileyLinkDevice: BluetoothDevice? = null