googlearchive / platinum-bluetooth

A set of Polymer elements to discover and communicate with nearby Bluetooth devices
https://elements.polymer-project.org/elements/platinum-bluetooth
Apache License 2.0
22 stars 13 forks source link

Subscribe to notifications from BLE device? #14

Closed ketile closed 8 years ago

ketile commented 8 years ago

Can't find any documentation on subscribing and unsubscribing to notifications using platinum-bluetooth. Is this possible or planned for implementation? Have not yet tried with the vanilla Web Bluetooth API but it seems possible.

Need this functionality for a demo and wondering if I should use Web Bluetooth API directly or through Polymer.

beaufortfrancois commented 8 years ago

It is not yet implemented in platinum-bluetooth. I'm waiting for notifications to land in stable channel to update platinum-bluetooth.

You may want to use Web Bluetooth API instead for the moment and make sure you use a recent Chromium build on Android (https://download-chromium.appspot.com/?platform=Android).

See https://googlechrome.github.io/samples/web-bluetooth/notifications.html for how it works.

jyasskin commented 8 years ago

You should be able to combine the Polymer elements with the lower-level JS API. Right now, the BluetoothGATTCharacteristic you need is only exposed as <bluetooth-gatt-characteristic>._characteristic, but I think we should make that public so folks can fill in holes like this.

beaufortfrancois commented 8 years ago

Fixed with https://github.com/PolymerElements/platinum-bluetooth/commit/18a1c063ac4f0d82bb500eecc5b6ac2df64ffef9

beaufortfrancois commented 8 years ago

@ketile You can give it a try now with WIP https://github.com/PolymerElements/platinum-bluetooth/pull/15