类 RtuMaster
java.lang.Object
com.huangjian.modbus4j.Modbus
com.huangjian.modbus4j.ModbusMaster
com.huangjian.modbus4j.serial.SerialMaster
com.huangjian.modbus4j.serial.rtu.RtuMaster
RtuMaster class.
-
字段概要
从类继承的字段 com.huangjian.modbus4j.serial.SerialMaster
serialPortOpen, transport, wrapper从类继承的字段 com.huangjian.modbus4j.ModbusMaster
connected, initialized, validateResponse从类继承的字段 com.huangjian.modbus4j.Modbus
DEFAULT_MAX_READ_BIT_COUNT, DEFAULT_MAX_READ_REGISTER_COUNT, DEFAULT_MAX_WRITE_REGISTER_COUNT -
构造器概要
构造器构造器说明RtuMaster(SerialPortWrapper wrapper) Constructor for RtuMaster.RtuMaster(SerialPortWrapper wrapper, boolean validateResponse) Constructor for RtuMaster. -
方法概要
修饰符和类型方法说明static longcomputeCharacterSpacing(SerialPortWrapper wrapper) RTU Spec: For baud greater than 19200 Char Spacing: 750uS For baud less than 19200 Char Spacing: 1.5 * char timestatic floatcomputeCharacterTime(SerialPortWrapper wrapper) Compute the time it takes to transmit 1 character with the provided Serial Parameters.static longRTU Spec: For baud greater than 19200 Message Spacing: 1.750uS For baud less than 19200 Message Spacing: 3.5 * char timevoiddestroy()destroy.voidinit()init.protected voidopenConnection(MessageControl toClose) Open the serial port and initialize the transport, ensure connection is closed firstsendImpl(ModbusRequest request) sendImpl.从类继承的方法 com.huangjian.modbus4j.serial.SerialMaster
close, closeConnection从类继承的方法 com.huangjian.modbus4j.ModbusMaster
closeMessageControl, getDiscardDataDelay, getePoll, getIoLog, getMessageControl, getRetries, getTimeout, getValue, isConnected, isInitialized, isMultipleWritesOnly, scanForSlaveNodes, scanForSlaveNodes, send, send, setConnected, setDiscardDataDelay, setePoll, setIoLog, setMultipleWritesOnly, setRetries, setTimeout, setValue, testSlaveNode
-
构造器详细资料
-
RtuMaster
Constructor for RtuMaster.
Default to validating the slave id in responses- 参数:
wrapper- aSerialPortWrapperobject.
-
RtuMaster
Constructor for RtuMaster.
- 参数:
wrapper- aSerialPortWrapperobject.validateResponse- - confirm that requested slave id is the same in the response
-
-
方法详细资料
-
init
init.
- 覆盖:
init在类中SerialMaster- 抛出:
ModbusInitException- if any.
-
openConnection
Open the serial port and initialize the transport, ensure connection is closed first- 覆盖:
openConnection在类中SerialMaster- 参数:
toClose-- 抛出:
Exception
-
destroy
public void destroy()destroy.
- 指定者:
destroy在类中ModbusMaster
-
sendImpl
sendImpl.
- 指定者:
sendImpl在类中ModbusMaster- 参数:
request- aModbusRequestobject.- 返回:
- a
ModbusResponseobject. - 抛出:
ModbusTransportException- if any.
-
computeMessageFrameSpacing
RTU Spec: For baud greater than 19200 Message Spacing: 1.750uS For baud less than 19200 Message Spacing: 3.5 * char time- 参数:
wrapper- aSerialPortWrapperobject.- 返回:
- a long.
-
computeCharacterSpacing
RTU Spec: For baud greater than 19200 Char Spacing: 750uS For baud less than 19200 Char Spacing: 1.5 * char time- 参数:
wrapper- aSerialPortWrapperobject.- 返回:
- a long.
-
computeCharacterTime
Compute the time it takes to transmit 1 character with the provided Serial Parameters. RTU Spec: For baud greater than 19200 Char Spacing: 750uS Message Spacing: 1.750uS For baud less than 19200 Char Spacing: 1.5 * char time Message Spacing: 3.5 * char time- 参数:
wrapper- aSerialPortWrapperobject.- 返回:
- time in nanoseconds
-