Polidea / RxBluetoothKit

iOS & OSX Bluetooth library for RxSwift
Apache License 2.0
1.41k stars 365 forks source link

peripheral.canSendWriteWithoutResponse change to false after enter background #388

Open MrQQQQQQQQQQ opened 3 years ago

MrQQQQQQQQQQ commented 3 years ago

peripheral.canSendWriteWithoutResponse change to false after enter background,then the in the function : "writeValue(_ data: Data, for characteristic: Characteristic, type: CBCharacteristicWriteType, canSendWriteWithoutResponseCheckEnabled: Bool = true) -> Single". will not send the data.

To Reproduce Steps to reproduce the behavior:

  1. scan and connect to a peripheral, and keep sending datas
  2. click Home, Makes the App enter background
  3. after several seconds, then will find canSendWriteWithoutResponse property changed to false .
  4. Even the App enter Foreground, the property canSendWriteWithoutResponse will never change to true

Expected behavior canSendWriteWithoutResponse will never change to false

Environment:

dariuszseweryn commented 3 years ago

Hello, Are you sure that it is not a system restriction?

MrQQQQQQQQQQ commented 3 years ago

Hello, Are you sure that it is not a system restriction?

I am not sure if it is a system restriction. but if yes, why the property canSendWriteWithoutResponse won't change to true when i back to foreground. in my app, i used a BLE background mode ,so my app won't be suspend by system.the app can still invoke the write method.but because of this property, it will never really invoke "writeOperationPerformingAndListeningObservable"