This API is available on Firefox OS for internal applications only.
The BluetoothGattService interface of the Web Bluetooth API represents a service provided by a GATT server, including the service definition, a list of referenced services, and a list of the characteristics of this service.
Interface overview
[CheckPermissions="bluetooth",
Constructor(boolean isPrimary, DOMString uuid)]
interface BluetoothGattService
{
[Cached, Pure] readonly attribute sequence<BluetoothGattCharacteristic> characteristics;
[Cached, Pure] readonly attribute sequence<BluetoothGattService> includedServices;
readonly attribute boolean isPrimary;
readonly attribute DOMString uuid;
readonly attribute unsigned short instanceId;
[NewObject] Promise<BluetoothGattCharacteristic> addCharacteristic(DOMString uuid, Permission permissions, Properties properties, ArrayBuffer value);
[NewObject] Promise<void> addIncludedService(BluetoothGattService service);
};
Properties
BluetoothGattService.characteristicsRead only- Returns a cached array of
BluetoothServiceCharacteristicobjects representing the characteristics of this service. BluetoothGattService.includedServicesRead only- Returns a cached array of
BluetoothGattServiceobjects representing the included services referenced by this service. BluetoothGattService.isPrimaryRead only- Returns a
BooleanIndicating whether this is a primary or secondary service. The default value isfalse, indicating a secondary service. BluetoothGattService.uuidRead only- Returns a
DOMStringrepresenting the UUID of this service. BluetoothGattService.instanceIdRead only- Returns a number representing the instance id of this service.
Methods
BluetoothGattService.addCharacteristic()- Adds a characteristic to this service.
BluetoothGattService.addIncludedService()- Adds a referenced included service to this service.
Specifications
| Specification | Status | Comment |
|---|---|---|
| Web Bluetooth The definition of 'BluetoothGattService' in that specification. |
Draft | Rough draft; not part of any official specification yet. It should be discussed as part of the W3C's System Applications Working Group. |
Browser Compatibility
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
|---|---|---|---|---|---|
| Basic support | No support | No support | No support | No support | No support |
| Feature | Android | Android Webview | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
|---|---|---|---|---|---|---|---|---|
| Basic support | No support | No support | No support | 2.1 | No support | No support | No support | No support |
See also
Document Tags and Contributors
Tags:
Contributors to this page:
chrisdavidmills
Last updated by:
chrisdavidmills,