BluetoothUUID:canonicalUUID() 静态方法
BluetoothUUID 接口的 canonicalUUID() 静态方法在传入 16 位或 32 位 UUID 别名时,会返回 128 位 UUID。
语法
js
BluetoothUUID.canonicalUUID(alias)
参数
别名-
包含 16 位或 32 位 UUID 别名的字符串。
返回值
一个 128 位 UUID。
示例
在下面的示例中,由别名 0x110A 表示的 UUID 被返回并打印到控制台。
js
let result = BluetoothUUID.canonicalUUID("0x110A");
console.log(result); // "0000110a-0000-1000-8000-00805f9b34fb"
规范
| 规范 |
|---|
| Web 蓝牙 # dom-bluetoothuuid-canonicaluuid |
浏览器兼容性
加载中…