blob: 965326a287d9f8e857c204262b0e094bb45d7599 [file] [log] [blame]
Badhri Jagan Sridharan2f162ef2017-01-04 00:02:59 -08001/*
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
19import IUsbCallback;
20
21interface IUsb {
22 /*
23 * This function is used to change the port role of a specific port.
24 * For example, when PD_SWAP or PR_SWAP is supported.
25 * This is function is asynchronous. The status of the role switch
26 * will be informed through IUsbCallback object's notifyPortStatusChange
27 * method.
28 *
29 * @param portName name of the port for which the role has to be changed
30 * @param role the new port role.
31 */
32 oneway switchRole(string portName, PortRole role);
33
34 /*
35 * This function is used to register a callback function which is
36 * called by the HAL whenever there is a change in the port state.
37 * i.e. DATA_ROLE, POWER_ROLE or MODE.
38 *
39 * Also the same callback object would be called to inform the caller
40 * of the roleSwitch status.
41 *
42 * @param callback IUsbCallback object used to convey status to the
43 * userspace.
44 */
45 oneway setCallback(IUsbCallback callback);
46
47 /*
48 * This functions is used to request the hal for the current status
49 * status of the Type-C ports. This method is async/oneway. The result of the
50 * query would be sent through the IUsbCallback object's notifyRoleSwitchStatus
51 * to the caller. This api would would let the caller know of the number
52 * of type-c ports that are present and their connection status through the
53 * PortStatus type.
54 */
55 oneway queryPortStatus();
56};
57