BluetoothRemoteGATTServer

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

BluetoothRemoteGATTServer interface of the Web Bluetooth API represents a GATT Server on a remote device.

This page describes the W3C Community Group Web Bluetooth API. For the Firefox OS Bluetooth API, see BluetoothGattServer (Firefox OS) .

Interface

interface BluetoothRemoteGATTServer {
  readonly attribute BluetoothDevice device;
  readonly attribute boolean connected;
  Promise<BluetoothRemoteGATTServer> connect();
  void disconnect();
  Promise<BluetoothRemoteGATTService> getPrimaryService(BluetoothServiceUUID service);
  Promise<sequence<BluetoothRemoteGATTService>> getPrimaryServices(optional BluetoothServiceUUID service);
};
					

特性

BluetoothRemoteGATTServer.connected 只读
A boolean value that returns true while this script execution environment is connected to this.device . It can be false while the user agent is physically connected.
BluetoothRemoteGATTServer.device 只读
A reference to the BluetoothDevice running the server.

方法

BluetoothRemoteGATTServer.connect()
Causes the script execution environment to connect to this.device .
BluetoothRemoteGATTServer.disconnect()
Causes the script execution environment to disconnect from this.device .
BluetoothRemoteGATTServer.getPrimaryService()
Returns a promise to the primary BluetoothGATTService offered by the bluetooth device for a specified BluetoothServiceUUID .
BluetoothRemoteGATTServer.getPrimaryServices()
Returns a promise to a list of primary BluetoothGATTService objects offered by the bluetooth device for a specified BluetoothServiceUUID .

规范

规范 状态 Comment
Web Bluetooth
The definition of 'BluetoothRemoteGATTServer' 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
BluetoothRemoteGATTServer
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
connect
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
connected
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 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
disconnect
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
getPrimaryService
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
getPrimaryServices
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

图例

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