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.usbPrivate</code> API to interact with connected USB | 5 // Use the <code>chrome.usbPrivate</code> API to interact with connected USB |
6 // devices. This API provides private extensions to the <code>chrome.usb</code> | 6 // devices. This API provides private extensions to the <code>chrome.usb</code> |
7 // API which should only be available to trusted pages. | 7 // API which should only be available to trusted pages. |
8 namespace usbPrivate { | 8 namespace usbPrivate { |
9 | 9 |
10 // Properties for matching devices. A device matches of any of its interfaces | |
11 // match the given properties. An empty dictionary matches any device. | |
12 dictionary DeviceFilter { | |
13 // Device-level matching criteria: | |
14 long? vendorId; | |
15 // Checked only if the vendorId matches. | |
16 long? productId; | |
17 | |
18 // Per-interface matching criteria: | |
19 long? interfaceClass; | |
20 // Checked only if the interfaceClass matches. | |
21 long? interfaceSubclass; | |
22 // Checked only if the interfaceSubclass matches. | |
23 long? interfaceProtocol; | |
24 }; | |
25 | |
26 dictionary DeviceInfo { | 10 dictionary DeviceInfo { |
27 long vendorId; // idVendor from the device | 11 long vendorId; // idVendor from the device |
28 long productId; // idProduct from the device | 12 long productId; // idProduct from the device |
29 | 13 |
30 // Vendor and product names from an internal database. | 14 // Vendor and product names from an internal database. |
31 DOMString? vendorName; | 15 DOMString? vendorName; |
32 DOMString? productName; | 16 DOMString? productName; |
33 | 17 |
34 // iManufacturer, iProduct and iSerial strings from the device. | 18 // iManufacturer, iProduct and iSerial strings from the device. |
35 DOMString? manufacturerString; | 19 DOMString? manufacturerString; |
36 DOMString? productString; | 20 DOMString? productString; |
37 DOMString? serialString; | 21 DOMString? serialString; |
38 }; | 22 }; |
39 | 23 |
40 callback GetDevicesCallback = void (long[] deviceIds); | 24 callback GetDevicesCallback = void (long[] deviceIds); |
41 callback GetDeviceInfoCallback = void (DeviceInfo deviceInfo); | 25 callback GetDeviceInfoCallback = void (DeviceInfo deviceInfo); |
42 | 26 |
43 interface Functions { | 27 interface Functions { |
44 // Lists USB devices matching any of the given filters. | 28 // Lists USB devices matching any of the given filters. |
45 // |filters|: The properties to search for on target devices. | 29 // |filters|: The properties to search for on target devices. |
46 // |callback|: Invoked with a list of device IDs on complete. | 30 // |callback|: Invoked with a list of device IDs on complete. |
47 static void getDevices(DeviceFilter[] filters, | 31 static void getDevices(usb.DeviceFilter[] filters, |
48 GetDevicesCallback callback); | 32 GetDevicesCallback callback); |
49 | 33 |
50 // Gets basic display information about a device. | 34 // Gets basic display information about a device. |
51 // |deviceId|: The device ID (from |getDevices|). | 35 // |deviceId|: The device ID (from |getDevices|). |
52 // |callback|: Invoked with |DeviceInfo| from the device. | 36 // |callback|: Invoked with |DeviceInfo| from the device. |
53 static void getDeviceInfo(long deviceId, GetDeviceInfoCallback callback); | 37 static void getDeviceInfo(long deviceId, GetDeviceInfoCallback callback); |
54 }; | 38 }; |
55 }; | 39 }; |
OLD | NEW |