adabru / BleWinrtDll

BLE for Unity 3d in Windows without UWP.
Do What The F*ck You Want To Public License
168 stars 52 forks source link

The ValueChanged function runs at irregular intervals. #54

Closed charleseungmin closed 1 year ago

charleseungmin commented 1 year ago

Hello,

I'm currently facing an issue while communicating with a BLE device. The device sends data packets of 21 bytes every 25 ms. However, I've noticed that the ValueChanged function is only triggering up to 20 times per second. This seems to be causing a delay or loss of some data packets. Interestingly, I've confirmed that the BLE device is capable of sending data at a faster rate (every 25 ms) using an Android app.

I'm seeking advice on how to address this problem and achieve a smoother data reception experience. Is there a way to ensure that the ValueChanged function is called more frequently to match the data transmission rate of the BLE device? I would greatly appreciate any insights or suggestions you could provide.

Thank you in advance for your assistance.

adabru commented 1 year ago

You can try changing your bluetooth dongle. For my project I tried 3 different ones until the last one had the performance I'd expect from BLE.

You can also try the threaded version https://github.com/Joelx/BleWinrtDll-Unity-Demo to avoid the scheduling latencies.