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, wait
getInBufferBytesCount, getOutBufferBytesCount, getXOFFChar, getXONChar, isCTS, isDSR, isIncommingRI, sendXOFF, sendXON, setBreak, setDTR, setRTS, setXOFFChar, setXONChar
protected 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 SerialPortSocket
public void close() throws IOException
SerialPortSocket
close
in interface Closeable
close
in interface AutoCloseable
close
in interface SerialPortSocket
IOException
public InputStream getInputStream() throws IOException
getInputStream
in interface SerialPortSocket
IOException
public OutputStream getOutputStream() throws IOException
getOutputStream
in interface SerialPortSocket
IOException
public String getPortName()
SerialPortSocket
getPortName
in interface SerialPortSocket
public boolean isOpen()
SerialPortSocket
isOpen
in interface SerialPortSocket
public void openAsIs() throws IOException
SerialPortSocket
openAsIs
in interface SerialPortSocket
SerialPortException
IOException
public void openRaw() throws IOException
openRaw
in interface SerialPortSocket
IOException
public void openTerminal() throws IOException
openTerminal
in interface SerialPortSocket
IOException
public void openModem() throws IOException
openModem
in interface SerialPortSocket
IOException
public void openRaw(Baudrate baudRate, DataBits dataBits, StopBits stopBits, Parity parity, Set<FlowControl> flowControls) throws IOException
SerialPortSocket
openRaw
in interface SerialPortSocket
baudRate
- data transfer ratedataBits
- number of data bitsstopBits
- number of stop bitsparity
- parityIOException
public void setFlowControl(Set<FlowControl> flowControls) throws IOException
setFlowControl
in interface SerialPortSocket
IOException
public Set<FlowControl> getFlowControl() throws IOException
getFlowControl
in interface SerialPortSocket
IOException
protected abstract void open(String portName, int type) throws IOException
portName
- name of port for openingIOException
protected abstract void close0() throws IOException
IOException
protected void finalize() throws Throwable
public void setBaudrate(Baudrate baudrate) throws IOException
setBaudrate
in interface SerialPortSocket
IOException
public void setDataBits(DataBits dataBits) throws IOException
setDataBits
in interface SerialPortSocket
IOException
public void setStopBits(StopBits stopBits) throws IOException
setStopBits
in interface SerialPortSocket
IOException
public void setParity(Parity parity) throws IOException
setParity
in interface SerialPortSocket
IOException
public Baudrate getBaudrate() throws IOException
getBaudrate
in interface SerialPortSocket
IOException
public DataBits getDatatBits() throws IOException
getDatatBits
in interface SerialPortSocket
IOException
public StopBits getStopBits() throws IOException
getStopBits
in interface SerialPortSocket
IOException
public Parity getParity() throws IOException
getParity
in interface SerialPortSocket
IOException
protected abstract int readSingle() throws IOException
IOException
protected 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
IOException
protected 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.IOException
protected abstract void setFlowControl(int mask) throws IOException
IOException
protected abstract int getFlowControl0() throws IOException
IOException
protected abstract void setBaudrate(int baudRate) throws IOException
IOException
protected abstract void setDataBits(int value) throws IOException
IOException
protected abstract void setStopBits(int value) throws IOException
IOException
protected abstract void setParity(int parity) throws IOException
IOException
protected abstract int getBaudrate0() throws IOException
IOException
protected abstract int getDataBits0() throws IOException
IOException
protected abstract int getStopBits0() throws IOException
IOException
protected abstract int getParity0() throws IOException
IOException
Copyright © 2009–2015 atmodem4j. All rights reserved.