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

Laptop BLE no issue Resolving Characteristics, Desktop has issues... #51

Open nonlin opened 1 year ago

nonlin commented 1 year ago

So tested this with laptop, after a windows update I had to get the latest intel BLE drivers but laptop can resolve services and characteristics and then write to device.

On Desktop my motherboards BLE could not resolve services until I updated the intel BLE driver but it would then never resolve characteristics. I went out and got an ASUS BLE Dongle and it too has the same issue, and if I can't resolve the characteristics I can't write to the device or subscribe.

Has anyone noticed any odd issues like this? Where it works on some machines but not others?

The Same BLE project by microsoft has no issue, so I'll be looking at their code and trying to understand what may be different.

nonlin commented 1 year ago

Notice there are two different ways to obtain services?

One is via the ScanServicesAsync which uses the same calls in the example.

The other is via retreiveServices which uses GetGattServicesForUuidAsync.

Not sure why we do it two different ways but the way its done in ScanServiceAsync seems to work on my PC where as the GetGattServicesForUuidAsync doesn't seem to work on my PC but does for my laptop.

adabru commented 1 year ago

Thank you for posting the results of your investigation!

Not sure why we do it two different ways

GetGattServicesAsync is used to explore available services, GetGattServicesForUuidAsync is used to retreive a previously known service, without the need to list all services. Given your description of your driver, one random guess of mine is that your driver doesn't support that api?

the way its done in ScanServiceAsync seems to work on my PC

I guess you can add the services found during ScanServiceAsync to the cache. That way you can run a service scan before you retrieve the characteristic.