| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Use the <code>chrome.hid</code> API to interact with connected HID devices. | 5 // Use the <code>chrome.hid</code> API to interact with connected HID devices. |
| 6 // This API provides access to HID operations from within the context of an app. | 6 // This API provides access to HID operations from within the context of an app. |
| 7 // Using this API, apps can function as drivers for hardware devices. | 7 // Using this API, apps can function as drivers for hardware devices. |
| 8 namespace hid { | 8 namespace hid { |
| 9 // HID top-level collection attributes. | 9 // HID top-level collection attributes. |
| 10 // Each enumerated device interface exposes an array of these objects. | 10 // Each enumerated device interface exposes an array of these objects. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 long maxOutputReportSize; | 35 long maxOutputReportSize; |
| 36 long maxFeatureReportSize; | 36 long maxFeatureReportSize; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 // Returned by <code>connect</code> to represent a communication session with | 39 // Returned by <code>connect</code> to represent a communication session with |
| 40 // an HID device. Must be closed with a call to <code>disconnect</code>. | 40 // an HID device. Must be closed with a call to <code>disconnect</code>. |
| 41 dictionary HidConnectInfo { | 41 dictionary HidConnectInfo { |
| 42 long connectionId; | 42 long connectionId; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 // Searching criteria to enumerate devices with. | 45 // Device matching criteria. |
| 46 dictionary HidDeviceFilter { |
| 47 long? vendorId; |
| 48 long? productId; |
| 49 long? usagePage; |
| 50 long? usage; |
| 51 }; |
| 52 |
| 53 // Options passed to <code>getDevices</code>. |
| 46 dictionary GetDevicesOptions { | 54 dictionary GetDevicesOptions { |
| 47 long vendorId; | 55 long? vendorId; |
| 48 long productId; | 56 long? productId; |
| 57 HidDeviceFilter[]? filters; |
| 49 }; | 58 }; |
| 50 | 59 |
| 51 callback GetDevicesCallback = void (HidDeviceInfo[] devices); | 60 callback GetDevicesCallback = void (HidDeviceInfo[] devices); |
| 52 callback ConnectCallback = void (HidConnectInfo connection); | 61 callback ConnectCallback = void (HidConnectInfo connection); |
| 53 callback DisconnectCallback = void (); | 62 callback DisconnectCallback = void (); |
| 54 | 63 |
| 55 // The callback to be invoked when a <code>receive</code> call is finished. | 64 // The callback to be invoked when a <code>receive</code> call is finished. |
| 56 // |reportId|: The ID of the report. | 65 // |reportId|: The ID of the report. |
| 57 // |data|: The content of the report. | 66 // |data|: The content of the report. |
| 58 callback ReceiveCallback = void (long reportId, ArrayBuffer data); | 67 callback ReceiveCallback = void (long reportId, ArrayBuffer data); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // |connectionId|: The connection to read Input report from. | 134 // |connectionId|: The connection to read Input report from. |
| 126 // |reportId|: The report ID to use, or <code>0</code> if none. | 135 // |reportId|: The report ID to use, or <code>0</code> if none. |
| 127 // |data|: The report data. | 136 // |data|: The report data. |
| 128 // |callback|: The callback to invoke once the write is finished. | 137 // |callback|: The callback to invoke once the write is finished. |
| 129 static void sendFeatureReport(long connectionId, | 138 static void sendFeatureReport(long connectionId, |
| 130 long reportId, | 139 long reportId, |
| 131 ArrayBuffer data, | 140 ArrayBuffer data, |
| 132 SendCallback callback); | 141 SendCallback callback); |
| 133 }; | 142 }; |
| 134 }; | 143 }; |
| OLD | NEW |