QCoapReply Class

The QCoapReply class holds the data of a CoAP reply. 更多...

头: #include <QCoapReply>
qmake: QT += coap
继承: QIODevice
继承者: QCoapResourceDiscoveryReply

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

公共函数

virtual ~QCoapReply () override
void abortRequest ()
QtCoap::Error errorReceived () const
bool isAborted () const
bool isFinished () const
bool isRunning () const
bool isSuccessful () const
QCoapMessage message () const
QtCoap::Method 方法 () const
QCoapRequest request () const
QtCoap::ResponseCode responseCode () const
QUrl url () const

信号

void aborted (const QCoapToken & token )
void error (QCoapReply * reply , QtCoap::Error error )
void finished (QCoapReply * reply )
void notified (QCoapReply * reply , const QCoapMessage & message )

详细描述

The QCoapReply contains data related to a request sent with the QCoapClient .

finished () signal is emitted when the response is fully received or when the request fails.

For Observe requests specifically, the notified () signal is emitted whenever a notification is received.

另请参阅 QCoapClient , QCoapRequest ,和 QCoapResourceDiscoveryReply .

成员函数文档编制

[signal] void QCoapReply:: aborted (const QCoapToken & token )

This signal is emitted when the request is aborted or the reply is deleted. Its token parameter is the token of the exchange that has been aborted.

注意: QCoapReply is deleted while not finished, both aborted() and finished () signal will be emitted immediately before the QCoapReply is destroyed. Given the QCoapReply may have been deleted when receiving the signal, you should not rely on the sender () object to be still valid.

另请参阅 finished () 和 error ().

[signal] void QCoapReply:: error ( QCoapReply * reply , QtCoap::Error error )

This signal is emitted whenever an error occurs and is followed by the finished () 信号。

Its reply parameters is the QCoapReply itself for convenience, and the error parameter is the error received.

另请参阅 finished () 和 aborted ().

[signal] void QCoapReply:: finished ( QCoapReply * reply )

This signal is emitted whenever the corresponding request finished, whether successfully or not. When a resource is observed, this signal will only be emitted once, when the observation ends.

reply parameter is the QCoapReply itself for convenience.

注意: QCoapReply is deleted while not finished, both aborted () and finished() signal will be emitted immediately before the QCoapReply is destroyed. Given the QCoapReply may have been deleted when receiving the signal, you should not rely on the reply to be still valid.

另请参阅 QCoapClient::finished (), isFinished (), notified (),和 aborted ().

[signal] void QCoapReply:: notified ( QCoapReply * reply , const QCoapMessage & message )

This signal is emitted whenever a notification is received from an observed resource.

Its message parameter is a QCoapMessage containing the payload and the message details. The reply parameter is the QCoapReply itself for convenience.

另请参阅 QCoapClient::finished (), isFinished (), finished (), and notified().

[override virtual] QCoapReply:: ~QCoapReply ()

销毁 QCoapReply and aborts the request if its response has not yet been received.

void QCoapReply:: abortRequest ()

Aborts the request immediately and emits the aborted (const QCoapToken &token) signal if the request was not finished.

QtCoap::Error QCoapReply:: errorReceived () const

Returns the error of the reply or QCoapReply::NoError if there is no error.

bool QCoapReply:: isAborted () const

返回 true if the request has been aborted.

bool QCoapReply:: isFinished () const

返回 true if the request is finished.

另请参阅 finished ().

bool QCoapReply:: isRunning () const

返回 true if the request is running.

bool QCoapReply:: isSuccessful () const

返回 true if the request finished with no error.

QCoapMessage QCoapReply:: message () const

Returns the contained message.

QtCoap::Method QCoapReply:: method () const

Returns the method of the associated request.

QCoapRequest QCoapReply:: request () const

Returns the associated request.

QtCoap::ResponseCode QCoapReply:: responseCode () const

Returns the response code of the request.

QUrl QCoapReply:: url () const

Returns the target uri of the associated request.