diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-05-11 00:26:02 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-05-14 15:15:05 +0000 |
commit | 218d796a1e9a2ae9ad87c71f7487a62d3a7dbab2 (patch) | |
tree | 28cfeae0555f75eb645b6f0a66e3826975c7f35a | |
parent | a5beff7436aba965d16b63d5677b6d3920724c59 (diff) |
Rename QCoapDiscoveryReply -> QCoapResourceDiscoveryReply
This change is based on the feedback from API review.
Change-Id: I43f08d5bd7f7f172ea4d337718be7bd14e81d64c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
21 files changed, 91 insertions, 88 deletions
@@ -55,7 +55,7 @@ The notified signal will provide the `QCoapReply` and most recent message. For machine to machine communication, CoAP Discovery requests is used to query the resources available to an endpoint, or to the complete network. ```c++ -QCoapDiscoveryReply* reply = client->discover("coap://coap.me/"); +QCoapResourceDiscoveryReply *reply = client->discover("coap://coap.me/"); connect(reply, &QCoapReply::discovered, this, &MyClass::onDiscovered); ``` @@ -63,7 +63,7 @@ For multicast discovery use one of the groups from the `QtCoap::MulticastGroup` specifying the discovery path: ```c++ -QCoapDiscoveryReply* reply = client->discover(QtCoap::AllCoapNodesIPv6LinkLocal); +QCoapResourceDiscoveryReply *reply = client->discover(QtCoap::AllCoapNodesIPv6LinkLocal); ``` If no group is specified, `QtCoap::AllCoapNodesIPv4` will be used by default. diff --git a/examples/coap/consolecoapclient/coaphandler.cpp b/examples/coap/consolecoapclient/coaphandler.cpp index 650cf5c..fa9fc34 100644 --- a/examples/coap/consolecoapclient/coaphandler.cpp +++ b/examples/coap/consolecoapclient/coaphandler.cpp @@ -34,7 +34,7 @@ #include <QLoggingCategory> #include <QCoapClient> #include <QCoapReply> -#include <QCoapDiscoveryReply> +#include <QCoapResourceDiscoveryReply> Q_LOGGING_CATEGORY(lcCoapClient, "qt.coap.client") @@ -78,11 +78,11 @@ bool CoapHandler::runObserve(const QUrl &url) bool CoapHandler::runDiscover(const QUrl &url) { - QCoapDiscoveryReply *discoverReply = m_coapClient.discover(url); + QCoapResourceDiscoveryReply *discoverReply = m_coapClient.discover(url); if (!discoverReply) return false; - connect(discoverReply, &QCoapDiscoveryReply::discovered, this, &CoapHandler::onDiscovered); + connect(discoverReply, &QCoapResourceDiscoveryReply::discovered, this, &CoapHandler::onDiscovered); return true; } @@ -105,7 +105,7 @@ void CoapHandler::onNotified(QCoapReply *reply, QCoapMessage message) qCInfo(lcCoapClient) << "Received Observe notification with payload:" << reply->readAll(); } -void CoapHandler::onDiscovered(QCoapDiscoveryReply *reply, QVector<QCoapResource> resources) +void CoapHandler::onDiscovered(QCoapResourceDiscoveryReply *reply, QVector<QCoapResource> resources) { Q_UNUSED(reply) diff --git a/examples/coap/consolecoapclient/coaphandler.h b/examples/coap/consolecoapclient/coaphandler.h index 1034ad1..a109a4c 100644 --- a/examples/coap/consolecoapclient/coaphandler.h +++ b/examples/coap/consolecoapclient/coaphandler.h @@ -40,7 +40,7 @@ QT_BEGIN_NAMESPACE class QCoapReply; -class QCoapDiscoveryReply; +class QCoapResourceDiscoveryReply; class QCoapResource; QT_END_NAMESPACE @@ -61,7 +61,7 @@ public: public Q_SLOTS: void onFinished(QCoapReply *reply); void onNotified(QCoapReply *reply, QCoapMessage message); - void onDiscovered(QCoapDiscoveryReply *reply, QVector<QCoapResource> resources); + void onDiscovered(QCoapResourceDiscoveryReply *reply, QVector<QCoapResource> resources); void onResponseToMulticast(QCoapReply *reply, const QCoapMessage& message, const QHostAddress &sender); void onError(QCoapReply *reply, QtCoap::Error error); diff --git a/examples/coap/doc/simplecoapclient.qdoc b/examples/coap/doc/simplecoapclient.qdoc index 961d473..438442d 100644 --- a/examples/coap/doc/simplecoapclient.qdoc +++ b/examples/coap/doc/simplecoapclient.qdoc @@ -134,8 +134,8 @@ \printuntil onDiscovered \dots - \note Instead of QCoapReply class, we use the QCoapDiscoveryReply to keep - the reply for a discovery request. It has the QCoapDiscoveryReply::discovered + \note Instead of QCoapReply class, we use the QCoapResourceDiscoveryReply to keep + the reply for a discovery request. It has the QCoapResourceDiscoveryReply::discovered signal, which returns the list of QCoapResources that has been discovered. If there are \e observable resources on the server (meaning that they have the diff --git a/examples/coap/quickmulticastclient/qmlcoapmulticastclient.cpp b/examples/coap/quickmulticastclient/qmlcoapmulticastclient.cpp index 196dfe5..7c868eb 100644 --- a/examples/coap/quickmulticastclient/qmlcoapmulticastclient.cpp +++ b/examples/coap/quickmulticastclient/qmlcoapmulticastclient.cpp @@ -50,7 +50,7 @@ #include "qmlcoapmulticastclient.h" -#include <QCoapDiscoveryReply> +#include <QCoapResourceDiscoveryReply> #include <QLoggingCategory> Q_LOGGING_CATEGORY(lcCoapClient, "qt.coap.client") @@ -73,9 +73,9 @@ void QmlCoapMulticastClient::discover(const QString &host, int port, const QStri url.setHost(host); url.setPort(port); - QCoapDiscoveryReply *discoverReply = QCoapClient::discover(url, discoveryPath); + QCoapResourceDiscoveryReply *discoverReply = QCoapClient::discover(url, discoveryPath); if (discoverReply) { - connect(discoverReply, &QCoapDiscoveryReply::discovered, + connect(discoverReply, &QCoapResourceDiscoveryReply::discovered, this, &QmlCoapMulticastClient::onDiscovered); } else { qCWarning(lcCoapClient, "Discovery request failed."); @@ -85,16 +85,16 @@ void QmlCoapMulticastClient::discover(const QString &host, int port, const QStri void QmlCoapMulticastClient::discover(QtCoap::MulticastGroup group, int port, const QString &discoveryPath) { - QCoapDiscoveryReply *discoverReply = QCoapClient::discover(group, port, discoveryPath); + QCoapResourceDiscoveryReply *discoverReply = QCoapClient::discover(group, port, discoveryPath); if (discoverReply) { - connect(discoverReply, &QCoapDiscoveryReply::discovered, + connect(discoverReply, &QCoapResourceDiscoveryReply::discovered, this, &QmlCoapMulticastClient::onDiscovered); } else { qCWarning(lcCoapClient, "Discovery request failed."); } } -void QmlCoapMulticastClient::onDiscovered(QCoapDiscoveryReply *reply, +void QmlCoapMulticastClient::onDiscovered(QCoapResourceDiscoveryReply *reply, const QVector<QCoapResource> &resources) { Q_UNUSED(reply) diff --git a/examples/coap/quickmulticastclient/qmlcoapmulticastclient.h b/examples/coap/quickmulticastclient/qmlcoapmulticastclient.h index 3dd91fc..7770ade 100644 --- a/examples/coap/quickmulticastclient/qmlcoapmulticastclient.h +++ b/examples/coap/quickmulticastclient/qmlcoapmulticastclient.h @@ -85,7 +85,7 @@ Q_SIGNALS: void finished(QtCoap::Error error); public slots: - void onDiscovered(QCoapDiscoveryReply *reply, const QVector<QCoapResource> &resources); + void onDiscovered(QCoapResourceDiscoveryReply *reply, const QVector<QCoapResource> &resources); }; #endif // QMLCOAPMULTICASTCLIENT_H diff --git a/examples/coap/simplecoapclient/mainwindow.cpp b/examples/coap/simplecoapclient/mainwindow.cpp index bff0dbc..fc103ad 100644 --- a/examples/coap/simplecoapclient/mainwindow.cpp +++ b/examples/coap/simplecoapclient/mainwindow.cpp @@ -52,7 +52,7 @@ #include "optiondialog.h" #include "ui_mainwindow.h" -#include <QCoapDiscoveryReply> +#include <QCoapResourceDiscoveryReply> #include <QCoapReply> #include <QDateTime> #include <QFileDialog> @@ -122,7 +122,7 @@ void MainWindow::onError(QCoapReply *reply, QtCoap::Error error) addMessage(errorMessage(errorCode), true); } -void MainWindow::onDiscovered(QCoapDiscoveryReply *reply, QVector<QCoapResource> resources) +void MainWindow::onDiscovered(QCoapResourceDiscoveryReply *reply, QVector<QCoapResource> resources) { if (reply->errorReceived() != QtCoap::Error::Ok) return; @@ -192,9 +192,9 @@ void MainWindow::on_discoverButton_clicked() url.setHost(tryToResolveHostName(ui->hostComboBox->currentText())); url.setPort(ui->portSpinBox->value()); - QCoapDiscoveryReply *discoverReply = m_client->discover(url, ui->discoveryPathEdit->text()); + QCoapResourceDiscoveryReply *discoverReply = m_client->discover(url, ui->discoveryPathEdit->text()); if (discoverReply) - connect(discoverReply, &QCoapDiscoveryReply::discovered, this, &MainWindow::onDiscovered); + connect(discoverReply, &QCoapResourceDiscoveryReply::discovered, this, &MainWindow::onDiscovered); else QMessageBox::critical(this, "Error", "Something went wrong, discovery request failed."); } diff --git a/examples/coap/simplecoapclient/mainwindow.h b/examples/coap/simplecoapclient/mainwindow.h index a561c0e..2cb9f98 100644 --- a/examples/coap/simplecoapclient/mainwindow.h +++ b/examples/coap/simplecoapclient/mainwindow.h @@ -78,7 +78,7 @@ private: private slots: void onFinished(QCoapReply *reply); void onError(QCoapReply *reply, QtCoap::Error error); - void onDiscovered(QCoapDiscoveryReply *reply, QVector<QCoapResource> resources); + void onDiscovered(QCoapResourceDiscoveryReply *reply, QVector<QCoapResource> resources); void onNotified(QCoapReply *reply, const QCoapMessage &message); void on_runButton_clicked(); diff --git a/src/coap/coap.pro b/src/coap/coap.pro index 54df74b..dbd9e6c 100644 --- a/src/coap/coap.pro +++ b/src/coap/coap.pro @@ -7,7 +7,6 @@ QMAKE_DOCS = $$PWD/doc/qtcoap.qdocconf PUBLIC_HEADERS += \ qcoapclient.h \ - qcoapdiscoveryreply.h \ qcoapglobal.h \ qcoapmessage.h \ qcoapnamespace.h \ @@ -15,12 +14,12 @@ PUBLIC_HEADERS += \ qcoapreply.h \ qcoaprequest.h \ qcoapresource.h \ + qcoapresourcediscoveryreply.h \ qcoapsecurityconfiguration.h PRIVATE_HEADERS += \ qcoapclient_p.h \ qcoapconnection_p.h \ - qcoapdiscoveryreply_p.h \ qcoapinternalmessage_p.h \ qcoapinternalreply_p.h \ qcoapinternalrequest_p.h \ @@ -31,12 +30,12 @@ PRIVATE_HEADERS += \ qcoapqudpconnection_p.h \ qcoapreply_p.h \ qcoaprequest_p.h \ - qcoapresource_p.h + qcoapresource_p.h \ + qcoapresourcediscoveryreply_p.h SOURCES += \ qcoapclient.cpp \ qcoapconnection.cpp \ - qcoapdiscoveryreply.cpp \ qcoapinternalmessage.cpp \ qcoapinternalreply.cpp \ qcoapinternalrequest.cpp \ @@ -48,6 +47,7 @@ SOURCES += \ qcoapreply.cpp \ qcoaprequest.cpp \ qcoapresource.cpp \ + qcoapresourcediscoveryreply.cpp \ qcoapsecurityconfiguration.cpp HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS diff --git a/src/coap/doc/src/qtcoap-overview.qdoc b/src/coap/doc/src/qtcoap-overview.qdoc index 5400362..c686974 100644 --- a/src/coap/doc/src/qtcoap-overview.qdoc +++ b/src/coap/doc/src/qtcoap-overview.qdoc @@ -106,15 +106,15 @@ firmware resource available in the network. The reply is represented in \l {https://tools.ietf.org/html/rfc6690}{CoRE Link Format}. - The specialized QCoapDiscoveryReply class is used to get the discovery replies: + The specialized QCoapResourceDiscoveryReply class is used to get the discovery replies: \code // This will make a multicast discovery request to the CoAP IPv4 multicast group. - QCoapDiscoveryReply *discoverReply = client->discover(); - connect(discoverReply, &QCoapDiscoveryReply::discovered, this, &MyClass::onDiscovered); + QCoapResourceDiscoveryReply *discoverReply = client->discover(); + connect(discoverReply, &QCoapResourceDiscoveryReply::discovered, this, &MyClass::onDiscovered); \endcode - The QCoapDiscoveryReply::discovered will return the list of CoAP resources found in the + The QCoapResourceDiscoveryReply::discovered will return the list of CoAP resources found in the network. \section2 Resource Observation diff --git a/src/coap/qcoapclient.cpp b/src/coap/qcoapclient.cpp index c86096c..f2205a0 100644 --- a/src/coap/qcoapclient.cpp +++ b/src/coap/qcoapclient.cpp @@ -31,7 +31,7 @@ #include "qcoapclient_p.h" #include "qcoapprotocol_p.h" #include "qcoapreply.h" -#include "qcoapdiscoveryreply.h" +#include "qcoapresourcediscoveryreply.h" #include "qcoapnamespace.h" #include "qcoapsecurityconfiguration.h" #include "qcoapqudpconnection_p.h" @@ -107,11 +107,11 @@ QCoapClientPrivate::~QCoapClientPrivate() When a reply arrives, the QCoapClient emits a finished() signal. - \note For a discovery request, the returned object is a QCoapDiscoveryReply. + \note For a discovery request, the returned object is a QCoapResourceDiscoveryReply. It can be used the same way as a QCoapReply but contains also a list of resources. - \sa QCoapRequest, QCoapReply, QCoapDiscoveryReply + \sa QCoapRequest, QCoapReply, QCoapResourceDiscoveryReply */ /*! @@ -176,7 +176,7 @@ QCoapClient::QCoapClient(QCoapConnection *connection, QObject *parent) : qRegisterMetaType<QCoapReply *>(); qRegisterMetaType<QCoapMessage>(); qRegisterMetaType<QPointer<QCoapReply>>(); - qRegisterMetaType<QPointer<QCoapDiscoveryReply>>(); + qRegisterMetaType<QPointer<QCoapResourceDiscoveryReply>>(); qRegisterMetaType<QCoapConnection *>(); qRegisterMetaType<QtCoap::Error>(); qRegisterMetaType<QtCoap::ResponseCode>(); @@ -373,8 +373,8 @@ QCoapReply *QCoapClient::deleteResource(const QUrl &url) \overload Discovers the resources available at the endpoints which have joined - the \a group at the given \a port. Returns a new QCoapDiscoveryReply - object which emits the \l QCoapDiscoveryReply::discovered() signal whenever + the \a group at the given \a port. Returns a new QCoapResourceDiscoveryReply + object which emits the \l QCoapResourceDiscoveryReply::discovered() signal whenever a response arrives. The \a group is one of the CoAP multicast group addresses and defaults to QtCoap::AllCoapNodesIPv4. @@ -384,7 +384,7 @@ QCoapReply *QCoapClient::deleteResource(const QUrl &url) \sa get(), post(), put(), deleteResource(), observe() */ -QCoapDiscoveryReply *QCoapClient::discover(QtCoap::MulticastGroup group, int port, +QCoapResourceDiscoveryReply *QCoapClient::discover(QtCoap::MulticastGroup group, int port, const QString &discoveryPath) { Q_D(QCoapClient); @@ -416,8 +416,8 @@ QCoapDiscoveryReply *QCoapClient::discover(QtCoap::MulticastGroup group, int por /*! Discovers the resources available at the given \a url and returns - a new QCoapDiscoveryReply object which emits the - \l QCoapDiscoveryReply::discovered() signal whenever the response + a new QCoapResourceDiscoveryReply object which emits the + \l QCoapResourceDiscoveryReply::discovered() signal whenever the response arrives. Discovery path defaults to "/.well-known/core", but can be changed @@ -426,7 +426,7 @@ QCoapDiscoveryReply *QCoapClient::discover(QtCoap::MulticastGroup group, int por \sa get(), post(), put(), deleteResource(), observe() */ -QCoapDiscoveryReply *QCoapClient::discover(const QUrl &url, const QString &discoveryPath) +QCoapResourceDiscoveryReply *QCoapClient::discover(const QUrl &url, const QString &discoveryPath) { Q_D(QCoapClient); @@ -532,14 +532,14 @@ QCoapReply *QCoapClientPrivate::sendRequest(const QCoapRequest &request) \internal Sends the CoAP \a request to its own URL and returns a - new QCoapDiscoveryReply object. + new QCoapResourceDiscoveryReply object. */ -QCoapDiscoveryReply *QCoapClientPrivate::sendDiscovery(const QCoapRequest &request) +QCoapResourceDiscoveryReply *QCoapClientPrivate::sendDiscovery(const QCoapRequest &request) { Q_Q(QCoapClient); // Prepare the reply - QCoapDiscoveryReply *reply = new QCoapDiscoveryReply(request, q); + QCoapResourceDiscoveryReply *reply = new QCoapResourceDiscoveryReply(request, q); if (!send(reply)) { delete reply; diff --git a/src/coap/qcoapclient.h b/src/coap/qcoapclient.h index 0703ab1..b64905b 100644 --- a/src/coap/qcoapclient.h +++ b/src/coap/qcoapclient.h @@ -40,7 +40,7 @@ QT_BEGIN_NAMESPACE class QCoapReply; -class QCoapDiscoveryReply; +class QCoapResourceDiscoveryReply; class QCoapRequest; class QCoapProtocol; class QCoapConnection; @@ -74,11 +74,13 @@ public: void cancelObserve(const QUrl &url); void disconnect(); - QCoapDiscoveryReply *discover(QtCoap::MulticastGroup group = QtCoap::MulticastGroup::AllCoapNodesIPv4, - int port = QtCoap::DefaultPort, - const QString &discoveryPath = QLatin1String("/.well-known/core")); - QCoapDiscoveryReply *discover(const QUrl &baseUrl, - const QString &discoveryPath = QLatin1String("/.well-known/core")); + QCoapResourceDiscoveryReply *discover( + QtCoap::MulticastGroup group = QtCoap::MulticastGroup::AllCoapNodesIPv4, + int port = QtCoap::DefaultPort, + const QString &discoveryPath = QLatin1String("/.well-known/core")); + QCoapResourceDiscoveryReply *discover( + const QUrl &baseUrl, + const QString &discoveryPath = QLatin1String("/.well-known/core")); void setSecurityConfiguration(const QCoapSecurityConfiguration &configuration); void setBlockSize(quint16 blockSize); diff --git a/src/coap/qcoapclient_p.h b/src/coap/qcoapclient_p.h index e853f60..84d3a83 100644 --- a/src/coap/qcoapclient_p.h +++ b/src/coap/qcoapclient_p.h @@ -60,7 +60,7 @@ public: QThread *workerThread = nullptr; QCoapReply *sendRequest(const QCoapRequest &request); - QCoapDiscoveryReply *sendDiscovery(const QCoapRequest &request); + QCoapResourceDiscoveryReply *sendDiscovery(const QCoapRequest &request); bool send(QCoapReply *reply); Q_DECLARE_PUBLIC(QCoapClient) diff --git a/src/coap/qcoapreply.cpp b/src/coap/qcoapreply.cpp index 847539e..7d6ba40 100644 --- a/src/coap/qcoapreply.cpp +++ b/src/coap/qcoapreply.cpp @@ -183,7 +183,7 @@ void QCoapReplyPrivate::_q_setError(QtCoap::ResponseCode code) For \e Observe requests specifically, the notified() signal is emitted whenever a notification is received. - \sa QCoapClient, QCoapRequest, QCoapDiscoveryReply + \sa QCoapClient, QCoapRequest, QCoapResourceDiscoveryReply */ /*! diff --git a/src/coap/qcoaprequest.cpp b/src/coap/qcoaprequest.cpp index 1d9a441..47abc2b 100644 --- a/src/coap/qcoaprequest.cpp +++ b/src/coap/qcoaprequest.cpp @@ -107,7 +107,7 @@ void QCoapRequestPrivate::setUrl(const QUrl &url) The QCoapRequest contains data needed to make CoAP frames that can be sent to the URL it holds. - \sa QCoapClient, QCoapReply, QCoapDiscoveryReply + \sa QCoapClient, QCoapReply, QCoapResourceDiscoveryReply */ /*! diff --git a/src/coap/qcoapresource.cpp b/src/coap/qcoapresource.cpp index 7e20209..3ce1eea 100644 --- a/src/coap/qcoapresource.cpp +++ b/src/coap/qcoapresource.cpp @@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE The QCoapRequest contains data as the path and title of the resource and other ancillary information. - \sa QCoapDiscoveryReply + \sa QCoapResourceDiscoveryReply */ /*! diff --git a/src/coap/qcoapdiscoveryreply.cpp b/src/coap/qcoapresourcediscoveryreply.cpp index abde474..81affc2 100644 --- a/src/coap/qcoapdiscoveryreply.cpp +++ b/src/coap/qcoapresourcediscoveryreply.cpp @@ -28,13 +28,13 @@ ** ****************************************************************************/ -#include "qcoapdiscoveryreply_p.h" +#include "qcoapresourcediscoveryreply_p.h" #include "qcoapinternalreply_p.h" #include "qcoapnamespace_p.h" QT_BEGIN_NAMESPACE -QCoapDiscoveryReplyPrivate::QCoapDiscoveryReplyPrivate(const QCoapRequest &request) : +QCoapResourceDiscoveryReplyPrivate::QCoapResourceDiscoveryReplyPrivate(const QCoapRequest &request) : QCoapReplyPrivate(request) { } @@ -42,13 +42,14 @@ QCoapDiscoveryReplyPrivate::QCoapDiscoveryReplyPrivate(const QCoapRequest &reque /*! \internal - Updates the QCoapDiscoveryReply object, its message and list of resources + Updates the QCoapResourceDiscoveryReply object, its message and list of resources with data of the internal reply \a internalReply. */ -void QCoapDiscoveryReplyPrivate::_q_setContent(const QHostAddress &sender, const QCoapMessage &msg, - QtCoap::ResponseCode code) +void QCoapResourceDiscoveryReplyPrivate::_q_setContent(const QHostAddress &sender, + const QCoapMessage &msg, + QtCoap::ResponseCode code) { - Q_Q(QCoapDiscoveryReply); + Q_Q(QCoapResourceDiscoveryReply); if (q->isFinished()) return; @@ -59,17 +60,17 @@ void QCoapDiscoveryReplyPrivate::_q_setContent(const QHostAddress &sender, const if (QtCoap::isError(responseCode)) { _q_setError(responseCode); } else { - auto res = QCoapDiscoveryReply::resourcesFromCoreLinkList(sender, message.payload()); + auto res = QCoapResourceDiscoveryReply::resourcesFromCoreLinkList(sender, message.payload()); resources.append(res); emit q->discovered(q, res); } } /*! - \class QCoapDiscoveryReply + \class QCoapResourceDiscoveryReply \inmodule QtCoap - \brief The QCoapDiscoveryReply class holds the data of a CoAP reply + \brief The QCoapResourceDiscoveryReply class holds the data of a CoAP reply for a resource discovery request. \reentrant @@ -79,14 +80,14 @@ void QCoapDiscoveryReplyPrivate::_q_setContent(const QHostAddress &sender, const address for discovery, the discovered() signal will be emitted once for each response received. - \note A QCoapDiscoveryReply is a QCoapReply that stores also a list + \note A QCoapResourceDiscoveryReply is a QCoapReply that stores also a list of QCoapResources. \sa QCoapClient, QCoapRequest, QCoapReply, QCoapResource */ /*! - \fn void QCoapDiscoveryReply::discovered(QCoapDiscoveryReply *reply, + \fn void QCoapResourceDiscoveryReply::discovered(QCoapResourceDiscoveryReply *reply, QVector<QCoapResource> resources); This signal is emitted whenever a CoAP resource is discovered. @@ -101,17 +102,17 @@ void QCoapDiscoveryReplyPrivate::_q_setContent(const QHostAddress &sender, const Constructs a new CoAP discovery reply from the \a request and sets \a parent as its parent. */ -QCoapDiscoveryReply::QCoapDiscoveryReply(const QCoapRequest &request, QObject *parent) : - QCoapReply(*new QCoapDiscoveryReplyPrivate(request), parent) +QCoapResourceDiscoveryReply::QCoapResourceDiscoveryReply(const QCoapRequest &request, QObject *parent) : + QCoapReply(*new QCoapResourceDiscoveryReplyPrivate(request), parent) { } /*! Returns the list of resources. */ -QVector<QCoapResource> QCoapDiscoveryReply::resources() const +QVector<QCoapResource> QCoapResourceDiscoveryReply::resources() const { - Q_D(const QCoapDiscoveryReply); + Q_D(const QCoapResourceDiscoveryReply); return d->resources; } @@ -121,7 +122,7 @@ QVector<QCoapResource> QCoapDiscoveryReply::resources() const discovery request. */ QVector<QCoapResource> -QCoapDiscoveryReply::resourcesFromCoreLinkList(const QHostAddress &sender, const QByteArray &data) +QCoapResourceDiscoveryReply::resourcesFromCoreLinkList(const QHostAddress &sender, const QByteArray &data) { QVector<QCoapResource> resourceList; diff --git a/src/coap/qcoapdiscoveryreply.h b/src/coap/qcoapresourcediscoveryreply.h index 9411192..132f3d7 100644 --- a/src/coap/qcoapdiscoveryreply.h +++ b/src/coap/qcoapresourcediscoveryreply.h @@ -28,8 +28,8 @@ ** ****************************************************************************/ -#ifndef QCOAPDISCOVERYREPLY_H -#define QCOAPDISCOVERYREPLY_H +#ifndef QCOAPRESOURCEDISCOVERYREPLY_H +#define QCOAPRESOURCEDISCOVERYREPLY_H #include <QtCoap/qcoapreply.h> #include <QtCoap/qcoapresource.h> @@ -37,13 +37,13 @@ QT_BEGIN_NAMESPACE -class QCoapDiscoveryReplyPrivate; -class Q_COAP_EXPORT QCoapDiscoveryReply : public QCoapReply +class QCoapResourceDiscoveryReplyPrivate; +class Q_COAP_EXPORT QCoapResourceDiscoveryReply : public QCoapReply { Q_OBJECT public: - explicit QCoapDiscoveryReply(const QCoapRequest &request, QObject *parent = nullptr); + explicit QCoapResourceDiscoveryReply(const QCoapRequest &request, QObject *parent = nullptr); QVector<QCoapResource> resources() const; @@ -51,12 +51,12 @@ public: const QHostAddress &sender, const QByteArray &data); Q_SIGNALS: - void discovered(QCoapDiscoveryReply *reply, QVector<QCoapResource> resources); + void discovered(QCoapResourceDiscoveryReply *reply, QVector<QCoapResource> resources); private: - Q_DECLARE_PRIVATE(QCoapDiscoveryReply) + Q_DECLARE_PRIVATE(QCoapResourceDiscoveryReply) }; QT_END_NAMESPACE -#endif // QCOAPDISCOVERYREPLY_H +#endif // QCOAPRESOURCEDISCOVERYREPLY_H diff --git a/src/coap/qcoapdiscoveryreply_p.h b/src/coap/qcoapresourcediscoveryreply_p.h index 5f4856e..3d2a539 100644 --- a/src/coap/qcoapdiscoveryreply_p.h +++ b/src/coap/qcoapresourcediscoveryreply_p.h @@ -28,11 +28,11 @@ ** ****************************************************************************/ -#ifndef QCOAPDISCOVERYREPLY_P_H -#define QCOAPDISCOVERYREPLY_P_H +#ifndef QCOAPRESOURCEDISCOVERYREPLY_P_H +#define QCOAPRESOURCEDISCOVERYREPLY_P_H #include <QtCore/qlist.h> -#include <QtCoap/qcoapdiscoveryreply.h> +#include <QtCoap/qcoapresourcediscoveryreply.h> #include <QtCoap/qcoapresource.h> #include <private/qcoapreply_p.h> @@ -49,18 +49,18 @@ QT_BEGIN_NAMESPACE -class Q_AUTOTEST_EXPORT QCoapDiscoveryReplyPrivate : public QCoapReplyPrivate +class Q_AUTOTEST_EXPORT QCoapResourceDiscoveryReplyPrivate : public QCoapReplyPrivate { public: - QCoapDiscoveryReplyPrivate(const QCoapRequest &request); + QCoapResourceDiscoveryReplyPrivate(const QCoapRequest &request); void _q_setContent(const QHostAddress &sender, const QCoapMessage &, QtCoap::ResponseCode) override; QVector<QCoapResource> resources; - Q_DECLARE_PUBLIC(QCoapDiscoveryReply) + Q_DECLARE_PUBLIC(QCoapResourceDiscoveryReply) }; QT_END_NAMESPACE -#endif // QCOAPDISCOVERYREPLY_P_H +#endif // QCOAPRESOURCEDISCOVERYREPLY_P_H diff --git a/tests/auto/qcoapclient/tst_qcoapclient.cpp b/tests/auto/qcoapclient/tst_qcoapclient.cpp index 8f0302e..b06fa21 100644 --- a/tests/auto/qcoapclient/tst_qcoapclient.cpp +++ b/tests/auto/qcoapclient/tst_qcoapclient.cpp @@ -34,7 +34,7 @@ #include <QtCoap/qcoapclient.h> #include <QtCoap/qcoaprequest.h> #include <QtCoap/qcoapreply.h> -#include <QtCoap/qcoapdiscoveryreply.h> +#include <QtCoap/qcoapresourcediscoveryreply.h> #include <QtCore/qbuffer.h> #include <QtNetwork/qnetworkdatagram.h> #include <private/qcoapclient_p.h> @@ -699,7 +699,7 @@ void tst_QCoapClient::discover() QCoapClient client; - QScopedPointer<QCoapDiscoveryReply> resourcesReply(client.discover(url)); // /.well-known/core + QScopedPointer<QCoapResourceDiscoveryReply> resourcesReply(client.discover(url)); // /.well-known/core QSignalSpy spyReplyFinished(resourcesReply.data(), SIGNAL(finished(QCoapReply *))); QTRY_COMPARE_WITH_TIMEOUT(spyReplyFinished.count(), 1, 30000); diff --git a/tests/auto/qcoapresource/tst_qcoapresource.cpp b/tests/auto/qcoapresource/tst_qcoapresource.cpp index 0d54029..c71b1d9 100644 --- a/tests/auto/qcoapresource/tst_qcoapresource.cpp +++ b/tests/auto/qcoapresource/tst_qcoapresource.cpp @@ -32,7 +32,7 @@ #include <QCoreApplication> #include <QtCoap/qcoapresource.h> -#include <QtCoap/qcoapdiscoveryreply.h> +#include <QtCoap/qcoapresourcediscoveryreply.h> class tst_QCoapResource : public QObject { @@ -145,7 +145,7 @@ void tst_QCoapResource::parseCoreLink() QFETCH(QByteArray, coreLinkList); const QVector<QCoapResource> resourceList = - QCoapDiscoveryReply::resourcesFromCoreLinkList(QHostAddress(senderAddress), coreLinkList); + QCoapResourceDiscoveryReply::resourcesFromCoreLinkList(QHostAddress(senderAddress), coreLinkList); QCOMPARE(resourceList.size(), resourceNumber); |