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

[web-bluetooth] Add connect and disconnect gatt server Bluetooth events.

From: François Beaufort via GitHub <sysbot+gh@w3.org>
Date: Wed, 06 Jan 2016 10:49:47 +0000
To: public-web-bluetooth-log@w3.org
Message-ID: <issues.opened-125154236-1452077386-sysbot+gh@w3.org>
beaufortfrancois has just created a new issue for 
https://github.com/WebBluetoothCG/web-bluetooth:

== Add connect and disconnect gatt server Bluetooth events. ==
The same way, WebUSB added `connect` and `disconnect` events 
(https://github.com/reillyeon/webusb/commit/5806adfc523ff5146bc9fa883367b024d1d62699),
 it would be nice to have them in WebBluetooth so that Web Apps can 
detect connected/disconnected devices.

Just a proposal there...
```js
navigator.bluetooth.addEventListener('connectGatt', handleGattServer);
navigator.bluetooth.addEventListener('disconnectGatt', 
handleGattServer);

function handleGattServer(event) {
  var gattServer = target.value;
  console.log('Gatt Server connected: ', gattServer.connected);
});

Please view or discuss this issue at 
https://github.com/WebBluetoothCG/web-bluetooth/issues/194 using your 
GitHub account
Received on Wednesday, 6 January 2016 10:49:51 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 6 January 2016 10:49:51 UTC