BluetoothGattService (Firefox OS)

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

JavaScript
[CheckPermissions="bluetooth",
 Constructor(boolean isPrimary, DOMString uuid)]
interface BluetoothGattService
{
  [Cached, Pure] readonly attribute sequence<<a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothGattCharacteristic#BluetoothGattCharacteristic" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattCharacteristic">BluetoothGattCharacteristic</a>> <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#characteristics" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService">characteristics</a>;
  [Cached, Pure] readonly attribute sequence<<a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#BluetoothGattService" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService">BluetoothGattService</a>> <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#includedServices" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService">includedServices</a>;

  readonly attribute boolean <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#isPrimary" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService">isPrimary</a>;
  readonly attribute DOMString <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#uuid" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService">uuid</a>;
  readonly attribute unsigned short <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#instanceId" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService">instanceId</a>;

  [NewObject] Promise<<a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothGattCharacteristic#BluetoothGattCharacteristic" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattCharacteristic">BluetoothGattCharacteristic</a>> <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#addCharacteristic.28DOMString_uuid.2C_Permissions_permissions.2C_Properties_properties.2C_ArrayBuffer_value.29" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService">addCharacteristic(DOMString uuid, Permission permissions, Properties properties, ArrayBuffer value)</a>;
  [NewObject] Promise<void> <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#addIncludedService.28BluetoothGattService_service.29" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService">addIncludedService(BluetoothGattService service)</a>;
};

Properties

BluetoothGattService.characteristics Read only
Returns a cached array of BluetoothServiceCharacteristic objects representing the characteristics of this service.
BluetoothGattService.includedServices Read only
Returns a cached array of BluetoothGattService objects representing the included services referenced by this service.
BluetoothGattService.isPrimary Read only
Returns a Boolean Indicating whether this is a primary or secondary service. The default value is false, indicating a secondary service.
BluetoothGattService.uuid Read only
Returns a DOMString representing the UUID of this service.
BluetoothGattService.instanceId Read 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

Using the Web Bluetooth API

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/bluetoothgattservice_(firefox_os)

API B2G Bluetooth BluetoothGattService Certified Firefox OS Interface Non-standard Reference Web Bluetooth