| 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.mojom; |
| 6 | 6 |
| 7 import "device.mojom"; | 7 import "device.mojom"; |
| 8 | 8 |
| 9 struct DeviceFilter { | 9 struct UsbDeviceFilter { |
| 10 bool has_vendor_id; | 10 bool has_vendor_id; |
| 11 uint16 vendor_id; | 11 uint16 vendor_id; |
| 12 | 12 |
| 13 bool has_product_id; | 13 bool has_product_id; |
| 14 uint16 product_id; | 14 uint16 product_id; |
| 15 | 15 |
| 16 bool has_class_code; | 16 bool has_class_code; |
| 17 uint8 class_code; | 17 uint8 class_code; |
| 18 | 18 |
| 19 bool has_subclass_code; | 19 bool has_subclass_code; |
| 20 uint8 subclass_code; | 20 uint8 subclass_code; |
| 21 | 21 |
| 22 bool has_protocol_code; | 22 bool has_protocol_code; |
| 23 uint8 protocol_code; | 23 uint8 protocol_code; |
| 24 | 24 |
| 25 string? serial_number; | 25 string? serial_number; |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 struct EnumerationOptions { | 28 struct UsbEnumerationOptions { |
| 29 array<DeviceFilter>? filters; | 29 array<UsbDeviceFilter>? filters; |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 interface DeviceManager { | 32 interface UsbDeviceManager { |
| 33 // Retrieves information about all devices available to the DeviceManager | 33 // Retrieves information about all devices available to the DeviceManager |
| 34 // implementation. | 34 // implementation. |
| 35 GetDevices(EnumerationOptions? options) => (array<DeviceInfo> results); | 35 GetDevices(UsbEnumerationOptions? options) => (array<UsbDeviceInfo> results); |
| 36 | 36 |
| 37 // Requests a device by guid. | 37 // Requests a device by guid. |
| 38 GetDevice(string guid, Device& device_request); | 38 GetDevice(string guid, UsbDevice& device_request); |
| 39 | 39 |
| 40 // Sets the client for this DeviceManager service. The service will notify its | 40 // Sets the client for this DeviceManager service. The service will notify its |
| 41 // client of device events such as connection and disconnection. | 41 // client of device events such as connection and disconnection. |
| 42 SetClient(DeviceManagerClient client); | 42 SetClient(UsbDeviceManagerClient client); |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 interface DeviceManagerClient { | 45 interface UsbDeviceManagerClient { |
| 46 // Called when a device is connected to the host. | 46 // Called when a device is connected to the host. |
| 47 OnDeviceAdded(DeviceInfo device_info); | 47 OnDeviceAdded(UsbDeviceInfo device_info); |
| 48 | 48 |
| 49 // Called when a device is disconnected from the host. | 49 // Called when a device is disconnected from the host. |
| 50 OnDeviceRemoved(DeviceInfo device_info); | 50 OnDeviceRemoved(UsbDeviceInfo device_info); |
| 51 }; | 51 }; |
| OLD | NEW |