BluetoothUUID: getCharacteristic() 靜態方法
BluetoothUUID 介面的 getCharacteristic() 靜態方法在傳入一個名稱或 16 位/32 位 UUID 別名時,會返回一個代表已註冊特徵值的 UUID。
語法
js
BluetoothUUID.getCharacteristic(name)
引數
name-
包含特徵值名稱的字串。
返回值
一個 128 位 UUID。
異常
TypeError-
如果
name未出現在登錄檔中,則會丟擲此錯誤。
示例
在下面的示例中,代表特徵值 `apparent_wind_direction` 的 UUID 被返回並列印到控制檯。
js
let result = BluetoothUUID.getCharacteristic("apparent_wind_direction");
console.log(result); // "00002a73-0000-1000-8000-00805f9b34fb"
規範
| 規範 |
|---|
| Web 藍牙 # dom-bluetoothuuid-getcharacteristic |
瀏覽器相容性
載入中…