/*
 * Copyright (C) 2016 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@1.0;

/**
 * Callback object used for all the IUsb async methods which expects a result.
 * Caller is expected to register the callback object using setCallback method
 * to receive updates on the PortStatus.
 */
interface IUsbCallback {
    /**
     * Used to convey the current port status to the caller.
     * Called either when PortState changes due to the port partner (or)
     * when caller requested for the PortStatus update through queryPortStatus.
     *
     * @param currentPortStatus vector object of current status of all the
     * typeC ports in the device.
     * @param retval SUCCESS when query was done successfully.
     * ERROR otherwise.
     */
    oneway notifyPortStatusChange(vec<PortStatus> currentPortStatus, Status retval);

    /**
     * Used to notify the result of the switchRole call to the caller.
     *
     * @param portName name of the port for which the roleswap is requested.
     * @param newRole the new role requested by the caller.
     * @param retval SUCCESS if the role switch succeeded. FAILURE otherwise.
     */
    oneway notifyRoleSwitchStatus(string portName, PortRole newRole, Status retval);
};
