Version: Smart Feature Phone 2.5Version: Smart Feature Phone 2.6

BluetoothGattService

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#

[Exposed=Window]
interface BluetoothGattService
{
[Throws]
constructor(optional BluetoothGattServiceInit initDict = {});
[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);
};
dictionary BluetoothGattServiceInit
{
boolean isPrimary = false;
DOMString uuid = "";
};

Properties#

  • BluetoothGattService.characteristics read-only Returns a cached array of BluetoothGattCharacteristic 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#