Package com.metratec.lib.connection
Class SerialConnection
- java.lang.Object
-
- com.metratec.lib.connection.ICommConnection
-
- com.metratec.lib.connection.SerialConnection
-
- Direct Known Subclasses:
Rs232Connection
,UsbConnection
public abstract class SerialConnection extends ICommConnection
Abstract parent class for the serial connections- Author:
- man
-
-
Field Summary
-
Fields inherited from class com.metratec.lib.connection.ICommConnection
CONNECTION_LOST, DEVICE_IN_USE, ETHERNET_TIMEOUT, ETHERNET_UNKNOWN_HOST, NO_DEVICES_FOUND, NO_LIBRARY_FOUND, NOT_AVAILABLE, NOT_INITIALISED, RECV_TIMEOUT, SERIAL_NO_ACCESS, SERIAL_NOT_INITIALISED, SERIAL_PARAMETER_NOT_SET, SERIAL_PORT_NOT_EXIST, SET_CONFIGURATION, UNHANDLED_ERROR, USB_SET_BAUDRATE, USB_SET_DATA_CHARACTERISTICS, USB_SET_FLOWCONTROL, USB_SET_TIMEOUTS, USER_ERRORCODE_01, USER_ERRORCODE_02, USER_ERRORCODE_03, USER_ERRORCODE_04, USER_ERRORCODE_05, WRONG_PARAMETER
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getBaudrate()
int
getDataBit()
int
getFlowControl()
int
getParity()
int
getStopBit()
void
setBaudrate(int baudrate)
void
setDataBit(int dataBit)
void
setFlowControl(int flowControl)
void
setParity(int parity)
void
setStopBit(int stopBit)
-
Methods inherited from class com.metratec.lib.connection.ICommConnection
connect, dataAvailable, disconnect, getConnectionTimeout, getInfo, getInputStream, getOutputStream, getRecvTimeout, isConnected, receive, recv, recv, recv, recv, send, send, setConnectionTimeout, setRecvTimeout, setSettings
-
-
-
-
Method Detail
-
getBaudrate
public int getBaudrate()
- Returns:
- the baud rate of the connected device
-
setBaudrate
public void setBaudrate(int baudrate)
- Parameters:
baudrate
- baud rate of the connected device
-
getDataBit
public int getDataBit()
- Returns:
- the number of data bits
-
setDataBit
public void setDataBit(int dataBit)
- Parameters:
dataBit
- number of data bits
-
getStopBit
public int getStopBit()
- Returns:
- the value of StopBits, a value larger 2 means 1.5 stopbits
-
setStopBit
public void setStopBit(int stopBit)
- Parameters:
stopBit
- value of StopBits, a value larger 2 means 1.5 stopbits
-
getParity
public int getParity()
- Returns:
- the parity bit (0 for no, 1 for ODD, 2 for EVEN, 3 for MARK, 4 for SPACE)
-
setParity
public void setParity(int parity)
- Parameters:
parity
- parity bit (0 for no, 1 for ODD, 2 for EVEN, 3 for MARK, 4 for SPACE)
-
getFlowControl
public int getFlowControl()
- Returns:
- the flow Control (0 for no, ..)
-
setFlowControl
public void setFlowControl(int flowControl)
- Parameters:
flowControl
- flow Control (0 for no, ..)
-
-