aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2019-05-11 00:26:02 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2019-05-14 15:15:05 +0000
commit218d796a1e9a2ae9ad87c71f7487a62d3a7dbab2 (patch)
tree28cfeae0555f75eb645b6f0a66e3826975c7f35a /src
parenta5beff7436aba965d16b63d5677b6d3920724c59 (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>
Diffstat (limited to 'src')
-rw-r--r--src/coap/coap.pro8
-rw-r--r--src/coap/doc/src/qtcoap-overview.qdoc8
-rw-r--r--src/coap/qcoapclient.cpp26
-rw-r--r--src/coap/qcoapclient.h14
-rw-r--r--src/coap/qcoapclient_p.h2
-rw-r--r--src/coap/qcoapreply.cpp2
-rw-r--r--src/coap/qcoaprequest.cpp2
-rw-r--r--src/coap/qcoapresource.cpp2
-rw-r--r--src/coap/qcoapresourcediscoveryreply.cpp (renamed from src/coap/qcoapdiscoveryreply.cpp)33
-rw-r--r--src/coap/qcoapresourcediscoveryreply.h (renamed from src/coap/qcoapdiscoveryreply.h)16
-rw-r--r--src/coap/qcoapresourcediscoveryreply_p.h (renamed from src/coap/qcoapdiscoveryreply_p.h)14
11 files changed, 65 insertions, 62 deletions
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