ModbusDevice
Description
The ModbusDevice object is the base class for Modbus client or server implementations. It provides basic communication mechanisms and properties and manages communication-related errors.
This object was introduced in InCore 2.0.
- › Inherits:
- › Inherited by:
Overview
Properties
Methods
Signals
Enumerations
Properties
activityLed
This property holds an LED which to let blink on bus activity. Only supported for Modbus RTU.
This property was introduced in InCore 2.8.
- › Type:
- › Signal:
activityLedChanged()
- › Attributes:
Writable
autoConnect
This property holds whether the device should automatically reconnect if the connection is lost or closed.
- › Type:
Boolean
- › Default:
true- › Signal:
autoConnectChanged()
- › Attributes:
Writable
error
This property holds the most recently occurred error or ModbusDevice.NoError if no error occurred. If the same error occurs multiple times this property does not change. Use the errorOccurred() signal to detect multiple occurrences of the same error.
- › Type:
- › Signal:
errorChanged()
- › Attributes:
Readonly
errorString
This property holds the current human readable error string corresponding to the current value in the error property. It may include additional information such as failure reasons or locations.
- › Type:
String
- › Signal:
errorStringChanged()
- › Attributes:
Readonly
state
This property holds the current state of the Modbus device. See the State enumeration for details.
- › Type:
- › Default:
- › Signal:
stateChanged()
- › Attributes:
Readonly
Methods
connectDevice()
This method connects the device or master to the network. If autoConnect is true calling this function is not necessary.
- › Returns:
Boolean
disconnectDevice()
This method disconnects the device or master from the network. Set autoConnect to false to make this function work properly.
Signals
connected()
This signal is emitted when the connection to the network is established.
disconnected()
This signal is emitted when the connection to the network is lost or closed.
errorOccurred()
This signal is emitted whenever an error has occurred, regardless of whether the error property has changed or not. In contrast to the change notification signal of the error property this signal is also emitted several times if a certain error occurs several times in succession.
Enumerations
BusInterface
This enumeration describes supported bus interface types used for Modbus RTU-based communication
This enumeration was introduced in InCore 2.8.
Name |
Value |
Description |
|---|---|---|
|
|
use the serial port as specified in the portName property. |
|
|
use the builtin RS485 interface (availability depends on hardware type). |
|
|
use the backplane bus interface (availability depends on hardware type). |
Error
This enumeration describes all possible errors which can occur when connecting to or communicating with other Modbus devices.
Name |
Value |
Description |
|---|---|---|
|
|
No error occurred or was detected. |
|
|
An error occurred during a read operation. |
|
|
An error occurred during a write operation. |
|
|
An error occurred when attempting to open the serial port or TCP connection. |
|
|
An error occurred when attempting to set a configuration parameter. |
|
|
A timeout occurred during I/O. An I/O operation did not finish within a given time frame. |
|
|
A Modbus specific protocol error occurred. |
|
|
The reply was aborted due to a disconnection of the device. |
|
|
An unknown error occurred. |
|
|
The bus is overloaded with requests or timeouts so at least one request has been dropped. |
State
This enumeration describes all possible states of the Modbus device.
Name |
Value |
Description |
|---|---|---|
|
|
The Modbus device is disconnected. |
|
|
The Modbus device is being connected. |
|
|
The Modbus device is connected. |
|
|
The Modbus device is closing/shutting down. |