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

Connecting and Subscribing to heart sensor #47

Open 99bits opened 1 year ago

99bits commented 1 year ago

Thank you for this really amazing project.
I have a heart sensor and it connects fine and the Scan services and Scan characteristic seems to populate fine. When I try to subscribe to the sensor, the editor completely hangs. I also built the app and tested it. It also hanged when trying to subscribe to the data.
Correct Heart Service

The heart rate service is 0x180D 0x2A37 is the UUID for the Heart Rate Measurement characteristic

Other information:
Unity 2022.2.13f1 Built for windows 10 standalone, not UWP

Do you know what I am missing.

Thank you in advance.

adabru commented 1 year ago

I have no clue. You can try this out: https://docs.microsoft.com/en-us/samples/microsoft/windows-universal-samples/bluetoothle/ and report whether that works for the heart rate measurement subscription.

lazerbots commented 1 month ago

Hey, I am new to BLE programming and was just checking out the issues. I did notice that in this screenshot the devices appear dozens of times again and again. When I was checking out your BleWinRRDll example project I had the same "problem". I was wondering if this is normal or how I can avoid this. Thanks!

adabru commented 1 month ago

Thanks @lazerbots for the remark! You're right, the lines https://github.com/adabru/BleWinrtDll/blob/03b4dcf71a4152958074b90cb5459cf575456bb7/BleWinrtDll%20Unity/Assets/Scenes/Demo.cs#L67-L74 don't check whether the device was there before. That's a bug. If the device sends multiple updates and has IsConnectable to true on some of them, it will be listed multiple times.

I don't know if that could have something to do with the hanging.