1
0
mirror of https://github.com/qt/qtmqtt.git synced 2026-10-25 16:16:26 +00:00
Commit Graph

82 Commits

Author SHA1 Message Date
Alexandru Croitor
5ea20cc458 CMake: Regenerate projects
And use an updated coin instruction file.

Change-Id: I852d38febe9ecaa86c516b7f4a0451d0f80d8011
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-05-26 17:43:51 +02:00
Alexandru Croitor
a450023285 Merge remote-tracking branch 'origin/wip/cmake' into dev
Change-Id: I5074da47986bcc826d3990238b02ebe7e6cc3d2e
2020-05-26 17:38:47 +02:00
Maurice Kalinowski
07b7baf3ca Regenerate projects
Change-Id: I8b306c077030ffe1904d42f813f3b7cacc35a0c9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-26 15:23:16 +00:00
Konstantin Ritt
f702420627 Tst_QMqttClient: fix the FakeServer's response regarding payload size
Change-Id: Ia4df16b8ad37c1d241b959dfc4c3194b770c7813
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-05-06 11:16:06 +00:00
Maurice Kalinowski
e1ac865ac6 Add runtime check for different test server
Some test servers might have different configurations.
For instance, mosquitto broker provides a different
default value for topic aliases.

Change-Id: I00bc9c6b27d06358a352f9c0adb04e4044666aac
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-05-06 08:30:54 +02:00
Maurice Kalinowski
824635b275 Increase waiting time
mosquitto MQTT5 support seems to wait longer to send
will messages.

Change-Id: I2c13609e228319ce8fefc5e79d4f99bbfe0b061b
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-05-06 08:30:51 +02:00
Alexandru Croitor
113f7ee864 Regenerate projects
Change-Id: I7574a6156e4c340ba94007176287a5d1bcb7f9e1
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-15 13:02:47 +00:00
Maurice Kalinowski
4e5af443ef Add initial support for cmake
Change-Id: I40153b0f225d67afebfaf3ff0b1c43a9c2f69b8c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-02 07:06:48 +00:00
Maurice Kalinowski
dcf3bbb980 Add autoKeepAlive to QMqttClient
In certain scenarios, a user wants to manually handle the keepAlive.
Introduce autoKeepAlive as a property. If set to false, then the user
needs to handle the keepAlive by invoking requestPing.

The default for this property is true and keeps the current behavior.

Task-number: QTBUG-76782
Change-Id: I073874e6bdacf3c8d128c20431606affe1d9eeb1
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
2019-08-20 15:21:36 +02:00
Qt Forward Merge Bot
9a2e77fc1f Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
	.qmake.conf

Change-Id: I39fabafba7b8bd591909ed6e32be619b1db73cf0
2019-07-11 14:44:26 +02:00
Maurice Kalinowski
d25a0abe78 Allow empty will messages
A will message is allowed to be empty. Hence, check whether a will topic
exists to identify incorporating the last will to the connect message.

Task-number: QTBUG-76783
Change-Id: Ifb7f5467e8e7e70c6d9c050b36a35df2419f4171
Reviewed-by: hjk <hjk@qt.io>
2019-07-02 12:52:04 +02:00
hjk
2c24a9ec62 Avoid deprecated use of QTime
Change-Id: If95c4f918b83057001bc43e01e9450ba1d08b475
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2019-07-01 15:42:31 +02:00
Maurice Kalinowski
acff2f2611 Fix server test code
For MQTT 5 the fake server did not send any property information. Hence,
the client (potentially) read among the buffer.

Change-Id: I58c7d1b4a1f15a0803c04495c82537f648c8a642
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2019-04-18 08:13:48 +00:00
Maurice Kalinowski
7d2525e623 Rename shared subscription functions
As agreed on the review process, using sharedSubscription(Name) is more
verbose and descriptive.

Change-Id: I81fa5d9f74ecd12d3b90d485f67b52dfb4f70bf5
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
2018-09-12 10:42:52 +00:00
Maurice Kalinowski
b3ee3a0fe1 Add test for subscription overlap
Furthermore also verifies subscription IDs are handled
properly.

