BluetoothRemoteGATTServer.getPrimaryService()

Experimental

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The BluetoothRemoteGATTServer.getPrimaryService() method returns a promise to the primary BluetoothRemoteGATTService offered by the bluetooth device for a specified BluetoothServiceUUID.

Syntax

BluetoothRemoteGATTServer.getPrimaryService(bluetoothServiceUUID).then(function(bluetoothGATTService) { ... })

Returns

A Promise that resolves to a BluetoothRemoteGATTService object.

Parameters

BluetoothServiceUUID
A Bluetooth service universally unique identifier for a specified device.

Specifications

Specification Status Comment
Web Bluetooth
The definition of 'getPrimaryService()' in that specification.
Draft Initial definition.

Browser compatibility

BCD tables only load in the browser