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