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 | package android.hardware.usb; |
| 17 | |
| 18 | import android.hardware.usb.PortRole; |
| 19 | import android.hardware.usb.PortStatus; |
| 20 | import android.hardware.usb.Status; |
| 21 | |
| 22 | /** |
| 23 | * Callback object used for all the IUsb async methods which expects a result. |
| 24 | * Caller is expected to register the callback object using setCallback method |
| 25 | * to receive updates on the PortStatus. |
| 26 | */ |
| 27 | @VintfStability |
| 28 | oneway interface IUsbCallback { |
| 29 | /** |
| 30 | * Used to convey the current port status to the caller. |
| 31 | * Must be called either when PortState changes due to the port partner or |
| 32 | * when caller requested for the PortStatus update through queryPortStatus. |
| 33 | * |
| 34 | * @param currentPortStatus describes the status of all the USB ports in the |
| 35 | * device. |
| 36 | * @param retval SUCCESS when the required information was enquired form |
| 37 | * kernel and the PortStatus object was built. |
| 38 | * ERROR otherwise. |
| 39 | */ |
| 40 | void notifyPortStatusChange(in PortStatus[] currentPortStatus, in Status retval); |
| 41 | |
| 42 | /** |
| 43 | * Used to notify the result of the switchRole call to the caller. |
| 44 | * |
| 45 | * @param portName name of the port for which the roleswap is requested. |
| 46 | * @param newRole the new role requested by the caller. |
| 47 | * @param retval SUCCESS if the role switch succeeded. FAILURE otherwise. |
| 48 | * @param transactionId transactionId sent during switchRole request. |
| 49 | */ |
| 50 | void notifyRoleSwitchStatus(in String portName, in PortRole newRole, in Status retval, |
| 51 | long transactionId); |
| 52 | |
| 53 | /** |
| 54 | * Used to notify the result of notifyEnableUsbDataStatus call to the caller. |
| 55 | * |
| 56 | * @param portName name of the port for which the enableUsbData is requested. |
| 57 | * @param enable true when usb data is enabled. |
| 58 | * false when usb data is disabled. |
| 59 | * @param retval SUCCESS if current request succeeded. FAILURE otherwise. |
| 60 | * @param transactionId transactionId sent during enableUsbData request. |
| 61 | */ |
| 62 | void notifyEnableUsbDataStatus(in String portName, boolean enable, in Status retval, |
| 63 | long transactionId); |
| 64 | |
| 65 | /** |
| 66 | * Used to notify the result of enableContaminantPresenceDetection. |
| 67 | * |
| 68 | * @param portName name of the port for which contaminant detection is enabled/disabled. |
| 69 | * @param enable true when contaminant detection is enabled. |
| 70 | * false when disabled. |
| 71 | * @param retval SUCCESS if the request for enabling/disabling contamiant detection succeeds. |
| 72 | * FAILURE otherwise. |
| 73 | * @param transactionId transactionId sent during queryPortStatus request |
| 74 | */ |
| 75 | void notifyContaminantEnabledStatus(in String portName, boolean enable, in Status retval, |
| 76 | long transactionId); |
| 77 | |
| 78 | /** |
| 79 | * Used to notify the request to query port status. |
| 80 | * |
| 81 | * @param portName name of the port for which port status is queried. |
| 82 | * @param retval SUCCESS if the port query succeeded. FAILURE otherwise. |
| 83 | * @param transactionId transactionId sent during queryPortStatus request |
| 84 | */ |
| 85 | void notifyQueryPortStatus(in String portName, in Status retval, long transactionId); |
Badhri Jagan Sridharan | 623f133 | 2021-11-25 09:35:21 -0800 | [diff] [blame^] | 86 | |
| 87 | /** |
| 88 | * Used to notify the result of requesting limitPowerTransfer. |
| 89 | * |
| 90 | * @param portName name of the port for which power transfer is being limited. |
| 91 | * @param limit true limit power transfer. |
| 92 | * false relax limiting power transfer. |
| 93 | * @param retval SUCCESS if the request to enable/disable limitPowerTransfer succeeds. |
| 94 | * FAILURE otherwise. |
| 95 | * @param transactionId ID sent during limitPowerTransfer request. |
| 96 | */ |
| 97 | void notifyLimitPowerTransferStatus(in String portName, boolean limit, in Status retval, long transactionId); |
Badhri Jagan Sridharan | b9f69ea | 2021-10-19 13:09:44 -0700 | [diff] [blame] | 98 | } |