这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
BluetoothRemoteGattCharacteristic
接口在
Web Bluetooth API
represents a GATT Characteristic, which is a basic data element that provides further information about a peripheral’s service.
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
数组
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()
ArrayBuffer
并返回
Promise
.
BluetoothRemoteGATTCharacteristic.startNotifications()
Promise
当
navigator.bluetooth
is added to the active notification context.
BluetoothRemoteGATTCharacteristic.stopNotifications()
Promise
当
navigator.bluetooth
is removed from the active notification context.
| 规范 | 状态 | 注释 |
|---|---|---|
|
Web Bluetooth
The definition of 'BluetoothRemoteGATTCharacteristic' in that specification. |
草案 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
BluetoothRemoteGATTCharacteristic
|
Chrome
56
|
Edge
≤79
|
Firefox No | IE No |
Opera
43
|
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
|
Edge
≤79
|
Firefox No | IE No |
Opera
43
|
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
|
Edge
≤79
|
Firefox No | IE No |
Opera
43
|
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
|
Edge
≤79
|
Firefox No | IE No |
Opera
43
|
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
|
Edge
≤79
|
Firefox No | IE No |
Opera
43
|
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
|
Edge
≤79
|
Firefox No | IE No |
Opera
43
|
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
|
Edge
≤79
|
Firefox No | IE No |
Opera
43
|
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
|
Edge
≤79
|
Firefox No | IE No |
Opera
43
|
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
|
Edge
≤79
|
Firefox No | IE No |
Opera
43
|
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
|
Edge
≤79
|
Firefox No | IE No |
Opera
43
|
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
|
Edge
≤79
|
Firefox No | IE No |
Opera
43
|
Safari No | WebView Android No | Chrome Android 56 | Firefox Android No | Opera Android 43 | Safari iOS No | Samsung Internet Android 6.0 |
完整支持
不支持
实验。期望将来行为有所改变。
见实现注意事项。
用户必须明确启用此特征。