/* SPDX-License-Identifier: BSD-3-Clause */
/*
 * Copyright 2010 Raritan Inc. All rights reserved.
 */

#include <UserEvent.idl>

/**
 * USB Ports
 */
module usb {

    /** USB device information */
    structure UsbDevice_3_0_0 {
        int portNumber;         ///< USB Port number (1-based)
        int bus;                ///< Bus number
        int device;             ///< Device address
        int vendorId;           ///< Vendor ID
        int productId;          ///< Product ID
        string manufacturer;    ///< Manufacturer
        string product;         ///< Product
    };

    /** USB interface */
    interface Usb_1_0_4 {

        /** USB interface settings */
        structure Settings {
            boolean hostPortsEnabled; ///< \false to deactivate the device's USB-A host ports
        };

        /** Event: Settings have changed */
        valueobject SettingsChangedEvent extends event.UserEvent {
            Settings oldSettings; ///< Settings before change
            Settings newSettings; ///< Settings after change
        };

        /**
         * Retrieve the USB interface settings.
         *
         * @return USB interface settings
         */
        Settings getSettings();

        /**
         * Change the USB interface settings.
         *
         * @param settings  New settings
         *
         * @return 0 if OK
         */
        int setSettings(in Settings settings);

        /**
         * Retrieve the number of external USB-A ports.
         *
         * @return Number of host ports
         */
        int getHostPortCount();

        /**
         * Get a list of USB devices connected to the host ports.
         *
         * @param usbDevices  Result: List of discovered devices
         */
        void getDevices(out vector<UsbDevice_3_0_0> usbDevices);

    };

}
