QCoapRequest Class

The QCoapRequest class holds a CoAP request. This request can be sent with QCoapClient. More...

Header: #include <QCoapRequest>
CMake: find_package(Qt6 REQUIRED COMPONENTS Coap)
target_link_libraries(mytarget PRIVATE Qt6::Coap)
qmake: QT += coap
Inherits: QCoapMessage

Note: All functions in this class are reentrant.

Public Functions

QCoapRequest(const QUrl &url = QUrl(), QCoapMessage::Type type = Type::NonConfirmable, const QUrl &proxyUrl = QUrl())
QCoapRequest(const char *url, QCoapMessage::Type type = Type::NonConfirmable)
QCoapRequest(const QCoapRequest &other)
~QCoapRequest()
void enableObserve()
bool isObserve() const
QtCoap::Method method() const
QUrl proxyUrl() const
void setProxyUrl(const QUrl &proxyUrl)
void setUrl(const QUrl &url)
QUrl url() const
QCoapRequest &operator=(const QCoapRequest &other)

Detailed Description

The QCoapRequest contains data needed to make CoAP frames that can be sent to the URL it holds.

See also QCoapClient, QCoapReply, and QCoapResourceDiscoveryReply.

Member Function Documentation

[explicit] QCoapRequest::QCoapRequest(const QUrl &url = QUrl(), QCoapMessage::Type type = Type::NonConfirmable, const QUrl &proxyUrl = QUrl())

Constructs a QCoapRequest object with the target url, the proxy URL proxyUrl and the type of the message.

[explicit] QCoapRequest::QCoapRequest(const char *url, QCoapMessage::Type type = Type::NonConfirmable)

Constructs a QCoapRequest from a string literal

QCoapRequest::QCoapRequest(const QCoapRequest &other)

Constructs a copy of the other QCoapRequest.

QCoapRequest::~QCoapRequest()

Destroys the QCoapRequest.

void QCoapRequest::enableObserve()

Sets the observe to true to make an observe request.

See also isObserve().

bool QCoapRequest::isObserve() const

Returns true if the request is an observe request.

See also enableObserve().

QtCoap::Method QCoapRequest::method() const

Returns the method of the request.

QUrl QCoapRequest::proxyUrl() const

Returns the proxy URI of the request. The request shall be sent directly if this is invalid.

See also setProxyUrl().

void QCoapRequest::setProxyUrl(const QUrl &proxyUrl)

Sets the proxy URI of the request to the given proxyUrl.

See also proxyUrl().

void QCoapRequest::setUrl(const QUrl &url)

Sets the target URI of the request to the given url.

If not indicated, the scheme of the URL will default to 'coap', and its port will default to 5683.

See also url().

QUrl QCoapRequest::url() const

Returns the target URI of the request.

See also setUrl().

QCoapRequest &QCoapRequest::operator=(const QCoapRequest &other)

Creates a copy of other.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.