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 BluetoothRemoteGATTService 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 BluetoothRemoteGATTService, formerly called BluethoothGATTService. For the Firefox OS interface of the same name, see BluetoothGattService.
Interface
interface BluetoothRemoteGATTService : 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
BluetoothRemoteGATTService.deviceRead only- Returns information about a Bluetooth device through an instance of
BluetoothDevice. BluetoothRemoteGATTService.isPrimaryRead only- Returns a
BooleanIndicating whether this is a primary or secondary service. BluetoothRemoteGATTService.uuidRead only- Returns a
DOMStringrepresenting the UUID of this service.
Methods
BluetoothRemoteGATTService.getCharacteristic()- Returns a
Promiseto an instance ofBluetoothGATTCharacteristicfor a given universally unique identifier (UUID). BluetoothRemoteGATTService.getCharacteristics()- Returns a
Promiseto anArrayofBluetoothGATTCharacteristicinstances for an optional universally unique identifier (UUID). BluetoothRemoteGATTService.getIncludedService()- Returns a
Promiseto an instance ofBluetoothRemoteGATTServicefor a given universally unique identifier (UUID). BluetoothRemoteGATTService.getIncludedServices()- Returns a
Promiseto anArrayofBluetoothRemoteGATTServiceinstances 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 Chrome OS [1] [2] 51.0 Linux 53.0 Mac 53.0 Origin Trial |
? | ? | ? | ? |
| Feature | Android | Android Webview | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
|---|---|---|---|---|---|---|---|---|
| Basic support | No support | 48.0 [1] 53.0 Origin Trial |
? | ? | ? | ? | ? | 48.0 [1] 53.0 Origin Trial |
[1] Behind a flag.
[2] Before Chrome 50, this interface was called BluetoothGATTService