Skip to content
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

Scan by manufacturerData #153

Closed
beaufortfrancois opened this issue Aug 24, 2015 · 4 comments
Closed

Scan by manufacturerData #153

beaufortfrancois opened this issue Aug 24, 2015 · 4 comments

Comments

@beaufortfrancois
Copy link
Member

It would be nice to be able to scan with filters on manufacturer data.

Here's how it would look like for the Rolling Spider Drone:

var rollingSpiderData = new Map([[0x0043, [0xcf, 0x19, 0x00, 0x09, 0x01, 0x00]]]);
return navigator.bluetooth.requestDevice({
  filters: [{ manufacturerData: [rollingSpiderData] }]
}).then(device => { ... })

According to https://github.com/voodootikigod/node-rolling-spider/blob/8996973eaee36be829d984d4ee7e37b0152b379d/lib/drone.js#L94

@jyasskin
Copy link
Member

Android allows scanning by a mask of the manufacturer data bits: http://developer.android.com/reference/android/bluetooth/le/ScanFilter.Builder.html#setManufacturerData(int, byte[], byte[]). Do we want that too?

Do we want to also allow matching just a prefix of the data?

We can allow just exact matches for now, and extend the array/buffersource value to an object if/when developers ask for more.

Should manufacturerData be a Map from id to array/buffersource or an object whose keys are the id? e.g.

filters: [{ manufacturerData: {0x0043: [0xcf, 0x19, 0x00, 0x09, 0x01, 0x00]} }]
filters: [{ manufacturerData: new Map([[0x0043, [0xcf, 0x19, 0x00, 0x09, 0x01, 0x00]]] }]
filters: [{ manufacturerData: {0x0043: new UInt8Array([0xcf, 0x19, 0x00, 0x09, 0x01, 0x00])} }]
filters: [{
  manufacturerData: {
    0x0043: {
      bits: new UInt8Array([0xcf, 0x19, 0x00, 0x09, 0x01, 0x00]),
      mask: new UInt8Array([0xff, 0xff, 0x00, 0xff, 0xff, 0x00]),
      matchType: 'prefix',
    }
  }]

I'm leaning toward using an object, and allowing (BufferSource or sequence<octet>), but not expanding to the mask or prefix matches yet.

@beaufortfrancois
Copy link
Member Author

A simple object would work well indeed for now.

@jyasskin
Copy link
Member

We should also allow filtering by Service Data.

@beaufortfrancois
Copy link
Member Author

beaufortfrancois commented Aug 24, 2016

I believe we can close this issue since #265 has been merged and handle manufacturerId filter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants