diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2018-11-09 15:43:03 +0100 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2018-11-14 10:20:55 +0000 |
commit | fb7a0ef5b31cba52a745006bf9dca61101229de8 (patch) | |
tree | d18579ac2d93031771230c3fa6bb3bb4141172cf | |
parent | df3487b7609fdbe55fff9d116f95d68567f11393 (diff) |
Improve QModbusDevice connect/open documentation
QModbusDevice::open() & connectDevice() can cover asynchronous and synchronous
connect behavior. This was not very obvious in the documentation. This patch
fixes this uncertainty.
Fixes: QTBUG-71282
Change-Id: I554ea7a8073f9b72027208f5deac4ac3ecc4ccee
Reviewed-by: André Hartmann <aha_1980@gmx.de>
-rw-r--r-- | src/serialbus/qmodbusdevice.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/serialbus/qmodbusdevice.cpp b/src/serialbus/qmodbusdevice.cpp index 7ef358c..aa1bddc 100644 --- a/src/serialbus/qmodbusdevice.cpp +++ b/src/serialbus/qmodbusdevice.cpp @@ -228,10 +228,14 @@ void QModbusDevice::setConnectionParameter(int parameter, const QVariant &value) */ /*! - Connects the device to the Modbus network. Returns \c true on success; - otherwise \c false. + Connects the device to the Modbus network. Returns \c true if the connection + process was successfully initiated; otherwise \c false. Final connection + success confirmation requires the \l state() changing to \l QModbusDevice::ConnectedState. + This function calls \l open() as part of its implementation. + + \sa open() */ bool QModbusDevice::connectDevice() { @@ -333,11 +337,13 @@ QString QModbusDevice::errorString() const This function is called by connectDevice(). Subclasses must provide an implementation that returns \c true on successful Modbus connection - or \c false otherwise. + or connection initiation; otherwise returns \c false. The implementation must ensure that the instance's \l state() - is set to \l QModbusDevice::ConnectedState upon success; otherwise - \l QModbusDevice::UnconnectedState. + is set to \l QModbusDevice::ConnectingState or \l QModbusDevice::ConnectedState upon success; otherwise + \l QModbusDevice::UnconnectedState. Typically, \l QModbusDevice::ConnectingState is used + when the connection process reports back asynchronously and \l QModbusDevice::ConnectedState + in case of synchronous connect behavior. \sa connectDevice() */ |