adabru / BleWinrtDll

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

BleWinrtDll.cpp:501 SubscribeCharacteristicAsync catch: 属性需要进行身份验证,然后才能读取或写入。 #7

Closed Jason-Chn95 closed 3 years ago

Jason-Chn95 commented 3 years ago

May I ask if this is the reason why the sensor needs authentication or something else? This is the first time for me to do this Bluetooth function.

Jason-Chn95 commented 3 years ago

4ff2436632c847ea84555b679f05b09

adabru commented 3 years ago

I didn't do any bluetooth authentication yet. From the error message I'd also guess you need it.

Maybe pairing it will help: https://docs.microsoft.com/en-us/windows/uwp/devices-sensors/bluetooth-dev-faq#why-does-my-bluetooth-le-device-stop-responding-after-a-disconnect . You could also try the microsoft sample https://github.com/microsoft/Windows-universal-samples/tree/master/Samples/BluetoothLE and see whether you can read the value without authentication instead of subscribing to it. You can also use the microsoft sample to try out the pairing code.

Jason-Chn95 commented 3 years ago

I didn't do any bluetooth authentication yet. From the error message I'd also guess you need it.

Maybe pairing it will help: https://docs.microsoft.com/en-us/windows/uwp/devices-sensors/bluetooth-dev-faq#why-does-my-bluetooth-le-device-stop-responding-after-a-disconnect . You could also try the microsoft sample https://github.com/microsoft/Windows-universal-samples/tree/master/Samples/BluetoothLE and see whether you can read the value without authentication instead of subscribing to it. You can also use the microsoft sample to try out the pairing code.

Thanks adabru for your help,now I solved this problem.I have another question. Do you know how to do it?I want to connect two Bluetooth devices on my PC,how to do this ?

adabru commented 3 years ago

I guess each bluetooth device normally has a unique device id. In that case you should be able to just call the functions with different device-ids. Each received data-package contains information about the device it was sent from. Likewise, in each data-package you send you can specify the device-id it should go to.

Jason-Chn95 commented 3 years ago

我猜每个蓝牙设备通常都有一个唯一的设备ID。在这种情况下,您应该能够仅使用不同的设备ID来调用函数。每个接收到的数据包都包含有关其发送设备的信息。同样,在您发送的每个数据包中,您都可以指定设备编号。

Thank you. I can only send you a star

Augmentaio commented 3 years ago

Hi Jason, did you face this issue (SubscribeCharacteristicAsync catch) when testing with beacons? How did you solve it?

Jason-Chn95 commented 3 years ago

Hi Jason, did you face this issue (SubscribeCharacteristicAsync catch) when testing with beacons? How did you solve it?

Sorry,I didn't have that problem