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.
[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.
Aborts the request immediately and emits the aborted (const QCoapToken &token) signal if the request was not finished.
Returns the error of the reply or QCoapReply::NoError if there is no error.
返回
true
if the request has been aborted.
返回
true
if the request is finished.
另请参阅 finished ().
返回
true
if the request is running.
返回
true
if the request finished with no error.
Returns the contained message.
Returns the method of the associated request.
Returns the associated request.
Returns the response code of the request.
Returns the target uri of the associated request.