这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
This page describes the W3C Community Group BluetoothRemoteGATTService, formerly called BluethoothGATTService. For the Firefox OS interface of the same name, see
BluetoothGattService
.
BluetoothRemoteGATTService
接口在
Web Bluetooth API
represents a service provided by a GATT server, including a device, a list of referenced services, and a list of the characteristics of this service.
interface BluetoothRemoteGATTService : ServiceEventHandlers {
readonly attribute UUID uuid;
readonly attribute boolean isPrimary;
readonly attribute BluetoothDevice device;
Promise<BluetoothGATTCharacteristic> getCharacteristic(BluetoothCharacteristicUUID characteristic);
Promise<sequence<BluetoothGATTCharacteristic>> getCharacteristics(optional BluetoothCharacteristicUUID characteristic);
Promise<BluetoothGATTService> getIncludedService(BluetoothServiceUUID service);
Promise<sequence<BluetoothGATTService>> getIncludedServices(optional BluetoothServiceUUID service);
};
BluetoothRemoteGATTService.device
只读
BluetoothDevice
.
BluetoothRemoteGATTService.isPrimary
只读
布尔
Indicating whether this is a primary or secondary service.
BluetoothRemoteGATTService.uuid
只读
DOMString
representing the UUID of this service.
BluetoothRemoteGATTService.getCharacteristic()
Promise
to an instance of
BluetoothGATTCharacteristic
for a given universally unique identifier (UUID).
BluetoothRemoteGATTService.getCharacteristics()
Promise
to an
数组
of
BluetoothGATTCharacteristic
instances for an optional universally unique identifier (UUID).
BluetoothRemoteGATTService.getIncludedService()
Promise
to an instance of
BluetoothRemoteGATTService
for a given universally unique identifier (UUID).
BluetoothRemoteGATTService.getIncludedServices()
Promise
to an
数组
of
BluetoothRemoteGATTService
instances for an optional universally unique identifier (UUID).
| 规范 | 状态 | 注释 |
|---|---|---|
|
Web Bluetooth
The definition of 'BluetoothRemoteGATTService' in that specification. |
草案 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
BluetoothRemoteGATTService
|
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 |
device
|
Chrome No | Edge No | Firefox No | IE No |
Opera
43
|
Safari No | WebView Android No | Chrome Android No | Firefox Android No | Opera Android 43 | Safari iOS No | Samsung Internet Android No |
getCharacteristic
|
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 |
getCharacteristics
|
Chrome No | Edge No | Firefox No | IE No | Opera Yes | Safari No | WebView Android No | Chrome Android No | Firefox Android No | Opera Android Yes | Safari iOS No | Samsung Internet Android No |
getIncludedService
|
Chrome No | Edge No | Firefox No | IE No | Opera ? | Safari No | WebView Android No | Chrome Android No | Firefox Android No | Opera Android ? | Safari iOS No | Samsung Internet Android No |
getIncludedServices
|
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 |
isPrimary
|
Chrome No | Edge No | Firefox No | IE No | Opera Yes | Safari No | WebView Android No | Chrome Android No | Firefox Android No | Opera Android Yes | Safari iOS No | Samsung Internet Android No |
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 |
完整支持
不支持
兼容性未知
实验。期望将来行为有所改变。
见实现注意事项。
用户必须明确启用此特征。