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.deviceRead only- Returns information about a Bluetooth device through an instance of
BluetoothDevice. BluetoothGATTService.isPrimaryRead only- Returns a
BooleanIndicating whether this is a primary or secondary service. BluetoothGATTService.uuidRead only- Returns a
DOMStringrepresenting the UUID of this service.
Methods
BluetoothGATTService.getCharacteristic()- Returns a
Promiseto an instance ofBluetoothGATTCharacteristicfor a given universally unique identifier (UUID). BluetoothGATTService.getCharacteristics()- Returns a
Promiseto anArrayofBluetoothGATTCharacteristicinstances for an optional universally unique identifier (UUID). BluetoothGATTService.getIncludedService()- Returns a
Promiseto an instance ofBluetoothGATTServicefor a given universally unique identifier (UUID). BluetoothGATTService.getIncludedServices()- Returns a
Promiseto anArrayofBluetoothGATTServiceinstances 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
Tags:
Contributors to this page:
jpmedley,
chrisdavidmills
Last updated by:
jpmedley,