blob: dd0e0600857d52a9e183f941c41fb5a712a75f4d [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.usb;
import "device.mojom";
struct DeviceFilter {
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;
};
struct EnumerationOptions {
array<DeviceFilter>? filters;
};
interface DeviceManager {
// Retrieves information about all devices available to the DeviceManager
// implementation.
GetDevices(EnumerationOptions? options) => (array<DeviceInfo> results);
// Requests a device by guid.
GetDevice(string guid, Device& device_request);
// Sets the client for this DeviceManager service. The service will notify its
// client of device events such as connection and disconnection.
SetClient(DeviceManagerClient client);
};
interface DeviceManagerClient {
// Called when a device is connected to the host.
OnDeviceAdded(DeviceInfo device_info);
// Called when a device is disconnected from the host.
OnDeviceRemoved(DeviceInfo device_info);
};