diff options
author | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-11-24 14:56:29 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@theqtcompany.com> | 2015-11-24 19:57:15 +0000 |
commit | 2715e92e13997cfce1d654718f0297b268251202 (patch) | |
tree | faf573d92aac3fba3f2101d7cd61bad66e357601 /tests | |
parent | 809f1af7ae7c540b197a2e10f4971cad109343b2 (diff) |
Move QModbusClient responseTimer into QModbusRtuSerialMaster
The TCP client doesn't use a queue system for requests and therefore
needs one timer per request. Therefore the abstraction offered by
QModbusClient is not suitable for the TCP client. As a consequence
we move the response timer into the RTU client implementation.
Change-Id: Ic30dfd730bcdae42ee7515be0fdf0eaff64af2fa
Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qmodbusclient/tst_qmodbusclient.cpp | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/tests/auto/qmodbusclient/tst_qmodbusclient.cpp b/tests/auto/qmodbusclient/tst_qmodbusclient.cpp index cf72a41..eb8d976 100644 --- a/tests/auto/qmodbusclient/tst_qmodbusclient.cpp +++ b/tests/auto/qmodbusclient/tst_qmodbusclient.cpp @@ -42,13 +42,7 @@ class TestClientPrivate : public QModbusClientPrivate { -public: - void handleResponseTimeout() Q_DECL_OVERRIDE - { - timeoutCounter++; - } - int timeoutCounter = 0; }; class TestClient : public QModbusClient @@ -59,7 +53,7 @@ class TestClient : public QModbusClient public: TestClient(QObject *parent = Q_NULLPTR) - : QModbusClient(*new TestClientPrivate, parent) + : QModbusClient(parent) {} virtual bool open() Q_DECL_OVERRIDE { return true; } @@ -89,20 +83,6 @@ private slots: // test timer firing off client.setTimeout(100); QCOMPARE(client.timeout(), 100); - - TestClientPrivate *tcp = client.d_func(); - - tcp->startResponseTimer(); - QTRY_COMPARE(tcp->timeoutCounter, 1); - QTest::qWait(1000); // wait to test single shot character of timer - QCOMPARE(tcp->timeoutCounter, 1); - - - client.setTimeout(-1); - QCOMPARE(client.timeout(), -1); - tcp->startResponseTimer(); - QTest::qWait(4000); //long enough to account for time deviations in Qt CI - QCOMPARE(tcp->timeoutCounter, 1); } void testProcessReadWriteSingleMultipleCoilsResponse() |