|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.thingmagic.AndroidUsbReflection
public class AndroidUsbReflection
Provides access to Android USB classes via Java reflection. To simplify the build and reduce the size of our distribution by not making a hard link to Android.
Field Summary | |
---|---|
static int |
deviceClass
|
static java.util.Map |
deviceList
|
static java.lang.Object |
ftDev
|
Constructor Summary | |
---|---|
AndroidUsbReflection(java.util.Map devices)
|
|
AndroidUsbReflection(java.lang.Object usbmanager,
java.lang.Object ftdev,
java.lang.Object usbdevice,
int deviceClass)
|
Method Summary | |
---|---|
static int |
bulkTransfer(java.lang.Object usbConnection,
java.lang.Object endPoint,
byte[] data,
int length,
int timeout)
Invokes the method android.hardware.usb.UsbDeviceConnection#bulkTransfer . |
static int |
bulkTransfer(java.lang.Object usbConnection,
java.lang.Object endPoint,
byte[] data,
int offset,
int length,
int timeout)
Invokes the method android.hardware.usb.UsbDeviceConnection#bulkTransfer . |
static boolean |
claimInterface(java.lang.Object usbConnection,
java.lang.Object usbInterface)
Invokes the method android.hardware.usb.UsbDeviceConnection#claimInterface . |
static void |
close()
Invokes the method #close . |
static void |
closeConnection(java.lang.Object usbConnection)
Invokes the method android.hardware.usb.UsbDeviceConnection#close . |
static int |
controlTransfer(java.lang.Object usbConnection,
int FTDI_DEVICE_OUT_REQTYPE,
int SIO_SET_BAUD_RATE_REQUEST,
int value,
int index,
byte[] data,
int length,
int USB_WRITE_TIMEOUT_MILLIS)
Invokes the method android.hardware.usb.UsbDeviceConnection#controlTransfer . |
static int |
getDeviceClass()
|
static int |
getEndPointDirection(java.lang.Object usbEndpoint)
Invokes the method android.hardware.usb.UsbEndpoint#getDirection . |
static java.lang.Object |
getInterface(int index)
Invokes the method android.hardware.usb.UsbDevice#getInterface . |
static int |
getInterfaceCount()
Invokes the method android.hardware.usb.UsbDevice#getInterfaceCount . |
static java.lang.Object |
getReadEndPoint(java.lang.Object usbInterFace,
int readPointAddr)
Invokes the method android.hardware.usb.UsbInterface#getEndpoint . |
static int |
getstatusQ()
Invokes the method #getQueueStatus . |
java.util.HashMap<java.lang.String,java.lang.Object> |
getUSBDeviceList()
|
static java.lang.Object |
getWriteEndPoint(java.lang.Object usbInterFace,
int writeEndPointAddr)
Invokes the method android.hardware.usb.UsbInterface#getEndpoint . |
static boolean |
hasAccessPermission()
Invokes the method android.hardware.usb.UsbManager#hasAccessPermission . |
static boolean |
initialize(java.lang.Object usbConnection,
java.lang.Object readEndPoint)
Invokes the method android.hardware.usb.UsbRequest#initialize . |
static boolean |
isBufferFull()
Invokes the method #readBufferFull . |
static boolean |
isOpen()
Invokes the method #isOpen . |
static java.lang.Object |
openDevice()
Invokes the method android.hardware.usb.UsbManager#openDevice . |
static int |
read(byte[] buf)
|
static int |
read(byte[] buf,
int len)
|
static int |
read(byte[] buf,
int len,
long timeout)
Invokes the method #read . |
static java.nio.ByteBuffer |
readBufferqueue(java.nio.ByteBuffer buffer,
int length)
Invokes the method android.hardware.usb.UsbRequest#queue . |
static boolean |
requestPermission()
|
static java.lang.Object |
requestWait(java.lang.Object usbConnection)
|
static void |
reSet()
Invokes the method #resetDevice . |
static void |
reSet(java.lang.Object usbConnection)
|
static boolean |
setBaudRate(int baudRate)
Invokes the method #getQueueStatus . |
static java.lang.Object |
setClientData()
|
static int |
write(byte[] buf,
int len)
Invokes the method #write . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.util.Map deviceList
public static int deviceClass
public static java.lang.Object ftDev
Constructor Detail |
---|
public AndroidUsbReflection(java.lang.Object usbmanager, java.lang.Object ftdev, java.lang.Object usbdevice, int deviceClass)
public AndroidUsbReflection(java.util.Map devices)
Method Detail |
---|
public static int getDeviceClass()
public java.util.HashMap<java.lang.String,java.lang.Object> getUSBDeviceList() throws java.lang.NoSuchFieldException
java.lang.NoSuchFieldException
public static int getstatusQ()
#getQueueStatus
.
public static int read(byte[] buf, int len, long timeout) throws java.io.IOException
#read
.
java.io.IOException
public static int read(byte[] buf, int len) throws java.io.IOException
java.io.IOException
public static int read(byte[] buf) throws java.io.IOException
java.io.IOException
public static int write(byte[] buf, int len) throws java.io.IOException
#write
.
java.io.IOException
public static void close()
#close
.
public static void reSet()
#resetDevice
.
public static boolean isOpen()
#isOpen
.
public static boolean setBaudRate(int baudRate)
#getQueueStatus
.
public static boolean isBufferFull()
#readBufferFull
.
public static boolean hasAccessPermission()
android.hardware.usb.UsbManager#hasAccessPermission
.
usbDevice
- a android.hardware.usb.UsbDevice
object
public static boolean requestPermission()
public static void reSet(java.lang.Object usbConnection)
public static java.lang.Object openDevice()
android.hardware.usb.UsbManager#openDevice
.
usbDevice
- a android.hardware.usb.UsbDevice
object
android.hardware.usb.UsbRequest
object, or null if
failed to openpublic static int getInterfaceCount()
android.hardware.usb.UsbDevice#getInterfaceCount
.
public static boolean claimInterface(java.lang.Object usbConnection, java.lang.Object usbInterface) throws java.lang.IllegalArgumentException
android.hardware.usb.UsbDeviceConnection#claimInterface
.
usbInterface
- a android.hardware.usb.UsbInterface
object
and boolean flag (true to disconnect kernel driver if necessary)
java.lang.IllegalArgumentException
public static java.lang.Object getInterface(int index)
android.hardware.usb.UsbDevice#getInterface
.
index
- a integer
android.hardware.usb.UsbInterface
a Objectpublic static java.lang.Object getReadEndPoint(java.lang.Object usbInterFace, int readPointAddr) throws java.io.IOException
android.hardware.usb.UsbInterface#getEndpoint
.
index
- a integer(0 for read endpoint)
android.hardware.usb.UsbEndpoint
a Object
java.io.IOException
public static int getEndPointDirection(java.lang.Object usbEndpoint) throws java.io.IOException
android.hardware.usb.UsbEndpoint#getDirection
.
java.io.IOException
public static java.lang.Object getWriteEndPoint(java.lang.Object usbInterFace, int writeEndPointAddr) throws java.io.IOException
android.hardware.usb.UsbInterface#getEndpoint
.
index
- a integer(1 for write endpoint)
android.hardware.usb.UsbEndpoint
a Object
java.io.IOException
public static int bulkTransfer(java.lang.Object usbConnection, java.lang.Object endPoint, byte[] data, int length, int timeout) throws java.io.IOException
android.hardware.usb.UsbDeviceConnection#bulkTransfer
.
usbendPoint
- android.hardware.usb.UsbEndpoint
a Objectbuffer
- a byte[] for data to send or receivelength
- a integer,the length of the data to send or receivetimeout
- a integer
java.io.IOException
public static int bulkTransfer(java.lang.Object usbConnection, java.lang.Object endPoint, byte[] data, int offset, int length, int timeout) throws java.io.IOException
android.hardware.usb.UsbDeviceConnection#bulkTransfer
.
usbendPoint
- android.hardware.usb.UsbEndpoint
a Objectbuffer
- a byte[] for data to send or receiveoffset
- a integer, the index of the first byte in the buffer to
send or receivelength
- a integer,the length of the data to send or receivetimeout
- a integer
java.io.IOException
public static int controlTransfer(java.lang.Object usbConnection, int FTDI_DEVICE_OUT_REQTYPE, int SIO_SET_BAUD_RATE_REQUEST, int value, int index, byte[] data, int length, int USB_WRITE_TIMEOUT_MILLIS) throws java.io.IOException
android.hardware.usb.UsbDeviceConnection#controlTransfer
.
requestType
- a integer, request type for this transactionrequestID
- a integer, request ID for this transactionvalue
- a integer, value field for this transactionbuffer
- a byte[], buffer for data portion of transaction, or null
if no data needs to be sent or receivedtimeout
- a integer
java.io.IOException
public static boolean initialize(java.lang.Object usbConnection, java.lang.Object readEndPoint)
android.hardware.usb.UsbRequest#initialize
.
usbConnection
- android.hardware.usb.UsbDeviceConnection
a objectusbEndpoint
- aandroid.hardware.usb.UsbEndpoint
object
public static java.nio.ByteBuffer readBufferqueue(java.nio.ByteBuffer buffer, int length) throws java.io.IOException
android.hardware.usb.UsbRequest#queue
.
buffer
- a ByteBuffer, containing the bytes to write, or location to
store the results of a readlength
- a integer, number of bytes to read or write
java.io.IOException
public static java.lang.Object requestWait(java.lang.Object usbConnection) throws java.io.IOException
java.io.IOException
public static java.lang.Object setClientData() throws java.io.IOException
java.io.IOException
public static void closeConnection(java.lang.Object usbConnection)
android.hardware.usb.UsbDeviceConnection#close
.
Releases all system resources related to the device.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |