| 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 usage pair. Each enumerated device interface exposes an array of |
| 10 // Each enumerated device interface exposes an array of these objects. | 10 // these objects. Values correspond to those defined by the |
| 11 // |usagePage|: HID usage page identifier. | 11 // <a href="http://www.usb.org/developers/devclass_docs/HID1_11.pdf> |
| 12 // HID device class specification</a>. |
| 13 // |usage_page|: HID usage page identifier. |
| 12 // |usage|: Page-defined usage identifier. | 14 // |usage|: Page-defined usage identifier. |
| 13 // |reportIds|: Report IDs which belong to the collection and to its children. | 15 dictionary HidUsageAndPage { |
| 14 dictionary HidCollectionInfo { | 16 long usage_page; |
| 15 long usagePage; | |
| 16 long usage; | 17 long usage; |
| 17 long[] reportIds; | |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 // Returned by <code>getDevices</code> functions to describes a connected HID | 20 // Returned by <code>getDevices</code> functions to describes a connected HID |
| 21 // device. Use <code>connect</code> to connect to any of the returned devices. | 21 // device. Use <code>connect</code> to connect to any of the returned devices. |
| 22 // |deviceId|: Device opaque ID. | 22 // |deviceId|: Device opaque ID. |
| 23 // |vendorId|: Vendor ID. | 23 // |vendorId|: Vendor ID. |
| 24 // |productId|: Product ID. | 24 // |productId|: Product ID. |
| 25 // |collections|: Top-level collections from this device's report descriptor. | 25 // |usages|: HID usage pairs exposed by underlying Top-level collections. |
| 26 // |maxInputReportSize|: Top-level collection's max input report size. | |
| 27 // |maxOutputReportSize|: Top-level collection's max output report size. | |
| 28 // |maxFeatureReportSize|: Top-level collection's max feature report size. | |
| 29 dictionary HidDeviceInfo { | 26 dictionary HidDeviceInfo { |
| 30 long deviceId; | 27 long deviceId; |
| 31 long vendorId; | 28 long vendorId; |
| 32 long productId; | 29 long productId; |
| 33 HidCollectionInfo[] collections; | 30 HidUsageAndPage[] usages; |
| 34 long maxInputReportSize; | |
| 35 long maxOutputReportSize; | |
| 36 long maxFeatureReportSize; | |
| 37 }; | 31 }; |
| 38 | 32 |
| 39 // Returned by <code>connect</code> to represent a communication session with | 33 // 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>. | 34 // an HID device. Must be closed with a call to <code>disconnect</code>. |
| 41 dictionary HidConnectInfo { | 35 dictionary HidConnectInfo { |
| 42 long connectionId; | 36 long connectionId; |
| 43 }; | 37 }; |
| 44 | 38 |
| 45 // Searching criteria to enumerate devices with. | 39 // Searching criteria to enumerate devices with. |
| 46 dictionary GetDevicesOptions { | 40 dictionary GetDevicesOptions { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // |connectionId|: The connection to read Input report from. | 115 // |connectionId|: The connection to read Input report from. |
| 122 // |reportId|: The report ID to use, or <code>0</code> if none. | 116 // |reportId|: The report ID to use, or <code>0</code> if none. |
| 123 // |data|: The report data. | 117 // |data|: The report data. |
| 124 // |callback|: The callback to invoke once the write is finished. | 118 // |callback|: The callback to invoke once the write is finished. |
| 125 static void sendFeatureReport(long connectionId, | 119 static void sendFeatureReport(long connectionId, |
| 126 long reportId, | 120 long reportId, |
| 127 ArrayBuffer data, | 121 ArrayBuffer data, |
| 128 SendCallback callback); | 122 SendCallback callback); |
| 129 }; | 123 }; |
| 130 }; | 124 }; |
| OLD | NEW |