BluetoothUUID: phương thức tĩnh getCharacteristic()

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

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

Phương thức tĩnh getCharacteristic() của giao diện BluetoothUUID trả về một UUID đại diện cho một characteristic đã đăng ký khi truyền vào tên hoặc bí danh UUID 16 bit hay 32 bit.

Cú pháp

js
BluetoothUUID.getCharacteristic(name)

Tham số

name

Một chuỗi chứa tên của characteristic.

Giá trị trả về

Một UUID 128 bit.

Ngoại lệ

TypeError

Được ném ra nếu name không xuất hiện trong registry.

Ví dụ

Trong ví dụ sau, UUID đại diện cho characteristic có tên apparent_wind_direction được trả về và in ra console.

js
let result = BluetoothUUID.getCharacteristic("apparent_wind_direction");
console.log(result); // "00002a73-0000-1000-8000-00805f9b34fb"

Thông số kỹ thuật

Specification
Web Bluetooth
# dom-bluetoothuuid-getcharacteristic

Tương thích trình duyệt