Add parameter for specifying the port for multicast discovery

Change-Id: I75db1a9fc3bf17df87a834a90d0e5bb5150ccc1c
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This commit is contained in:
Sona Kurazyan 2019-03-29 10:34:36 +01:00
parent 64b696e517
commit 6473d2e807
2 changed files with 7 additions and 5 deletions

View File

@ -382,10 +382,10 @@ QCoapReply *QCoapClient::deleteResource(const QUrl &url)
\overload
Discovers the resources available at the endpoints which have joined
the \a group. Returns a new QCoapDiscoveryReply object which emits the
\l QCoapDiscoveryReply::discovered() signal whenever a response arrives.
The \a group is one of the CoAP multicast group addresses and defaults to
QtCoap::AllCoapNodesIPv4.
the \a group at the given \a port. Returns a new QCoapDiscoveryReply
object which emits the \l QCoapDiscoveryReply::discovered() signal whenever
a response arrives. The \a group is one of the CoAP multicast group addresses
and defaults to QtCoap::AllCoapNodesIPv4.
Discovery path defaults to "/.well-known/core", but can be changed
by passing a different path to \a discoveryPath. Discovery is described in
@ -393,7 +393,7 @@ QCoapReply *QCoapClient::deleteResource(const QUrl &url)
\sa get(), post(), put(), deleteResource(), observe()
*/
QCoapDiscoveryReply *QCoapClient::discover(QtCoap::MulticastGroup group,
QCoapDiscoveryReply *QCoapClient::discover(QtCoap::MulticastGroup group, int port,
const QString &discoveryPath)
{
Q_D(QCoapClient);
@ -414,6 +414,7 @@ QCoapDiscoveryReply *QCoapClient::discover(QtCoap::MulticastGroup group,
QUrl discoveryUrl;
discoveryUrl.setHost(base);
discoveryUrl.setPath(discoveryPath);
discoveryUrl.setPort(port);
QCoapRequest request(discoveryUrl);
request.setMethod(QtCoap::Get);

View File

@ -74,6 +74,7 @@ public:
void cancelObserve(const QUrl &url);
QCoapDiscoveryReply *discover(QtCoap::MulticastGroup group = QtCoap::AllCoapNodesIPv4,
int port = QtCoap::DefaultPort,
const QString &discoveryPath = QLatin1String("/.well-known/core"));
QCoapDiscoveryReply *discover(const QUrl &baseUrl,
const QString &discoveryPath = QLatin1String("/.well-known/core"));