Closed felHR85 closed 8 years ago
Hi Felipe,
This is great - the abstraction of the comms port was one of the casualties of the huge number of changes to get j2mod into a production fit state so I'm very happy to see it come back. This work will also resolve https://github.com/steveohara/j2mod/issues/3
I'm on holiday for a couple of weeks but when I'm back, I'll pull your changes and try it out with the serial devices we have here.
Thanks, Steve
Cool! Enjoy your holidays!
Thanks felHR85 and SteveoHara !
I have pulled this into the development and master builds after doing some testing locally. There were some javadoc issues and a nasty recursive loop when closing the SerialConnection. I've also renamed the interface class to fit in with the j2mod naming convention. Take a look and let me know whet you think
I will try to take a look as soon as possible! :)
Hi @steveohara I want Modbus support for Android devices using the USB port and j2mod is the obvious starting point to begin with. I plan to use my library UsbSerial so decoupling jSerialComm was needed.
In this pull request I've added an abstract class called SerialConnectionInterface that represents an abstract serial port connection. I've respected jSerialComm constants for backwards compatibility.
All jSerialComm references are embedded inside a class inheriting SerialConnectionInterface called SerialConnection as the previous existing class to avoid compatibility issues.
The previous constructors and factory methods are the same, I just added a new constructor for ModbusSerialListener
And a new createCustomModbusMaster method:
I've made some tests and seems to be sending an receiving data but it would be very good if someone with more Modbus expertise could test it further.
Thanks! Felipe