Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: chrome/common/extensions/api/hid.idl

Issue 161823002: Clean up HID backend and API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_browser_extensions.gypi ('k') | device/hid/hid_connection.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
62 // 62 //
63 // Input reports are returned to the host through the INTERRUPT IN endpoint. 63 // Input reports are returned to the host through the INTERRUPT IN endpoint.
64 // |connectionId|: The connection from which to receive a report. 64 // |connectionId|: The connection from which to receive a report.
65 // |size|: The size of the Input report to receive. 65 // |size|: The size of the Input report to receive.
66 // |callback|: The callback to invoke with received report. 66 // |callback|: The callback to invoke with received report.
67 static void receive(long connectionId, 67 static void receive(long connectionId,
68 long size, 68 long size,
69 ReceiveCallback callback); 69 ReceiveCallback callback);
70 70
71 // Send an Output report to an HID device. 71 // Send an Output report to an HID device.
72 // <code>send</code> will send the data on the first OUT endpoint, if one 72 // <code>send</code> will send the data on the first OUT endpoint, if one
73 // exists. If one does not exist, the report will be sent through the 73 // exists. If one does not exist, the report will be sent through the
74 // Control endpoint. 74 // Control endpoint.
75 // 75 //
76 // |connectionId|: The connection to which to send a report. 76 // |connectionId|: The connection to which to send a report.
77 // |reportId|: The report ID to use, or <code>0</code> if none.
77 // |data|: The report data. 78 // |data|: The report data.
78 // |callback|: The callback to invoke once the write is finished. 79 // |callback|: The callback to invoke once the write is finished.
79 static void send(long connectionId, 80 static void send(long connectionId,
81 long reportId,
80 ArrayBuffer data, 82 ArrayBuffer data,
81 SendCallback callback); 83 SendCallback callback);
82 84
83 // Receive a Feature report from the device. 85 // Receive a Feature report from the device.
84 // 86 //
85 // |connectionId|: The connection to read Input report from. 87 // |connectionId|: The connection to read Input report from.
88 // |reportId|: The report ID, or zero if none.
86 // |size|: The size of the Feature report to receive. 89 // |size|: The size of the Feature report to receive.
87 // |callback|: The callback to invoke once the write is finished. 90 // |callback|: The callback to invoke once the write is finished.
88 static void receiveFeatureReport(long connectionId, 91 static void receiveFeatureReport(long connectionId,
92 long reportId,
89 long size, 93 long size,
90 ReceiveCallback callback); 94 ReceiveCallback callback);
91 95
92 // Send a Feature report to the device. 96 // Send a Feature report to the device.
93 // 97 //
94 // Feature reports are sent over the Control endpoint as a Set_Report 98 // Feature reports are sent over the Control endpoint as a Set_Report
95 // transfer. 99 // transfer.
96 // |connectionId|: The connection to read Input report from. 100 // |connectionId|: The connection to read Input report from.
101 // |reportId|: The report ID to use, or <code>0</code> if none.
97 // |data|: The report data. 102 // |data|: The report data.
98 // |callback|: The callback to invoke once the write is finished. 103 // |callback|: The callback to invoke once the write is finished.
99 static void sendFeatureReport(long connectionId, 104 static void sendFeatureReport(long connectionId,
105 long reportId,
100 ArrayBuffer data, 106 ArrayBuffer data,
101 SendCallback callback); 107 SendCallback callback);
102 }; 108 };
103 }; 109 };
OLDNEW
« no previous file with comments | « chrome/chrome_browser_extensions.gypi ('k') | device/hid/hid_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698