Comments (7)
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 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.
from blewinrtdll.
co_await characteristic.WriteValueWithResultAsync(buffer, GattWriteOption::WriteWithResponse);
this works fine
from blewinrtdll.
if I have only one characteristic the write button works fine
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:
- select the characteristics dropdown in unity
- in the inspector, find "On Value Changed (Int32)" in the "Dropdown" component
- add Demo.SelectCharacteristic and pass "DropdownCharacteristic" as the argument
from blewinrtdll.
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.
from blewinrtdll.
@ehauner would you mind creating a pull request :) ? Currently I don't have the setup to test this.
from blewinrtdll.
Hi,
we started to use the BlewinrtDll we need it for our Unity app and the solution seems great.
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
the device can recieve correctly from/with other libraries for ios and Mac
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.
from blewinrtdll.
Hi @tommasoFabbri :),
please open a new issue and write which error message you are getting. Please also try the Microsoft provided sample linked in the Readme to checkout if sending data works there.
from blewinrtdll.
Related Issues (20)
- Using dll in the Unity but can't subscribe HOT 1
- Multiple BLE connections alternating so buffer doesnt get overflood HOT 3
- Why can't BleWinrtDll.dll be called when this project is deployed to HoloLens? HOT 2
- Connecting and Subscribing to heart sensor HOT 3
- Unable to write attribute HOT 5
- Suddenly unable to subscribe to notifications from and write to characteristic HOT 1
- Communication with Dongle
- Laptop BLE no issue Resolving Characteristics, Desktop has issues... HOT 2
- Problems connecting two devices at the same time. HOT 1
- BleScan.Impl.PollData make my Unity crashed. HOT 2
- The ValueChanged function runs at irregular intervals. HOT 1
- Does BleWinrtDll provide API for pairing with passkey? HOT 4
- again: BleWinrtDll.cpp:501 SubscribeCharacteristicAsync catch: The attribute cannot be written. HOT 6
- Write to device problem HOT 2
- Error subscribing to Characteristic HOT 3
- Hololens 2 unable to connect to Microbit HOT 9
- η΄ζ₯θΏζ₯ Direct connection HOT 1
- Device Filtering by Service HOT 1
- Connect 2 DLLs to one BLE IndoorBike
- Connect 2 DLLs to one BLE IndoorBike HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blewinrtdll.