QCoapResource Class
La classe QCoapResource contiene informazioni relative a una risorsa individuata. Maggiori informazioni...
| Intestazione: | #include <QCoapResource> |
| 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.
Funzioni pubbliche
| 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) |
Descrizione dettagliata
L'oggetto ` QCoapRequest ` contiene dati quali il percorso e il titolo della risorsa, oltre ad altre informazioni accessorie.
Vedi anche QCoapResourceDiscoveryReply.
Documentazione delle funzioni membro
QCoapResource::QCoapResource()
Crea una nuova istanza di QCoapResource.
QCoapResource::QCoapResource(const QCoapResource &other)
Crea una nuova risorsa CoAP come copia di other, rendendo le due risorse identiche.
[noexcept] QCoapResource::~QCoapResource()
Distruggi l'QCoapResource.
uint QCoapResource::contentFormat() const
Restituisce il codice Content-Format della risorsa.
Il codice Content-Format corrisponde all'attributo 'ct' e fornisce un'indicazione sui formati di contenuto restituiti da questa risorsa. È specificato nella RFC 7252.
Vedi anche setContentFormat().
QHostAddress QCoapResource::host() const
Restituisce l'host della risorsa.
Vedi anche setHost().
QString QCoapResource::interface() const
Restituisce la descrizione dell'interfaccia della risorsa.
L'attributo "if" della descrizione dell'interfaccia è una stringa opaca utilizzata per fornire un nome o un URI che indica una definizione specifica dell'interfaccia utilizzata per interagire con la risorsa di destinazione. È specificato nella RFC 6690.
Vedi anche setInterface().
int QCoapResource::maximumSize() const
Restituisce la dimensione massima della risorsa.
L'attributo di stima della dimensione massima "sz" fornisce un'indicazione della dimensione massima della rappresentazione della risorsa restituita eseguendo un'operazione GET sull'URI di destinazione. È specificato nella RFC 6690.
Vedi anche setMaximumSize().
bool QCoapResource::observable() const
Restituisce true se la risorsa è osservabile
Vedi anche setObservable().
QString QCoapResource::path() const
Restituisce il percorso della risorsa.
Vedi anche setPath().
QString QCoapResource::resourceType() const
Restituisce il tipo della risorsa.
Vedi anche setResourceType().
void QCoapResource::setContentFormat(uint contentFormat)
Imposta il formato del contenuto della risorsa su contentFormat. Il formato del contenuto può essere uno di quelli definiti nel Registro dei formati di contenuto CoAP.
Nota: CoAP supporta formati di contenuto comuni quali XML, JSON e così via, ma questi sono basati su testo e, di conseguenza, pesanti sia in termini di payload che di elaborazione. Uno dei formati di contenuto raccomandati per l’uso con CoAP è CBOR, progettato appositamente per tali contesti.
Vedi anche contentFormat(), QCborStreamWriter e QCborStreamReader.
void QCoapResource::setHost(const QHostAddress &host)
Imposta l'host della risorsa su host.
Vedi anche host().
void QCoapResource::setInterface(const QString &interface)
Imposta l'interfaccia della risorsa su interface.
Vedi anche interface().
void QCoapResource::setMaximumSize(int maximumSize)
Imposta la dimensione massima della risorsa su maximumSize.
Vedi anche maximumSize().
void QCoapResource::setObservable(bool observable)
Rende la risorsa osservabile se il parametro ` observable ` è impostato su ` true`.
Vedi anche observable().
void QCoapResource::setPath(const QString &path)
Imposta il percorso della risorsa su path.
Vedi anche path().
void QCoapResource::setResourceType(const QString &resourceType)
Imposta il tipo di risorsa su resourceType.
Vedi anche resourceType().
void QCoapResource::setTitle(const QString &title)
Imposta il titolo della risorsa su title.
Vedi anche title().
[noexcept] void QCoapResource::swap(QCoapResource &other)
Sostituisce questa risorsa con other. Questa operazione è molto veloce e non fallisce mai.
QString QCoapResource::title() const
Restituisce il titolo della risorsa.
Vedi anche setTitle().
QCoapResource &QCoapResource::operator=(const QCoapResource &other)
Copia other in questa risorsa, rendendo le due risorse identiche. Restituisce un riferimento a questa QCoapResource.
© 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.