HIDDevice: phương thức receiveFeatureReport()
Khả dụng hạn chế
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Note: This feature is available in Web Workers, except for Shared Web Workers.
Phương thức receiveFeatureReport() của giao diện HIDDevice nhận báo cáo tính năng từ thiết bị HID. Báo cáo tính năng là cách để các thiết bị HID và ứng dụng trao đổi dữ liệu HID không được chuẩn hóa.
reportId cho mỗi định dạng báo cáo mà thiết bị này hỗ trợ có thể được lấy từ HIDDevice.collections.
Cú pháp
receiveFeatureReport(reportId)
Tham số
reportId-
Một ID báo cáo 8-bit. Nếu thiết bị HID không sử dụng ID báo cáo, truyền
0.
Giá trị trả về
Một Promise được giải quyết với một đối tượng DataView chứa báo cáo tính năng.
Ngoại lệ
NotAllowedErrorDOMException-
Được ném nếu việc nhận báo cáo thất bại vì bất kỳ lý do nào.
Ví dụ
Trong ví dụ sau, một báo cáo được nhận từ thiết bị sử dụng reportId bằng 1.
const dataView = await device.receiveFeatureReport(1);
Thông số kỹ thuật
| Thông số kỹ thuật |
|---|
| WebHID API> # dom-hiddevice-receivefeaturereport> |