Reedyuk / blue-falcon

A Bluetooth kotlin multiplatform "Cross-Platform" library for iOS and Android
https://bluefalcon.dev
Apache License 2.0
321 stars 43 forks source link

didWriteValueForCharacteristic not trigger short time after connection in IOS #99

Closed mehmetakify closed 1 year ago

mehmetakify commented 1 year ago

After connection, didWriteValueForCharacteristic trigger correctly after calling writeByteArray() function, but after some random time, it does not trigger, but it successfully write data to peripheral.

Steps to reproduce the behavior:

  1. Connect a peripheral from an IOS device.
  2. Set Notify Value as true to read characteristic after connection
  3. Send data to write characteristic and see didWriteValueForCharacteristic trigger in PeripheralDelegate.kt file
  4. Wait a little bit, approximately 5-10 seconds and try again, peripheral can get the data but didWriteValueForCharacteristic not trigger anymore.
  5. Disconnect device and reconnect. See same behaviour, the function trigger at the beginning and then it brokes.

didWriteValueForCharacteristic must be triggered after every writeByteArray() function's call.

All Apple devices show same behaviour. (Iphone 7 (IOS 15.6.1), Iphone 8 (IOS 15.6.1), Ipad 9 (IOS 16.1.1), Mac M1 (Ventura 13.0.1))

There is no any problem with Android devices.

Reedyuk commented 1 year ago

Interesting, maybe its getting deallocated on ios. Happy for you to put a pull request in with the fix, otherwise i will have to look at it when i get time