/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.usb.gadget@1.0;

import IUsbGadgetCallback;

interface IUsbGadget {
    /**
     * This function is used to set the current USB gadget configuration.
     * Usb gadget needs to teared down if an USB configuration is already
     * active.
     *
     * @param functions list of functions defined by GadgetFunction to be
     *                  included in the gadget composition.
     * @param callback IUsbGadgetCallback::setCurrentUsbFunctionsCb used to
     *                 propagate back the status.
     * @param timeout The maximum time (in milliseconds) within which the
     *                IUsbGadgetCallback needs to be returned.
     */
    oneway setCurrentUsbFunctions(bitfield<GadgetFunction> functions,
                                  IUsbGadgetCallback callback,
                                  uint64_t timeout);

    /**
     * This function is used to query the USB functions included in the
     * current USB configuration.
     *
     * @param callback IUsbGadgetCallback::getCurrentUsbFunctionsCb used to
     *                 propagate the current functions list.
     */
    oneway getCurrentUsbFunctions(IUsbGadgetCallback callback);

};
