|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectjPicUsb.iface
public class iface
Interface with Microchip Usb API
Requires jpicusb.dll on the same folder of running program
Author: Geronimo OƱativia
Version: 1.0
Date: 30 de Enero de 2009
Field Summary | |
---|---|
static int |
FUNCTION_CALL_FAIL
Called function failed. |
static int |
MAX_NUM_MPUSB_DEV
Max number of attached devices. |
static int |
MP_READ
Direction of the endpoint. |
static int |
MP_WRITE
Direction of the endpoint. |
static int |
MPUSB_FAIL
Called function failed. |
static int |
MPUSB_SUCCESS
Called function succeeded. |
Constructor Summary | |
---|---|
iface()
Dummy constructor. |
Method Summary | |
---|---|
static boolean |
Close(long handle)
Opens an endpoint pipe with matching handle. |
static java.lang.String |
GetAPIVersion()
Get mpusbapi revision level |
static int |
GetDeviceCount(java.lang.String pVID_PID)
Returns the number of devices with matching VID & PID. |
static void |
load()
Loads the interface jpicusb.dll Call this function only once. |
static long |
Open(int instance,
java.lang.String pVID_PID,
java.lang.String pEP,
int dwDir,
int dwReserved)
Opens an endpoint pipe with matching VID & PID. |
static byte[] |
QRead(int dwLen,
long dwMilliseconds)
Quick Read Open a connection with DEFAULT VID & PID, reads data, and closes the opened endpoint pipe. |
static long |
QWrite(byte[] pData,
int dwLen,
long dwMilliseconds)
Quick Write Open a connection with DEFAULT VID & PID, writes data, and closes the opened endpoint pipe. |
static byte[] |
QWriteRead(byte[] pData,
int dwLenWrite,
int dwLenRead,
long dwMilliseconds)
Quick Write and Read Open two connections with DEFAULT VID & PID, wtite data, then reads data, and closes the opened endpoint pipes. |
static byte[] |
Read(long handle,
int dwLen,
long dwMilliseconds)
Reads data from an opened endpoint pipe. |
static byte[] |
Read(java.lang.String pVID_PID,
int instance,
int dwLen,
long dwMilliseconds)
Open a connection with matching VID & PID, reads data, and closes the opened endpoint pipe. |
static void |
set_instance(int i)
Sets DEFAULT instance used by functions wich don't receive a handle or VID & PID. |
static void |
set_vidpid(java.lang.String s)
Sets DEFAULT VID & PID used by functions wich don't receive a handle or VID & PID. |
static long |
Write(long handle,
byte[] pData,
int dwLen,
long dwMilliseconds)
Writes data to an opened endpoint pipe. |
static long |
Write(java.lang.String pVID_PID,
int instance,
byte[] pData,
int dwLen,
long dwMilliseconds)
Open a connection with matching VID & PID, writes data, and closes the opened endpoint pipe. |
static byte[] |
WriteRead(java.lang.String pVID_PID,
int instance,
byte[] pData,
int dwLenWrite,
int dwLenRead,
long dwMilliseconds)
Open two connections with matching VID & PID, wtite data, then reads data, and closes the opened endpoint pipes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int FUNCTION_CALL_FAIL
public static int MPUSB_FAIL
public static int MPUSB_SUCCESS
public static int MP_WRITE
public static int MP_READ
public static int MAX_NUM_MPUSB_DEV
Constructor Detail |
---|
public iface()
Method Detail |
---|
public static java.lang.String GetAPIVersion()
public static int GetDeviceCount(java.lang.String pVID_PID)
pVID_PID
- A string containing the VID & PID value of the target device. The format is "vid_xxxx&pid_yyyy".
public static long Open(int instance, java.lang.String pVID_PID, java.lang.String pEP, int dwDir, int dwReserved)
instance
- An instance number of the device to open.pVID_PID
- A string containing the VID & PID value of the target device. The format is "vid_xxxx&pid_yyyy".pEP
- A string of the endpoint number on the target endpoint to open. The format is "\\MCHP_EPz". Where z is the endpoint number in decimal.dwDir
- Specifies the direction of the endpoint. Use MP_READ for Read. Use MP_WRITE for Write.dwReserved
- Future Use.
public static boolean Close(long handle)
handle
- long value representing the handle to an endpoint pipe opened with Open.
public static long Write(long handle, byte[] pData, int dwLen, long dwMilliseconds)
handle
- Long value representing the handle to an endpoint pipe opened with Open.pData
- Byte array containing the data to be sent.dwLen
- Amount of bytes to be sent.dwMilliseconds
- Timeout in milliseconds.
public static long Write(java.lang.String pVID_PID, int instance, byte[] pData, int dwLen, long dwMilliseconds)
pVID_PID
- A string containing the VID & PID value of the target device. The format is "vid_xxxx&pid_yyyy".instance
- An instance number of the device to open.pData
- Byte array containing the data to be sent.dwLen
- Amount of bytes to be sent.dwMilliseconds
- Timeout in milliseconds.
public static byte[] Read(long handle, int dwLen, long dwMilliseconds)
handle
- Long value representing the handle to an endpoint pipe opened with Open.dwLen
- Amount of bytes to be read.dwMilliseconds
- Timeout in milliseconds.
public static byte[] Read(java.lang.String pVID_PID, int instance, int dwLen, long dwMilliseconds)
pVID_PID
- A string containing the VID & PID value of the target device. The format is "vid_xxxx&pid_yyyy".instance
- An instance number of the device to open.dwLen
- Amount of bytes to be read.dwMilliseconds
- Timeout in milliseconds.
public static byte[] WriteRead(java.lang.String pVID_PID, int instance, byte[] pData, int dwLenWrite, int dwLenRead, long dwMilliseconds)
pVID_PID
- A string containing the VID & PID value of the target device. The format is "vid_xxxx&pid_yyyy".instance
- An instance number of the device to open.pData
- Byte array containing the data to be sent.dwLenWrite
- Amount of bytes to be sent.dwLenRead
- Amount of bytes to be read.dwMilliseconds
- Timeout in milliseconds.
public static long QWrite(byte[] pData, int dwLen, long dwMilliseconds)
pData
- Byte array containing the data to be sent.dwLen
- Amount of bytes to be sent.dwMilliseconds
- Timeout in milliseconds.
public static byte[] QRead(int dwLen, long dwMilliseconds)
dwLen
- Amount of bytes to be read.dwMilliseconds
- Timeout in milliseconds.
public static byte[] QWriteRead(byte[] pData, int dwLenWrite, int dwLenRead, long dwMilliseconds)
pData
- Byte array containing the data to be sent.dwLenWrite
- Amount of bytes to be sent.dwLenRead
- Amount of bytes to be read.dwMilliseconds
- Timeout in milliseconds.
public static void set_vidpid(java.lang.String s)
s
- A string containing the VID & PID value of the target device. The format is "vid_xxxx&pid_yyyy".public static void set_instance(int i)
i
- An instance number of the device.public static void load()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |