QCoapOption Class
La classe QCoapOption contiene dati relativi alle opzioni CoAP. Maggiori informazioni...
| Intestazione: | #include <QCoapOption> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Coap) target_link_libraries(mytarget PRIVATE Qt6::Coap) |
| qmake: | QT += coap |
Nota: tutte le funzioni di questa classe sono rientranti.
Tipi pubblici
| enum | OptionName { Invalid, IfMatch, UriHost, Etag, IfNoneMatch, …, Size1 } |
Funzioni pubbliche
| QCoapOption(QCoapOption::OptionName name = Invalid, const QByteArray &opaqueValue = QByteArray()) | |
| QCoapOption(QCoapOption::OptionName name, const QString &stringValue) | |
| QCoapOption(QCoapOption::OptionName name, quint32 intValue) | |
| QCoapOption(const QCoapOption &other) | |
| QCoapOption(QCoapOption &&other) | |
| ~QCoapOption() | |
| bool | isValid() const |
| int | length() const |
| QCoapOption::OptionName | name() const |
| QByteArray | opaqueValue() const |
| QString | stringValue() const |
| void | swap(QCoapOption &other) |
| quint32 | uintValue() const |
| bool | operator!=(const QCoapOption &other) const |
| QCoapOption & | operator=(QCoapOption &&other) |
| QCoapOption & | operator=(const QCoapOption &other) |
| bool | operator==(const QCoapOption &other) const |
Descrizione dettagliata
CoAP definisce una serie di opzioni che possono essere incluse in un messaggio. Sia le richieste che le risposte possono includere un elenco di una o più opzioni. Ad esempio, l'URI in una richiesta viene trasportato in diverse opzioni, e anche i metadati che in HTTP verrebbero trasportati in un'intestazione HTTP vengono forniti come opzioni.
Un'opzione contiene un nome, associato a un ID opzione, e un valore. Il nome è uno dei valori dell'enumerazione OptionName.
Documentazione sui tipi di membro
enum QCoapOption::OptionName
Indica il nome di un'opzione. Il valore di ciascun ID è quello specificato dallo standard CoAP, ad eccezione di "Invalid". Per ulteriori dettagli, consultare le RFC 7252 e RFC 7959.
| Costante | Valore | Descrizione |
|---|---|---|
QCoapOption::Invalid | 0 | Un'opzione non valida. |
QCoapOption::IfMatch | 1 | Opzione If-Match. |
QCoapOption::UriHost | 3 | Opzione Uri-Host. |
QCoapOption::Etag | 4 | Opzione Etag. |
QCoapOption::IfNoneMatch | 5 | Opzione If-None-Match. |
QCoapOption::Observe | 6 | Opzione Observe. |
QCoapOption::UriPort | 7 | Opzione Uri-Port. |
QCoapOption::LocationPath | 8 | Opzione Location-path. |
QCoapOption::UriPath | 11 | Opzione Uri-Path. |
QCoapOption::ContentFormat | 12 | Opzione Content-Format. |
QCoapOption::MaxAge | 14 | Opzione Max-Age. |
QCoapOption::UriQuery | 15 | Opzione Uri-Query. |
QCoapOption::Accept | 17 | Opzione Accept. |
QCoapOption::LocationQuery | 20 | Opzione Location-Query. |
QCoapOption::Block2 | 23 | Opzione Block2. |
QCoapOption::Block1 | 27 | Opzione Block1. |
QCoapOption::Size2 | 28 | Opzione Size2. |
QCoapOption::ProxyUri | 35 | Opzione Proxy-Uri. |
QCoapOption::ProxyScheme | 39 | Opzione Proxy-Scheme. |
QCoapOption::Size1 | 60 | Opzione Size1. |
Documentazione delle funzioni membro
QCoapOption::QCoapOption(QCoapOption::OptionName name = Invalid, const QByteArray &opaqueValue = QByteArray())
Crea una nuova opzione CoAP con i valori specificati per name, QByteArray e opaqueValue. Se non vengono passati parametri, crea un oggetto Invalid.
Vedi anche isValid().
QCoapOption::QCoapOption(QCoapOption::OptionName name, const QString &stringValue)
Crea una nuova opzione CoAP con l'name specificato e l'QString stringValue .
Vedi anche isValid().
QCoapOption::QCoapOption(QCoapOption::OptionName name, quint32 intValue)
Crea una nuova opzione CoAP con l'name specificato e l'intero senza segno intValue.
Vedi anche isValid().
QCoapOption::QCoapOption(const QCoapOption &other)
Crea una nuova opzione CoAP come copia di other, rendendo le due opzioni identiche.
Vedi anche isValid().
QCoapOption::QCoapOption(QCoapOption &&other)
Crea un oggetto `QCoapOption` tramite `move-construct`, facendo sì che esso punti allo stesso oggetto a cui puntava ` other `.
[noexcept] QCoapOption::~QCoapOption()
Elimina l'oggetto ` QCoapOption `.
bool QCoapOption::isValid() const
Restituisce ` true ` se l'opzione è valida.
int QCoapOption::length() const
Restituisce la lunghezza del valore dell'opzione.
QCoapOption::OptionName QCoapOption::name() const
Restituisce il nome dell'opzione.
QByteArray QCoapOption::opaqueValue() const
Restituisce il valore dell'opzione.
QString QCoapOption::stringValue() const
Restituisce il valore " QString " dell'opzione.
[noexcept] void QCoapOption::swap(QCoapOption &other)
Scambia questa opzione con " other". Questa operazione è molto veloce e non fallisce mai.
quint32 QCoapOption::uintValue() const
Restituisce il valore intero dell'opzione.
Nota: un'opzione di tipo uint può contenere al massimo 4 byte. Se il valore dell'opzione è più lungo, per calcolare il risultato vengono utilizzati solo i 4 byte meno significativi; utilizzare length() per rilevare un valore troppo lungo.
bool QCoapOption::operator!=(const QCoapOption &other) const
Restituisce ` true ` se ` QCoapOption ` e ` other ` sono diversi.
[noexcept] QCoapOption &QCoapOption::operator=(QCoapOption &&other)
Sposta ` other ` in questa opzione e restituisce un riferimento a questa ` QCoapOption`.
QCoapOption &QCoapOption::operator=(const QCoapOption &other)
Copia other in questa opzione, rendendo le due opzioni identiche. Restituisce un riferimento a questo QCoapOption.
bool QCoapOption::operator==(const QCoapOption &other) const
Restituisce " true " se " QCoapOption " e " other " sono uguali.
© 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.