BluetoothUUID

The BluetoothUUID interface of the Web Bluetooth API provides a way to look up Universally Unique Identifier (UUID) values by name in the registry maintained by the Bluetooth SIG.

Description

A UUID string is a 128-bit UUID, for example 00001818-0000-1000-8000-00805f9b34fb. The Bluetooth registry contains lists of descriptors, services, and characteristics identified by these UUIDs in addition to a 16- or 32- bit alias, and a name.

The BluetoothUUID interface provides methods to retrieve these 128-bit UUIDs.

Properties

None.

Event handlers

None.

Methods

BluetoothUUID.canonicalUUID()

Returns the 128-bit UUID when passed the 16- or 32-bit UUID alias.

BluetoothUUID.getCharacteristic()

Returns the 128-bit UUID representing a registered characteristic when passed a name or the 16- or 32-bit UUID alias.

BluetoothUUID.getDescriptor()

Returns a UUID representing a registered descriptor when passed a name or the 16- or 32-bit UUID alias.

BluetoothUUID.getService()

Returns a UUID representing a registered service when passed a name or the 16- or 32-bit UUID alias.

Examples

In the following example the UUID representing the service named device_information is returned and printed to the console.

let result = BluetoothUUID.getService('device_information');
console.log(result); // "0000180a-0000-1000-8000-00805f9b34fb"

Specifications

No specification found

No specification data found for api.BluetoothUUID.
Check for problems with this page or contribute a missing spec_url to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
BluetoothUUID
56
Before Chrome 70, this feature was only supported in macOS. In Chrome 70, support was added for Windows 10. Linux support is not enabled by default.
56
In Linux and versions of Windows earlier than 10, this flag must be enabled.
79
Supported by default only on macOS and Windows 10. Linux support is not enabled by default.
79
In Linux and versions of Windows earlier than 10, this flag must be enabled.
No
No
43
Before Opera 57, this feature was only supported in macOS. In Opera 57, support was added for Windows 10. Linux support is not enabled by default.
43
In Linux and versions of Windows earlier than 10, this flag must be enabled.
No
No
56
No
43
No
6.0
canonicalUUID
56
79
No
No
43
No
No
56
No
43
No
6.0
getCharacteristic
56
79
No
No
43
No
No
56
No
43
No
6.0
getDescriptor
56
79
No
No
43
No
No
56
No
43
No
6.0
getService
56
79
No
No
43
No
No
56
No
43
No
6.0

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/BluetoothUUID