-
Notifications
You must be signed in to change notification settings - Fork 54
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 attribute #48
Comments
Hi @StevenDextrain :-) you only subscribe to characteristics that issue notify events. After subscription you can read incoming messages with PollData. You can write to characteristics without prior subscription. "ReadCharacteristic" is not implemented in the dll although it is a ble functionality. If you need it you can checkout #6 (comment) . But subscribing alone might be sufficient for you. |
Hey again ! |
Ah nevermind, I just realized I missed part of the first (and most important part of your reply 🙃), I'm gonna try that and come back with another question, or hopefully, everything will work fine and I'll close the issue ! |
Hello again, It doesn't work (yet), and I noticed that the BleApi.SendData(in data, false) method call returned "false". Thanks again, and have a nice day ! |
For the non-blocking call, the result is always false: BleWinrtDll/BleWinrtDll/BleWinrtDll.cpp Lines 554 to 560 in f2635b7
You should see an error in the message window eventually, if it doesn't succeed. The blocking call returns true on success of sending: BleWinrtDll/BleWinrtDll/BleWinrtDll.cpp Lines 537 to 540 in f2635b7
The success doesn't guarantee that the package arrives at the target device though. There is a possibility to do that though.
Exactly: SubscribeCharacteristicAsync BleWinrtDll/BleWinrtDll/BleWinrtDll.cpp Line 492 in f2635b7
Characteristic_ValueChanged BleWinrtDll/BleWinrtDll/BleWinrtDll.cpp Line 478 in f2635b7
PollData BleWinrtDll/BleWinrtDll/BleWinrtDll.cpp Lines 520 to 524 in f2635b7
|
Hello !
First of all, thanks a lot for your project and the work you've done, as a novice when working with Bluetooth, it helps a lot. I've scoured the different issues already listed on this repo, but can't find something that answers my questions.
That being said, I'm currently having an issue when trying to subscribe to my write notification on my bluetooth device.
I get this error :
"Could not establish connection to device with ID BluetoothLE#BluetoothLEc4:23:60:eb:a3:ec-c5:02:be:bb:2a:69
System.Exception: Connection failed: BleWinrtDll.cpp:501 SubscribeCharacteristicAsync catch: Unable to write attribute (translated from French, not sure about the translation, sorry about that)"
The strange thing is that it happens when trying to subscribe to my device's Write characteristic.
I have 2 different characteristics on my device, one that is for Read/Notify, and one that is for Write, and I figured the script would be able to identify which is which, and subscribe to notifications for the Notify one, and subscribe to the Write characteristic to send messages, but I realize I might be wrong ?
I also had another question, it might be because I can't reach this part yet because of my previous issue, but I don't see a way to read data sent by the BLE device, am I missing something ? I looked for "Read" "Receive" and other keywords in the code but found no results
Anyways, I'm very much stuck and I'd really appreciate if you could help me 😁
Thank you so much, have a nice day !
The text was updated successfully, but these errors were encountered: