QCoapRequest Class
QCoapRequest 类保存一个 CoAP 请求。该请求可通过QCoapClient 发送。更多
头文件: | #include <QCoapRequest> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Coap) target_link_libraries(mytarget PRIVATE Qt6::Coap) |
qmake: | QT += coap |
继承: | QCoapMessage |
注意:该类中的所有函数都是可重入的。
公共函数
QCoapRequest(const char *url, QCoapMessage::Type type = Type::NonConfirmable) | |
QCoapRequest(const QUrl &url = QUrl(), QCoapMessage::Type type = Type::NonConfirmable, const QUrl &proxyUrl = QUrl()) | |
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) |
另请参阅 QCoapClient,QCoapReply, 和QCoapResourceDiscoveryReply 。
成员函数文档
[explicit]
QCoapRequest::QCoapRequest(const char *url, QCoapMessage::Type type = Type::NonConfirmable)
从字面字符串构建 QCoapRequest
[explicit]
QCoapRequest::QCoapRequest(const QUrl &url = QUrl(), QCoapMessage::Type type = Type::NonConfirmable, const QUrl &proxyUrl = QUrl())
用目标url 、代理 URLproxyUrl 和消息的type 构建一个 QCoapRequest 对象。
QCoapRequest::QCoapRequest(const QCoapRequest &other)
构造other QCoapRequest 的副本。
[noexcept]
QCoapRequest::~QCoapRequest()
摧毁QCoapRequest.
void QCoapRequest::enableObserve()
将观测值设置为true
,以提出观测请求。
另请参阅 isObserve().
bool QCoapRequest::isObserve() const
如果请求是观察请求,则返回true
。
另请参阅 enableObserve().
QtCoap::Method QCoapRequest::method() const
返回请求的方法。
QUrl QCoapRequest::proxyUrl() const
返回请求的代理 URI。如果无效,将直接发送请求。
另请参见 setProxyUrl()。
void QCoapRequest::setProxyUrl(const QUrl &proxyUrl)
将请求的代理 URI 设置为给定的proxyUrl 。
另请参阅 proxyUrl() 。
void QCoapRequest::setUrl(const QUrl &url)
将请求的目标 URI 设置为给定的url 。
如果未指定,URL 的方案默认为 "coap",端口默认为 5683。
另请参阅 url() 。
QUrl QCoapRequest::url() const
返回请求的目标 URI。
另请参阅 setUrl()。
QCoapRequest &QCoapRequest::operator=(const QCoapRequest &other)
创建other 的副本。
© 2025 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.