Implement Modbus Handlers for Master and Slave
masterEasymodbus4j requires you to implement specific interfaces to handle Modbus communication logic depending on whether your component acts as a Master or a Slave.
For Master (Client) roles:
- Implement the
ResponseHandlerinterface. - OR implement the
ModbusMasterResponseProcessorinterface and use it withnew ModbusMasterResponseHandler(responseProcessor).
For Slave (Server) roles:
- Implement the
RequestHandlerinterface. - OR implement the
ModbusSlaveRequestProcessorinterface and use it withnew ModbusSlaveRequestHandler(reqProcessor).