public class HardwareInterface
extends java.lang.Object
| Constructor and Description |
|---|
HardwareInterface(HWType Type,
android.content.Context ctx)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
Close()
To close hardware interface
|
HWType |
getHWType()
To get the Hardware type
|
int |
getMaxRxPkLength()
To get maximum data length for each Rx packet.
|
int |
getMaxTxPkLength()
To get maximum data length for each Tx packet.
|
java.lang.Object |
getmDevObj()
To get the casted hardware interface instance (UsbDevice for instance)which has been stored
|
boolean |
getSerialNumber(byte[] pBuff,
byte[] Len)
Get Serial Number of Reader internally.
|
boolean |
Init(android.hardware.usb.UsbManager Manager,
android.hardware.usb.UsbDevice Device)
To initial the hardware for communication
|
boolean |
initNFC(android.hardware.usb.UsbManager Manager,
android.hardware.usb.UsbDevice Device)
To initial the hardware for communication if you are using the NFC function.
|
boolean |
IsDevSet()
Simply return flag to check is this class is ready
|
int |
Rx(byte[] pBuff,
int[] Len)
To receive data from hardware interface
|
void |
setAppContext(android.content.Context ctx) |
int |
Tx(byte[] pBuff,
int Len)
To transfer data to hardware interface
|
boolean |
usbCtrl(byte[] pBuf,
int requestType,
int request,
int value,
int index,
int[] pLength)
To get an specific Usb descriptor
|
boolean |
usbResetDevice()
To send a reset request to USB device.
|
public boolean Init(android.hardware.usb.UsbManager Manager,
android.hardware.usb.UsbDevice Device)
throws amlib.hw.ReaderHwException
Manager - UsbManagerDevice - UsbDevice which smart card belong toamlib.hw.ReaderHwExceptionUsbManager,
UsbDevicepublic boolean initNFC(android.hardware.usb.UsbManager Manager,
android.hardware.usb.UsbDevice Device)
throws amlib.hw.ReaderHwException
Manager - UsbManagerDevice - UsbDevice which smart card belong toamlib.hw.ReaderHwExceptionUsbManager,
UsbDevicepublic boolean Close()
public int Tx(byte[] pBuff,
int Len)
pBuff - data to transfer, the length of pBuffer is specified in parameter 'Len'Len - length of data to transferpublic int Rx(byte[] pBuff,
int[] Len)
pBuff - data to receive. Be aware that providing a buffer with enough size.Len - length of received datapublic boolean getSerialNumber(byte[] pBuff,
byte[] Len)
pBuff - byte array to get serial numberLen - length of received datapublic boolean usbCtrl(byte[] pBuf,
int requestType,
int request,
int value,
int index,
int[] pLength)
pBuf - byte array to receive descriptor. Be aware that providing a buffer with enough sizerequestType - request type for this transaction.request - request ID for this transaction.value - value field for this transaction.index - index field for this transaction.pLength - one element array to indicate transfer length.public boolean usbResetDevice()
throws amlib.hw.ReaderHwException
amlib.hw.ReaderHwExceptionpublic java.lang.Object getmDevObj()
Objectpublic void setAppContext(android.content.Context ctx)
public boolean IsDevSet()
public int getMaxTxPkLength()
public int getMaxRxPkLength()