0

Hoping that the experts might have a tip: I've inherited some code that uses the Android BLE API. It works OK with most devices, but will not connect to one, a blood pressure monitor. I wrote a quick test app using RxAndroidBle that connects fine as long as autoConnect is true. If it's false, I get an "already connected" error. With autoConnect true, I get the same error but after a few seconds it corrects itself and connects, then works as expected.

With the legacy code, the call to connect the device fails immediately with a DISCONNECTED state and a generic GATT_ERROR (status 0x85). This happens whether autoConnect is on or off.

Does this suggest any possible solution? (Unfortunately, rewriting the app isn't an option in the short term.) There's more info here:

Robert Lewis
  • 1,847
  • 2
  • 18
  • 43
  • Which RxAndroidBle code paths are you using? We can peek under the hood of those to see if there is any secret sauce under the hood that's causing the difference. You're testing these two apps on the same phone now, right? – stkent May 09 '18 at 00:47
  • Using `establishConnection`, `flatMap`ping it to `setupNotification`, `flatMap`ping that to itself to unwrap the notifications, `subscribe`ing to get the `byte[]`, upon receipt of the first one calling `writeCharacteristic` to send the device the Start command. – Robert Lewis May 09 '18 at 17:03
  • All works. And yes, now running both apps on the same Android 5.0 phone. – Robert Lewis May 09 '18 at 17:04
  • Hmm, doesn't look to be any relevant special case handling in that RxAndroidBle code path. Does the legacy code call `close` on the `BluetoothGatt` instance each time a disconnect is received? – stkent May 09 '18 at 19:20

0 Answers0