|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.wimpi.modbus.io.ModbusSerialTransport
net.wimpi.modbus.io.ModbusRTUTransport
public class ModbusRTUTransport
Class that implements the ModbusRTU transport flavor.
| Field Summary | |
|---|---|
private byte[] |
lastRequest
|
private BytesInputStream |
m_ByteIn
|
private BytesOutputStream |
m_ByteInOut
|
private BytesOutputStream |
m_ByteOut
|
private byte[] |
m_InBuffer
|
private InputStream |
m_InputStream
|
private OutputStream |
m_OutputStream
|
| Fields inherited from class net.wimpi.modbus.io.ModbusSerialTransport |
|---|
m_CommPort, m_Echo |
| Constructor Summary | |
|---|---|
ModbusRTUTransport()
|
|
| Method Summary | |
|---|---|
void |
clearInput()
Clear the input if characters are found in the input stream. |
void |
close()
The close method closes the serial input/output streams. |
private void |
getResponse(int fn,
BytesOutputStream out)
|
void |
prepareStreams(InputStream in,
OutputStream out)
Prepares the input and output streams of this ModbusRTUTransport instance. |
ModbusRequest |
readRequest()
The readRequest method listens continuously on the serial
input stream for master request messages and replies if the request slave
ID matches its own set in ModbusCoupler.getUnitID(). |
ModbusResponse |
readResponse()
readResponse reads a response message from the slave
responding to a master writeMessage request. |
void |
writeMessage(ModbusMessage msg)
The writeMessage method writes a modbus serial message to
its serial output stream to a specified slave unit ID. |
| Methods inherited from class net.wimpi.modbus.io.ModbusSerialTransport |
|---|
isEcho, readEcho, setCommPort, setEcho, setReceiveThreshold, setReceiveTimeout |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private InputStream m_InputStream
private OutputStream m_OutputStream
private byte[] m_InBuffer
private BytesInputStream m_ByteIn
private BytesOutputStream m_ByteInOut
private BytesOutputStream m_ByteOut
private byte[] lastRequest
| Constructor Detail |
|---|
public ModbusRTUTransport()
| Method Detail |
|---|
public void writeMessage(ModbusMessage msg)
throws ModbusIOException
ModbusSerialTransportwriteMessage method writes a modbus serial message to
its serial output stream to a specified slave unit ID.
writeMessage in interface ModbusTransportwriteMessage in class ModbusSerialTransportmsg - a ModbusMessage value
ModbusIOException - if an error occurs
public ModbusRequest readRequest()
throws ModbusIOException
ModbusSerialTransportreadRequest method listens continuously on the serial
input stream for master request messages and replies if the request slave
ID matches its own set in ModbusCoupler.getUnitID().
readRequest in interface ModbusTransportreadRequest in class ModbusSerialTransportModbusRequest value
ModbusIOException - if an error occurs
public void clearInput()
throws IOException
IOException
public ModbusResponse readResponse()
throws ModbusIOException
ModbusSerialTransportreadResponse reads a response message from the slave
responding to a master writeMessage request.
readResponse in interface ModbusTransportreadResponse in class ModbusSerialTransportModbusResponse value
ModbusIOException - if an error occurs
public void prepareStreams(InputStream in,
OutputStream out)
throws IOException
prepareStreams in class ModbusSerialTransportin - the input stream to be read from.out - the output stream to write to.
IOException - if an I\O error occurs.
public void close()
throws IOException
ModbusSerialTransportclose method closes the serial input/output streams.
close in interface ModbusTransportclose in class ModbusSerialTransportIOException - if an error occurs
private void getResponse(int fn,
BytesOutputStream out)
throws IOException
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||