BluetoothRemoteGATTServer: phương thức getPrimaryService()
Khả dụng hạn chế
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.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Phương thức BluetoothRemoteGATTServer.getPrimaryService() trả về một promise cho BluetoothRemoteGATTService chính do thiết bị Bluetooth cung cấp cho một UUID dịch vụ Bluetooth được chỉ định.
Cú pháp
getPrimaryService(bluetoothServiceUUID)
Tham số
bluetoothServiceUUID-
Mã định danh duy nhất toàn cục của một dịch vụ Bluetooth cho thiết bị được chỉ định; có thể là UUID 128 bit, bí danh UUID 16 bit hoặc 32 bit, hoặc một chuỗi trong danh sách khóa của các dịch vụ GATT được gán.
Giá trị trả về
Một Promise được phân giải thành một đối tượng BluetoothRemoteGATTService.
Thông số kỹ thuật
| Thông số kỹ thuật |
|---|
| Web Bluetooth> # dom-bluetoothremotegattserver-getprimaryservice> |