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#
Properties#
BluetoothGattCharacteristic.serviceread-onlyno-linkReturns the BluetoothGattService that this characteristic belongs to.BluetoothGattCharacteristic.descriptorsread-onlyno-linkReturns a cached array containing the BluetoothGattDescriptor objects that describe this characteristic.BluetoothGattCharacteristic.uuidread-onlyno-linkReturns a DOMString representing the UUID of this characteristic.BluetoothGattCharacteristic.instanceIdread-onlyno-linkReturns a number representing the instance id of this characteristic.BluetoothGattCharacteristic.valueread-onlyno-linkReturns The cached value of this characteristic. This value can be updated via theBluetoothGattCharacteristic.readValue()method, characteristic notification, or indication from the remote device.BluetoothGattCharacteristic.permissionsread-onlyno-linkReturns a bit mask that describes the operations permitted on this characteristic.BluetoothGattCharacteristic.propertiesread-onlyno-linkReturns a bit mask that describes how to use the characteristic value.
Methods#
BluetoothGattCharacteristic.readValue()Reads the characteristic value from the remote device. The cached value property will also be updated after retrieving the value.BluetoothGattCharacteristic.writeValue()Writes the characteristic 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 BluetoothGattCharacteristic.value.BluetoothGattCharacteristic.startNotifications()Registers notifications/indications for this characteristic.BluetoothGattCharacteristic.stopNotifications()Unregisters notifications/indications for this characteristic.BluetoothGattCharacteristic.addDescriptor()Adds a descriptor to this characteristic.