BluetoothRemoteGATTCharacteristic
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("Bluetooth API")}}{{SeeCompatTable}}{{SecureContext_Header}}
The BluetoothRemoteGattCharacteristic interface of the Web Bluetooth API represents a GATT Characteristic, which is a basic data element that provides further information about a peripheral's service.
{{InheritanceDiagram}}
Instance properties
- {{DOMxRef("BluetoothRemoteGATTCharacteristic.service")}} {{ReadOnlyInline}} {{Experimental_Inline}}
- : Returns the {{DOMxRef("BluetoothRemoteGATTService")}} this characteristic belongs to.
- {{DOMxRef("BluetoothRemoteGATTCharacteristic.uuid")}} {{ReadOnlyInline}} {{Experimental_Inline}}
- : Returns a string containing the UUID of the characteristic, for example
'00002a37-0000-1000-8000-00805f9b34fb'for the Heart Rate Measurement characteristic. - {{DOMxRef("BluetoothRemoteGATTCharacteristic.properties")}} {{ReadOnlyInline}} {{Experimental_Inline}}
- : Returns the properties of this characteristic.
- {{DOMxRef("BluetoothRemoteGATTCharacteristic.value")}} {{ReadOnlyInline}} {{Experimental_Inline}}
- : The currently cached characteristic value. This value gets updated when the value of the characteristic is read or updated via a notification or indication.
Instance methods
- {{DOMxRef("BluetoothRemoteGATTCharacteristic.getDescriptor()")}} {{Experimental_Inline}}
- : Returns a {{JSxRef("Promise")}} that resolves to the first {{DOMxRef("BluetoothRemoteGATTDescriptor")}} for a given descriptor UUID.
- {{DOMxRef("BluetoothRemoteGATTCharacteristic.getDescriptors()")}} {{Experimental_Inline}}
- : Returns a {{JSxRef("Promise")}} that resolves to an {{JSxRef("Array")}} of all {{DOMxRef("BluetoothRemoteGATTDescriptor")}} objects for a given descriptor UUID.
- {{DOMxRef("BluetoothRemoteGATTCharacteristic.readValue()")}} {{Experimental_Inline}}
- : Returns a {{JSxRef("Promise")}} that resolves to a {{JSxRef("DataView")}} holding a duplicate of the
valueproperty if it is available and supported. Otherwise it throws an error. - {{DOMxRef("BluetoothRemoteGATTCharacteristic.writeValue()")}} {{Deprecated_Inline}}
- : Sets the
valueproperty to the bytes contained in a given {{JSxRef("ArrayBuffer")}}, writes the characteristic value with optional response, and returns the resulting {{JSxRef("Promise")}}. - {{DOMxRef("BluetoothRemoteGATTCharacteristic.writeValueWithResponse()")}} {{Experimental_Inline}}
- : Sets the
valueproperty to the bytes contained in a given {{JSxRef("ArrayBuffer")}}, writes the characteristic value with required response, and returns the resulting {{JSxRef("Promise")}}. - {{DOMxRef("BluetoothRemoteGATTCharacteristic.writeValueWithoutResponse()")}} {{Experimental_Inline}}
- : Sets the
valueproperty to the bytes contained in a given {{JSxRef("ArrayBuffer")}}, writes the characteristic value without response, and returns the resulting {{JSxRef("Promise")}}. - {{DOMxRef("BluetoothRemoteGATTCharacteristic.startNotifications()")}} {{Experimental_Inline}}
- : Returns a {{JSxRef("Promise")}} that resolves when
navigator.bluetoothis added to the active notification context. - {{DOMxRef("BluetoothRemoteGATTCharacteristic.stopNotifications()")}} {{Experimental_Inline}}
- : Returns a {{JSxRef("Promise")}} that resolves when
navigator.bluetoothis removed from the active notification context.
Events
- {{DOMxRef("BluetoothRemoteGATTCharacteristic/characteristicvaluechanged_event", "characteristicvaluechanged")}} {{Experimental_Inline}}
- : Fired on a
BluetoothRemoteGATTCharacteristicwhen its value changes.
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}