BluetoothRemoteGATTService

可用性有限

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

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

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

BluetoothRemoteGATTService 介面是 Web Bluetooth API 的一部分,它表示 GATT 伺服器提供的服務,包括裝置、引用服務的列表以及該服務的特性的列表。

EventTarget BluetoothRemoteGATTService

例項屬性

BluetoothRemoteGATTService.device 只讀 實驗性

透過 BluetoothDevice 例項返回有關藍牙裝置的資訊。

BluetoothRemoteGATTService.isPrimary 只讀 實驗性

返回一個布林值,指示這是主服務還是輔助服務。

BluetoothRemoteGATTService.uuid 只讀 實驗性

返回一個表示該服務 UUID 的字串。

例項方法

BluetoothRemoteGATTService.getCharacteristic() 實驗性

返回一個 Promise,該 Promise 解析為一個給定通用唯一識別符號 (UUID) 的 BluetoothRemoteGATTCharacteristic 例項。

BluetoothRemoteGATTService.getCharacteristics() 實驗性

返回一個 Promise,該 Promise 解析為一個 Array,其中包含給定可選通用唯一識別符號 (UUID) 的 BluetoothRemoteGATTCharacteristic 例項。

規範

規範
Web 藍牙
# bluetoothgattservice-interface

瀏覽器相容性