Common data for Modbus protocol.
$ dotnet add package AMWD.Protocols.Modbus.CommonThis package contains all basic tools to build your own clients.
IModbusConnection
This is the interface used on the base client to communicate with the remote device.
If you want to use a custom connection type, you should implement this interface yourself.
The IModbusConnection is responsible to open and close the data channel in the background.
IModbusProtocol
If you want to speak a custom type of protocol with the clients, you can implement this interface.
ModbusBaseClient
This abstract base client contains all the basic methods and handlings required to communicate via Modbus Protocol.
The packages AMWD.Protocols.Modbus.Serial and AMWD.Protocols.Modbus.Tcp have specific derived implementations to match the communication types.
Here you have all typed enumerables defined by the Modbus Protocol.
ModbusObject instead of Coil, etc.)To convert the Modbus specific types to usable values and vice-versa, there are some extensions.
float (single) and doublesbyte, short (int16), int (int32) and long (int64)byte, ushort (uint16), uint (uint32) and ulong (uint64)string and boolThe different types handled by the Modbus Protocol.
In addition, you'll find the DeviceIdentification there.
It is used for a "special" function called Read Device Identification (0x2B / 43), not supported on all devices.
The ModbusDevice is used for the VirtualModbusClient.
In combination with the *Proxy implementations (in the derived packages) it can be used as server.
Here you have the specific default implementations for the Modbus Protocol.
NOTE:
The implementations over serial line (RTU and ASCII) have a minimum unit ID of one (1) and maximum unit ID of 247 referring to the specification.
This validation is not implemented here due to real world experience, that some manufactures don't care about it.
Published under MIT License (see choose a license)