public class SerialPortInterface
extends java.lang.Object
Constructor and Description |
---|
SerialPortInterface() |
Modifier and Type | Method and Description |
---|---|
static int |
close()
Close the serial port opened before.
|
static int |
flushIO()
Flush the IO buffer of the serial port.
|
static boolean |
isOpened()
Recognize if the serial port is open.
|
static int |
open(java.lang.String deviceName)
Open the serial port by the specified device name.
|
static int |
read(byte[] pDataBuffer,
int nExpectedDataLength,
int nTimeout_MS)
Get information from the serial port.
|
static int |
setBaudrate(int nBaudrate)
Set the baud rate of the serial port so that this device can read and write in the same baud rate.
|
static int |
write(byte[] pDataBuffer,
int offset,
int nDataLength)
Send information from the serial port.
|
public static int open(java.lang.String deviceName)
deviceName
- in WizarPOS1, deviceName is DB9, in WizarHANDQ1, deviceName is WIZARHANDQ1.public static int close()
public static int read(byte[] pDataBuffer, int nExpectedDataLength, int nTimeout_MS)
pDataBuffer
- Data buffernExpectedDataLength
- Data length to readnTimeout_MS
- Time in milliseconds. <0: read until got data.public static int write(byte[] pDataBuffer, int offset, int nDataLength)
pDataBuffer
- Data bufferoffset
- offset of the data buffernDataLength
- data length of writepublic static int setBaudrate(int nBaudrate)
nBaudrate
- baud ratepublic static int flushIO()
public static boolean isOpened()