summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-06-15 10:39:09 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-06-17 14:21:47 +0000
commit77d797d6998768acfd5bfcef686974732670fa5d (patch)
tree05e81523668669fae5b3a9d09435400de054d9bc /src
parente51701cc6cccb03d3b39f5777faad33c53715401 (diff)
Modbus: extend documentation
Clarify that default Modbus client implementation does not handle all FunctionCodes and that this needs to be implemented in the custom Modbus clients. Also explicitly mention that UnknownError can also mean that the received function code is not implemented. This commit amends 09927894825d97197ffa656576e6be780371dda0 Fixes: QTBUG-103879 Change-Id: Ifb70107cda2595293b9759504fcfc1ca1a3abfa7 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com> (cherry picked from commit 8360fcd497bcf6e52412629cd4e29f1ef05a93d6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/serialbus/qmodbusclient.cpp8
-rw-r--r--src/serialbus/qmodbusdevice.cpp7
2 files changed, 13 insertions, 2 deletions
diff --git a/src/serialbus/qmodbusclient.cpp b/src/serialbus/qmodbusclient.cpp
index 72cc5a0..a91ba46 100644
--- a/src/serialbus/qmodbusclient.cpp
+++ b/src/serialbus/qmodbusclient.cpp
@@ -222,8 +222,12 @@ QModbusClient::QModbusClient(QModbusClientPrivate &dd, QObject *parent) :
}
/*!
- Processes a Modbus server \a response and stores the decoded information in \a data. Returns
- true on success; otherwise false.
+ Processes a Modbus server \a response and stores the decoded information in
+ \a data. Returns \c true on success; otherwise \c false.
+
+ \note The default implementation does not support all
+ \l {QModbusPdu::}{FunctionCode}s. Override this method in a custom Modbus
+ client implementations to handle the needed functions.
*/
bool QModbusClient::processResponse(const QModbusResponse &response, QModbusDataUnit *data)
{
diff --git a/src/serialbus/qmodbusdevice.cpp b/src/serialbus/qmodbusdevice.cpp
index 8036355..91a7652 100644
--- a/src/serialbus/qmodbusdevice.cpp
+++ b/src/serialbus/qmodbusdevice.cpp
@@ -204,6 +204,13 @@ void QModbusDevice::setConnectionParameter(int parameter, const QVariant &value)
\value ReplyAbortedError The reply was aborted due to a disconnection of
the device.
\value UnknownError An unknown error occurred.
+
+ \note An UnknownError can also indicate that the received
+ \l {QModbusPdu::}{FunctionCode} is not supported in the current
+ implementation. In this case custom Modbus client implementations need to
+ override the \l {QModbusClient::}{processResponse()} and
+ \l {QModbusClient::}{processPrivateResponse()} methods to provide support
+ for needed functions.
*/
/*!