BluetoothRemoteGATTService: getCharacteristics() 方法

可用性有限

此特性不是基線特性,因為它在一些最廣泛使用的瀏覽器中不起作用。

實驗性: 這是一項實驗性技術
在生產中使用此技術之前,請仔細檢查瀏覽器相容性表格

安全上下文: 此功能僅在安全上下文(HTTPS)中可用,且支援此功能的瀏覽器數量有限。

BluetoothGATTService.getCharacteristics() 方法返回一個 Promise,該 Promise 解析為一個 BluetoothRemoteGATTCharacteristic 例項列表,這些例項對應於給定通用唯一識別符號 (UUID)。

語法

js
getCharacteristics(characteristics)

引數

characteristics

特性的 UUID,例如,心率測量特性的 UUID 為 '00002a37-0000-1000-8000-00805f9b34fb'

返回值

一個 Promise,解析為一個 BluetoothRemoteGATTCharacteristic 例項的 Array

規範

規範
Web 藍牙
# dom-bluetoothremotegattservice-getcharacteristics

瀏覽器相容性