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

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

Issue 514923002: Add more generic filters to the chrome.hid.getDevices API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Document the deprecated properties and the suggested filter replacement. Created 6 years, 3 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
« no previous file with comments | « extensions/browser/api/hid/hid_device_manager.cc ('k') | no next file » | 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 // 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
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 DeviceFilter {
47 long? vendorId;
48 // (checked only if the vendor ID matches)
49 long? productId;
50 long? usagePage;
51 // (checked only if the HID usage page matches)
not at google - send to devlin 2014/08/29 00:26:26 This is all going to be generated as https://devel
52 long? usage;
53 };
54
55 // Options passed to <code>getDevices</code>.
46 dictionary GetDevicesOptions { 56 dictionary GetDevicesOptions {
47 long vendorId; 57 // <b>Note:</b> Deprecated, equivalent to a filter with
48 long productId; 58 // <code>vendorId</code> set.
59 long? vendorId;
not at google - send to devlin 2014/08/29 00:26:26 There's a deprecated annotation: [deprecated=Use
60 // <b>Note:</b> Deprecated, equivalent to a filter with
61 // <code>productId</code> set.
62 long? productId;
63 // Devices matching any of the given filters will be returned. Providing an
64 // empty filter list will return all devices the app has permission for.
65 DeviceFilter[]? filters;
49 }; 66 };
50 67
51 callback GetDevicesCallback = void (HidDeviceInfo[] devices); 68 callback GetDevicesCallback = void (HidDeviceInfo[] devices);
52 callback ConnectCallback = void (HidConnectInfo connection); 69 callback ConnectCallback = void (HidConnectInfo connection);
53 callback DisconnectCallback = void (); 70 callback DisconnectCallback = void ();
54 71
55 // The callback to be invoked when a <code>receive</code> call is finished. 72 // The callback to be invoked when a <code>receive</code> call is finished.
56 // |reportId|: The ID of the report. 73 // |reportId|: The ID of the report.
57 // |data|: The content of the report. 74 // |data|: The content of the report.
58 callback ReceiveCallback = void (long reportId, ArrayBuffer data); 75 callback ReceiveCallback = void (long reportId, ArrayBuffer data);
59 76
60 // The callback to be invoked when a <code>receiveFeatureReport</code> call 77 // The callback to be invoked when a <code>receiveFeatureReport</code> call
61 // is finished. 78 // is finished.
62 // |data|: The content of the report. 79 // |data|: The content of the report.
63 callback ReceiveFeatureReportCallback = void (ArrayBuffer data); 80 callback ReceiveFeatureReportCallback = void (ArrayBuffer data);
64 81
65 // The callback to be invoked when a <code>send</code> or 82 // The callback to be invoked when a <code>send</code> or
66 // <code>sendFeatureReport</code> call is finished. 83 // <code>sendFeatureReport</code> call is finished.
67 callback SendCallback = void(); 84 callback SendCallback = void();
68 85
69 interface Functions { 86 interface Functions {
70 // Enumerate all the connected HID devices specified by the vendorId/ 87 // Enumerate all the connected HID devices matching the given properties.
71 // productId/interfaceId tuple.
72 // |options|: The properties to search for on target devices. 88 // |options|: The properties to search for on target devices.
73 // |callback|: Invoked with the <code>HidDeviceInfo</code> array on success. 89 // |callback|: Invoked with the <code>HidDeviceInfo</code> array on success.
74 static void getDevices(GetDevicesOptions options, 90 static void getDevices(GetDevicesOptions options,
75 GetDevicesCallback callback); 91 GetDevicesCallback callback);
76 92
77 // Open a connection to an HID device for communication. 93 // Open a connection to an HID device for communication.
78 // |deviceId|: The ID of the device to open. 94 // |deviceId|: The ID of the device to open.
79 // |callback|: Invoked with an <code>HidConnectInfo</code>. 95 // |callback|: Invoked with an <code>HidConnectInfo</code>.
80 static void connect(long deviceId, 96 static void connect(long deviceId,
81 ConnectCallback callback); 97 ConnectCallback callback);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // |connectionId|: The connection to read Input report from. 141 // |connectionId|: The connection to read Input report from.
126 // |reportId|: The report ID to use, or <code>0</code> if none. 142 // |reportId|: The report ID to use, or <code>0</code> if none.
127 // |data|: The report data. 143 // |data|: The report data.
128 // |callback|: The callback to invoke once the write is finished. 144 // |callback|: The callback to invoke once the write is finished.
129 static void sendFeatureReport(long connectionId, 145 static void sendFeatureReport(long connectionId,
130 long reportId, 146 long reportId,
131 ArrayBuffer data, 147 ArrayBuffer data,
132 SendCallback callback); 148 SendCallback callback);
133 }; 149 };
134 }; 150 };
OLDNEW
« no previous file with comments | « extensions/browser/api/hid/hid_device_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698