BluetoothRemoteGATTCharacteristic

这是 实验性技术
检查 浏览器兼容性表格 在生产中使用这之前。

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.

Interface

interface BluetoothRemoteGATTCharacteristic {
  readonly attribute BluetoothRemoteGATTService service;
  readonly attribute UUID uuid;
  readonly attribute BluetoothCharacteristicProperties properties;
  readonly attribute DataView? value;
  Promise<BluetoothRemoteGATTDescriptor> getDescriptor(BluetoothDescriptorUUID descriptor);
  Promise<sequence<BluetoothRemoteGATTDescriptor>>
    getDescriptors(optional BluetoothDescriptorUUID descriptor);
  Promise<DataView> readValue();
  Promise<void> writeValue(BufferSource value);
  Promise<void> startNotifications();
  Promise<void> stopNotifications();
};
BluetoothRemoteGATTCharacteristic implements EventTarget;
BluetoothRemoteGATTCharacteristic implements CharacteristicEventHandlers;
					

特性

BluetoothRemoteGATTCharacteristic.service 只读
返回 BluetoothGATTService this characteristic belongs to.
BluetoothRemoteGATTCharacteristic.uuid 只读
返回 DOMString containing the UUID of the characteristic, for example '00002a37-0000-1000-8000-00805f9b34fb' for the Heart Rate Measurement characteristic.
BluetoothRemoteGATTCharacteristic.properties 只读
Returns the properties of this characteristic.
BluetoothRemoteGATTCharacteristic.value 只读
The currently cached characteristic value. This value gets updated when the value of the characteristic is read or updated via a notification or indication.

方法

BluetoothRemoteGATTCharacteristic.getDescriptor()
返回 Promise that resolves to the first BluetoothGATTDescriptor for a given descriptor UUID.
BluetoothRemoteGATTCharacteristic.getDescriptors()
返回 Promise that resolves to an Array of all BluetoothGATTDescriptor objects for a given descriptor UUID.
BluetoothRemoteGATTCharacteristic.readValue()
返回 Promise that resolves to an ArrayBuffer holding a duplicate of the value property if it is available and supported. Otherwise it throws an error.
BluetoothRemoteGATTCharacteristic.writeValue()
Sets the value property to the bytes contained in an ArrayBuffer and returns a Promise .
BluetoothRemoteGATTCharacteristic.startNotifications()
返回 Promise when navigator.bluetooth is added to the active notification context.
BluetoothRemoteGATTCharacteristic.stopNotifications()
返回 Promise when navigator.bluetooth is removed from the active notification context.

规范

