QCoapRequest Class

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

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

注意: 此类的所有函数 可重入 .

公共函数

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 方法 () const
QUrl proxyUrl () const
void setProxyUrl (const QUrl & proxyUrl )
void setUrl (const QUrl & url )
QUrl url () const
QCoapRequest & operator= (const QCoapRequest & other )

详细描述

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

另请参阅 QCoapClient , QCoapReply ,和 QCoapResourceDiscoveryReply .

成员函数文档编制

[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 proxyUrltype 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 )

构造副本为 other QCoapRequest.

QCoapRequest:: ~QCoapRequest ()

销毁 QCoapRequest .

void QCoapRequest:: enableObserve ()

Sets the observe to true to make an observe request.

另请参阅 isObserve ().

bool QCoapRequest:: isObserve () const

返回 true if the request is an observe request.

另请参阅 enableObserve ().

QtCoap::Method QCoapRequest:: 方法 () 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.

另请参阅 setProxyUrl ().

void QCoapRequest:: setProxyUrl (const QUrl & proxyUrl )

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

另请参阅 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.

另请参阅 url ().

QUrl QCoapRequest:: url () const

Returns the target URI of the request.

另请参阅 setUrl ().

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

创建副本为 other .