1/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.usb@1.0;
18
19/**
20 * Callback object used for all the IUsb async methods which expects a result.
21 * Caller is expected to register the callback object using setCallback method
22 * to receive updates on the PortStatus.
23 */
24interface IUsbCallback {
25    /**
26     * Used to convey the current port status to the caller.
27     * Called either when PortState changes due to the port partner (or)
28     * when caller requested for the PortStatus update through queryPortStatus.
29     *
30     * @param currentPortStatus vector object of current status of all the
31     * typeC ports in the device.
32     * @param retval SUCCESS when query was done successfully.
33     * ERROR otherwise.
34     */
35    oneway notifyPortStatusChange(vec<PortStatus> currentPortStatus, Status retval);
36
37    /**
38     * Used to notify the result of the switchRole call to the caller.
39     *
40     * @param portName name of the port for which the roleswap is requested.
41     * @param newRole the new role requested by the caller.
42     * @param retval SUCCESS if the role switch succeeded. FAILURE otherwise.
43     */
44    oneway notifyRoleSwitchStatus(string portName, PortRole newRole, Status retval);
45};
46