Forum Xamarin.iOS

BLE IOS 13 - SetNotifyValue Constantly Returns Values

rosa_prosa_p Member ✭✭
CBPeripheral method SetNotifyValue(bool enabled, CBCharacteristic characteristic) constantly returns characteristic values.

I connect to a device with BLE and subscribe to certain characteristic. In DiscoveredCharacteristic I call SetNotifyValue(true, characteristic) method. In UpdatedCharacteristicValue I print out the values received in debugger. I noticed enormous output from the application.

The updated characteristic values are added to a queue from which I dequeue values in another thread. After each dequeue I check how many values are left. On previous iOS versions the queue has single digit size but on iOS 13 the length increases massively in size. In seconds the length becomes 100+ and it keeps rising, reaching 10000+ before I stopped the application. The values keep comming constantly and they are unchanged.

Has anyone else experienced this or some similar issue?

Software installed:
- Visual Studio for Mac Community:
- Version: 8.3 (build 1805)
- Xcode:
- Version: 11.0 (11A420a)

Posts

  • rosa_prosa_p Member ✭✭
    Edit: the device sends characteristic every 20ms. I am still looking into why previous versions can process so much data but the iOS 13 and 13.1 are unable to.
  • rosa_prosa_p Member ✭✭

    Update: I have removed SetNotifyValue and added a timer that reads the characteristic in intervals. Somehow I still get subscribed to the characteristic and keep receiving data at the same rate.

    I have another characteristic (battery %) to which I subscribe and there are no issues with that one.

  • rosa_prosa_p Member ✭✭
    edited October 2019
    Update:
    The problem was there was another call to read characteristic when we got the value of the characteristic.

    The characteristic does not have a read option, only notify when looking in nrfConnect.

    My guess is that previous versions handled the call differently whereas the new version subscribes again to the characteristic. Removing the duplicated read call solved the issue.

    I would also like to thank Apple Support for helpfully recommending me to contact the hardware staff. It was cruicial in finding the error in my code.
Sign In or Register to comment.