Class ModbusProtocolLogic<T extends ModbusADU>
- java.lang.Object
-
- org.apache.plc4x.java.spi.Plc4xProtocolBase<T>
-
- org.apache.plc4x.java.modbus.base.protocol.ModbusProtocolLogic<T>
-
- Direct Known Subclasses:
ModbusAsciiProtocolLogic,ModbusRtuProtocolLogic,ModbusTcpProtocolLogic
public abstract class ModbusProtocolLogic<T extends ModbusADU> extends Plc4xProtocolBase<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected DriverTypedriverTypeprotected static intFC_EXTENDED_REGISTERS_FILE_RECORD_LENGTHprotected static intFC_EXTENDED_REGISTERS_GROUP_HEADER_LENGTHprotected PlcTagpingAddressprotected DurationrequestTimeoutprotected RequestTransactionManagertmprotected AtomicIntegertransactionIdentifierGeneratorprotected shortunitIdentifier-
Fields inherited from class org.apache.plc4x.java.spi.Plc4xProtocolBase
context, driverContext
-
-
Constructor Summary
Constructors Constructor Description ModbusProtocolLogic(DriverType driverType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose(ConversationContext<T> context)protected voiddecode(ConversationContext<T> context, T msg)protected byte[]fromPlcValue(PlcTag tag, PlcValue plcValue)protected PlcResponseCodegetErrorCode(ModbusPDUError errorResponse)protected ModbusPDUgetReadRequestPdu(PlcTag tag)protected ModbusPDUgetWriteRequestPdu(PlcTag tag, PlcValue plcValue)protected PlcValuereadCoilBooleanList(int count, byte[] data)protected bytereverseBitsOfByte(byte b)protected PlcValuetoPlcValue(ModbusPDU request, ModbusPDU response, ModbusDataType dataType)-
Methods inherited from class org.apache.plc4x.java.spi.Plc4xProtocolBase
browse, browseWithInterceptor, getDriverContext, onConnect, onDisconnect, onDiscover, ping, read, setContext, setDriverContext, subscribe, unsubscribe, write
-
-
-
-
Field Detail
-
driverType
protected final DriverType driverType
-
requestTimeout
protected Duration requestTimeout
-
unitIdentifier
protected short unitIdentifier
-
pingAddress
protected PlcTag pingAddress
-
tm
protected RequestTransactionManager tm
-
transactionIdentifierGenerator
protected final AtomicInteger transactionIdentifierGenerator
-
FC_EXTENDED_REGISTERS_GROUP_HEADER_LENGTH
protected static final int FC_EXTENDED_REGISTERS_GROUP_HEADER_LENGTH
- See Also:
- Constant Field Values
-
FC_EXTENDED_REGISTERS_FILE_RECORD_LENGTH
protected static final int FC_EXTENDED_REGISTERS_FILE_RECORD_LENGTH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ModbusProtocolLogic
public ModbusProtocolLogic(DriverType driverType)
-
-
Method Detail
-
close
public void close(ConversationContext<T> context)
- Specified by:
closein classPlc4xProtocolBase<T extends ModbusADU>
-
decode
protected void decode(ConversationContext<T> context, T msg) throws Exception
- Overrides:
decodein classPlc4xProtocolBase<T extends ModbusADU>- Throws:
Exception
-
getErrorCode
protected PlcResponseCode getErrorCode(ModbusPDUError errorResponse)
-
toPlcValue
protected PlcValue toPlcValue(ModbusPDU request, ModbusPDU response, ModbusDataType dataType) throws ParseException
- Throws:
ParseException
-
reverseBitsOfByte
protected byte reverseBitsOfByte(byte b)
-
readCoilBooleanList
protected PlcValue readCoilBooleanList(int count, byte[] data) throws ParseException
- Throws:
ParseException
-
-