-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to write to device #20
Comments
For investigation, you can download and run the Microsoft's Bluetooth Low Energy sample and see whether writing the characteristic works there. Can you see any error message in the GUI? You could also try out changing |
co_await characteristic.WriteValueWithResultAsync(buffer, GattWriteOption::WriteWithResponse); |
Hello, I managed to compile the code and changed the line 536. I then customized the Unity code and I'm trying to write a letter "C" or "F" but when I press the Write Button I get: "BleWinrtDll.cpp:545 SendDataAsync catch: The attribute cannot be written." I also seem to subscribe to the first characteristic of my BLE peripheral despite clicking on the second characteristic. This bug only happens from within unity, it doesn't happen with either the BLE scanner app from my android phone nor the same PC BLE scanner app. Those apps seem to work fine. Edit: It seems if I have only one characteristic the write button works fine. I'll make a few more tests and try to figure out the culprit. |
Thank you. This hint helped me solve this issue. I logged a bunch of things and found out that changing the characteristics dropdown was not correctly setting the selected characteristic in the script. It was always trying to subscribe to the first one since the script selects the first item by default. This issue is that the dropdown was never hooked up to the SelectCharacteristic function in the Demo script. Simple fix:
|
@ehauner would you mind creating a pull request :) ? Currently I don't have the setup to test this. |
Hi, we can connect to the BLE device and can receive data but the function "SendData" always return false we have try to use the precompiled dll that e find in the unity example non threaded we have tried also this You could also try out changing GattWriteOption::WriteWithoutResponse to GattWriteOption::WriteWithResponse at https://github.com/adabru/BleWinrtDll/blob/main/BleWinrtDll/BleWinrtDll.cpp#L536 . That would make the call wait for the BLE device to send a "I received" confirmation. In BLE terms that would be "request"+"response" instead of a "command" without a response. but the returnis still false. what can we do about it? Thank you in advance. |
Hi @tommasoFabbri :), |
Hiya,
I recently started use this library and It is amazing, thank you very much.
I am trying to get this working in the Unity Editor for faster debugging. After connecting to my BLE device I am able to receive data just fine but the device does not receive any data I try to send.
I know the device works because I can send data through our webpage.
I am not too familiar with Bluetooth development so I was wondering if anyone had run into this issue. I was also wondering what the best way I can debug this issue is?
Thank you.
The text was updated successfully, but these errors were encountered: