My data field app reads a data stream from a bike sensor using the compute(info) function, decodes the values and displays them. It works perfectly. However, when activating the data field on Garmin Edge1030, 1030plus and 1040, all current BLE and ANT+ connections to all connected sensors/devices suddenly break down at seemingly random times.
This error only occurs while there is a parallel phone connection via BLE. If I switch off the phone connection on the Garmin, there are no disconnects.
The data field reads a data stream of 90-120 bytes per second from the sensor using a BLE delegate with 1 BLE profile. The data stream from the sensor pulses every second, i.e. the sensor delivers the data in blocks and then pauses briefly. The data flows in via GATT notification. MTU of the BLE connection is 20. Thus, 4-5 callbacks (OnCharacteristicChanged) occur per second, i.e. the data comes in 20-byte blocks, corresponding to MTU. In the OnChararacteristicChanged callback funtcion i add this data to a buffer (byte array). I process it via compute(info) function once per second. The size of the buffer varies between 60-160, depending on actual timing.
I used the profiler to check the runtime of the compute routine, which is approx. 12 milliseconds. The memory consumption of the data field is constant at approx. 27 KB, i.e. there is no memory leak.
Source code see here: github.com/.../Forumslader-Companion
I have tried many analyses to narrow down the origin of the error, but to no avail. The data field app runs without errors, there are no crashes or exceptions, nor are there any other anomalies when the connection is lost.
What could be the reason? What possibilities are there to analyze it more deeply?