BluetoothRemoteGATTServer

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Экспериментальная возможность: Это экспериментальная технология
Так как спецификация этой технологии ещё не стабилизировалась, смотрите таблицу совместимости по поводу использования в различных браузерах. Также заметьте, что синтаксис и поведение экспериментальной технологии может измениться в будущих версиях браузеров, вслед за изменениями спецификации.

Интерфейс BluetoothRemoteGATTServer, относящийся к Web Bluetooth API, представляет сервер GATT на удалённом устройстве.

Примечание: Данная страница описывает Web Bluetooth API от W3C Community Group. BluetoothGattServer (Firefox OS) - Bluetooth API в Firefox OS.

Интерфейс

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Только для чтения

Двоичное значение, равное true, если устройство this.device подключено. It can be false while the user agent is physically connected.

BluetoothRemoteGATTServer.deviceТолько для чтения

BluetoothDevice, на котором работает сервер.

Методы

BluetoothRemoteGATTServer.connect()

Подключение к устройству this.device.

BluetoothRemoteGATTServer.disconnect()

Отключение от устройства 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.

Спецификации

Specification
Web Bluetooth
# bluetoothgattremoteserver-interface

Совместимость с браузерами

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
BluetoothRemoteGATTServer
Experimental
connect
Experimental
connected
Experimental
device
Experimental
disconnect
Experimental
getPrimaryService
Experimental
getPrimaryServices
Experimental

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support
Experimental. Expect behavior to change in the future.
See implementation notes.
Has more compatibility info.