blob: 95ecff70049718dfaf4ab77c390115723d237480 [file] [log] [blame]
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module device.mojom;
import "device/usb/public/mojom/device.mojom";
import "mojo/public/mojom/base/string16.mojom";
struct UsbDeviceFilter {
bool has_vendor_id;
uint16 vendor_id;
bool has_product_id;
uint16 product_id;
bool has_class_code;
uint8 class_code;
bool has_subclass_code;
uint8 subclass_code;
bool has_protocol_code;
uint8 protocol_code;
mojo_base.mojom.String16? serial_number;
};
struct UsbEnumerationOptions {
array<UsbDeviceFilter> filters;
};
interface UsbDeviceManager {
// Retrieves information about all devices available to the DeviceManager
// implementation and set client for device added/removed events.
EnumerateDevicesAndSetClient(associated UsbDeviceManagerClient client)
=> (array<UsbDeviceInfo> results);
// Retrieves devices information filtered by |options| to the DeviceManager
// implementation.
GetDevices(UsbEnumerationOptions? options) => (array<UsbDeviceInfo> results);
// Requests a device by guid.
GetDevice(string guid, UsbDevice& device_request,
UsbDeviceClient? device_client);
// Sets the client for this DeviceManager service. The service will notify its
// client of device events such as connection and disconnection.
SetClient(associated UsbDeviceManagerClient client);
};
interface UsbDeviceManagerClient {
// Called when a device is connected to the host.
OnDeviceAdded(UsbDeviceInfo device_info);
// Called when a device is disconnected from the host.
OnDeviceRemoved(UsbDeviceInfo device_info);
};