Badhri Jagan Sridharan | b9f69ea | 2021-10-19 13:09:44 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2021 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 | |
| 17 | package android.hardware.usb; |
| 18 | |
| 19 | import android.hardware.usb.IUsbCallback; |
| 20 | import android.hardware.usb.PortRole; |
| 21 | |
| 22 | @VintfStability |
| 23 | oneway interface IUsb { |
| 24 | /** |
| 25 | * When supportsEnableContaminantPresenceDetection is true, |
| 26 | * enableContaminantPresenceDetection enables/disables contaminant |
| 27 | * presence detection algorithm. Calling enableContaminantPresenceDetection |
| 28 | * when supportsEnableContaminantPresenceDetection is false does |
| 29 | * not have any effect. |
| 30 | * Change in contantaminant presence status should be notified to the |
| 31 | * client via notifyPortStatusChange through PortStatus. |
| 32 | * |
| 33 | * @param portName name of the port. |
| 34 | * @param enable true Enable contaminant presence detection algorithm. |
| 35 | * false Disable contaminant presence detection algorithm. |
| 36 | * @param transactionId ID to be used when invoking the callback. |
| 37 | */ |
| 38 | void enableContaminantPresenceDetection(in String portName, in boolean enable, long transactionId); |
| 39 | |
| 40 | /** |
| 41 | * This function is used to enable/disable USB data controller. |
| 42 | * |
| 43 | * @param portName Name of the port. |
| 44 | * @param enable true Enable USB data signaling. |
| 45 | * false Disable USB data signaling. |
| 46 | * @param transactionId ID to be used when invoking the callback. |
| 47 | * |
| 48 | */ |
| 49 | void enableUsbData(in String portName, boolean enable, long transactionId); |
| 50 | |
| 51 | /** |
| 52 | * This functions is used to request the hal for the current status |
| 53 | * status of the Type-C ports. The result of the query would be sent |
| 54 | * through the IUsbCallback object's notifyRoleSwitchStatus |
| 55 | * to the caller. This api would would let the caller know of the number |
| 56 | * of type-c ports that are present and their connection status through the |
| 57 | * PortStatus type. |
| 58 | * @param transactionId ID to be used when invoking the callback. |
| 59 | */ |
| 60 | void queryPortStatus(long transactionId); |
| 61 | |
| 62 | /** |
| 63 | * This function is used to register a callback function which is |
| 64 | * called by the HAL to inform the client of port status updates and |
| 65 | * result of the requested operation. Please refer IUsbCallback for |
| 66 | * complete description of when each of the IUsbCallback's interface |
| 67 | * methods is expected to be called. |
| 68 | * |
| 69 | * @param callback IUsbCallback object used to convey status to the |
| 70 | * userspace. |
| 71 | */ |
| 72 | void setCallback(in IUsbCallback callback); |
| 73 | |
| 74 | /** |
| 75 | * This function is used to change the port role of a specific port. |
| 76 | * For example, when DR_SWAP or PR_SWAP is supported. |
| 77 | * The status of the role switch will be informed through IUsbCallback |
| 78 | * object's notifyPortStatusChange method. |
| 79 | * |
| 80 | * @param portName name of the port for which the role has to be changed |
| 81 | * @param role the new port role. |
| 82 | * @param transactionId ID to be used when invoking the callback. |
| 83 | */ |
| 84 | void switchRole(in String portName, in PortRole role, long transactionId); |
Badhri Jagan Sridharan | 623f133 | 2021-11-25 09:35:21 -0800 | [diff] [blame^] | 85 | |
| 86 | /** |
| 87 | * This function is used to limit power transfer in and out of the port. |
| 88 | * When limited, the port does not charge from the partner port. |
| 89 | * Also, the port limits sourcing power to the partner port when the USB |
| 90 | * specification allows it to do so. |
| 91 | * |
| 92 | * @param portName name of the port for which power transfer is being limited. |
| 93 | * @param limit true limit power transfer. |
| 94 | * false relax limiting power transfer. |
| 95 | * @param transactionId ID to be used when invoking the callback. |
| 96 | */ |
| 97 | void limitPowerTransfer(in String portName, boolean limit, long transactionId); |
Badhri Jagan Sridharan | b9f69ea | 2021-10-19 13:09:44 -0700 | [diff] [blame] | 98 | } |