BluetoothRemoteGATTService

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

This page describes the W3C Community Group BluetoothRemoteGATTService, formerly called BluethoothGATTService. For the Firefox OS interface of the same name, see BluetoothGattService .

BluetoothRemoteGATTService interface of the 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

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 只读
Returns information about a Bluetooth device through an instance of BluetoothDevice .
BluetoothRemoteGATTService.isPrimary 只读
返回 Boolean 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 Array 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 Array of BluetoothRemoteGATTService instances for an optional universally unique identifier (UUID).

规范

规范 状态 Comment
Web Bluetooth
The definition of 'BluetoothRemoteGATTService' 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
BluetoothRemoteGATTService
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
device
Chrome No Edge No 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 No Firefox Android No Opera Android 43 Safari iOS No Samsung Internet Android No
getCharacteristic
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
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
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
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
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

图例

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