BluetoothGATTService

Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

The BluetoothGattService 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.

This page describes the W3C Community Group BluetoothGATTService. For the Firefox OS interface of the same name, see BluetoothGattService.

Interface

interface BluetoothGATTService : 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);
};

Properties

BluetoothGATTService.device Read only
Returns information about a Bluetooth device through an instance of BluetoothDevice.
BluetoothGATTService.isPrimary Read only
Returns a Boolean Indicating whether this is a primary or secondary service. 
BluetoothGATTService.uuid Read only
Returns a DOMString representing the UUID of this service.

Methods

BluetoothGATTService.getCharacteristic()
Returns a Promise to an instance of BluetoothGATTCharacteristic for a given universally unique identifier (UUID).
BluetoothGATTService.getCharacteristics()
Returns a Promise to an Array of BluetoothGATTCharacteristic instances for an optional universally unique identifier (UUID).
BluetoothGATTService.getIncludedService()
Returns a Promise to an instance of BluetoothGATTService for a given universally unique identifier (UUID).
BluetoothGATTService.getIncludedServices()
Returns a Promise to an Array of BluetoothGATTService instances for an optional universally unique identifier (UUID).

Specifications

Specification Status Comment
Web Bluetooth Draft Initial definition.

Browser Compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 45.0 [1] ? ? ? ?
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support Not supported Not supported ? ? ? ? ? Not supported

[1] Behind a flag.  Chrome OS only.

Document Tags and Contributors

 Contributors to this page: jpmedley, chrisdavidmills
 Last updated by: jpmedley,