Open blueskit opened 1 year ago
Hi, thanks for your suggestion. I am wondering why you cannot simply call AddUnit(1)
in your derived class (as you did in ModbusSlaveOneTcpServer
) and then always work with that unit?
You can access the corresponding registers by calling e.g. GetHoldingRegisters(unitIdentifier: 1)
or GetHoldingRegisterBuffer<T>(unitIdentifier: 1)
, etc.
Or did I overlook something?
Currently, there is a use case as follows: As a ModbusServer, the client (ModbusRTU) of the other party requires a non-zero unitIdentifier, which prevents access to the data in the ModbusServer.
After inspection, the Find() method in class ModbusServer is as follows:
If the Find method is changed to a protected virtual method, then the problem can be solved by deriving a class from ModbusServer as follows.
Please change the Find method in class ModbusServer to a protected method, or if there is a better way, please consider it.