ModbusClient class abstract

The Modbus client definition.

The client can send a ModbusRequest retrieved by a ModbusElement.

If unitId id specified then it is used to make requests. The unitId is overridden in case the send command has it's own unitId defined.

Based on the connectionMode send command will connect in case current connection is not yet established.

Implementers

Constructors

ModbusClient({int? unitId, Duration responseTimeout = const Duration(seconds: 3), ModbusConnectionMode connectionMode = ModbusConnectionMode.autoConnectAndKeepConnected})

Properties

connectionMode ModbusConnectionMode
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
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
unitId int?
final

Methods

connect() Future<bool>
Connects to the client and returns true if connection is successfully established.
disconnect() Future<void>
Disconnects from current client
getResponseTimeout(ModbusRequest request) Duration
If request has its own responseTimeout defined, then it will override this client responseTimeout.
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.
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