Closed Exquemelin closed 3 years ago
Hello @Exquemelin.
Thank you for your work, but seems that it is very complicated to pass unitId as parameter over all methods.
I made more simple solution for you: https://github.com/Hacker-CB/modbus-dart/tree/unit_id Please try, and I will merge it to master if all is ok.
Hello @Hacker-CB ,
I considered using the unitID as part of the conection as you use it. But I prefer to stablish only one conection to send messages to both devices, using an unique conection.
I have been testing your solution and it works properly. Even, if I use two simultaneous conections and petitions. You can merge it to the master. Thank you for your support.
@Exquemelin
You don't need to use multiply connections. Just call client.setUnitId(XXX)
between calls.
I added example to README.
Please confirm.
https://github.com/Hacker-CB/modbus-dart/blob/unit_id/README.md
Merged to master 66b35cc0d8ba5c8f3db7b22e5f8673ea6208dce5, in version 0.1.0
Ok, I understand what you mean. It's a good solution.
Ok, great. So, you can use it in latest release
Hello Hacker-CB,
I have been testing your modbus package in a LAN where I have a modbus/TCP converter, with two slave devices, so I needed to implement the use of unitID's. It works fine for me, using an app coded with fllutter.
I prefer to put the unitID as a optional parameter in the functions, so it still work with older versions of the package. If you have any question, don't hesitate to ask it to me. I hope that this code will be useful for you.