OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 module device.usb; | 5 module device.usb; |
6 | 6 |
7 import "device.mojom"; | 7 import "device.mojom"; |
8 | 8 |
9 enum OpenDeviceError { | |
10 // Opening the device succeeded. | |
11 OK, | |
12 | |
13 // The device could not be opened because the request GUID is unknown. | |
14 NOT_FOUND, | |
15 | |
16 // The operating system denied access to the device. | |
17 ACCESS_DENIED, | |
18 }; | |
19 | |
20 struct DeviceFilter { | 9 struct DeviceFilter { |
21 bool has_vendor_id; | 10 bool has_vendor_id; |
22 uint16 vendor_id; | 11 uint16 vendor_id; |
23 | 12 |
24 bool has_product_id; | 13 bool has_product_id; |
25 uint16 product_id; | 14 uint16 product_id; |
26 | 15 |
27 bool has_class_code; | 16 bool has_class_code; |
28 uint8 class_code; | 17 uint8 class_code; |
29 | 18 |
(...skipping 16 matching lines...) Expand all Loading... |
46 interface DeviceManager { | 35 interface DeviceManager { |
47 // Retrieves information about all devices available to the DeviceManager | 36 // Retrieves information about all devices available to the DeviceManager |
48 // implementation. | 37 // implementation. |
49 GetDevices(EnumerationOptions? options) => (array<DeviceInfo> results); | 38 GetDevices(EnumerationOptions? options) => (array<DeviceInfo> results); |
50 | 39 |
51 // Retrieves information about changes to the set of devices available to the | 40 // Retrieves information about changes to the set of devices available to the |
52 // DeviceManager since the last call to this method. A device that is added | 41 // DeviceManager since the last call to this method. A device that is added |
53 // and removed between calls will not be included. | 42 // and removed between calls will not be included. |
54 GetDeviceChanges() => (DeviceChangeNotification changes); | 43 GetDeviceChanges() => (DeviceChangeNotification changes); |
55 | 44 |
56 // Attempts to open a device given its GUID. | 45 // Requests a device by guid. |
57 OpenDevice(string guid, Device& device_request) => (OpenDeviceError error); | 46 GetDevice(string guid, Device& device_request); |
58 }; | 47 }; |
OLD | NEW |