Change-Id: I7bad65d6cbbe60fb005056dc0e31ef4e7a0a8ffa
Reviewed-by: hjk <hjk@qt.io>
2018-08-20 06:28:08 +00:00
Qt Forward Merge Bot
4bae427962 Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I780e10a6fa43d24e2770be9b610a0579d4e66454
2018-08-18 03:00:50 +02:00
Kevin Funk
d84eeec724 Fix CMake unit tests
Before failed with:
.../qtmqtt/tests/auto/cmake/build/module_includes/main.cpp:4:16: fatal error: QMqtt: No such file or directory
       #include <QMqtt>
                ^~~~~~~

Task-number: QTBUG-68343
Change-Id: I1000f533b2b29558f3c2b0d23c64c2c621e641e5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-08-16 09:37:52 +00:00
Maurice Kalinowski
5ef7e409fb Add support for message status updates
A user might be interested in knowing the exact state of a message while
publishing or when a message is received.

Task-number: QTPM-1453
Task-number: QTBUG-66599
Change-Id: Ibf977f76ba6078b5b525ba00b6988d4b69960176
Reviewed-by: hjk <hjk@qt.io>
2018-08-14 03:47:04 +00:00
Maurice Kalinowski
d7cd172677 Fix tests for brokers with no server connection properties
VerneMQ does not send any server connection properties at all and relies
on the default values set by the standard. All other implementations
behave differently so far, mostly to set lower limits (i.e. max packet
size).

Change-Id: I01824640021651cfe752523803b9797aed197fc9
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2018-08-10 13:23:26 +00:00
Maurice Kalinowski
e8bdfe7b4c Rename QMqttPublishProperties::subscriptionIdentifiers
The standard did not mention it explicitly to be a list. However,
quoting "Multiple Subscription Identifiers will be included if the
publication is the result of a match to more than one subscription, in
this case their order is not significant" clearly indicates that
multiple subscription ids can be part of a publish message.

Change-Id: I1a45564a719847020e24aec7d0385807f3be3aa4
Reviewed-by: hjk <hjk@qt.io>
2018-08-09 10:30:36 +00:00
Maurice Kalinowski
b9ac8d04f2 MQTT5: Rename QMqttServerConnectionProperties::reasonString
Use reason() as name for consistency with other cases.

Change-Id: I9219a0fd47520f10f1c4b85fd0c4428dcc2d39a1
Reviewed-by: hjk <hjk@qt.io>
2018-08-09 10:30:17 +00:00
Maurice Kalinowski
0deebaab6d MQTT5: Introduce support for topic aliases
Task-number: QTPM-1490
Change-Id: Ie666d4c0dd75c08083a6860f345144ee1efb3d83
Reviewed-by: hjk <hjk@qt.io>
2018-08-08 04:39:20 +00:00
Maurice Kalinowski
4ffc9efc7b MQTT5: Introduce AUTH support
Task-number: QTPM-1455
Change-Id: I8eef500fe5eb0e8a36f449534c70e35487c04a7b
Reviewed-by: hjk <hjk@qt.io>
2018-08-02 09:15:55 +00:00
Maurice Kalinowski
bcc2a4e7b5 Disallow property changes while connected
Certain properties cannot be changed while connected and hence this
should be reflected in the behavior.

Task-number: QTBUG-67176
Change-Id: Ib9baafa1ac8d99d7a071839c892187efb51491e0
Reviewed-by: hjk <hjk@qt.io>
2018-08-02 07:43:40 +00:00
Maurice Kalinowski
001c3e7edc MQTT5: Add support for shared subscriptions
The scheme to create a shared subscription is $share/sharename/
topicfilter. During QMqttSubscription creation, the topic gets split and
shareName is a newly introduced property to verify whether a
subscription has been shared.

Task-number: QTPM-1452
Change-Id: I99c1aa9bb3bf8db2a930ce031c1a0a4882f01bcd
Reviewed-by: hjk <hjk@qt.io>
2018-07-30 11:52:32 +00:00
Maurice Kalinowski
f9ad481abc MQTT5: Introduce QMqttUnsubscriptionProperties
While removing a subscription, properties can be passed. V5.0 only
specifies user properties.

