steveohara / j2mod

Enhanced Modbus library implemented in the Java programming language
Apache License 2.0
265 stars 111 forks source link

How to use AbstractModbusListener to realize real-time monitoring serial data, please provide example #97

Closed ArtIsLong closed 5 years ago

ArtIsLong commented 5 years ago

How to use AbstractModbusListener to realize real-time monitoring serial data, please provide example

steveohara commented 5 years ago

I'm afraid I don't have time to give you an example other than point you to the code base and see how it is implemented yourself. Take a look AbstractSerialConnection and where that is implemented, that will give you very low level metrics about the serial comms.

If you need metrics at a higher level then perhaps you should extend AbstractModbusTransport with your own implementation and then use that . Take a look through the unit tests for examples e.g. ModbusMasterFactory.createCustomModbusMaster