QCoapResource Class

Die Klasse QCoapResource enthält Informationen über eine entdeckte Ressource. Mehr...

Kopfzeile: #include <QCoapResource>
CMake: find_package(Qt6 REQUIRED COMPONENTS Coap)
target_link_libraries(mytarget PRIVATE Qt6::Coap)
qmake: QT += coap

Hinweis: Alle Funktionen in 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

QCoapRequest enthält Daten wie den Pfad und den Titel der Ressource und andere Zusatzinformationen.

Siehe auch QCoapResourceDiscoveryReply.

Dokumentation der Mitgliedsfunktionen

QCoapResource::QCoapResource()

Konstruiert eine neue QCoapResource.

QCoapResource::QCoapResource(const QCoapResource &other)

Konstruiert eine neue CoAP-Ressource als Kopie von other, wodurch die beiden Ressourcen identisch werden.

[noexcept] QCoapResource::~QCoapResource()

Zerstören Sie die 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 spezifiziert.

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 Schnittstellenbeschreibung 'if' ist eine undurchsichtige Zeichenkette, die verwendet wird, um einen Namen oder einen URI anzugeben, der eine bestimmte Schnittstellendefinition angibt, die zur 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" für die geschätzte maximale Größe gibt einen Hinweis auf die maximale Größe der Ressourcendarstellung, die durch die Durchführung eines GET auf den Ziel-URI zurückgegeben wird. Es ist in RFC 6690 spezifiziert.

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)

Setzt das Inhaltsformat der Ressource auf contentFormat. Das Inhaltsformat kann eines der im CoAP Content-Formats Registry definierten Inhaltsformate sein.

Hinweis: CoAP unterstützt gängige Inhaltsformate wie XML, JSON usw., diese sind jedoch textbasiert und daher sowohl in der Nutzlast als auch in der Verarbeitung schwerfällig. Eines der empfohlenen Inhaltsformate für die Verwendung mit CoAP ist CBOR, das für die Verwendung in solchen Kontexten konzipiert ist.

Siehe auch contentFormat(), QCborStreamWriter, und QCborStreamReader.

void QCoapResource::setHost(const QHostAddress &host)

Setzt den Host der Ressource auf host.

Siehe auch host().

void QCoapResource::setInterface(const QString &interface)

Setzt die Schnittstelle der Ressource auf interface.

Siehe auch interface().

void QCoapResource::setMaximumSize(int maximumSize)

Setzt die maximale Größe der Ressource auf maximumSize.

Siehe auch maximumSize().

void QCoapResource::setObservable(bool observable)

Macht die Ressource beobachtbar, wenn der Parameter observable true lautet.

Siehe auch observable().

void QCoapResource::setPath(const QString &path)

Setzt den Pfad der Ressource auf path.

Siehe auch path().

void QCoapResource::setResourceType(const QString &resourceType)

Setzt den Ressourcentyp auf resourceType.

Siehe auch resourceType().

void QCoapResource::setTitle(const QString &title)

Setzt den Titel der Ressource auf title.

Siehe auch title().

[noexcept] void QCoapResource::swap(QCoapResource &other)

Tauscht diese Ressource mit other aus. Dieser Vorgang ist sehr schnell und schlägt nie 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 einen Verweis auf diese QCoapResource zurück.

© 2025 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.