public class PL2303GMultiLib
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
PL2303GMultiLib.BaudRate |
static class |
PL2303GMultiLib.DataBits |
static class |
PL2303GMultiLib.FlowControl |
static class |
PL2303GMultiLib.Parity |
static class |
PL2303GMultiLib.StopBits |
Modifier and Type | Field and Description |
---|---|
static int |
BAUD0 |
static int |
BAUD115200 |
static int |
BAUD1200 |
static int |
BAUD1228800 |
static int |
BAUD14400 |
static int |
BAUD150 |
static int |
BAUD1800 |
static int |
BAUD19200 |
static int |
BAUD230400 |
static int |
BAUD2400 |
static int |
BAUD2457600 |
static int |
BAUD300 |
static int |
BAUD3000000 |
static int |
BAUD38400 |
static int |
BAUD460800 |
static int |
BAUD4800 |
static int |
BAUD57600 |
static int |
BAUD600 |
static int |
BAUD6000000 |
static int |
BAUD614400 |
static int |
BAUD75 |
static int |
BAUD921600 |
static int |
BAUD9600 |
static int |
PL2303G_CTS_ON |
static int |
PL2303G_DCD_ON |
static int |
PL2303G_DSR_ON |
static int |
PL2303G_RI_ON |
java.lang.String |
PLUART_DETACHED |
java.lang.String |
PLUART_MESSAGE |
java.util.Hashtable<java.lang.String,java.lang.String> |
Prolific_DevicePath_2_COMNumber |
java.util.Hashtable<java.lang.String,UsbDevice> |
ProlificUSBCurrentDeviceList |
Constructor and Description |
---|
PL2303GMultiLib(UsbManager manager,
Context context,
java.lang.String sAppName)
Initialize a PL2303G driver, the software 4K Queue buffer is enable.
|
PL2303GMultiLib(UsbManager manager,
Context context,
java.lang.String sAppName,
boolean bWithQueue)
Initialize a PL2303G driver.
|
Modifier and Type | Method and Description |
---|---|
boolean |
EnableFixed_COMPort_Mode()
Enable Fixed COM port Mode.
|
void |
PL2303CloseDeviceByIndex(int index)
Close an PL-UART USB Device by index.
|
boolean |
PL2303Device_GetCommTimeouts(int TimeoutConstant)
The PL2303Device_GetCommTimeouts function retrieves the time-out
parameters for all read and write operations on a specified communications device.
|
java.lang.String |
PL2303Device_GetSerialNumber(int index) |
boolean |
PL2303Device_SetCommTimeouts(int TimeoutConstant)
The PL2303Device_SetCommTimeouts function sets the time-out parameters,
for all read and write operations on a specified communications device. |
int |
PL2303Enumerate()
Found a PL2303G device number , the default VID_PID is 067B_2303.
|
int |
PL2303G_Enable_GPIO_A(int index,
int GPIO_Num,
boolean Enable)
PL2303G has 8 software controllable, General-purpose input and output control signal pins,
You can use this API to control the direction of these pins GPIO_A. |
int |
PL2303G_Enable_GPIO_B(int index,
int GPIO_Num,
boolean Enable)
PL2303G has 8 software controllable, General-purpose input and output control signal pins,
You can use this API to control the direction of these pins GPIO_B. |
int[] |
PL2303G_Get_GPIO_Value_A(int index,
int GPIO_Num)
PL2303G has 8 software controllable, General-purpose input and output control signal pins,
You can use this API to get the status of these GPIO_A pins when the direction is in input mode. |
int[] |
PL2303G_Get_GPIO_Value_B(int index,
int GPIO_Num)
PL2303G has 8 software controllable, General-purpose input and output control signal pins,
You can use this API to get the status of these GPIO_B pins when the direction is in input mode. |
int |
PL2303G_GPIO_A_CNT_ENABLE(int index,
int GPIO_Num,
boolean Enable)
PL2303G has 8 software controllable, General-purpose input and output control signal pins,
You can use this API to Init GPIO_A. |
int |
PL2303G_GPIO_B_CNT_ENABLE(int index,
int GPIO_Num,
boolean Enable)
PL2303G has 8 software controllable, General-purpose input and output control signal pins,
You can use this API to Init GPIO_B. |
void |
PL2303G_ReSetStatus()
ReSet Port Status.
|
int |
PL2303G_Set_GPIO_Value_A(int index,
int GPIO_Num,
int val)
PL2303G has 8 software controllable, General-purpose input and output control signal pins,
You can use this API to control the status of these pins of GPIO_A when the direction is output mode. |
int |
PL2303G_Set_GPIO_Value_B(int index,
int GPIO_Num,
int val)
PL2303G has 8 software controllable, General-purpose input and output control signal pins,
You can use this API to control the status of these pins of GPIO_B when the direction is output mode. |
int |
PL2303G_SetDTR(int index,
boolean state)
Switch PL2303G DTR on or off.
|
int |
PL2303G_SetRTS(int index,
boolean state)
Switch PL2303G RTS on or off.
|
java.lang.String |
PL2303getCOMNumber(int index)
Get the PL2303G COM port Number : COM1, COM2, COM3...
|
java.lang.String |
PL2303getDevicePathByIndex(int index)
Get the Device Path.
|
int |
PL2303getProlificUSBDeviceCount()
Returns the active device number of PL2303.
|
java.lang.String |
PL2303getSerialByIndex(int index)
Returns the serial number for the device.
|
boolean |
PL2303IsDeviceConnectedByIndex(int index)
Get the connection status of this PL2303G, ie, whether there is an active connection with PL2303G device.
|
int |
PL2303LibGetVersion(byte[] byVersion)
Get Lib version.
|
boolean |
PL2303OpenDevByBaudRate(int index,
PL2303GMultiLib.BaudRate R)
Open an PL-UART USB Device by baudrate.
|
boolean |
PL2303OpenDevByDefualtSetting(int index)
Open an PL-UART USB Device by default UART setting.
|
boolean |
PL2303OpenDevByUARTSetting(int index,
PL2303GMultiLib.BaudRate R,
PL2303GMultiLib.DataBits D,
PL2303GMultiLib.StopBits S,
PL2303GMultiLib.Parity P,
PL2303GMultiLib.FlowControl F)
Open an PL-UART USB Device by UART setting.
|
int |
PL2303Read(int index,
byte[] buf)
Read Binary Data from PL2303G chip.
|
void |
PL2303Release()
Close an PL2303G USB Device.
|
int |
PL2303SetupCOMPort(int index,
PL2303GMultiLib.BaudRate R,
PL2303GMultiLib.DataBits D,
PL2303GMultiLib.StopBits S,
PL2303GMultiLib.Parity P,
PL2303GMultiLib.FlowControl F)
Setup basic communication parameters on PL2303G chip.
|
boolean |
PL2303USBFeatureSupported()
Detecting whether this Android OS supports USB host API feature.
|
int |
PL2303Write(int index,
byte[] buf)
Writes n bytes Data to PL-UART chipset.
|
public static final int BAUD0
public static final int BAUD75
public static final int BAUD150
public static final int BAUD300
public static final int BAUD600
public static final int BAUD1200
public static final int BAUD1800
public static final int BAUD2400
public static final int BAUD4800
public static final int BAUD9600
public static final int BAUD14400
public static final int BAUD19200
public static final int BAUD38400
public static final int BAUD57600
public static final int BAUD115200
public static final int BAUD230400
public static final int BAUD460800
public static final int BAUD614400
public static final int BAUD921600
public static final int BAUD1228800
public static final int BAUD2457600
public static final int BAUD3000000
public static final int BAUD6000000
public static final int PL2303G_DCD_ON
public static final int PL2303G_DSR_ON
public static final int PL2303G_RI_ON
public static final int PL2303G_CTS_ON
public java.lang.String PLUART_MESSAGE
public java.lang.String PLUART_DETACHED
public java.util.Hashtable<java.lang.String,UsbDevice> ProlificUSBCurrentDeviceList
public java.util.Hashtable<java.lang.String,java.lang.String> Prolific_DevicePath_2_COMNumber
public PL2303GMultiLib(UsbManager manager, Context context, java.lang.String sAppName)
manager
- [in] Initialize a PL2303G driver.context
- [in] Initialize a PL2303G driver.sAppName
- [in] ACTION_USB_PERMISSION string, for example:
public PL2303GMultiLib(UsbManager manager, Context context, java.lang.String sAppName, boolean bWithQueue)
manager
- [in] Initialize a PL2303G driver.context
- [in] Initialize a PL2303G driver.sAppName
- [in] ACTION_USB_PERMISSION string, for example:
bWithQueue
- Specifies the software 4K Queue buffer is enable or disable.public void PL2303Release()
public boolean PL2303USBFeatureSupported()
public int PL2303LibGetVersion(byte[] byVersion)
byVersion
- [out] Lib version, e.g., 2.0.0.0.public void PL2303G_ReSetStatus()
public int PL2303Enumerate()
public boolean PL2303IsDeviceConnectedByIndex(int index)
index
- usb-device index.public java.lang.String PL2303getDevicePathByIndex(int index)
index
- usb-device index.public java.lang.String PL2303getCOMNumber(int index)
index
- usb-device index, the number is between 0 and 7.public boolean EnableFixed_COMPort_Mode()
public java.lang.String PL2303getSerialByIndex(int index)
index
- [in] usb-device index.public int PL2303getProlificUSBDeviceCount()
public int PL2303Write(int index, byte[] buf)
index
- [in] usb-device index.buf
- [in] write buffer.public int PL2303Read(int index, byte[] buf)
index
- [in] usb-device index.buf
- [in] read buffer.public boolean PL2303OpenDevByDefualtSetting(int index)
index
- [in] usb-device index.public boolean PL2303OpenDevByBaudRate(int index, PL2303GMultiLib.BaudRate R)
index
- [in] usb-device index.R
- [in] UART baud rate , the baud rate range of PL2303G are 75~12M bps.public boolean PL2303OpenDevByUARTSetting(int index, PL2303GMultiLib.BaudRate R, PL2303GMultiLib.DataBits D, PL2303GMultiLib.StopBits S, PL2303GMultiLib.Parity P, PL2303GMultiLib.FlowControl F)
index
- [in] usb-device index.R
- [in] UART baud rate , the baud rate range of PL2303G are 75~12M bps.D
- [in] UART Data bit, PL2303G supports 5, 6, 7 or 8 data bits.S
- [in] UART Stop bit, PL2303G supports 1, 1.5 or 2 data bits.P
- [in] UART Parity bit, PL2303G supports Odd, Even, Mark, Space, or None parity mode.F
- [in] UART Flow Control mode, PL2303G supports None, software or hardware Flow Control mode.public void PL2303CloseDeviceByIndex(int index)
index
- [in] usb-device index.public int PL2303SetupCOMPort(int index, PL2303GMultiLib.BaudRate R, PL2303GMultiLib.DataBits D, PL2303GMultiLib.StopBits S, PL2303GMultiLib.Parity P, PL2303GMultiLib.FlowControl F) throws java.io.IOException
index
- [in] usb-device index.R
- [in] UART baud rate , the baud rate range of PL2303G are 75~12M bps.D
- [in] UART Data bit, PL2303G supports 5, 6, 7 or 8 data bits.S
- [in] UART Stop bit, PL2303G supports 1, 1.5 or 2 data bits.P
- [in] UART Parity bit, PL2303G supports Odd, Even, Mark, Space, or None parity mode.F
- [in] UART Flow Control mode, PL2303G supports None, software or hardware Flow Control mode.java.io.IOException
- if settings not supported or connection is closed.public boolean PL2303Device_SetCommTimeouts(int TimeoutConstant)
TimeoutConstant
- is timeout Constant of read and write.public boolean PL2303Device_GetCommTimeouts(int TimeoutConstant)
TimeoutConstant:
- Timeout Constant of read and write.public java.lang.String PL2303Device_GetSerialNumber(int index)
public int PL2303G_SetDTR(int index, boolean state)
state
- true: SET DTR, false: CLEAR DTR.public int PL2303G_SetRTS(int index, boolean state)
state
- true: SET RTS, false: CLEAR RTS.public int PL2303G_GPIO_A_CNT_ENABLE(int index, int GPIO_Num, boolean Enable)
index
- [in] usb-device index.GPIO_Num
- [in] The GPIO number, the range is 0 ~ 7.Enable
- [in] True is Output mode, false is input mode.public int PL2303G_GPIO_B_CNT_ENABLE(int index, int GPIO_Num, boolean Enable)
index
- [in] usb-device index.GPIO_Num
- [in] The GPIO number, the range is 0 ~ 7.Enable
- [in] True is Output mode, false is input mode.public int PL2303G_Enable_GPIO_A(int index, int GPIO_Num, boolean Enable)
index
- [in] usb-device index.GPIO_Num
- [in] The GPIO number, the range is 0 ~ 7 .Enable
- [in] True is Output mode, false is input mode.public int PL2303G_Enable_GPIO_B(int index, int GPIO_Num, boolean Enable)
index
- [in] usb-device index.GPIO_Num
- [in] The GPIO number, the range is 0 ~ 7 .Enable
- [in] True is Output mode, false is input mode.public int PL2303G_Set_GPIO_Value_A(int index, int GPIO_Num, int val)
index
- [in] usb-device index.GPIO_Num
- [in] The GPIO number, the range is 0 ~ 7 .val
- [in] " 1 " is High level, " 0 " is low level.public int PL2303G_Set_GPIO_Value_B(int index, int GPIO_Num, int val)
index
- [in] usb-device index.GPIO_Num
- [in] The GPIO number, the range is 0 ~ 7 .val
- [in] " 1 " is High level, " 0 " is low level.public int[] PL2303G_Get_GPIO_Value_A(int index, int GPIO_Num)
index
- [in] usb-device index.GPIO_Num
- [in] The GPIO number, the range is 0 ~ 7 .public int[] PL2303G_Get_GPIO_Value_B(int index, int GPIO_Num)
index
- [in] usb-device index.GPIO_Num
- [in] The GPIO number, the range is 0 ~ 7 .