Task-number: QTPM-1454
Change-Id: Id068875c1947c9479175f6e5458713e038f7454f
Reviewed-by: hjk <hjk@qt.io>
2018-07-26 10:10:07 +00:00
Maurice Kalinowski
19475c3403 Move qWarning to categorized logging
qWarning could potentially quit an application while it is easily
possible to recover from an error state. Hence avoid usage of qWarning
inside the module.

Task-number: QTBUG-69544
Change-Id: I7340f38d80e6716450fbcd0918226e9435d37daa
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2018-07-26 08:16:07 +00:00
Maurice Kalinowski
86b2366942 Enable server client id test
When a client connects without a client id, the server might decide to
assign one to the client. The test was disabled so far, but
QMqttServerConnectionProperties handles this properly now.

Change-Id: If013ba67aa1f08c8842b872a6125e7d2bfa6430d
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-24 12:32:43 +00:00
Maurice Kalinowski
ba94777b84 MQTT5: Add support for last will properties
Task-number: QTPM-1451
Change-Id: I26a12b944eddb029f7fffe8c1af1610ff79cc494
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
2018-07-24 12:32:37 +00:00
Maurice Kalinowski
29420b9f6c Move PayloadFormatIndicator to dedicated namespace
The PayloadFormatIndicator is used on multiple places.
Consequently, avoid duplication of this enum and move it to
a module namespace. It is not sufficient to have it inside QMqttClient.

Change-Id: I1113de55e69a5f548cdf4feba435b806949a8153
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
2018-07-24 12:32:24 +00:00
hjk
629f52ae27 Avoid a few compiler warnings
Signed/unsigned comparison and an unused argument.

Change-Id: Iec452f058d6e40d24dc66261cb221b45cc89d59a
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2018-07-24 12:32:17 +00:00
hjk
47c4ef3e53 Suppress some signed vs unsigned warnings in tests
Change-Id: Iae17f5ce94ef28dcf510cdbd1a78acc5ffc05e35
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2018-07-20 12:30:17 +00:00
Maurice Kalinowski
de25c6b78d Make test topics unique to test class
Always use a prefix for topics inside a test class. Otherwise running
multiple tests concurrently can cause failures as test data is shared
among the broker and behavior becomes unreliable.

Task-number: QTBUG-69549
Change-Id: Ia9886826f65e8e40826fcd9a83bb8ec5a1a8e850
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2018-07-20 11:55:23 +00:00
Maurice Kalinowski
4816c09e20 MQTT5: Add QMqttSubscriptionProperties auto tests
Change-Id: Ib8eb4a657210574bfc3a8a6cf223582dd5ad2915
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2018-07-20 11:54:30 +00:00
Maurice Kalinowski
56d3a0f98a MQTT5: Add QMqttPublishProperties auto tests
Change-Id: I12b161e5aeddd254ba1ec7f29f0153a75f4a69ff
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2018-07-20 11:54:13 +00:00
Maurice Kalinowski
f18abd4703 MQTT5: Add QMqttConnectionProperties tests
Change-Id: Ia1c3bf862731bc5c3e8919f1d61a52ec3af0b78e
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2018-07-20 11:53:49 +00:00
Maurice Kalinowski
307eaa2cf8 MQTT5: Update tests
Some tests require checks for MQTT5

Change-Id: If3c22c9c805a137d90b27bae0bdc9d77e17cd8a1
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2018-07-20 11:53:40 +00:00
Maurice Kalinowski
ac666587dd MQTT5: Add initial support
With this patch it is possible to set the version to MQTT5 and
use the same features as against version 3.1.1. No MQTT5 specific
features are enabled.

Change-Id: I129ff8a2c996d7bcc582565fccda9e38edc48c62
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2018-07-20 11:53:14 +00:00
Maurice Kalinowski
c0b9b02896 Remove superfluous wait
Prefer QTRY_ instead of using wait and VERIFY.

Change-Id: I4699dd6e7865b2043534d624875071b0882cce45
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
2018-06-13 11:17:20 +00:00
Maurice Kalinowski
0aa6dadcf5 Allow overwriting client defaults
Some test brokers require credentials to allow a connection. To be able
to verify the module against those, add a mean to pass those to the
client and run the auto tests without modification.

