BleWinrtDll icon indicating copy to clipboard operation
BleWinrtDll copied to clipboard

Multiple BLE connections alternating so buffer doesnt get overflood

Open DaanP-2056102 opened this issue 2 years ago • 3 comments

Hello I managed to connect 3 BLE devices and everything works super fine, thanks for the DLL.

But for my application (thesis). I have to read data simultaneously meaning that I am reading 0.5 seconds the data from Sensor1, then 1 second reading my sensor 2, and then sensor 3. The buffer data always gets messed up and my code is reading the wrong sensor for each data field. Is it possible to switch between connected BLE devices and then make a scheduler to indicate when every sensor is allowed to read or is this simply not possible with your DLL? Thanks in advance

DaanP-2056102 avatar Mar 21 '23 18:03 DaanP-2056102

Do you check the deviceId in each data package?

The dll buffer should be unlimited (i.e. RAM size) and both the writing and the reading are synchronized.

https://github.com/adabru/BleWinrtDll/blob/f2635b7b02432ea3006983657107f092c862171d/BleWinrtDll/BleWinrtDll.cpp#L203

Do you mean the OS/hardware buffer? How large are your bluetooth packages?

I'd guess switching on/off is only supported with unsubscribe/subscribe. But you can try to find the functionality in the Microsoft's UWP BLE documentation (C#). If you find it you can port it to this dll.

adabru avatar Mar 21 '23 20:03 adabru

Hey there thanks for the insights. I thought that when I called "polldata" I was asking the BLE sensor to send data. But it just always sends data and it is up to me to detect the deviceId and then call the correct method. Thanks a lot for the fast reply!

DaanP-2056102 avatar Mar 22 '23 10:03 DaanP-2056102

Yeah that's probably confusing because "ReadCharacteristic" is not implemented in the dll although it is a ble functionality. If you need it you can checkout https://github.com/adabru/BleWinrtDll/issues/6#issuecomment-1480375448 .

adabru avatar Mar 22 '23 23:03 adabru