- From: François Beaufort 🇫🇷 <fbeaufort@google.com>
- Date: Fri, 22 Jan 2016 12:30:22 +0100
- To: public-web-bluetooth <public-web-bluetooth@w3.org>
As discussed in https://github.com/WebBluetoothCG/web-bluetooth/issues/172, BluetoothGATTCharacteristic.value will now return a DataView object instead of an ArrayBuffer object to make it easier (most of time) to read that value. BEFORE: characteristic.readValue().then(buffer => { let data = new DataView(buffer); let foo = data.getUint8(0); ... NOW: characteristic.readValue().then(value => { let foo = value.getUint8(0); // We can always access ArrayBuffer if we need to with value.buffer ... We have updated our specification, demos, samples, codelabs, articles and sent some PRs to external projects we know. Until Chrome 50 reaches Stable channel (estimated to Apr 19th, 2016 according to https://www.chromium.org/developers/calendar), here's what you can add in your app's code: characteristic.readValue().then(value => { // TODO: Remove line below when Chrome 50 reaches Stable channel. value = value.buffer ? value : new DataView(value); let foo = value.getUint8(0); ...
Received on Friday, 22 January 2016 11:30:52 UTC