public abstract class AbstractSerialPortSocket extends Object implements SerialPortSocket
SerialPortSocket.SerialPortSocketFactory| Modifier and Type | Field and Description |
|---|---|
protected net.sf.atmodem4j.spsw.AbstractSerialPortSocket.SerialInputStream |
is |
protected static Logger |
LOG |
protected net.sf.atmodem4j.spsw.AbstractSerialPortSocket.SerialOutputStream |
os |
static String |
SPSW_PROPERTIES |
FACTORY| Constructor and Description |
|---|
AbstractSerialPortSocket(String portName) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close port.
|
protected abstract void |
close0()
Close port
|
protected void |
finalize() |
static String |
getArch() |
Baudrate |
getBaudrate() |
protected abstract int |
getBaudrate0() |
protected abstract int |
getDataBits0() |
DataBits |
getDatatBits() |
Set<FlowControl> |
getFlowControl() |
protected abstract int |
getFlowControl0() |
InputStream |
getInputStream() |
static String |
getLibName() |
static String |
getOsName() |
OutputStream |
getOutputStream() |
Parity |
getParity() |
protected abstract int |
getParity0() |
String |
getPortName()
Getting port name under operation
|
StopBits |
getStopBits() |
protected abstract int |
getStopBits0() |
boolean |
isClosed() |
static boolean |
isLibLoaded() |
boolean |
isOpen()
Getting port state
|
static boolean |
loadNativeLib() |
protected abstract void |
open(String portName,
int type)
Open port
|
void |
openAsIs()
Port opening
Note: If port busy TYPE_PORT_BUSY exception will be thrown. |
void |
openModem() |
void |
openRaw() |
void |
openRaw(Baudrate baudRate,
DataBits dataBits,
StopBits stopBits,
Parity parity,
Set<FlowControl> flowControls)
Setting the parameters of port
|
void |
openTerminal() |
protected abstract int |
readBytes(byte[] b,
int off,
int len)
Read data from port
|
protected abstract int |
readSingle() |
void |
setBaudrate(Baudrate baudrate) |
protected abstract void |
setBaudrate(int baudRate) |
void |
setDataBits(DataBits dataBits) |
protected abstract void |
setDataBits(int value) |
protected abstract void |
setFlowControl(int mask) |
void |
setFlowControl(Set<FlowControl> flowControls) |
protected abstract void |
setParity(int parity) |
void |
setParity(Parity parity) |
protected abstract void |
setStopBits(int value) |
void |
setStopBits(StopBits stopBits) |
String |
toString() |
protected abstract void |
writeBytes(byte[] b,
int off,
int len)
Write data to port
|
protected abstract void |
writeSingle(int b) |
static boolean |
yesIhaveLoadedTheNativeLibMyself(String libName)
Someone else has loaded the correct native lib somplace else, Or know
what she is doingt...
|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitgetInBufferBytesCount, getOutBufferBytesCount, getXOFFChar, getXONChar, isCTS, isDSR, isIncommingRI, sendXOFF, sendXON, setBreak, setDTR, setRTS, setXOFFChar, setXONCharprotected static final Logger LOG
public static final String SPSW_PROPERTIES
protected net.sf.atmodem4j.spsw.AbstractSerialPortSocket.SerialInputStream is
protected net.sf.atmodem4j.spsw.AbstractSerialPortSocket.SerialOutputStream os
public AbstractSerialPortSocket(String portName)
public static boolean isLibLoaded()
public static String getLibName()
public static String getArch()
public static String getOsName()
public static boolean yesIhaveLoadedTheNativeLibMyself(String libName)
libName - the name of the libpublic static boolean loadNativeLib()
public boolean isClosed()
isClosed in interface SerialPortSocketpublic void close()
throws IOException
SerialPortSocketclose in interface Closeableclose in interface AutoCloseableclose in interface SerialPortSocketIOExceptionpublic InputStream getInputStream() throws IOException
getInputStream in interface SerialPortSocketIOExceptionpublic OutputStream getOutputStream() throws IOException
getOutputStream in interface SerialPortSocketIOExceptionpublic String getPortName()
SerialPortSocketgetPortName in interface SerialPortSocketpublic boolean isOpen()
SerialPortSocketisOpen in interface SerialPortSocketpublic void openAsIs()
throws IOException
SerialPortSocketopenAsIs in interface SerialPortSocketSerialPortExceptionIOExceptionpublic void openRaw()
throws IOException
openRaw in interface SerialPortSocketIOExceptionpublic void openTerminal()
throws IOException
openTerminal in interface SerialPortSocketIOExceptionpublic void openModem()
throws IOException
openModem in interface SerialPortSocketIOExceptionpublic void openRaw(Baudrate baudRate, DataBits dataBits, StopBits stopBits, Parity parity, Set<FlowControl> flowControls) throws IOException
SerialPortSocketopenRaw in interface SerialPortSocketbaudRate - data transfer ratedataBits - number of data bitsstopBits - number of stop bitsparity - parityIOExceptionpublic void setFlowControl(Set<FlowControl> flowControls) throws IOException
setFlowControl in interface SerialPortSocketIOExceptionpublic Set<FlowControl> getFlowControl() throws IOException
getFlowControl in interface SerialPortSocketIOExceptionprotected abstract void open(String portName, int type) throws IOException
portName - name of port for openingIOExceptionprotected abstract void close0()
throws IOException
IOExceptionprotected void finalize()
throws Throwable
public void setBaudrate(Baudrate baudrate) throws IOException
setBaudrate in interface SerialPortSocketIOExceptionpublic void setDataBits(DataBits dataBits) throws IOException
setDataBits in interface SerialPortSocketIOExceptionpublic void setStopBits(StopBits stopBits) throws IOException
setStopBits in interface SerialPortSocketIOExceptionpublic void setParity(Parity parity) throws IOException
setParity in interface SerialPortSocketIOExceptionpublic Baudrate getBaudrate() throws IOException
getBaudrate in interface SerialPortSocketIOExceptionpublic DataBits getDatatBits() throws IOException
getDatatBits in interface SerialPortSocketIOExceptionpublic StopBits getStopBits() throws IOException
getStopBits in interface SerialPortSocketIOExceptionpublic Parity getParity() throws IOException
getParity in interface SerialPortSocketIOExceptionprotected abstract int readSingle()
throws IOException
IOExceptionprotected abstract int readBytes(byte[] b,
int off,
int len)
throws IOException
b - the data to be writtenoff - the start offset in the datalen - the number of bytes that are writtenIOException - If an I/O error has occurred.protected abstract void writeSingle(int b)
throws IOException
IOExceptionprotected abstract void writeBytes(byte[] b,
int off,
int len)
throws IOException
b - off - the start offset in the data.len - the number of bytes to write.IOExceptionprotected abstract void setFlowControl(int mask)
throws IOException
IOExceptionprotected abstract int getFlowControl0()
throws IOException
IOExceptionprotected abstract void setBaudrate(int baudRate)
throws IOException
IOExceptionprotected abstract void setDataBits(int value)
throws IOException
IOExceptionprotected abstract void setStopBits(int value)
throws IOException
IOExceptionprotected abstract void setParity(int parity)
throws IOException
IOExceptionprotected abstract int getBaudrate0()
throws IOException
IOExceptionprotected abstract int getDataBits0()
throws IOException
IOExceptionprotected abstract int getStopBits0()
throws IOException
IOExceptionprotected abstract int getParity0()
throws IOException
IOExceptionCopyright © 2009–2015 atmodem4j. All rights reserved.