summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-06-15 10:39:09 +0200
committerIvan Solovev <ivan.solovev@qt.io>2022-06-17 12:08:38 +0200
commit8360fcd497bcf6e52412629cd4e29f1ef05a93d6 (patch)
treeb9b089ffbd4d02d5b5bc2ca7d36cdad12a612839
parenta2ef435e6479af0cf6d051de146991af19ccba68 (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 Pick-to: 6.4 6.3 6.2 5.15 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>
-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 29914e5..6f1335e 100644
--- a/src/serialbus/qmodbusclient.cpp
+++ b/src/serialbus/qmodbusclient.cpp
@@ -186,8 +186,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 ad215d9..e7b891f 100644
--- a/src/serialbus/qmodbusdevice.cpp
+++ b/src/serialbus/qmodbusdevice.cpp
@@ -166,6 +166,13 @@ void QModbusDevice::setConnectionParameter(ConnectionParameter parameter, const
\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.
*/
/*!