QCoapReply Class
La classe QCoapReply contiene i dati di una risposta CoAP. Maggiori informazioni...
| Intestazione: | #include <QCoapReply> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Coap) target_link_libraries(mytarget PRIVATE Qt6::Coap) |
| qmake: | QT += coap |
| Eredita da: | QIODevice |
| Ereditato da: |
Nota: Tutte le funzioni di questa classe sono rientranti.
Funzioni pubbliche
| 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 | method() const |
| QCoapRequest | request() const |
| QtCoap::ResponseCode | responseCode() const |
| QUrl | url() const |
Segnali
| void | aborted(const QCoapToken &token) |
| void | error(QCoapReply *reply, QtCoap::Error error) |
| void | finished(QCoapReply *reply) |
| void | notified(QCoapReply *reply, const QCoapMessage &message) |
Descrizione dettagliata
La classe QCoapReply contiene i dati relativi a una richiesta inviata tramite la funzione QCoapClient.
Il segnale finished() viene emesso quando la risposta è stata ricevuta per intero o quando la richiesta fallisce.
Per le richieste di tipo "Observe", in particolare, il segnale notified() viene emesso ogni volta che viene ricevuta una notifica.
Vedi anche QCoapClient, QCoapRequest e QCoapResourceDiscoveryReply.
Documentazione delle funzioni membro
[override virtual noexcept] QCoapReply::~QCoapReply()
Elimina l'oggetto ` QCoapReply ` e interrompe la richiesta se la relativa risposta non è ancora stata ricevuta.
void QCoapReply::abortRequest()
Interrompe immediatamente la richiesta ed emette il segnale “ aborted ” (const QCoapToken &token) se la richiesta non è stata completata.
[signal] void QCoapReply::aborted(const QCoapToken &token)
Questo segnale viene emesso quando la richiesta viene interrotta o la risposta viene cancellata. Il suo parametro ` token ` è il token dello scambio che è stato interrotto.
Nota: se l’ QCoapReply viene eliminato prima che l’operazione sia terminata, i segnali aborted() e finished() verranno emessi immediatamente prima che l’ QCoapReply venga distrutto. Dato che l’ QCoapReply potrebbe essere stato eliminato al momento della ricezione del segnale, non si dovrebbe fare affidamento sul fatto che l’oggetto sender() sia ancora valido.
Vedi anche finished() e error().
[signal] void QCoapReply::error(QCoapReply *reply, QtCoap::Error error)
Questo segnale viene emesso ogni volta che si verifica un errore ed è seguito dal segnale finished().
Per comodità, il suo parametro ` reply ` è lo stesso oggetto ` QCoapReply `, mentre il parametro ` error ` è l'errore ricevuto.
Vedi anche finished() e aborted().
QtCoap::Error QCoapReply::errorReceived() const
Restituisce l'errore contenuto nella risposta oppure QCoapReply::NoError se non vi sono errori.
[signal] void QCoapReply::finished(QCoapReply *reply)
Questo segnale viene emesso ogni volta che la richiesta corrispondente viene completata, indipendentemente dal fatto che abbia avuto esito positivo o meno. Quando si osserva una risorsa, questo segnale viene emesso una sola volta, al termine dell'osservazione.
Il parametro ` reply ` è, per comodità, lo stesso ` QCoapReply `.
Nota: se l’ QCoapReply viene eliminato prima del completamento, sia il segnale aborted() che quello finished() verranno emessi immediatamente prima che l’ QCoapReply venga distrutto. Dato che l’ QCoapReply potrebbe essere stato eliminato al momento della ricezione del segnale, non si dovrebbe fare affidamento sul fatto che l’ reply sia ancora valido.
Vedi anche QCoapClient::finished(), isFinished(), notified() e aborted().
bool QCoapReply::isAborted() const
Restituisce ` true ` se la richiesta è stata interrotta.
bool QCoapReply::isFinished() const
Restituisce true se la richiesta è stata completata.
Vedi anche finished().
bool QCoapReply::isRunning() const
Restituisce ` true ` se la richiesta è in esecuzione.
bool QCoapReply::isSuccessful() const
Restituisce ` true ` se la richiesta è stata completata senza errori.
QCoapMessage QCoapReply::message() const
Restituisce il messaggio contenuto.
QtCoap::Method QCoapReply::method() const
Restituisce il metodo della richiesta associata.
[signal] void QCoapReply::notified(QCoapReply *reply, const QCoapMessage &message)
Questo segnale viene emesso ogni volta che si riceve una notifica da una risorsa monitorata.
Il suo parametro ` message ` è un ` QCoapMessage ` contenente il payload e i dettagli del messaggio. Il parametro ` reply ` è, per comodità, l’ QCoapReply o stesso.
Vedi anche QCoapClient::finished(), isFinished(), finished() e aborted().
QCoapRequest QCoapReply::request() const
Restituisce la richiesta associata.
QtCoap::ResponseCode QCoapReply::responseCode() const
Restituisce il codice di risposta della richiesta.
QUrl QCoapReply::url() const
Restituisce l'URI di destinazione della richiesta associata.
© 2026 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.