Package: android.hardware.usb@1.0

IUsb

interface IUsb

Methods

switchRole

oneway switchRole (string portName, PortRole role)

This function is used to change the port role of a specific port.For example, when PD_SWAP or PR_SWAP is supported.This is function is asynchronous.The status of the role switch will be informed through IUsbCallback object's notifyPortStatusChange method.

Details
RPC mode
oneway
Parameters
portName
name of the port for which the role has to be changed
role
the new port role.

setCallback

oneway setCallback (IUsbCallback callback)

This function is used to register a callback function which is called by the HAL whenever there is a change in the port state.i.e.DATA_ROLE, POWER_ROLE or MODE.

Also the same callback object would be called to inform the caller of the roleSwitch status.

Details
RPC mode
oneway
Parameters
callback
IUsbCallback object used to convey status to the userspace.

queryPortStatus

oneway queryPortStatus ()

This functions is used to request the hal for the current status status of the Type-C ports.This method is async/oneway.The result of the query would be sent through the IUsbCallback object's notifyRoleSwitchStatus to the caller.This api would would let the caller know of the number of type-c ports that are present and their connection status through the PortStatus type.

Details
RPC mode
oneway