As running the unit tests requires a specific setup, this should be
documented.
Change-Id: Ia9059e6590c54bd232842fc02a4dc91dd630f48f
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
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>
Checking for NoError was done on the wrong variable.
Change-Id: I3206333c0e69124ac22ccddcd329a63b7df0f761
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Currently CI was importing all modules and not just qtbase,
which is the only module it depends on.
Change-Id: I4ddb5773be5c4dff81126f885aca1b8c55b0ac49
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
The old test yield false if for example 3 bytes where received and the
second byte had no continuation bit but the third byte. In such a case
the third byte, however, is not part of the fixed header any more. Thus
the fixed header must considered complete.
Task-number: QTBUG-64965
Change-Id: Ie2853d11edeabc5ab3d06e98c3628af99a4d9ea8
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
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>
As the class is exported now, move the data members to a private class.
Furthermore payload should just return a const-ref in case no copy is
needed.
Change-Id: I273d235431b2f4d6e2834b2a9c6934a23daf3962
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
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>
Furthermore avoid qFatal and allow the user to gracefully handle an
invalid protocol version.
Change-Id: Idd3cbe9eaa53afd179691890f602354e4e26e9f1
Reviewed-by: Lorenz Haas <lorenz.haas@histomatics.de>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Second argument is superfluous in this case.
Change-Id: Id0b5444741375000929d26ea8567ba85b33f2ba7
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
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>
Instead of querying the properties each time from the client, prefer to
use QMqttClientPrivate, which stores the value types.
Change-Id: I3f199029dc82077bd67a46a922206502b6519dfd
Reviewed-by: Lorenz Haas <lorenz.haas@histomatics.de>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
There is no reason to use waitForConnected, instead asynchronously react
when the connection is established.
As a side-effect UWP can use this module now without any issue as well.
Change-Id: Ib30f13e42a8cb5c17f83aca594139926e056b932
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The example has no UI and Qt Creator requires an image for the
Welcome page Examples tab.
Change-Id: I9371583d4fd117a617e4b32c67557600802f18cd
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
This file was somehow overlooked in a previous commit.
Change-Id: Ibfd5622cb23b66559e72e24eaf3112ef4aee45fa
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
According to the standard's section "4.8 Handling errors" the client
must close the current connection if it encounters a protocol violation.
Change-Id: I0be8fb381d42e7d90dd871d3a959fce9d478ea65
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Rename State to ClientState to avoid clashing names with other state
management.
Introduce ClientError to provide further information on occurring
errors. Error values 1-5 are from the standard, followed by Qt specific
error values.
Change-Id: Ica1b703845e93e923fd1af4e3fb6ffb95de8390d
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Make sure that the auto generated client ID is accepted by a standard
compliant server. On the other hand do not forbid client IDs longer than
23 characters because servers MAY allow longer IDs.
Change-Id: I6ccbd140586c2327b8675cd7aeb31bdde0d51f27
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Since the remaining length can be up to 4 bytes long make sure that
there are enough bytes transmitted to parse the fix header correctly.
Change-Id: I3830d3abb308c86048cac3a00a80067194caa482
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
While there has been some initial API documentation for the preview
release, incorporate further updates to make the module fully
documented.
Additional minor updates due to API changes.
Task-number: QTBUG-63362
Change-Id: Ib472e4d4d18d505e77fdef3c14483c31628f8546
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The standard requires that the identifier is non-zero and currently
unused. The identifier has also to be unique in the scope of the client,
not only to SUBSCRIBE, UNSUBSCRIBE, and PUBLISH messages.
Change-Id: Ide1546dbc3282fe256f08f9d3cd779ffea0318a5
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
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>
PYTHON3_PATH only returns the directory containing python.
If the environment variable is not set, assume python3 to be in the
path.
Circumvent potential issues when launching the broker, but broker not
being ready to handle connections.
Change-Id: I594e21286bae8b4646fa079c9294d34102c57e66
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Sending UNSUBSCRIBE for all subscriptions before disconnecting will
cause the broker to not store any messages afterwards by the standard.
However, mosquitto does so and hence conformance tests succeeded even
though they should not have. This was revealed when using the paho
conformance testing broker in the CI.
Task-number: QTBUG-63318
Change-Id: I5c2410b45b7c0e5bf5cebeb13a8aa8dfd9f0ae3a
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
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>
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>
Even though there is no default QML binding available, it is pretty easy
to use QMqttClient directly exported like in the example. A user then
might want to publish messages in addition to receiving them.
Change-Id: I81e9ad61ffea7c833317986bbf5b5acf293a2ccd
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>