B2G/Bluetooth/WebBluetooth-v2/BluetoothGattDescriptor: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Change "Promise<ArrayBuffer> writeValue(ArrayBuffer value)" to "Promise<void> writeValue(ArrayBuffer value)")
(edit write descriptor value for both server and client)
Line 84: Line 84:


; Description
; Description
: Write the descriptor value to the remote device.
: Write the descriptor value to the GATT server. If the local device is the GATT client, the value will be written to the remote GATT server. On the other hand, if the local device is the GATT server, the value will be written to [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattDescriptor#value|value]].


; Parameter
; Parameter
: ''value''
: ''value''
:: Desired value to be written to the remote device.
:: Desired value to be written to the GATT server.


; Return
; Return
: A Promise to indicate whether the operation is resolved or rejected. The Promise is resolved along with the descriptor value after this write operation.
: A Promise to indicate whether the operation is resolved or rejected. The Promise is resolved along with the descriptor value after this write operation.

Revision as of 11:47, 5 May 2015

Overview

BluetoothGattDescriptor represents a GATT descriptor, which contains related information about a characteristic value.

Interfaces

BluetoothGattDescriptor

BluetoothGattDescriptor

[CheckPermissions="bluetooth"]
interface BluetoothGattDescriptor
{
  readonly attribute BluetoothGattCharacteristic characteristic;
  readonly attribute DOMString uuid;
  readonly attribute ArrayBuffer? value;
  [Cached, Constant] readonly attribute Permissions permissions;

  [NewObject] Promise<ArrayBuffer> readValue();
  [NewObject] Promise<void> writeValue(ArrayBuffer value);
};

Properties

characteristic

Description
The characteristic which this descriptor belongs to.
Value Type
BluetoothGattCharacteristic
Default Value
null pointer

uuid

Description
This property stores the UUID of this descriptor.
Value Type
DOMString
Default Value
Empty string ("")

value

Description
The cached value of this descriptor.
This value can be updated via readValue() method.
Value Type
ArrayBuffer or null
Default Value
null pointer

permissions

Description
A bit mask which describes allowed operations on the characteristic.
Value Type
dictionary Permissions
Default Value
0

Methods

readValue()

Description
Read the descriptor value from the remote device. The cached value property is also updated after retrieving the value.
Return
A Promise to indicate whether the operation is resolved or rejected. The Promise is resolved along with the value retrieved from the remote device.

writeValue(ArrayBuffer value)

Description
Write the descriptor value to the GATT server. If the local device is the GATT client, the value will be written to the remote GATT server. On the other hand, if the local device is the GATT server, the value will be written to value.
Parameter
value
Desired value to be written to the GATT server.
Return
A Promise to indicate whether the operation is resolved or rejected. The Promise is resolved along with the descriptor value after this write operation.