W3C home > Mailing lists > Public > public-web-bluetooth-log@w3.org > May 2016

Re: [web-bluetooth] Have sites explicitly watch for advertisements on paired devices.

From: François Beaufort via GitHub <sysbot+gh@w3.org>
Date: Wed, 04 May 2016 07:01:09 +0000
To: public-web-bluetooth-log@w3.org
Message-ID: <issue_comment.created-216761556-1462345268-sysbot+gh@w3.org>
Thank you for spec'ing this @jyasskin!

Here are my two cents: Do we really need the added this new boolean 
attribute `watchingAdvertisements`? Can't we simply set it internally 
to true when developer calls 
`device.addEventListener('advertisementreceived', foo);`?

It would be as simple and nice as:
```js
var known_service = "A service in the iBeacon’s GATT server";
return navigator.bluetooth.requestDevice({
  filters: [{services: [known_service]}]
}).then(device => {
  // Set `watchingAdvertisements` to true
  device.addEventListener('advertisementreceived', interpretIBeacon);
});

// Later on...
// Set `watchingAdvertisements` to false
device.removeEventListener('advertisementreceived', interpretIBeacon);

```

-- 
GitHub Notification of comment by beaufortfrancois
Please view or discuss this issue at 
https://github.com/WebBluetoothCG/web-bluetooth/pull/235#issuecomment-216761556
 using your GitHub account
Received on Wednesday, 4 May 2016 07:03:05 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 4 May 2016 07:03:05 UTC