BluetoothRemoteGATTServer

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

Интерфейс BluetoothRemoteGATTServer, относящийся к Web Bluetooth API (en-US), представляет сервер 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 (en-US)Только для чтения

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

BluetoothRemoteGATTServer.device (en-US)Только для чтения

BluetoothDevice (en-US), на котором работает сервер.

Методы

BluetoothRemoteGATTServer.connect() (en-US)

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

BluetoothRemoteGATTServer.disconnect() (en-US)

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

BluetoothRemoteGATTServer.getPrimaryService() (en-US)

Returns a promise to the primary BluetoothGATTService (en-US) offered by the bluetooth device for a specified BluetoothServiceUUID.

BluetoothRemoteGATTServer.getPrimaryServices() (en-US)

Returns a promise to a list of primary BluetoothGATTService (en-US) objects offered by the bluetooth device for a specified BluetoothServiceUUID.

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

Specification
Web Bluetooth
# bluetoothgattremoteserver-interface

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

BCD tables only load in the browser