BluetoothGattService

Tags: 2.5 Privileged

Description

The BluetoothGattService interface of the 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

[CheckAnyPermissions="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, GattPermissions permissions, GattCharacteristicProperties properties, ArrayBuffer value);
  [NewObject] Promise<void> addIncludedService(BluetoothGattService service);
};

Properties

Methods

  • BluetoothGattService.addCharacteristic() Adds a characteristic to this service.

  • BluetoothGattService.addIncludedService() Adds a referenced included service to this service.