QCoapOption Class
La classe QCoapOption contient des données sur les options CoAP. Plus d'informations...
| En-tête : | #include <QCoapOption> |
| CMake : | find_package(Qt6 REQUIRED COMPONENTS Coap)target_link_libraries(mytarget PRIVATE Qt6::Coap) |
| qmake : | QT += coap |
Remarque : toutes les fonctions de cette classe sont réentrantes.
Types publics
| enum | OptionName { Invalid, IfMatch, UriHost, Etag, IfNoneMatch, …, Size1 } |
Fonctions publiques
| 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 |
Description détaillée
CoAP définit un certain nombre d'options qui peuvent être incluses dans un message. Les demandes et les réponses peuvent inclure une liste d'une ou plusieurs options. Par exemple, l'URI d'une requête est transporté dans plusieurs options, et les métadonnées qui seraient transportées dans un en-tête HTTP sont également fournies en tant qu'options.
Une option contient un nom, lié à un identifiant d'option, et une valeur. Le nom est l'une des valeurs de l'énumération OptionName.
Documentation sur les types de membres
enum QCoapOption::OptionName
Indique le nom d'une option. La valeur de chaque ID est telle que spécifiée par le standard CoAP, à l'exception de Invalid. Vous pouvez vous référer aux RFC 7252 et RFC 7959 pour plus de détails.
| Constante | Valeur | Description de l'option |
|---|---|---|
QCoapOption::Invalid | 0 | Option non valide. |
QCoapOption::IfMatch | 1 | Option If-Match. |
QCoapOption::UriHost | 3 | Option Uri-Host. |
QCoapOption::Etag | 4 | Option Etag. |
QCoapOption::IfNoneMatch | 5 | Option If-None-Match. |
QCoapOption::Observe | 6 | Option Observe. |
QCoapOption::UriPort | 7 | Option Uri-Port. |
QCoapOption::LocationPath | 8 | Option Location-path. |
QCoapOption::UriPath | 11 | Option Uri-Path. |
QCoapOption::ContentFormat | 12 | Option Content-Format. |
QCoapOption::MaxAge | 14 | Option Max-Age. |
QCoapOption::UriQuery | 15 | Option Uri-Query. |
QCoapOption::Accept | 17 | Option Accept. |
QCoapOption::LocationQuery | 20 | Option Location-Query. |
QCoapOption::Block2 | 23 | Option Block2. |
QCoapOption::Block1 | 27 | Option Block1. |
QCoapOption::Size2 | 28 | Option Size2. |
QCoapOption::ProxyUri | 35 | Option Proxy-Uri. |
QCoapOption::ProxyScheme | 39 | Option Proxy-Scheme. |
QCoapOption::Size1 | 60 | Option Size1. |
Documentation des fonctions membres
QCoapOption::QCoapOption(QCoapOption::OptionName name = Invalid, const QByteArray &opaqueValue = QByteArray())
Construit une nouvelle option CoAP avec les paramètres name et QByteArray opaqueValue . Si aucun paramètre n'est transmis, un objet Invalid est construit.
Voir aussi isValid().
QCoapOption::QCoapOption(QCoapOption::OptionName name, const QString &stringValue)
Construit une nouvelle option CoAP avec l'adresse name et l'adresse QString stringValue .
Voir aussi isValid().
QCoapOption::QCoapOption(QCoapOption::OptionName name, quint32 intValue)
Construit une nouvelle option CoAP avec l'adresse name et l'entier non signé intValue.
Voir aussi isValid().
QCoapOption::QCoapOption(const QCoapOption &other)
Construit une nouvelle option CoAP comme une copie de other, rendant les deux options identiques.
Voir aussi isValid().
QCoapOption::QCoapOption(QCoapOption &&other)
Move-construit une QCoapOption, la faisant pointer sur le même objet que other.
[noexcept] QCoapOption::~QCoapOption()
Détruit l'objet QCoapOption.
bool QCoapOption::isValid() const
Renvoie true si l'option est valide.
int QCoapOption::length() const
Renvoie la longueur de la valeur de l'option.
QCoapOption::OptionName QCoapOption::name() const
Renvoie le nom de l'option.
QByteArray QCoapOption::opaqueValue() const
Renvoie la valeur de l'option.
QString QCoapOption::stringValue() const
Renvoie la valeur QString de l'option.
[noexcept] void QCoapOption::swap(QCoapOption &other)
Remplace cette option par other. Cette opération est très rapide et n'échoue jamais.
quint32 QCoapOption::uintValue() const
Renvoie la valeur entière de l'option.
bool QCoapOption::operator!=(const QCoapOption &other) const
Renvoie true si QCoapOption et other sont différents.
[noexcept] QCoapOption &QCoapOption::operator=(QCoapOption &&other)
Déplace other dans cette option et renvoie une référence à cette QCoapOption.
QCoapOption &QCoapOption::operator=(const QCoapOption &other)
Copie other dans cette option, rendant les deux options identiques. Renvoie une référence à ce site QCoapOption.
bool QCoapOption::operator==(const QCoapOption &other) const
Renvoie true si QCoapOption et other sont égaux.
© 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.