W3C home > Mailing lists > Public > public-web-bluetooth-log@w3.org > April 2019

Re: [web-bluetooth] Missing API for GATT Write w/o Response (#238)

From: François Beaufort via GitHub <sysbot+gh@w3.org>
Date: Mon, 15 Apr 2019 06:57:50 +0000
To: public-web-bluetooth-log@w3.org
Message-ID: <issue_comment.created-483130653-1555311469-sysbot+gh@w3.org>
We could also decide to add two new methods `writeValueWithResponse` and `writeValueWithoutResponse`.

```js
// Write value to a BLE characteristic. Client trusts UA to know which type to send.
try {
  await myCharacteristic.writeValue(someData);
} catch(error) {
  // Error is thrown if BLE characteristic does NOT support any write operation.
}

// [NEW] Write value with response to a BLE characteristic.
try {
  await myCharacteristic.writeValueWithResponse(someData);
} catch(error) {
  // Error is thrown if BLE characteristic does NOT support writeWithResponse.
}

// [NEW] Write value without response to a BLE characteristic.
try {
  await myCharacteristic.writeValueWithoutResponse(someData);
} catch(error) {
  // Error is thrown if BLE characteristic does NOT support writeWithoutResponse.
}
```

-- 
GitHub Notification of comment by beaufortfrancois
Please view or discuss this issue at https://github.com/WebBluetoothCG/web-bluetooth/issues/238#issuecomment-483130653 using your GitHub account
Received on Monday, 15 April 2019 06:57:51 UTC

This archive was generated by hypermail 2.3.1 : Monday, 15 April 2019 06:57:52 UTC