diff options
author | Leena Miettinen <riitta-leena.miettinen@qt.io> | 2017-10-25 13:45:58 +0200 |
---|---|---|
committer | Leena Miettinen <riitta-leena.miettinen@qt.io> | 2017-11-08 08:46:44 +0000 |
commit | 6d4ca0a999d18f6f8e01afa9762ae3e77eac71db (patch) | |
tree | 552a7b9801d6ba770d0c283f0898c62e64edb929 /examples | |
parent | 7bc7efd1b97b942c5b21e9c5a1908519ab3fdbe4 (diff) |
Doc: Add screenshot and details to Simple MQTT Client example docs
Change-Id: Idd0549a40365f12dc7cbe1f73696cb6cef1138f4
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/mqtt/doc/images/simpleclient.png | bin | 0 -> 32318 bytes | |||
-rw-r--r-- | examples/mqtt/doc/simpleclient.qdoc | 46 |
2 files changed, 44 insertions, 2 deletions
diff --git a/examples/mqtt/doc/images/simpleclient.png b/examples/mqtt/doc/images/simpleclient.png Binary files differnew file mode 100644 index 0000000..f7c216d --- /dev/null +++ b/examples/mqtt/doc/images/simpleclient.png diff --git a/examples/mqtt/doc/simpleclient.qdoc b/examples/mqtt/doc/simpleclient.qdoc index 959901b..92140ed 100644 --- a/examples/mqtt/doc/simpleclient.qdoc +++ b/examples/mqtt/doc/simpleclient.qdoc @@ -54,7 +54,49 @@ \ingroup qtmqtt-examples \brief Creating a minimalistic telemetry application. - \e {Simple MQTT Client} demonstrates how to use the QMqttClient class - for creating a minimalistic telemetry application. + \image simpleclient.png + \e {Simple MQTT Client} demonstrates how to create a minimalistic client + application. + + To use the application, you first specify a broker, such as + \e test.mosquitto.org or \e broker.hivemq.com and the port number 1883, and + connect to it. You can then subscribe to a topic and send a message, which + you will also receive. + + \note Port number 1883 is not encrypted, and therefore it is suitable only + for development and testing purposes. In production, always use encrypted + connections. + + \section1 Creating a Client + + First, we use the QMqttClient class to create an MQTT client. The class + provides properties for setting a unique client ID as well as the broker + host name and port to connect to: + + \quotefromfile simpleclient/mainwindow.cpp + \skipto m_client + \printuntil setPort + + We do not set the client ID, and therefore it will be automatically + generated for us. + + Next, we connect to QMqttClient::messageReceived() to receive all messages + sent to the broker: + + \skipto messageReceived + \printuntil } + + When users subscribe to topics in the client, we call + QMqttClient::subscribe() on the specified topic: + + \skipto on_buttonSubscribe_clicked + \printuntil } + + In this example, we subscribe to all topics. For more information about + how to receive messages on particular topics, see + \l {MQTT Subscriptions Example}. + + For an example of how to use the QMqttClient class in a Qt Quick + application, see \l {Quick MQTT Example}. */ |