QModbusReply#
The QModbusReply
class contains the data for a request sent with a QModbusClient
derived class. More…
Synopsis#
Functions#
def
addIntermediateError
(error)def
error
()def
errorString
()def
intermediateErrors
()def
isFinished
()def
result
()def
serverAddress
()def
setError
(error, errorText)def
setFinished
(isFinished)def
setResult
(unit)def
type
()
Signals#
def
errorOccurred
(error)def
finished
()def
intermediateErrorOccurred
(error)
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description#
- class PySide6.QtSerialBus.QModbusReply(type, serverAddress[, parent=None])#
- Parameters:
serverAddress – int
type –
ReplyType
parent –
PySide6.QtCore.QObject
Constructs a QModbusReply
object with a given type
and the specified parent
.
The reply will be sent to the Modbus client represented by serverAddress
.
- PySide6.QtSerialBus.QModbusReply.ReplyType#
This enum describes the possible reply type.
Constant
Description
QModbusReply.Raw
The reply originates from a raw Modbus request. See
sendRawRequest
QModbusReply.Common
The reply originates from a common read, write or read/write request. See
sendReadRequest
,sendWriteRequest
andsendReadWriteRequest
QModbusReply.Broadcast
The reply originates from a Modbus broadcast request. The
serverAddress()
will return0
and thefinished()
signal will be emitted immediately.
- PySide6.QtSerialBus.QModbusReply.addIntermediateError(error)#
- Parameters:
error –
IntermediateError
Returns the error state of this reply.
See also
This signal is emitted when an error has been detected in the processing of this reply. The finished()
signal will probably follow.
The error will be described by the error code error
. If errorString
is not empty it will contain a textual description of the error. In case of a ProtocolError
the rawResult()
function can be used to obtain the original Modbus exception response to get the exception code.
Note: Do not delete this reply object in the slot connected to this signal. Use deleteLater()
instead.
See also
- PySide6.QtSerialBus.QModbusReply.errorString()#
- Return type:
str
Returns the textual representation of the error state of this reply.
If no error has occurred this will return an empty string. It is possible that an error occurred which has no associated textual representation, in which case this will also return an empty string.
See also
- PySide6.QtSerialBus.QModbusReply.finished()#
This signal is emitted when the reply has finished processing. The reply may still have returned with an error.
After this signal is emitted, there will be no more updates to the reply’s data.
Note
Do not delete the object in the slot connected to this signal. Use deleteLater()
.
You can also use isFinished()
to check if a QNetworkReply
has finished even before you receive the finished() signal.
See also
- PySide6.QtSerialBus.QModbusReply.intermediateErrorOccurred(error)#
- Parameters:
error –
IntermediateError
- PySide6.QtSerialBus.QModbusReply.intermediateErrors()#
Returns the list of intermediate errors that might have happened during the send-receive cycle of a Modbus request until the QModbusReply
reports to be finished.
- PySide6.QtSerialBus.QModbusReply.isFinished()#
- Return type:
bool
Returns true
when the reply has finished or was aborted.
See also
- PySide6.QtSerialBus.QModbusReply.result()#
- Return type:
Returns the preprocessed result of a Modbus request.
For read requests as well as combined read/write requests send via sendReadWriteRequest()
it contains the values read from the server instance.
If the request has not finished, has failed with an error or was a write request then the returned QModbusDataUnit
instance is invalid.
Note
If the type()
of the reply is Broadcast
, the return value will always be invalid. If the type()
of the reply is Raw
, the return value might be invalid depending on the implementation of processPrivateResponse()
.
See also
type()
rawResult()
processPrivateResponse()
- PySide6.QtSerialBus.QModbusReply.serverAddress()#
- Return type:
int
Returns the server address that this reply object targets.
- PySide6.QtSerialBus.QModbusReply.setError(error, errorText)#
- Parameters:
error –
Error
errorText – str
- PySide6.QtSerialBus.QModbusReply.setFinished(isFinished)#
- Parameters:
isFinished – bool
- PySide6.QtSerialBus.QModbusReply.setResult(unit)#
- Parameters:
Returns the type of the reply.