public class HidToI2c extends HidToGpio
* thanks to ....
| Constructor and Description |
|---|
HidToI2c()
New a HidToI2C driver object.
|
HidToI2c(android.content.Context context,
java.lang.String strAppName)
New a HidToI2C driver object.
|
| Modifier and Type | Method and Description |
|---|---|
int |
askPermissionByDeviceIndex(int nDeviceIndex)
Obtain permission to communicate with a device by given device name
|
int |
askPermissionByUsbDevice(android.hardware.usb.UsbDevice usbDevice)
Obtain permission to communicate with the given device.
|
int |
closeDevice()
Close the PL23C3 device.
|
int |
closeDeviceByDeviceIndex(int nDeviceIndex) |
void |
dumpMsg(java.lang.Object objMsg)
Dump log into sdk.
|
int |
enumDevices(int nDeviceVid)
Found a PL23B3, PL23C3, or PL23D3 device , the default VID is 067B
|
int |
enumDevices(int nDeviceVid,
int nDevicePid)
Found a PL23B3, PL23C3, or PL23D3 device by given VID and PID
|
java.lang.String |
getDeviceName(int nDeviceIndex)
Gets device name by given index.
|
java.lang.String |
getSdkVersion()
Gets SDK version.
|
java.lang.String |
getSerialNumber(int nDeviceIndex)
Gets device serial number by given index.
|
android.hardware.usb.UsbDevice |
getUsbDevice(int nDeviceIndex)
Gets UsbDevice object by given index
|
boolean |
hasPermissionByDeviceIndex(int nDeviceIndex)
Detecting whether this device which decided by given index has permission
|
boolean |
hasPermissionByUsbDevice(android.hardware.usb.UsbDevice usbDevice)
check if device has permission or not.
|
int |
i2cRead(int nDeviceIndex,
byte[] byBuffer,
int nNumberOfBytesToRead,
int nTimeOutms)
Read Binary Data from PL23C3 HidtoI2C chip.
|
int |
i2cReset(int nDeviceIndex)
Reset PL23C3 HidToI2C Chip configurations.
|
int |
i2cWrite(int nDeviceIndex,
byte[] byBuffer,
int nNumberOfBytesToWrite,
int nTimeOutms)
Write Binary Data to PL23C3 HidtoI2C chip.
|
int |
i2cWriteRead(int nDeviceIndex,
byte[] byWriteBuffer,
int nNumberOfBytesToWrite,
byte[] byReadBuffer,
int nNumberOfBytesToRead,
int nTimeOutms)
Write and Read Data to PL23C3 HidtoI2C chip.
|
int |
openDeviceByIndex(int nDeviceIndex)
Open device by given index.
|
int |
openDeviceBySerialNumber(java.lang.String strSerialNumber)
Open device by given serial number.
|
void |
setCommandTimeOut(int nMillSecond)
Sets device command time out value.
|
int |
setI2cDeviceAddress(int nDeviceIndex,
byte byDeviceAddress)
Sets I2C device address.
|
int |
setI2cFrequency(int nDeviceIndex,
byte byFreqDiv)
Sets I2C frequency.
|
getGpio, setGpio, setGpioDirpublic HidToI2c()
public HidToI2c(android.content.Context context,
java.lang.String strAppName)
context - the contextstrAppName - ACTION_USB_PERMISSION string, for example: "tw.com.prolific.HidToI2CTest.USB_PERMISSION"public int setI2cDeviceAddress(int nDeviceIndex,
byte byDeviceAddress)
nDeviceIndex - the device indexbyDeviceAddress - I2C Device Addresspublic int setI2cFrequency(int nDeviceIndex,
byte byFreqDiv)
nDeviceIndex - the device indexbyFreqDiv - The frequency divisor, the range between 4 and 0xFF.public int i2cRead(int nDeviceIndex,
byte[] byBuffer,
int nNumberOfBytesToRead,
int nTimeOutms)
nDeviceIndex - the device indexbyBuffer - Reading buffernNumberOfBytesToRead - The number of bytes to readnTimeOutms - The timeout value in milliseconds.public int i2cWriteRead(int nDeviceIndex,
byte[] byWriteBuffer,
int nNumberOfBytesToWrite,
byte[] byReadBuffer,
int nNumberOfBytesToRead,
int nTimeOutms)
nDeviceIndex - the device indexbyWriteBuffer - The write buffernNumberOfBytesToWrite - The number of bytes to writebyReadBuffer - Reading buffernNumberOfBytesToRead - The number of bytes to readnTimeOutms - The timeout value in milliseconds.public int i2cWrite(int nDeviceIndex,
byte[] byBuffer,
int nNumberOfBytesToWrite,
int nTimeOutms)
nDeviceIndex - the device indexbyBuffer - The write buffernNumberOfBytesToWrite - The number of bytes to writenTimeOutms - The timeout value in milliseconds.public int i2cReset(int nDeviceIndex)
nDeviceIndex - the device indexpublic int enumDevices(int nDeviceVid)
nDeviceVid - the device vidpublic int enumDevices(int nDeviceVid,
int nDevicePid)
nDeviceVid - the device vidnDevicePid - the device pidpublic java.lang.String getDeviceName(int nDeviceIndex)
nDeviceIndex - The index of devicepublic java.lang.String getSerialNumber(int nDeviceIndex)
nDeviceIndex - the index of devicepublic int openDeviceByIndex(int nDeviceIndex)
nDeviceIndex - the index of devicepublic int openDeviceBySerialNumber(java.lang.String strSerialNumber)
strSerialNumber - the serial number of devicepublic boolean hasPermissionByDeviceIndex(int nDeviceIndex)
nDeviceIndex - the index of devicepublic int askPermissionByDeviceIndex(int nDeviceIndex)
nDeviceIndex - the index of devicepublic boolean hasPermissionByUsbDevice(android.hardware.usb.UsbDevice usbDevice)
usbDevice - the usb devicepublic int askPermissionByUsbDevice(android.hardware.usb.UsbDevice usbDevice)
usbDevice - the usb devicepublic int closeDevice()
public int closeDeviceByDeviceIndex(int nDeviceIndex)
public java.lang.String getSdkVersion()
public void setCommandTimeOut(int nMillSecond)
nMillSecond - the time value in millisecond.public void dumpMsg(java.lang.Object objMsg)
objMsg - The message content.public android.hardware.usb.UsbDevice getUsbDevice(int nDeviceIndex)
nDeviceIndex - the index of device