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

From MozillaWiki
Jump to navigation Jump to search
(Created page with "== Overview == TBD == Interfaces == BluetoothGattDescriptor === BluetoothGattDescriptor ===...")
 
Line 19: Line 19:
   const unsigned short PERMISSION_WRITE_SIGNED_MITM = 0x0100;
   const unsigned short PERMISSION_WRITE_SIGNED_MITM = 0x0100;
   
   
   readonly attribute [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattCharacteristic#BluetoothGattCharacteristic|BluetoothGattCharacteristic]]                 [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattDescriptor#characteristic|characteristic]];
   readonly attribute [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattCharacteristic#BluetoothGattCharacteristic|BluetoothGattCharacteristic]] [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattDescriptor#characteristic|characteristic]];
   readonly attribute DOMString                            [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattDescriptor#uuid|uuid]];
   readonly attribute DOMString                            [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattDescriptor#uuid|uuid]];
   readonly attribute int                                  [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattDescriptor#permissions|permissions]];
   readonly attribute int                                  [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattDescriptor#permissions|permissions]];

Revision as of 08:55, 22 August 2014

Overview

TBD

Interfaces

BluetoothGattDescriptor

BluetoothGattDescriptor

[CheckPermissions="bluetooth"]
interface BluetoothGattDescriptor
{
  // Permission
  const unsigned short PERMISSION_READ              = 0x0001;
  const unsigned short PERMISSION_READ_ENCRYPTED    = 0x0002;
  const unsigned short PERMISSION_READ_ENC_MITM     = 0x0004;
  const unsigned short PERMISSION_WRITE             = 0x0010;
  const unsigned short PERMISSION_WRITE_ENCRYPTED   = 0x0020;
  const unsigned short PERMISSION_WRITE_ENC_MITM    = 0x0040;
  const unsigned short PERMISSION_WRITE_SIGNED      = 0x0080;
  const unsigned short PERMISSION_WRITE_SIGNED_MITM = 0x0100;

  readonly attribute BluetoothGattCharacteristic characteristic;
  readonly attribute DOMString                             uuid;
  readonly attribute int                                   permissions;
  readonly attribute ArrayBuffer?                          value;

  [NewObject, Throws]
  Promise<ArrayBuffer> readValue();
  [NewObject, Throws]
  Promise<ArrayBuffer> 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 ("")

permissions

Description
A bit mask which describes the security level required for read/write accesses of this descriptor.
Value Type
integer
Default Value
0

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

Methods

readValue()

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

writeValue(ArrayBuffer value)

Description
Write the descriptor value to the remote device.
Parameter
value
Desired value to be written to the remote device.
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.