WebBluetoothCG / web-bluetooth

Bluetooth support for the Web.
http://www.w3.org/community/web-bluetooth/
Other
1.37k stars 185 forks source link

Web Bluetooth Manufacturer Specific Data Map empty #598

Closed eskalVAR closed 1 year ago

eskalVAR commented 1 year ago

Hello I’m trying to receive manufacturer specific data. I filter by prefix and company id into navigator.requestDevice.

When running device.watchAdvertisements the event for advertisement received gets fired but there the manufacturer specific data map is empty.

Is this perhaps due to a permission issue I’m not understanding? The data shows up just fine on internal browser tools.

dlech commented 1 year ago

This sounds like a problem with the implementation rather than with the specification. Please see https://www.chromium.org/developers/how-tos/file-web-bluetooth-bugs/ for how to file bugs for Chromium.

reillyeon commented 1 year ago

Only data matching the optionalManufacturerData parameter to requestDevice is included in the advertisement event.

This could be an implementation bug, as this feature isn't stable yet. If you can file a Chromium bug with an example of the code you are running and information about the device (perhaps so we can reproduce it) that would be very helpful.

eskalVAR commented 1 year ago

When you say optionalmanufacturerdata. Do you mean

option.manufacturerData with the company ID or

option.optionalManufacturerData

An example of the object would be great

Thanks

On Thu, Nov 3, 2022 at 18:05, Reilly Grant @.***> wrote:

Only data matching the optionalManufacturerData parameter to requestDevice is included in the advertisement event.

This could be an implementation bug, as this feature isn't stable yet. If you can file a Chromium bug with an example of the code you are running and information about the device (perhaps so we can reproduce it) that would be very helpful.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

reillyeon commented 1 year ago

I mean options.optionalManufacturerData. I don't think we have an example of this on https://googlechrome.github.io/samples/web-bluetooth.

eskalVAR commented 1 year ago

So would something like this be sufficient?

options.filters[0].manufacturerData[0].companyIdentifier

options.optionalManufacturerData[0].manufacturerData[0].companyIdentifier

Those both set.

Or should it be formatted differently?

Thanks

On Thu, Nov 3, 2022 at 18:31, Reilly Grant @.***> wrote:

I mean options.optionalManufacturerData. I don't think we have an example of this on https://googlechrome.github.io/samples/web-bluetooth.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

beaufortfrancois commented 1 year ago

I think* this example code should work.

const manufacturerId = 0x0001;

await navigator.bluetooth.requestDevice({
  acceptAllDevices: true,
  optionalManufacturerData: [manufacturerId],
});
eskalVAR commented 1 year ago

This does the job. Thanks!