Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package qt6-mqtt for openSUSE:Factory checked in at 2023-10-13 23:14:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/qt6-mqtt (Old) and /work/SRC/openSUSE:Factory/.qt6-mqtt.new.20540 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "qt6-mqtt" Fri Oct 13 23:14:17 2023 rev:24 rq:1116939 version:6.6.0 Changes: -------- --- /work/SRC/openSUSE:Factory/qt6-mqtt/qt6-mqtt.changes 2023-10-02 20:07:24.784847139 +0200 +++ /work/SRC/openSUSE:Factory/.qt6-mqtt.new.20540/qt6-mqtt.changes 2023-10-13 23:14:45.555207195 +0200 @@ -1,0 +2,6 @@ +Tue Oct 10 09:39:53 UTC 2023 - Christophe Marin <christo...@krop.fr> + +- Update to 6.6.0 + * https://www.qt.io/blog/qt-6.6-released + +------------------------------------------------------------------- Old: ---- qtmqtt-everywhere-src-6.5.3.tar.xz New: ---- qtmqtt-everywhere-src-6.6.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ qt6-mqtt.spec ++++++ --- /var/tmp/diff_new_pack.C5LecP/_old 2023-10-13 23:14:46.051225185 +0200 +++ /var/tmp/diff_new_pack.C5LecP/_new 2023-10-13 23:14:46.055225331 +0200 @@ -16,8 +16,8 @@ # -%define real_version 6.5.3 -%define short_version 6.5 +%define real_version 6.6.0 +%define short_version 6.6 %define tar_name qtmqtt-everywhere-src %define tar_suffix %{nil} # @@ -27,7 +27,7 @@ %endif # Name: qt6-mqtt%{?pkg_suffix} -Version: 6.5.3 +Version: 6.6.0 Release: 0 Summary: Qt 6 Module to implement MQTT protocol version 3.1 and 3.1.1 License: GPL-3.0-only WITH Qt-GPL-exception-1.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.C5LecP/_old 2023-10-13 23:14:46.087226492 +0200 +++ /var/tmp/diff_new_pack.C5LecP/_new 2023-10-13 23:14:46.091226637 +0200 @@ -1,9 +1,9 @@ <services> <service name="tar_scm" mode="disabled"> <param name="changesgenerate">disable</param> - <param name="version">6.5.3</param> + <param name="version">6.6.0</param> <param name="url">git://code.qt.io/qt/qtmqtt.git</param> - <param name="revision">v6.5.3</param> + <param name="revision">v6.6.0</param> <param name="scm">git</param> <param name="filename">qtmqtt-everywhere-src</param> </service> ++++++ qtmqtt-everywhere-src-6.5.3.tar.xz -> qtmqtt-everywhere-src-6.6.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/.cmake.conf new/qtmqtt-everywhere-src-6.6.0/.cmake.conf --- old/qtmqtt-everywhere-src-6.5.3/.cmake.conf 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/.cmake.conf 2023-10-03 20:26:55.000000000 +0200 @@ -1,3 +1,3 @@ -set(QT_REPO_MODULE_VERSION "6.5.3") +set(QT_REPO_MODULE_VERSION "6.6.0") set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1") set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_AS_CONST=1") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/coin/axivion/ci_config_linux.json new/qtmqtt-everywhere-src-6.6.0/coin/axivion/ci_config_linux.json --- old/qtmqtt-everywhere-src-6.5.3/coin/axivion/ci_config_linux.json 1970-01-01 01:00:00.000000000 +0100 +++ new/qtmqtt-everywhere-src-6.6.0/coin/axivion/ci_config_linux.json 2023-10-03 20:26:55.000000000 +0200 @@ -0,0 +1,59 @@ +{ + "Project": { + "Git": { + "_active": true, + "sourceserver_gitdir": "/data/axivion/databases/$(env:TESTED_MODULE_COIN).git" + }, + "BuildSystemIntegration": { + "child_order": [ + "GCCSetup", + "CMake", + "LinkLibraries" + ] + }, + "CMake": { + "_active": true, + "_copy_from": "CMakeIntegration", + "build_environment": {}, + "build_options": "-j4", + "generate_options": "--fresh", + "generator": "Ninja" + }, + "GCCSetup": { + "_active": true, + "_copy_from": "Command", + "build_command": "gccsetup --cc gcc --cxx g++ --config ../../../axivion/" + }, + "LinkLibraries": { + "_active": true, + "_copy_from": "AxivionLinker", + "input_files": [ + "build/lib/lib*.so*.ir" + ], + "ir": "build/$(env:TESTED_MODULE_COIN).ir" + }, + "Project-GlobalOptions": { + "directory": "../work/qt/$(env:TESTED_MODULE_COIN)", + "ir": "build/$(env:TESTED_MODULE_COIN).ir", + "name": "qt_$(env:TESTED_MODULE_COIN)_dev_$(env:TARGET_OS_COIN)" + } + }, + "Results": { + "Dashboard": { + "dashboard_url": "https://axivion-srv.ci.qt.io/axivion/" + }, + "Database": { + "ci_mode": { + "directory": "/data/axivion/databases" + } + } + }, + "_Format": "1.0", + "_Version": "trunk-9e0ef9c5818", + "_VersionNum": [ + 7, + 6, + 9999, + 11489 + ] +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/dependencies.yaml new/qtmqtt-everywhere-src-6.6.0/dependencies.yaml --- old/qtmqtt-everywhere-src-6.5.3/dependencies.yaml 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/dependencies.yaml 2023-10-03 20:26:55.000000000 +0200 @@ -1,7 +1,7 @@ dependencies: ../qtbase: - ref: 372eaedc5b8c771c46acc4c96e91bbade4ca3624 + ref: 33f5e985e480283bb0ca9dea5f82643e825ba87c required: true ../qtdeclarative: - ref: e00c258fa5a4e122636d441967dea035865fac5d + ref: e559d5cf2b66c4a973f83f173d57676a21d287ef required: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/CMakeLists.txt new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/CMakeLists.txt --- old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/CMakeLists.txt 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/CMakeLists.txt 2023-10-03 20:26:55.000000000 +0200 @@ -1,7 +1,6 @@ -# Copyright (C) 2022 The Qt Company Ltd. +# Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause -qt_internal_add_example(consolepubsub) if(TARGET Qt::Gui AND TARGET Qt::Widgets) qt_internal_add_example(simpleclient) qt_internal_add_example(subscriptions) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/consolepubsub/CMakeLists.txt new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/consolepubsub/CMakeLists.txt --- old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/consolepubsub/CMakeLists.txt 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/consolepubsub/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,71 +0,0 @@ -# Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: BSD-3-Clause - -cmake_minimum_required(VERSION 3.16) -project(qtmqtt_pub_sub LANGUAGES CXX) - -set(CMAKE_AUTOMOC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/mqtt/consolepubsub") - -find_package(Qt6 REQUIRED COMPONENTS Mqtt) - -# -# Pub -# - -qt_add_executable(qtmqtt_pub - configuration.h - main_pub.cpp -) - -set_target_properties(qtmqtt_pub PROPERTIES - WIN32_EXECUTABLE FALSE - MACOSX_BUNDLE FALSE -) - -target_compile_definitions(qtmqtt_pub PUBLIC - QT_DEPRECATED_WARNINGS -) - -target_link_libraries(qtmqtt_pub PUBLIC - Qt::Mqtt -) - -install(TARGETS qtmqtt_pub - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) - -# -# Sub -# - -qt_add_executable(qtmqtt_sub - configuration.h - main_sub.cpp -) - -set_target_properties(qtmqtt_sub PROPERTIES - WIN32_EXECUTABLE FALSE - MACOSX_BUNDLE FALSE -) - -target_compile_definitions(qtmqtt_sub PUBLIC - QT_DEPRECATED_WARNINGS -) - -target_link_libraries(qtmqtt_sub PUBLIC - Qt::Mqtt -) - -install(TARGETS qtmqtt_sub - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/consolepubsub/configuration.h new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/consolepubsub/configuration.h --- old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/consolepubsub/configuration.h 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/consolepubsub/configuration.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,264 +0,0 @@ -// Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -#include <QByteArray> -#include <QCommandLineParser> -#include <QCommandLineOption> -#include <QDir> -#include <QFile> -#include <QFileInfo> -#include <QLoggingCategory> -#include <QString> -#include <QMqttClient> -#include <QSslConfiguration> -#include <QSslSocket> - -struct Configuration -{ - QString topic; - QByteArray content; - quint8 qos; - bool retain{false}; - bool useEncryption{false}; -#ifndef QT_NO_SSL - QSslConfiguration sslConfiguration; -#endif -}; - -QMqttClient *createClientWithConfiguration(QCoreApplication *app, - Configuration *msg, - bool publish) -{ - QCommandLineParser parser; - if (publish) - parser.setApplicationDescription("Qt MQTT publish tool"); - else - parser.setApplicationDescription("Qt MQTT subscription tool"); - - parser.addHelpOption(); - parser.addVersionOption(); - - QCommandLineOption optionDebug("d", - QLatin1String("Enable debug messages / logging categories")); - parser.addOption(optionDebug); - - QCommandLineOption optionFile("f", - QLatin1String("Specify the content of a file as message."), - QLatin1String("filename")); - if (publish) - parser.addOption(optionFile); - - QCommandLineOption optionClientId("i", - QLatin1String("Specify a client ID. Defaults to random value."), - QLatin1String("clientid")); - parser.addOption(optionClientId); - - QCommandLineOption optionKeepAlive("k", - QLatin1String("Specify the keep-alive value in seconds."), - QLatin1String("keepAlive")); - parser.addOption(optionKeepAlive); - - QCommandLineOption optionMessageContent("m", - QLatin1String("Specify the message content. Defaults to" - " a null message."), - QLatin1String("messageContent")); - if (publish) - parser.addOption(optionMessageContent); - - QCommandLineOption optionPassword("P", - QLatin1String("Provide a password."), - QLatin1String("password")); - parser.addOption(optionPassword); - - QCommandLineOption optionPort("p", - QLatin1String("Network port to connect to. Defaults to 1883."), - QLatin1String("hostPort"), - QLatin1String("1883")); - parser.addOption(optionPort); - - QCommandLineOption optionQos("q", - QLatin1String("Quality of service level to use for all messages." - "Defaults to 0."), - QLatin1String("qos"), - QLatin1String("0")); - parser.addOption(optionQos); - - QCommandLineOption optionRetain("r", - QLatin1String("Specify the retain flag for a message.")); - if (publish) - parser.addOption(optionRetain); - - QCommandLineOption optionHost("s", - QLatin1String("MQTT server to connect to. Defaults to localhost."), - QLatin1String("hostName"), - QLatin1String("localhost")); - parser.addOption(optionHost); - - QCommandLineOption optionMessageTopic("t", - QLatin1String("Specify the message topic."), - QLatin1String("messageTopic")); - parser.addOption(optionMessageTopic); - - QCommandLineOption optionUser("u", - QLatin1String("Provide a username."), - QLatin1String("username")); - parser.addOption(optionUser); - - QCommandLineOption optionVersion("V", - QLatin1String("Specify the protocol version. Options are " - "mqtt31, mqtt311, mqtt5. Defaults to mqtt311."), - QLatin1String("protocolVersion"), - QLatin1String("mqtt311")); - parser.addOption(optionVersion); - - QCommandLineOption optionCaFile("cafile", - QLatin1String("Specify a file containing trusted CA " - "certificates to enable encrypted communication."), - QLatin1String("cafile")); - parser.addOption(optionCaFile); - - QCommandLineOption optionCaPath("capath", - QLatin1String("Specify a directory containing trusted CA " - "certificates to enable encrypted communication."), - QLatin1String("capath")); - parser.addOption(optionCaPath); - - parser.process(*app); - - auto *client = new QMqttClient(app); - - client->setHostname(parser.value(optionHost)); - bool ok = true; - quint16 port = static_cast<quint16>(parser.value(optionPort).toInt(&ok)); - if (!ok) { - qWarning() << "Invalid port specified:" << parser.value(optionPort); - return nullptr; - } - client->setPort(port); - - if (parser.isSet(optionUser)) - client->setUsername(parser.value(optionUser)); - if (parser.isSet(optionPassword)) - client->setPassword(parser.value(optionPassword)); - if (parser.isSet(optionClientId)) - client->setClientId(parser.value(optionClientId)); - if (parser.isSet(optionVersion)) { - const QString version = parser.value(optionVersion); - if (version == QLatin1String("mqtt31")) - client->setProtocolVersion(QMqttClient::MQTT_3_1); - else if (version == QLatin1String("mqtt311")) - client->setProtocolVersion(QMqttClient::MQTT_3_1_1); - else if (version == QLatin1String("mqtt5")) - client->setProtocolVersion(QMqttClient::MQTT_5_0); - else { - qWarning() << "Invalid protocol version specified:" << version; - return nullptr; - } - } - - if (parser.isSet(optionCaFile) || parser.isSet(optionCaPath)) { -#ifdef QT_NO_SSL - qWarning() << "Qt has not been compiled with SSL support."; - return nullptr; -#else - QList<QString> fileNames; - if (parser.isSet(optionCaFile)) - fileNames.append(parser.value(optionCaFile)); - - if (parser.isSet(optionCaPath)) { - QFileInfo path(parser.value(optionCaPath)); - if (!path.isDir()) { - qWarning() << "Specified capath is not a directory"; - return nullptr; - } - auto entries = QDir(parser.value(optionCaPath)).entryInfoList(QDir::Files | QDir::NoDotAndDotDot); - for (auto entry : entries) - fileNames.append(entry.absoluteFilePath()); - } - if (fileNames.isEmpty()) { - qWarning() << "No certificate file found."; - return nullptr; - } - - QList<QSslCertificate> defaultCerts; - for (auto it : fileNames) { - auto certificates = QSslCertificate::fromPath(it); - if (certificates.isEmpty() && parser.isSet(optionDebug)) - qWarning() << "File " << it << " does not contain any certificates"; - defaultCerts.append(certificates); - } - if (defaultCerts.isEmpty()) { - qWarning() << "No certificate could be loaded."; - return nullptr; - } - - msg->sslConfiguration.setCaCertificates(defaultCerts); - msg->useEncryption = true; -#endif - } - - if (parser.isSet(optionDebug)) - QLoggingCategory::setFilterRules(QLatin1String("qt.mqtt.*=true")); - - msg->qos = static_cast<quint8>(parser.value(optionQos).toInt(&ok)); - if (!ok || msg->qos > 2) { - qWarning() << "Invalid quality of service for message specified:" << msg->qos; - return nullptr; - } - - if (parser.isSet(optionKeepAlive)) { - const quint16 keep = static_cast<quint16>(parser.value(optionKeepAlive).toUInt(&ok)); - if (!ok) { - qWarning() << "Invalid keep alive value specified"; - return nullptr; - } - client->setKeepAlive(keep); - } - - if (publish) { - if (parser.isSet(optionFile) && parser.isSet(optionMessageContent)) { - qWarning() << "You cannot specify a file and a text as message."; - return nullptr; - } - if (parser.isSet(optionFile)) { - QFile file(parser.value(optionFile)); - if (!file.open(QIODevice::ReadOnly)) { - qWarning() << "Could not open specified file for reading."; - return nullptr; - } - msg->content = file.readAll(); - file.close(); - } - if (parser.isSet(optionMessageContent)) - msg->content = parser.value(optionMessageContent).toUtf8(); - } - - if (!parser.isSet(optionMessageTopic)) { - qWarning() << "You must specify a topic to publish a message."; - return nullptr; - } - msg->topic = parser.value(optionMessageTopic); - - if (publish && !QMqttTopicName(msg->topic).isValid()) { - qWarning() << "The specified message topic is invalid."; - return nullptr; - } - - if (!publish && !QMqttTopicFilter(msg->topic).isValid()) { - qWarning() << "The specified subscription topic is invalid."; - return nullptr; - } - - if (publish && parser.isSet(optionRetain)) - msg->retain = true; - - // Output: - qInfo() << "Client configuration:"; - qInfo() << " Host:" << client->hostname() << " Port:" << client->port() - << " Protocol:" << client->protocolVersion(); - qInfo() << " Username:" << client->username() << " Password:" << !client->password().isEmpty(); - qInfo() << " Client ID:" << client->clientId() << "Keep Alive:" << client->keepAlive(); - - return client; -} - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/consolepubsub/consolepubsub.pro new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/consolepubsub/consolepubsub.pro --- old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/consolepubsub/consolepubsub.pro 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/consolepubsub/consolepubsub.pro 1970-01-01 01:00:00.000000000 +0100 @@ -1,8 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS = \ - qtmqtt_pub.pro \ - qtmqtt_sub.pro - -CONFIG += ordered - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/consolepubsub/main_pub.cpp new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/consolepubsub/main_pub.cpp --- old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/consolepubsub/main_pub.cpp 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/consolepubsub/main_pub.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,65 +0,0 @@ -// Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -#include "configuration.h" - -#include <QCoreApplication> -#include <QMqttClient> -#include <QSslSocket> -#include <QTimer> - -int main(int argc, char *argv[]) -{ - QCoreApplication a(argc, argv); - QCoreApplication::setApplicationName(QStringLiteral("qtmqtt_pub")); - QCoreApplication::setApplicationVersion(QStringLiteral("1.0")); - - // Create the client - Configuration description; - auto *client = createClientWithConfiguration(&a, &description, true); - - if (!client) - return -1; - - a.connect(client, &QMqttClient::errorChanged, [&client](const QMqttClient::ClientError e) { - if (e == QMqttClient::NoError) - return; - - qWarning() << "Error Occurred:" << e << " Client state:" << client->state(); - client->disconnectFromHost(); - }); - - a.connect(client, &QMqttClient::messageSent, [&client] (quint32 id) { - qInfo() << "Message with ID:" << id << " sent"; - client->disconnectFromHost(); - }); - - a.connect(client, &QMqttClient::stateChanged, [&client] (QMqttClient::ClientState s) { - if (s == QMqttClient::Disconnected) { - client->deleteLater(); - qApp->quit(); - } - }); - - a.connect(client, &QMqttClient::connected, [&client, description]() { - qInfo() << "Message:"; - qInfo() << " Topic:" << description.topic << " QoS:" << description.qos - << " Retain:" << description.retain; - qInfo() << " Content: " << description.content.left(50); - client->publish(description.topic, - description.content, - description.qos, - description.retain); - if (description.qos == 0)// 0 has no acknowledgment - QTimer::singleShot(500, client, &QMqttClient::disconnectFromHost); - }); - -#ifndef QT_NO_SSL - if (description.useEncryption) - client->connectToHostEncrypted(description.sslConfiguration); - else -#endif - client->connectToHost(); - - return a.exec(); -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/consolepubsub/main_sub.cpp new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/consolepubsub/main_sub.cpp --- old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/consolepubsub/main_sub.cpp 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/consolepubsub/main_sub.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,65 +0,0 @@ -// Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -#include "configuration.h" - -#include <QCoreApplication> -#include <QMqttClient> -#include <QSslSocket> -#include <QTimer> - -int main(int argc, char *argv[]) -{ - QCoreApplication a(argc, argv); - QCoreApplication::setApplicationName(QStringLiteral("qtmqtt_sub")); - QCoreApplication::setApplicationVersion(QStringLiteral("1.0")); - - // Create the client - Configuration description; - auto *client = createClientWithConfiguration(&a, &description, false); - - if (!client) - return -1; - - a.connect(client, &QMqttClient::errorChanged, [&client](const QMqttClient::ClientError e) { - if (e == QMqttClient::NoError) - return; - - qWarning() << "Error Occurred:" << e << " Client state:" << client->state(); - client->disconnectFromHost(); - }); - - a.connect(client, &QMqttClient::stateChanged, [&client] (QMqttClient::ClientState s) { - if (s == QMqttClient::Disconnected) { - client->deleteLater(); - qApp->quit(); - } - }); - - a.connect(client, &QMqttClient::connected, [&client, description]() { - auto sub = client->subscribe(description.topic, description.qos); - client->connect(sub, &QMqttSubscription::stateChanged, [&client](QMqttSubscription::SubscriptionState s) { - qInfo() << "Subscription state:" << s; - if (s == QMqttSubscription::Unsubscribed) - client->disconnectFromHost(); - }); - - client->connect(sub, &QMqttSubscription::messageReceived, [](const QMqttMessage &msg) { - qInfo() << "ID:" << msg.id() - << "Topic:" << msg.topic().name() - << "QoS:" << msg.qos() - << "Retain:" << msg.retain() - << "Duplicate:" << msg.duplicate() - << "Payload:" << msg.payload().left(50) << (msg.payload().size() > 50 ? "..." : ""); - }); - }); - -#ifndef QT_NO_SSL - if (description.useEncryption) - client->connectToHostEncrypted(description.sslConfiguration); - else -#endif - client->connectToHost(); - - return a.exec(); -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/consolepubsub/qtmqtt_pub.pro new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/consolepubsub/qtmqtt_pub.pro --- old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/consolepubsub/qtmqtt_pub.pro 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/consolepubsub/qtmqtt_pub.pro 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -QT -= gui -QT += mqtt - -CONFIG += c++11 console -CONFIG -= app_bundle - -# The following define makes your compiler emit warnings if you use -# any Qt feature that has been marked deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if it uses deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_UP_TO=0x060000 # disables all APIs deprecated in Qt 6.0.0 and earlier - -SOURCES += \ - main_pub.cpp - -HEADERS += \ - configuration.h - -target.path = $$[QT_INSTALL_EXAMPLES]/mqtt/consolepubsub -INSTALLS += target diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/consolepubsub/qtmqtt_sub.pro new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/consolepubsub/qtmqtt_sub.pro --- old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/consolepubsub/qtmqtt_sub.pro 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/consolepubsub/qtmqtt_sub.pro 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -QT -= gui -QT += mqtt - -CONFIG += c++11 console -CONFIG -= app_bundle - -# The following define makes your compiler emit warnings if you use -# any Qt feature that has been marked deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if it uses deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_UP_TO=0x060000 # disables all APIs deprecated in Qt 6.0.0 and earlier - -SOURCES += \ - main_sub.cpp - -HEADERS += \ - configuration.h - -target.path = $$[QT_INSTALL_EXAMPLES]/mqtt/consolepubsub -INSTALLS += target Binary files old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/doc/images/simpleclient.png and new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/doc/images/simpleclient.png differ Binary files old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/doc/images/subscriptions.png and new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/doc/images/subscriptions.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/doc/simpleclient.qdoc new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/doc/simpleclient.qdoc --- old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/doc/simpleclient.qdoc 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/doc/simpleclient.qdoc 2023-10-03 20:26:55.000000000 +0200 @@ -3,7 +3,8 @@ /*! \example simpleclient - \title Simple MQTT Client Example + \examplecategory {Connectivity} + \title Simple MQTT Client \ingroup qtmqtt-examples \brief Creating a minimalistic telemetry application. @@ -47,8 +48,8 @@ \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}. + how to receive messages on particular topics, see the + \l {MQTT Subscriptions} example. For an example of how to use the QMqttClient class in a Qt Quick application, see \l {Quick MQTT Example}. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/doc/subscriptions.qdoc new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/doc/subscriptions.qdoc --- old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/doc/subscriptions.qdoc 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/doc/subscriptions.qdoc 2023-10-03 20:26:55.000000000 +0200 @@ -3,7 +3,8 @@ /*! \example subscriptions - \title MQTT Subscriptions Example + \examplecategory {Connectivity} + \title MQTT Subscriptions \ingroup qtmqtt-examples \brief Creating a application that communicates with an MQTT broker. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/doc/websocketsubscription.qdoc new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/doc/websocketsubscription.qdoc --- old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/doc/websocketsubscription.qdoc 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/doc/websocketsubscription.qdoc 2023-10-03 20:26:55.000000000 +0200 @@ -3,7 +3,8 @@ /*! \example websocketsubscription - \title WebSockets MQTT Subscription Example + \examplecategory {Connectivity} + \title WebSockets MQTT Subscription \ingroup qtmqtt-examples \brief Combining an MQTT client with a web socket connection. @@ -11,4 +12,37 @@ QIODevice to combine a \l {Qt WebSockets}{web socket} connection with QMqttClient. + \section1 Creating a Custom QIODevice + + The new custom device, \c WebSocketIODevice, has to be a subclass of + \l QIODevice: + + \quotefromfile websocketsubscription/websocketiodevice.h + \skipto WebSocketIODevice + \printuntil } + + \section1 Designing a Class to Manage the Connection and Subscription + + \c WebSocketIODevice will be a private member of the \c ClientSubscription + class alongside the QMqttClient and the QMqttSubscription: + + \quotefromfile websocketsubscription/clientsubscription.h + \skipto private + \printuntil m_version + + \section1 Subscribing to and Receiving Messages + + The main logic is implemented in the \c connectAndSubscribe() method of the + \c ClientSubscription class. You need to verify that the web socket has + successfully connected before you can initialize an MQTT connection over + it. After the MQTT connection has been established, the QMqttClient can + subscribe to the topic. If the subscription is successful, the + QMqttSubscription can be used to receive messages from the subscribed topic + that will be handled by the \c handleMessage() method of the + \c ClientSubscription class. + + \quotefromfile websocketsubscription/clientsubscription.cpp + \skipto connectAndSubscribe + \printuntil Could + \printuntil } */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/mqtt.pro new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/mqtt.pro --- old/qtmqtt-everywhere-src-6.5.3/examples/mqtt/mqtt.pro 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/examples/mqtt/mqtt.pro 2023-10-03 20:26:55.000000000 +0200 @@ -1,6 +1,5 @@ TEMPLATE = subdirs -SUBDIRS += \ - consolepubsub + qtHaveModule(gui):qtHaveModule(widgets): SUBDIRS += \ simpleclient \ subscriptions diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/src/mqtt/doc/src/overview.qdoc new/qtmqtt-everywhere-src-6.6.0/src/mqtt/doc/src/overview.qdoc --- old/qtmqtt-everywhere-src-6.5.3/src/mqtt/doc/src/overview.qdoc 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/src/mqtt/doc/src/overview.qdoc 2023-10-03 20:26:55.000000000 +0200 @@ -6,7 +6,7 @@ \page qtmqtt-overview.html \title Qt MQTT Overview \brief Provides insight into the MQTT protocol and the Qt MQTT module. - \ingroup explanation + \ingroup explanations-networkingandconnectivity Qt MQTT enables you to create applications and devices that can communicate over the MQ telemetry transport (MQTT) protocol. It fully complies to the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/tests/auto/conformance/CMakeLists.txt new/qtmqtt-everywhere-src-6.6.0/tests/auto/conformance/CMakeLists.txt --- old/qtmqtt-everywhere-src-6.5.3/tests/auto/conformance/CMakeLists.txt 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/tests/auto/conformance/CMakeLists.txt 2023-10-03 20:26:55.000000000 +0200 @@ -10,7 +10,7 @@ ../../common/broker_connection.h tst_conformance.cpp DEFINES - SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\" + SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/" INCLUDE_DIRECTORIES ../../common LIBRARIES diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/tests/auto/qmqttclient/CMakeLists.txt new/qtmqtt-everywhere-src-6.6.0/tests/auto/qmqttclient/CMakeLists.txt --- old/qtmqtt-everywhere-src-6.5.3/tests/auto/qmqttclient/CMakeLists.txt 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/tests/auto/qmqttclient/CMakeLists.txt 2023-10-03 20:26:55.000000000 +0200 @@ -10,7 +10,7 @@ ../../common/broker_connection.h tst_qmqttclient.cpp DEFINES - SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\" + SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/" INCLUDE_DIRECTORIES ../../common LIBRARIES diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/tests/auto/qmqttconnectionproperties/CMakeLists.txt new/qtmqtt-everywhere-src-6.6.0/tests/auto/qmqttconnectionproperties/CMakeLists.txt --- old/qtmqtt-everywhere-src-6.5.3/tests/auto/qmqttconnectionproperties/CMakeLists.txt 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/tests/auto/qmqttconnectionproperties/CMakeLists.txt 2023-10-03 20:26:55.000000000 +0200 @@ -10,7 +10,7 @@ ../../common/broker_connection.h tst_qmqttconnectionproperties.cpp DEFINES - SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\" + SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/" INCLUDE_DIRECTORIES ../../common LIBRARIES diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/tests/auto/qmqttcontrolpacket/CMakeLists.txt new/qtmqtt-everywhere-src-6.6.0/tests/auto/qmqttcontrolpacket/CMakeLists.txt --- old/qtmqtt-everywhere-src-6.5.3/tests/auto/qmqttcontrolpacket/CMakeLists.txt 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/tests/auto/qmqttcontrolpacket/CMakeLists.txt 2023-10-03 20:26:55.000000000 +0200 @@ -9,7 +9,7 @@ SOURCES tst_qmqttcontrolpacket.cpp DEFINES - SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\" + SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/" LIBRARIES Qt::MqttPrivate Qt::Mqtt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/tests/auto/qmqttlastwillproperties/CMakeLists.txt new/qtmqtt-everywhere-src-6.6.0/tests/auto/qmqttlastwillproperties/CMakeLists.txt --- old/qtmqtt-everywhere-src-6.5.3/tests/auto/qmqttlastwillproperties/CMakeLists.txt 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/tests/auto/qmqttlastwillproperties/CMakeLists.txt 2023-10-03 20:26:55.000000000 +0200 @@ -10,7 +10,7 @@ ../../common/broker_connection.h tst_qmqttlastwillproperties.cpp DEFINES - SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\" + SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/" INCLUDE_DIRECTORIES ../../common LIBRARIES diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/tests/auto/qmqttpublishproperties/CMakeLists.txt new/qtmqtt-everywhere-src-6.6.0/tests/auto/qmqttpublishproperties/CMakeLists.txt --- old/qtmqtt-everywhere-src-6.5.3/tests/auto/qmqttpublishproperties/CMakeLists.txt 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/tests/auto/qmqttpublishproperties/CMakeLists.txt 2023-10-03 20:26:55.000000000 +0200 @@ -10,7 +10,7 @@ ../../common/broker_connection.h tst_qmqttpublishproperties.cpp DEFINES - SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\" + SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/" INCLUDE_DIRECTORIES ../../common LIBRARIES diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/tests/auto/qmqttsubscription/CMakeLists.txt new/qtmqtt-everywhere-src-6.6.0/tests/auto/qmqttsubscription/CMakeLists.txt --- old/qtmqtt-everywhere-src-6.5.3/tests/auto/qmqttsubscription/CMakeLists.txt 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/tests/auto/qmqttsubscription/CMakeLists.txt 2023-10-03 20:26:55.000000000 +0200 @@ -10,7 +10,7 @@ ../../common/broker_connection.h tst_qmqttsubscription.cpp DEFINES - SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\" + SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/" INCLUDE_DIRECTORIES ../../common LIBRARIES diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/tests/auto/qmqttsubscriptionproperties/CMakeLists.txt new/qtmqtt-everywhere-src-6.6.0/tests/auto/qmqttsubscriptionproperties/CMakeLists.txt --- old/qtmqtt-everywhere-src-6.5.3/tests/auto/qmqttsubscriptionproperties/CMakeLists.txt 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/tests/auto/qmqttsubscriptionproperties/CMakeLists.txt 2023-10-03 20:26:55.000000000 +0200 @@ -10,7 +10,7 @@ ../../common/broker_connection.h tst_qmqttsubscriptionproperties.cpp DEFINES - SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\" + SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/" INCLUDE_DIRECTORIES ../../common LIBRARIES diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/tests/auto/qmqtttopicfilter/CMakeLists.txt new/qtmqtt-everywhere-src-6.6.0/tests/auto/qmqtttopicfilter/CMakeLists.txt --- old/qtmqtt-everywhere-src-6.5.3/tests/auto/qmqtttopicfilter/CMakeLists.txt 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/tests/auto/qmqtttopicfilter/CMakeLists.txt 2023-10-03 20:26:55.000000000 +0200 @@ -9,7 +9,7 @@ SOURCES tst_qmqtttopicfilter.cpp DEFINES - SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\" + SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/" LIBRARIES Qt::MqttPrivate Qt::Mqtt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/tests/auto/qmqtttopicname/CMakeLists.txt new/qtmqtt-everywhere-src-6.6.0/tests/auto/qmqtttopicname/CMakeLists.txt --- old/qtmqtt-everywhere-src-6.5.3/tests/auto/qmqtttopicname/CMakeLists.txt 2023-09-24 11:46:21.000000000 +0200 +++ new/qtmqtt-everywhere-src-6.6.0/tests/auto/qmqtttopicname/CMakeLists.txt 2023-10-03 20:26:55.000000000 +0200 @@ -9,7 +9,7 @@ SOURCES tst_qmqtttopicname.cpp DEFINES - SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\" + SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/" LIBRARIES Qt::MqttPrivate Qt::Mqtt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/tests/manual/consolepubsub/CMakeLists.txt new/qtmqtt-everywhere-src-6.6.0/tests/manual/consolepubsub/CMakeLists.txt --- old/qtmqtt-everywhere-src-6.5.3/tests/manual/consolepubsub/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/qtmqtt-everywhere-src-6.6.0/tests/manual/consolepubsub/CMakeLists.txt 2023-10-03 20:26:55.000000000 +0200 @@ -0,0 +1,75 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +cmake_minimum_required(VERSION 3.16) +project(qtmqtt_pub_sub LANGUAGES CXX) + +if (ANDROID) + message(FATAL_ERROR "This project cannot be built on Android.") +endif() + +set(CMAKE_AUTOMOC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/mqtt/consolepubsub") + +find_package(Qt6 REQUIRED COMPONENTS Mqtt) + +# +# Pub +# + +qt_add_executable(qtmqtt_pub + configuration.h + main_pub.cpp +) + +set_target_properties(qtmqtt_pub PROPERTIES + WIN32_EXECUTABLE FALSE + MACOSX_BUNDLE FALSE +) + +target_compile_definitions(qtmqtt_pub PUBLIC + QT_DEPRECATED_WARNINGS +) + +target_link_libraries(qtmqtt_pub PUBLIC + Qt::Mqtt +) + +install(TARGETS qtmqtt_pub + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +# +# Sub +# + +qt_add_executable(qtmqtt_sub + configuration.h + main_sub.cpp +) + +set_target_properties(qtmqtt_sub PROPERTIES + WIN32_EXECUTABLE FALSE + MACOSX_BUNDLE FALSE +) + +target_compile_definitions(qtmqtt_sub PUBLIC + QT_DEPRECATED_WARNINGS +) + +target_link_libraries(qtmqtt_sub PUBLIC + Qt::Mqtt +) + +install(TARGETS qtmqtt_sub + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/tests/manual/consolepubsub/configuration.h new/qtmqtt-everywhere-src-6.6.0/tests/manual/consolepubsub/configuration.h --- old/qtmqtt-everywhere-src-6.5.3/tests/manual/consolepubsub/configuration.h 1970-01-01 01:00:00.000000000 +0100 +++ new/qtmqtt-everywhere-src-6.6.0/tests/manual/consolepubsub/configuration.h 2023-10-03 20:26:55.000000000 +0200 @@ -0,0 +1,264 @@ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#include <QByteArray> +#include <QCommandLineParser> +#include <QCommandLineOption> +#include <QDir> +#include <QFile> +#include <QFileInfo> +#include <QLoggingCategory> +#include <QString> +#include <QMqttClient> +#include <QSslConfiguration> +#include <QSslSocket> + +struct Configuration +{ + QString topic; + QByteArray content; + quint8 qos; + bool retain{false}; + bool useEncryption{false}; +#ifndef QT_NO_SSL + QSslConfiguration sslConfiguration; +#endif +}; + +QMqttClient *createClientWithConfiguration(QCoreApplication *app, + Configuration *msg, + bool publish) +{ + QCommandLineParser parser; + if (publish) + parser.setApplicationDescription("Qt MQTT publish tool"); + else + parser.setApplicationDescription("Qt MQTT subscription tool"); + + parser.addHelpOption(); + parser.addVersionOption(); + + QCommandLineOption optionDebug("d", + QLatin1String("Enable debug messages / logging categories")); + parser.addOption(optionDebug); + + QCommandLineOption optionFile("f", + QLatin1String("Specify the content of a file as message."), + QLatin1String("filename")); + if (publish) + parser.addOption(optionFile); + + QCommandLineOption optionClientId("i", + QLatin1String("Specify a client ID. Defaults to random value."), + QLatin1String("clientid")); + parser.addOption(optionClientId); + + QCommandLineOption optionKeepAlive("k", + QLatin1String("Specify the keep-alive value in seconds."), + QLatin1String("keepAlive")); + parser.addOption(optionKeepAlive); + + QCommandLineOption optionMessageContent("m", + QLatin1String("Specify the message content. Defaults to" + " a null message."), + QLatin1String("messageContent")); + if (publish) + parser.addOption(optionMessageContent); + + QCommandLineOption optionPassword("P", + QLatin1String("Provide a password."), + QLatin1String("password")); + parser.addOption(optionPassword); + + QCommandLineOption optionPort("p", + QLatin1String("Network port to connect to. Defaults to 1883."), + QLatin1String("hostPort"), + QLatin1String("1883")); + parser.addOption(optionPort); + + QCommandLineOption optionQos("q", + QLatin1String("Quality of service level to use for all messages." + "Defaults to 0."), + QLatin1String("qos"), + QLatin1String("0")); + parser.addOption(optionQos); + + QCommandLineOption optionRetain("r", + QLatin1String("Specify the retain flag for a message.")); + if (publish) + parser.addOption(optionRetain); + + QCommandLineOption optionHost("s", + QLatin1String("MQTT server to connect to. Defaults to localhost."), + QLatin1String("hostName"), + QLatin1String("localhost")); + parser.addOption(optionHost); + + QCommandLineOption optionMessageTopic("t", + QLatin1String("Specify the message topic."), + QLatin1String("messageTopic")); + parser.addOption(optionMessageTopic); + + QCommandLineOption optionUser("u", + QLatin1String("Provide a username."), + QLatin1String("username")); + parser.addOption(optionUser); + + QCommandLineOption optionVersion("V", + QLatin1String("Specify the protocol version. Options are " + "mqtt31, mqtt311, mqtt5. Defaults to mqtt311."), + QLatin1String("protocolVersion"), + QLatin1String("mqtt311")); + parser.addOption(optionVersion); + + QCommandLineOption optionCaFile("cafile", + QLatin1String("Specify a file containing trusted CA " + "certificates to enable encrypted communication."), + QLatin1String("cafile")); + parser.addOption(optionCaFile); + + QCommandLineOption optionCaPath("capath", + QLatin1String("Specify a directory containing trusted CA " + "certificates to enable encrypted communication."), + QLatin1String("capath")); + parser.addOption(optionCaPath); + + parser.process(*app); + + auto *client = new QMqttClient(app); + + client->setHostname(parser.value(optionHost)); + bool ok = true; + quint16 port = static_cast<quint16>(parser.value(optionPort).toInt(&ok)); + if (!ok) { + qWarning() << "Invalid port specified:" << parser.value(optionPort); + return nullptr; + } + client->setPort(port); + + if (parser.isSet(optionUser)) + client->setUsername(parser.value(optionUser)); + if (parser.isSet(optionPassword)) + client->setPassword(parser.value(optionPassword)); + if (parser.isSet(optionClientId)) + client->setClientId(parser.value(optionClientId)); + if (parser.isSet(optionVersion)) { + const QString version = parser.value(optionVersion); + if (version == QLatin1String("mqtt31")) + client->setProtocolVersion(QMqttClient::MQTT_3_1); + else if (version == QLatin1String("mqtt311")) + client->setProtocolVersion(QMqttClient::MQTT_3_1_1); + else if (version == QLatin1String("mqtt5")) + client->setProtocolVersion(QMqttClient::MQTT_5_0); + else { + qWarning() << "Invalid protocol version specified:" << version; + return nullptr; + } + } + + if (parser.isSet(optionCaFile) || parser.isSet(optionCaPath)) { +#ifdef QT_NO_SSL + qWarning() << "Qt has not been compiled with SSL support."; + return nullptr; +#else + QList<QString> fileNames; + if (parser.isSet(optionCaFile)) + fileNames.append(parser.value(optionCaFile)); + + if (parser.isSet(optionCaPath)) { + QFileInfo path(parser.value(optionCaPath)); + if (!path.isDir()) { + qWarning() << "Specified capath is not a directory"; + return nullptr; + } + auto entries = QDir(parser.value(optionCaPath)).entryInfoList(QDir::Files | QDir::NoDotAndDotDot); + for (auto entry : entries) + fileNames.append(entry.absoluteFilePath()); + } + if (fileNames.isEmpty()) { + qWarning() << "No certificate file found."; + return nullptr; + } + + QList<QSslCertificate> defaultCerts; + for (auto it : fileNames) { + auto certificates = QSslCertificate::fromPath(it); + if (certificates.isEmpty() && parser.isSet(optionDebug)) + qWarning() << "File " << it << " does not contain any certificates"; + defaultCerts.append(certificates); + } + if (defaultCerts.isEmpty()) { + qWarning() << "No certificate could be loaded."; + return nullptr; + } + + msg->sslConfiguration.setCaCertificates(defaultCerts); + msg->useEncryption = true; +#endif + } + + if (parser.isSet(optionDebug)) + QLoggingCategory::setFilterRules(QLatin1String("qt.mqtt.*=true")); + + msg->qos = static_cast<quint8>(parser.value(optionQos).toInt(&ok)); + if (!ok || msg->qos > 2) { + qWarning() << "Invalid quality of service for message specified:" << msg->qos; + return nullptr; + } + + if (parser.isSet(optionKeepAlive)) { + const quint16 keep = static_cast<quint16>(parser.value(optionKeepAlive).toUInt(&ok)); + if (!ok) { + qWarning() << "Invalid keep alive value specified"; + return nullptr; + } + client->setKeepAlive(keep); + } + + if (publish) { + if (parser.isSet(optionFile) && parser.isSet(optionMessageContent)) { + qWarning() << "You cannot specify a file and a text as message."; + return nullptr; + } + if (parser.isSet(optionFile)) { + QFile file(parser.value(optionFile)); + if (!file.open(QIODevice::ReadOnly)) { + qWarning() << "Could not open specified file for reading."; + return nullptr; + } + msg->content = file.readAll(); + file.close(); + } + if (parser.isSet(optionMessageContent)) + msg->content = parser.value(optionMessageContent).toUtf8(); + } + + if (!parser.isSet(optionMessageTopic)) { + qWarning() << "You must specify a topic to publish a message."; + return nullptr; + } + msg->topic = parser.value(optionMessageTopic); + + if (publish && !QMqttTopicName(msg->topic).isValid()) { + qWarning() << "The specified message topic is invalid."; + return nullptr; + } + + if (!publish && !QMqttTopicFilter(msg->topic).isValid()) { + qWarning() << "The specified subscription topic is invalid."; + return nullptr; + } + + if (publish && parser.isSet(optionRetain)) + msg->retain = true; + + // Output: + qInfo() << "Client configuration:"; + qInfo() << " Host:" << client->hostname() << " Port:" << client->port() + << " Protocol:" << client->protocolVersion(); + qInfo() << " Username:" << client->username() << " Password:" << !client->password().isEmpty(); + qInfo() << " Client ID:" << client->clientId() << "Keep Alive:" << client->keepAlive(); + + return client; +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/tests/manual/consolepubsub/main_pub.cpp new/qtmqtt-everywhere-src-6.6.0/tests/manual/consolepubsub/main_pub.cpp --- old/qtmqtt-everywhere-src-6.5.3/tests/manual/consolepubsub/main_pub.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/qtmqtt-everywhere-src-6.6.0/tests/manual/consolepubsub/main_pub.cpp 2023-10-03 20:26:55.000000000 +0200 @@ -0,0 +1,65 @@ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#include "configuration.h" + +#include <QCoreApplication> +#include <QMqttClient> +#include <QSslSocket> +#include <QTimer> + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + QCoreApplication::setApplicationName(QStringLiteral("qtmqtt_pub")); + QCoreApplication::setApplicationVersion(QStringLiteral("1.0")); + + // Create the client + Configuration description; + auto *client = createClientWithConfiguration(&a, &description, true); + + if (!client) + return -1; + + a.connect(client, &QMqttClient::errorChanged, [&client](const QMqttClient::ClientError e) { + if (e == QMqttClient::NoError) + return; + + qWarning() << "Error Occurred:" << e << " Client state:" << client->state(); + client->disconnectFromHost(); + }); + + a.connect(client, &QMqttClient::messageSent, [&client] (quint32 id) { + qInfo() << "Message with ID:" << id << " sent"; + client->disconnectFromHost(); + }); + + a.connect(client, &QMqttClient::stateChanged, [&client] (QMqttClient::ClientState s) { + if (s == QMqttClient::Disconnected) { + client->deleteLater(); + qApp->quit(); + } + }); + + a.connect(client, &QMqttClient::connected, [&client, description]() { + qInfo() << "Message:"; + qInfo() << " Topic:" << description.topic << " QoS:" << description.qos + << " Retain:" << description.retain; + qInfo() << " Content: " << description.content.left(50); + client->publish(description.topic, + description.content, + description.qos, + description.retain); + if (description.qos == 0)// 0 has no acknowledgment + QTimer::singleShot(500, client, &QMqttClient::disconnectFromHost); + }); + +#ifndef QT_NO_SSL + if (description.useEncryption) + client->connectToHostEncrypted(description.sslConfiguration); + else +#endif + client->connectToHost(); + + return a.exec(); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtmqtt-everywhere-src-6.5.3/tests/manual/consolepubsub/main_sub.cpp new/qtmqtt-everywhere-src-6.6.0/tests/manual/consolepubsub/main_sub.cpp --- old/qtmqtt-everywhere-src-6.5.3/tests/manual/consolepubsub/main_sub.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/qtmqtt-everywhere-src-6.6.0/tests/manual/consolepubsub/main_sub.cpp 2023-10-03 20:26:55.000000000 +0200 @@ -0,0 +1,65 @@ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#include "configuration.h" + +#include <QCoreApplication> +#include <QMqttClient> +#include <QSslSocket> +#include <QTimer> + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + QCoreApplication::setApplicationName(QStringLiteral("qtmqtt_sub")); + QCoreApplication::setApplicationVersion(QStringLiteral("1.0")); + + // Create the client + Configuration description; + auto *client = createClientWithConfiguration(&a, &description, false); + + if (!client) + return -1; + + a.connect(client, &QMqttClient::errorChanged, [&client](const QMqttClient::ClientError e) { + if (e == QMqttClient::NoError) + return; + + qWarning() << "Error Occurred:" << e << " Client state:" << client->state(); + client->disconnectFromHost(); + }); + + a.connect(client, &QMqttClient::stateChanged, [&client] (QMqttClient::ClientState s) { + if (s == QMqttClient::Disconnected) { + client->deleteLater(); + qApp->quit(); + } + }); + + a.connect(client, &QMqttClient::connected, [&client, description]() { + auto sub = client->subscribe(description.topic, description.qos); + client->connect(sub, &QMqttSubscription::stateChanged, [&client](QMqttSubscription::SubscriptionState s) { + qInfo() << "Subscription state:" << s; + if (s == QMqttSubscription::Unsubscribed) + client->disconnectFromHost(); + }); + + client->connect(sub, &QMqttSubscription::messageReceived, [](const QMqttMessage &msg) { + qInfo() << "ID:" << msg.id() + << "Topic:" << msg.topic().name() + << "QoS:" << msg.qos() + << "Retain:" << msg.retain() + << "Duplicate:" << msg.duplicate() + << "Payload:" << msg.payload().left(50) << (msg.payload().size() > 50 ? "..." : ""); + }); + }); + +#ifndef QT_NO_SSL + if (description.useEncryption) + client->connectToHostEncrypted(description.sslConfiguration); + else +#endif + client->connectToHost(); + + return a.exec(); +}