Version: Smart Feature Phone 2.5Version: Smart Feature Phone 2.6

BluetoothGattCharacteristic

Description#

The BluetoothGattCharacteristic interface of the Bluetooth API represents a GATT service characteristic, which includes characteristic definition, value, properties and configuration info, and a list of descriptors that provide related information.

Interface overview#

[Exposed=Window]
interface BluetoothGattCharacteristic
{
readonly attribute BluetoothGattService service;
[Cached, Pure] readonly attribute sequence<BluetoothGattDescriptor> descriptors;
readonly attribute DOMString uuid;
readonly attribute unsigned short instanceId;
readonly attribute ArrayBuffer? value;
[Cached, Constant] readonly attribute GattPermissions permissions;
[Cached, Constant] readonly attribute GattCharacteristicProperties properties;
[NewObject] Promise<ArrayBuffer> readValue();
[NewObject] Promise<void> writeValue(ArrayBuffer value);
[NewObject] Promise<void> startNotifications();
[NewObject] Promise<void> stopNotifications();
[NewObject] Promise<BluetoothGattDescriptor> addDescriptor(DOMString uuid, GattPermissions permissions, ArrayBuffer value);
};
dictionary GattPermissions
{
boolean read = false;
boolean readEncrypted = false;
boolean readEncryptedMITM = false;
boolean write = false;
boolean writeEncrypted = false;
boolean writeEncryptedMITM = false;
boolean writeSigned = false;
boolean writeSignedMITM = false;
};
dictionary GattCharacteristicProperties
{
boolean broadcast = false;
boolean read = false;
boolean writeNoResponse = false;
boolean write = false;
boolean notify = false;
boolean indicate = false;
boolean signedWrite = false;
boolean extendedProps = false;
};

Properties#

  • BluetoothGattCharacteristic.service read-only Returns the BluetoothGattService that this characteristic belongs to.

  • BluetoothGattCharacteristic.descriptors read-only Returns a cached array containing the BluetoothGattDescriptor objects that describe this characteristic.

  • BluetoothGattCharacteristic.uuid read-only Returns a DOMString representing the UUID of this characteristic.

  • BluetoothGattCharacteristic.instanceId read-only Returns a number representing the instance id of this characteristic.

  • BluetoothGattCharacteristic.value read-only Returns The cached value of this characteristic as an ArrayBuffer. This value can be updated via the BluetoothGattCharacteristic.readValue() method, characteristic notification, or indication from the remote device.

  • BluetoothGattCharacteristic.permissions read-only Returns a GattPermissions that describes the operations permitted on this characteristic.

  • BluetoothGattCharacteristic.properties read-only Returns a GattCharacteristicProperties that describes how to use the characteristic value.

Methods#