| 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 | 9 |
| 10 // Returned by <code>getDevices</code> functions to describes a connected HID | 10 // Returned by <code>getDevices</code> functions to describes a connected HID |
| 11 // device. Use <code>connect</code> to connect to any of the returned devices. | 11 // device. Use <code>connect</code> to connect to any of the returned devices. |
| 12 dictionary HidDeviceInfo { | 12 dictionary HidDeviceInfo { |
| 13 DOMString path; | 13 long deviceId; |
| 14 long vendorId; | 14 long vendorId; |
| 15 long productId; | 15 long productId; |
| 16 }; | 16 }; |
| 17 | 17 |
| 18 // Returned by <code>connect</code> to represent a communication session with | 18 // Returned by <code>connect</code> to represent a communication session with |
| 19 // an HID device. Must be closed with a call to <code>disconnect</code>. | 19 // an HID device. Must be closed with a call to <code>disconnect</code>. |
| 20 dictionary HidConnectInfo { | 20 dictionary HidConnectInfo { |
| 21 long connectionId; | 21 long connectionId; |
| 22 }; | 22 }; |
| 23 | 23 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 interface Functions { | 40 interface Functions { |
| 41 // Enumerate all the connected HID devices specified by the vendorId/ | 41 // Enumerate all the connected HID devices specified by the vendorId/ |
| 42 // productId/interfaceId tuple. | 42 // productId/interfaceId tuple. |
| 43 // |options|: The properties to search for on target devices. | 43 // |options|: The properties to search for on target devices. |
| 44 // |callback|: Invoked with the <code>HidDeviceInfo</code> array on success. | 44 // |callback|: Invoked with the <code>HidDeviceInfo</code> array on success. |
| 45 static void getDevices(GetDevicesOptions options, | 45 static void getDevices(GetDevicesOptions options, |
| 46 GetDevicesCallback callback); | 46 GetDevicesCallback callback); |
| 47 | 47 |
| 48 // Open a connection to an HID device for communication. | 48 // Open a connection to an HID device for communication. |
| 49 // |deviceInfo|: The device to open. | 49 // |deviceId|: The ID of the device to open. |
| 50 // |callback|: Invoked with an <code>HidConnectInfo</code>. | 50 // |callback|: Invoked with an <code>HidConnectInfo</code>. |
| 51 static void connect(HidDeviceInfo deviceInfo, | 51 static void connect(long deviceId, |
| 52 ConnectCallback callback); | 52 ConnectCallback callback); |
| 53 | 53 |
| 54 // Disconnect from a device. Invoking operations on a device after calling | 54 // Disconnect from a device. Invoking operations on a device after calling |
| 55 // this is safe but has no effect. | 55 // this is safe but has no effect. |
| 56 // |connectionId|: The connection to close. | 56 // |connectionId|: The connection to close. |
| 57 // |callback|: The callback to invoke once the device is closed. | 57 // |callback|: The callback to invoke once the device is closed. |
| 58 static void disconnect(long connectionId, | 58 static void disconnect(long connectionId, |
| 59 optional DisconnectCallback callback); | 59 optional DisconnectCallback callback); |
| 60 | 60 |
| 61 // Receive an Input report from an HID device. | 61 // Receive an Input report from an HID device. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // Feature reports are sent over the Control endpoint as a Set_Report | 94 // Feature reports are sent over the Control endpoint as a Set_Report |
| 95 // transfer. | 95 // transfer. |
| 96 // |connectionId|: The connection to read Input report from. | 96 // |connectionId|: The connection to read Input report from. |
| 97 // |data|: The report data. | 97 // |data|: The report data. |
| 98 // |callback|: The callback to invoke once the write is finished. | 98 // |callback|: The callback to invoke once the write is finished. |
| 99 static void sendFeatureReport(long connectionId, | 99 static void sendFeatureReport(long connectionId, |
| 100 ArrayBuffer data, | 100 ArrayBuffer data, |
| 101 SendCallback callback); | 101 SendCallback callback); |
| 102 }; | 102 }; |
| 103 }; | 103 }; |
| OLD | NEW |