- From: Reilly Grant via GitHub <sysbot+gh@w3.org>
- Date: Mon, 16 Sep 2019 06:21:49 +0000
- To: public-web-bluetooth-log@w3.org
Discussed at the 2019 TPAC F2F. The combination of the `watchAdvertisements()` and `connect()` methods are sufficient to determine that a device is in range and connectable and to connect to it. As mentioned previously Chromium does not currently implement these methods but the mechanism is specified.
```js
device.addEventListener('gattserverdisconnected', async e => {
await device.watchAdvertisements();
});
device.addEventListener('advertisementreceived', async e => {
try {
await device.gatt.connect();
await device.unwatchAdvertisements();
} catch (e) {
// Continue listening for advertisements.
}
});
--
GitHub Notification of comment by reillyeon
Please view or discuss this issue at https://github.com/WebBluetoothCG/web-bluetooth/issues/31#issuecomment-531654273 using your GitHub account
Received on Monday, 16 September 2019 06:21:50 UTC