public class ModbusBINTransport extends ModbusSerialTransport
| Modifier and Type | Field and Description |
|---|---|
static int |
FRAME_END
Defines a virtual number for the FRAME_END token (CR LF).
|
static int |
FRAME_END_TOKEN
Defines the frame end token }.
|
static int |
FRAME_START
Defines a virtual number for the FRAME START token (COLON).
|
static int |
FRAME_START_TOKEN
Defines the frame start token {.
|
m_CommPort, m_Echo| Constructor and Description |
|---|
ModbusBINTransport()
Constructs a new MobusBINTransport instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
The
close method closes the serial input/output streams. |
void |
prepareStreams(InputStream in,
OutputStream out)
Prepares the input and output streams of this
ModbusASCIITransport 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. |
isEcho, readEcho, setCommPort, setEcho, setReceiveThreshold, setReceiveTimeoutpublic static final int FRAME_START
public static final int FRAME_END
public static final int FRAME_START_TOKEN
public static final int FRAME_END_TOKEN
public ModbusBINTransport()
public void close()
throws IOException
ModbusSerialTransportclose method closes the serial input/output streams.close in interface ModbusTransportclose in class ModbusSerialTransportIOException - if an error occurspublic 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 valueModbusIOException - if an error occurspublic 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 valueModbusIOException - if an error occurspublic 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 valueModbusIOException - if an error occurspublic void prepareStreams(InputStream in, OutputStream out) throws IOException
prepareStreams in class ModbusSerialTransportin - the input stream to be used for reading.out - the output stream to be used for writing.IOException - if an I\O related error occurs.Copyright © 2017. All rights reserved.