ModbusClientTcp class

The Modbus TCP client class.

Constructors

ModbusClientTcp(String serverAddress, {int serverPort = 502, ModbusConnectionMode connectionMode = ModbusConnectionMode.autoConnectAndKeepConnected, Duration connectionTimeout = const Duration(seconds: 3), Duration responseTimeout = const Duration(seconds: 3), Duration? delayAfterConnect, int? unitId})

Properties

connectionMode → ModbusConnectionMode
finalinherited
connectionTimeout Duration
final
delayAfterConnect Duration?
final
hashCode int
The hash code for this object.
no setterinherited
isConnected bool
Returns true if connection to client is established.
no setter
responseTimeout Duration
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serverAddress String
final
serverPort int
final
unitId int?
finalinherited

Methods

connect() Future<bool>
Connect the socket if not already done or disconnected
disconnect() Future<void>
Handle socket being closed
getResponseTimeout(ModbusRequest request) Duration
If request has its own responseTimeout defined, then it will override this client responseTimeout.
inherited
getUnitId(ModbusRequest request) int
If request has its own unitId defined, then it will override this client unitId. If both unitId are not defined the a 0 is returned.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
send(ModbusRequest request) Future<ModbusResponseCode>
Sends the modbus requests. A ModbusResponseCode is returned as a future.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

discover(String startIpAddress, {int serverPort = 502, Duration connectionTimeout = const Duration(milliseconds: 10)}) Future<String?>
This is an easy server address discovery.