-
Notifications
You must be signed in to change notification settings - Fork 141
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
Windows: AdvertisementPayload empty #302
Comments
I see this from args.GetAdvertisement(); |
@universam1 please see comment here https://github.com/tinygo-org/bluetooth/blob/release/gap_windows.go#L37 |
Thank you @deadprogram , so what makes Python succeed here? |
These comments are interesting here https://github.com/hbldh/bleak/blob/develop/bleak/backends/winrt/scanner.py#L126 Perhaps @jagobagascon can interpret this code to figure out how to parse this data? |
It looks like we forgot to load the service information data from the advertising: Lines 245 to 248 in a668e1b
The Python library works because they do load that information: I made a quick test and I can get the service UUIDs, but I'm still not sure what to add in the Any idea? |
Good news! I got it to work after doing the same they do here: https://github.com/hbldh/bleak/blob/e01e2640994b99066552b6161f84799712c396fa/bleak/backends/winrt/scanner.py#L169
But it required a few changes to WinRT:
I'll try to find some time to work on this next week. |
That is great news @jagobagascon ! |
Hi! I'm trying to get UUIDs in the getScanResultFromArgs function of windows_gap.go like this:
but getting an error
The same happens when trying to fetch service data. |
You are calling Also hr is the error result. Not the output parameter. var serviceUUIDs []UUID
if winAdv, err := args.GetAdvertisement(); err == nil && winAdv != nil {
vector, _ := winAdv.GetServiceUuids()
size, _ := vector.GetSize()
for i := uint32(0); i < size; i++ {
- element, _ := vector.GetAt(i)
var outGuid syscall.GUID
hr, _, _ := syscall.SyscallN(
vector.VTable().GetAt,
- uintptr(unsafe.Pointer(element)),
+ uintptr(unsafe.Pointer(vector)),
uintptr(i),
uintptr(unsafe.Pointer(&outGuid)),
)
+ if hr != 0 {
+ return ole.NewError(hr)
+ }
- uuid := (*UUID)(unsafe.Pointer(hr))
- serviceUUIDs = append(serviceUUIDs, *uuid)
+ serviceUUIDs = append(serviceUUIDs, outGuid)
}
} |
After a couple of adjustments, I managed to add them to the scan results. Many thanks! |
Thank you @jagobagascon and others for the work. Unfortunately on Windows (11) the AdvertisementPayload or manufacturer data is empty.
However, via Python I receive that data just fine, on the same machine.
Go results:
Go code:
Python results:
Python code:
Any idea what could be fixed?
The text was updated successfully, but these errors were encountered: