QCoapResource Class
Die Klasse „QCoapResource“ enthält Informationen zu einer erkannten Ressource. Mehr...
| Header: | #include <QCoapResource> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Coap) target_link_libraries(mytarget PRIVATE Qt6::Coap) |
| qmake: | QT += coap |
Hinweis: Alle Funktionen dieser Klasse sind reentrant.
Öffentliche Funktionen
| QCoapResource() | |
| QCoapResource(const QCoapResource &other) | |
| ~QCoapResource() | |
| uint | contentFormat() const |
| QHostAddress | host() const |
| QString | interface() const |
| int | maximumSize() const |
| bool | observable() const |
| QString | path() const |
| QString | resourceType() const |
| void | setContentFormat(uint contentFormat) |
| void | setHost(const QHostAddress &host) |
| void | setInterface(const QString &interface) |
| void | setMaximumSize(int maximumSize) |
| void | setObservable(bool observable) |
| void | setPath(const QString &path) |
| void | setResourceType(const QString &resourceType) |
| void | setTitle(const QString &title) |
| void | swap(QCoapResource &other) |
| QString | title() const |
| QCoapResource & | operator=(const QCoapResource &other) |
Detaillierte Beschreibung
Das ` QCoapRequest ` enthält Daten wie den Pfad und den Titel der Ressource sowie weitere Zusatzinformationen.
Siehe auch „ QCoapResourceDiscoveryReply “.
Dokumentation der Mitgliedsfunktionen
QCoapResource::QCoapResource()
Erstellt eine neue `QCoapResource`.
QCoapResource::QCoapResource(const QCoapResource &other)
Erstellt eine neue CoAP-Ressource als Kopie von other, wodurch die beiden Ressourcen identisch werden.
[noexcept] QCoapResource::~QCoapResource()
Zerstöre das „ QCoapResource “.
uint QCoapResource::contentFormat() const
Gibt den Content-Format-Code der Ressource zurück.
Der Content-Format-Code entspricht dem Attribut „ct“ und gibt einen Hinweis auf die Content-Formate, die diese Ressource zurückgibt. Er ist in RFC 7252 festgelegt.
Siehe auch „ setContentFormat“ ().
QHostAddress QCoapResource::host() const
Gibt den Host der Ressource zurück.
Siehe auch ` setHost()`.
QString QCoapResource::interface() const
Gibt die Schnittstellenbeschreibung der Ressource zurück.
Das Attribut „if“ der Schnittstellenbeschreibung ist eine undurchsichtige Zeichenkette, die dazu dient, einen Namen oder eine URI anzugeben, die auf eine bestimmte Schnittstellendefinition verweisen, die für die Interaktion mit der Zielressource verwendet wird. Es ist in RFC 6690 spezifiziert.
Siehe auch „ setInterface“ ().
int QCoapResource::maximumSize() const
Gibt die maximale Größe der Ressource zurück.
Das Attribut „sz“ zur Schätzung der maximalen Größe gibt einen Anhaltspunkt für die maximale Größe der Ressourcenrepräsentation, die durch einen GET-Aufruf an die Ziel-URI zurückgegeben wird. Es ist in RFC 6690 festgelegt.
Siehe auch „ setMaximumSize“ ().
bool QCoapResource::observable() const
Gibt „ true “ zurück, wenn die Ressource beobachtbar ist
Siehe auch ` setObservable()`.
QString QCoapResource::path() const
Gibt den Pfad der Ressource zurück.
Siehe auch ` setPath()`.
QString QCoapResource::resourceType() const
Gibt den Typ der Ressource zurück.
Siehe auch ` setResourceType()`.
void QCoapResource::setContentFormat(uint contentFormat)
Legt das Inhaltsformat der Ressource auf „ contentFormat “ fest. Das Inhaltsformat kann eines der in der CoAP-Inhaltsformat-Registrierung definierten Formate sein.
Hinweis: CoAP unterstützt gängige Inhaltsformate wie XML, JSON usw., diese sind jedoch textbasiert und daher sowohl hinsichtlich der Nutzlast als auch der Verarbeitung sehr ressourcenintensiv. Eines der für die Verwendung mit CoAP empfohlenen Inhaltsformate ist CBOR, das speziell für den Einsatz in solchen Kontexten entwickelt wurde.
Siehe auch contentFormat(), QCborStreamWriter und QCborStreamReader.
void QCoapResource::setHost(const QHostAddress &host)
Legt den Host der Ressource auf host fest.
Siehe auch host().
void QCoapResource::setInterface(const QString &interface)
Setzt die Schnittstelle der Ressource auf „ interface “.
Siehe auch interface().
void QCoapResource::setMaximumSize(int maximumSize)
Legt die maximale Größe der Ressource auf „ maximumSize “ fest.
Siehe auch maximumSize().
void QCoapResource::setObservable(bool observable)
Macht die Ressource beobachtbar, wenn der Parameter „ observable “ auf „ true “ gesetzt ist.
Siehe auch ` observable()`.
void QCoapResource::setPath(const QString &path)
Legt den Pfad der Ressource auf path fest.
Siehe auch path().
void QCoapResource::setResourceType(const QString &resourceType)
Legt den Ressourcentyp auf „ resourceType “ fest.
Siehe auch resourceType().
void QCoapResource::setTitle(const QString &title)
Legt den Titel der Ressource auf „ title “ fest.
Siehe auch title().
[noexcept] void QCoapResource::swap(QCoapResource &other)
Tauscht diese Ressource gegen „ other “ aus. Dieser Vorgang ist sehr schnell und schlägt niemals fehl.
QString QCoapResource::title() const
Gibt den Titel der Ressource zurück.
Siehe auch setTitle().
QCoapResource &QCoapResource::operator=(const QCoapResource &other)
Kopiert „ other “ in diese Ressource, wodurch die beiden Ressourcen identisch werden. Gibt eine Referenz auf „ QCoapResource “ zurück.
© 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.