Change-Id: I10b8e2343f7fc66199d70f5f238f69b07665110a
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
2018-06-13 11:17:13 +00:00
Maurice Kalinowski
434ed83741 Fix connecting via an already open QIODevice transport
In case a transport is handed over to QMqttClient which is based on
QIODevice and already opened, the implementation was not sending a
CONNECT request and hence the broker never got informed about a new
client establishing connection. Hence manually send the connect
statement.

For QAbstractSocket based transports this was done already.

Task-number: QTBUG-66955
Change-Id: I50cba1b6dd03d0af561d4e39a3b57af5b2161a4b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2018-03-12 09:10:50 +00:00
Maurice Kalinowski
539bc149f0 Fix memory leak in tests
The QTcpServer did not get deleted on destruction.

Change-Id: I525b6d4602aaf23dde193ef2d0dc49bc30898741
Reviewed-by: Andrew O'Doherty <andrew.odoherty@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2018-03-07 07:35:08 +00:00
Maurice Kalinowski
68fe97befd Fix reconnecting after transport error
In case a connection fails due to a transport error, the client must be
able to try to reconnect. Hence, reset the error state when
connectToHost is called. Furthermore the socket needs to be re-created
if it has been instantiated by QMqttClient previously.

Task-number: QTBUG-65726
Change-Id: Id54e5f91a8ca4d0c7be6f51f1ad79e090c681584
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2018-02-02 07:59:24 +00:00
Maurice Kalinowski
6b6d2749e6 Fix subscriptions at reconnect
When a client reconnects with a cleanSession, all previous subscriptions
need to be disabled due to not being valid anymore. Furthermore, a
broker can decide to not restore a session even though cleanSession was
false. Take this into account by disabling existing subscriptions in
that case as well.

Task-number: QTBUG-64042
Change-Id: I618bc1fe4bb30651a34d70ec9d9e95e48b1c25d5
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2017-11-15 14:06:41 +00:00
Lorenz Haas
6eca6f914d Introduce specific types for topic names and filters
For "topics" the standard defines topic names and topic filters with
specific characteristics. QMqttTopicName and QMqttTopicFilter implement
this requirements.

[ChangeLog][General] Added QMqttTopicName and QMqttTopicFilter

Change-Id: Ie2b6851ec9249f20d05c4b8df3c2f27afc2be4b9
Reviewed-by: hjk <hjk@qt.io>
2017-11-15 13:18:31 +00:00
Maurice Kalinowski
70b7ee03c5 Fix publishing of data containing arbitrary content
Using QByteArray::append(const char*) checks for \0 and stops copying
into the payload. Instead use the QByteArray version, which ideally just
shares the data or uses the explicit size of the data, ignoring the
content of the data.

Change-Id: Ifdabd7508c738fbd9b3967a745904f1cc95dfb7d
Reviewed-by: Lorenz Haas <lorenz.haas@histomatics.de>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2017-11-14 07:21:19 +00:00
Jani Heikkinen
984527e516 Update license headers
Change-Id: If9b7f82a71ec554b152485ddd91a9d105019c6ce
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-09-25 11:58:23 +00:00
Maurice Kalinowski
0693346b4e Revert "Disable auto tests"
This reverts commit ca21591cdb.

Provisioning scripts should be done now and tests be able to run
on Windows and Linux.

Change-Id: I04eeb12ebcf6486902fa624f55fed0f4728c473d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-09-23 06:38:07 +00:00
Maurice Kalinowski
ca21591cdb Disable auto tests
Currently updating the provisioning scripts is not possible. Hence, the
paho test broker cannot be installed on test machines and tests not be
run.

Change-Id: I3ba2c5453101dc52378c96684e5324a3c06367a8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-09-04 13:49:12 +00:00
Maurice Kalinowski
5986b03bad Change signature of QMqttClient::subscribe
Instead of returning a QSharedPointer, return the same pointer. This
improves readability as well as using the subscription from a user
perspective.

The ownership has to stay with the client though, otherwise behavior
is unexpected.

Change-Id: I72d3c15a12faf45c9575af8b3a790dfff1a30c2a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-09-01 18:52:20 +00:00