public interface USBExtSwitchDevice extends Device
USBExtSwitchDevice interface provides control over the power state of USB host ports.
This interface allows applications to manage the power on/off state of USB hosts. The USBExtSwitchDevice object is obtained from the POSTerminal:
USBExtSwitchDevice USBExtSwitchDevice =
(USBExtSwitchDevice) POSTerminal.getInstance().getDevice(POSTerminal.DEVICE_NAME_USBEXTSWITCHDEVICE);
The identifier USBExtSwitchDevice is used to specify the device, as defined by the implementation.
Applications require the following permission to access the device:
The USB host ports can be configured in various modes, affecting how USB1 and USB2 operate:
| USB1 | USB2 | Work Mode |
|---|---|---|
| disable | disable | USB1 works only in SLAVE mode, USB2 does not work. |
| enable | disable | USB1 works in Host or SLAVE mode, USB2 does not work. |
| enable | enable | Both USB1 and USB2 work only in Host mode. |
| disable | enable | USB1 does not work, USB2 works only in Host mode. |
Note: By default, if no API is called, the firmware will enable USB1 and disable USB2.
| Modifier and Type | Method and Description |
|---|---|
void |
disablePower(int usbID)
Powers off the specified USB host.
|
void |
enablePower(int usbID)
Powers on the specified USB host.
|
boolean |
isPowerEnabled(int usbID)
Checks whether the specified USB host is powered on.
|
cancelRequest, close, getFailCount, getUsageCount, openvoid enablePower(int usbID)
throws DeviceException
usbID - The index of the USB host to power on.DeviceException - for standard errors as documented in DeviceException.void disablePower(int usbID)
throws DeviceException
usbID - The index of the USB host to power off.DeviceException - for standard errors as documented in DeviceException.boolean isPowerEnabled(int usbID)
throws DeviceException
usbID - The index of the USB host.true if the specified USB host is powered on, false otherwise.DeviceException - for standard errors as documented in DeviceException.