规范 状态 Comment
Web Bluetooth
The definition of 'BluetoothRemoteGATTCharacteristic' in that specification.
草案 初始定义。

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
BluetoothRemoteGATTCharacteristic
Chrome 56
56
macOS only.
56
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 56: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ). To change preferences in Chrome, visit chrome://flags.
70
Windows 10.
Edge ≤79
≤79
macOS only.
≤79
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version ≤79: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
≤79
Windows 10.
Firefox No IE No Opera 43
43
macOS only.
43
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 43: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
57
Windows 10.
Safari No WebView Android No Chrome Android 56 Firefox Android No Opera Android 43 Safari iOS No Samsung Internet Android 6.0
getDescriptor
Chrome 56
56
macOS only.
56
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 56: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ). To change preferences in Chrome, visit chrome://flags.
70
Windows 10.
Edge ≤79
≤79
macOS only.
≤79
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version ≤79: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
≤79
Windows 10.
Firefox No IE No Opera 43
43
macOS only.
43
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 43: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
57
Windows 10.
Safari No WebView Android No Chrome Android 56 Firefox Android No Opera Android 43 Safari iOS No Samsung Internet Android 6.0
getDescriptors
Chrome 56
56
macOS only.
56
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 56: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ). To change preferences in Chrome, visit chrome://flags.
70
Windows 10.
Edge ≤79
≤79
macOS only.
≤79
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version ≤79: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
≤79
Windows 10.
Firefox No IE No Opera 43
43
macOS only.
43
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 43: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
57
Windows 10.
Safari No WebView Android No Chrome Android 56 Firefox Android No Opera Android 43 Safari iOS No Samsung Internet Android 6.0
properties
Chrome 56
56
macOS only.
56
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 56: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ). To change preferences in Chrome, visit chrome://flags.
70
Windows 10.
Edge ≤79
≤79
macOS only.
≤79
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version ≤79: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
≤79
Windows 10.
Firefox No IE No Opera 43
43
macOS only.
43
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 43: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
57
Windows 10.
Safari No WebView Android No Chrome Android 56 Firefox Android No Opera Android 43 Safari iOS No Samsung Internet Android 6.0
readValue
Chrome 56
56
macOS only.
56
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 56: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ). To change preferences in Chrome, visit chrome://flags.
70
Windows 10.
Edge ≤79
≤79
macOS only.
≤79
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version ≤79: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
≤79
Windows 10.
Firefox No IE No Opera 43
43
macOS only.
43
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 43: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
57
Windows 10.
Safari No WebView Android No Chrome Android 56 Firefox Android No Opera Android 43 Safari iOS No Samsung Internet Android 6.0
service
Chrome 56
56
macOS only.
56
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 56: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ). To change preferences in Chrome, visit chrome://flags.
70
Windows 10.
Edge ≤79
≤79
macOS only.
≤79
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version ≤79: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
≤79
Windows 10.
Firefox No IE No Opera 43
43
macOS only.
43
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 43: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
57
Windows 10.
Safari No WebView Android No Chrome Android 56 Firefox Android No Opera Android 43 Safari iOS No Samsung Internet Android 6.0
startNotifications
Chrome 56
56
macOS only.
56
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 56: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ). To change preferences in Chrome, visit chrome://flags.
70
Windows 10.
Edge ≤79
≤79
macOS only.
≤79
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version ≤79: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
≤79
Windows 10.
Firefox No IE No Opera 43
43
macOS only.
43
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 43: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
57
Windows 10.
Safari No WebView Android No Chrome Android 56 Firefox Android No Opera Android 43 Safari iOS No Samsung Internet Android 6.0
stopNotifications
Chrome 56
56
macOS only.
56
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 56: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ). To change preferences in Chrome, visit chrome://flags.
70
Windows 10.
Edge ≤79
≤79
macOS only.
≤79
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version ≤79: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
≤79
Windows 10.
Firefox No IE No Opera 43
43
macOS only.
43
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 43: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
57
Windows 10.
Safari No WebView Android No Chrome Android 56 Firefox Android No Opera Android 43 Safari iOS No Samsung Internet Android 6.0
uuid
Chrome 56
56
macOS only.
56
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 56: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ). To change preferences in Chrome, visit chrome://flags.
70
Windows 10.
Edge ≤79
≤79
macOS only.
≤79
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version ≤79: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
≤79
Windows 10.
Firefox No IE No Opera 43
43
macOS only.
43
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 43: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
57
Windows 10.
Safari No WebView Android No Chrome Android 56 Firefox Android No Opera Android 43 Safari iOS No Samsung Internet Android 6.0
value
Chrome 56
56
macOS only.
56
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 56: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ). To change preferences in Chrome, visit chrome://flags.
70
Windows 10.
Edge ≤79
≤79
macOS only.
≤79
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version ≤79: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
≤79
Windows 10.
Firefox No IE No Opera 43
43
macOS only.
43
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 43: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
57
Windows 10.
Safari No WebView Android No Chrome Android 56 Firefox Android No Opera Android 43 Safari iOS No Samsung Internet Android 6.0
writeValue
Chrome 56
56
macOS only.
56
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 56: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ). To change preferences in Chrome, visit chrome://flags.
70
Windows 10.
Edge ≤79
≤79
macOS only.
≤79
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version ≤79: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
≤79
Windows 10.
Firefox No IE No Opera 43
43
macOS only.
43
Disabled
Linux and versions of Windows earlier than 10.
Disabled From version 43: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled ).
57
Windows 10.
Safari No WebView Android No Chrome Android 56 Firefox Android No Opera Android 43 Safari iOS No Samsung Internet Android 6.0

图例

完整支持
完整支持
不支持
不支持
实验。期望将来行为有所改变。
实验。期望将来行为有所改变。
见实现注意事项。
用户必须明确启用此特征。
用户必须明确启用此特征。