QCoapResource Class

QCoapResourceクラスは、発見されたリソースに関する情報を保持します。詳細...

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

注意:このクラスの関数はすべてリエントラントです。

パブリック関数

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)

詳細説明

QCoapRequest には、リソースのパスとタイトル、その他の補助的な情報が含まれます。

QCoapResourceDiscoveryReplyも参照してください

メンバ関数ドキュメント

QCoapResource::QCoapResource()

新しいQCoapResourceを構築します。

QCoapResource::QCoapResource(const QCoapResource &other)

other のコピーとして新しい CoAP リソースを構築し、2 つのリソースを同一にする。

[noexcept] QCoapResource::~QCoapResource()

QCoapResource を破壊する。

uint QCoapResource::contentFormat() const

リソースの Content-Format コードを返します。

Content-Format コードは 'ct' 属性に対応し、このリソースが返す Content-Format に関するヒントを提供します。これはRFC 7252 で規定されています。

setContentFormat()も参照

QHostAddress QCoapResource::host() const

リソースのホストを返します。

setHost()も参照ください

QString QCoapResource::interface() const

リソースのインタフェース記述を返す。

インタフェース記述 'if' 属性は、対象リソースと相互作用するために使われる特定のインタフェース定義を示す名前またはURIを提供するために使われる不透明な文字列です。RFC 6690で規定されています。

setInterface()も参照

int QCoapResource::maximumSize() const

リソースの最大サイズを返す。

最大サイズ推定属性 'sz' は、対象の URI を GET して返されるリソース表現の最大サイズを示す。これはRFC 6690 で規定されています。

setMaximumSize()も参照

bool QCoapResource::observable() const

リソースが観測可能であればtrue を返す。

setObservable()も参照

QString QCoapResource::path() const

リソースのパスを返します。

setPath()も参照ください

QString QCoapResource::resourceType() const

リソースの型を返します。

setResourceType()も参照ください

void QCoapResource::setContentFormat(uint contentFormat)

リソースのコンテンツフォーマットをcontentFormat に設定します。 コンテンツフォーマットは、CoAP Content-Formats Registry で定義されているコンテンツフォーマットのいずれかになります。

注: CoAPは、XML、JSONなどの一般的なコンテンツフォーマットをサポートしていますが、これらはテキストベースであるため、ペイロードと処理の両方が重くなります。CoAPで推奨されるコンテンツ・フォーマットの1つはCBORで、このようなコンテキストで使用するように設計されている。

contentFormat()、QCborStreamWriterQCborStreamReaderも参照のこと

void QCoapResource::setHost(const QHostAddress &host)

リソースのホストをhost に設定する。

host()も参照

void QCoapResource::setInterface(const QString &interface)

リソースのインターフェイスをinterface に設定する。

interface()も参照

void QCoapResource::setMaximumSize(int maximumSize)

リソースの最大サイズをmaximumSize に設定する。

maximumSize()も参照

void QCoapResource::setObservable(bool observable)

observable パラメータがtrue の場合、リソースを観測可能にする。

observable()も参照のこと

void QCoapResource::setPath(const QString &path)

リソースのパスをpath に設定する。

path()も参照

void QCoapResource::setResourceType(const QString &resourceType)

リソースタイプをresourceType に設定する。

resourceType()も参照

void QCoapResource::setTitle(const QString &title)

リソースのタイトルをtitle に設定する。

title()も参照

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

このリソースをother と交換する。この操作は非常に高速で、失敗することはない。

QString QCoapResource::title() const

リソースのタイトルを返します。

setTitle()も参照ください

QCoapResource &QCoapResource::operator=(const QCoapResource &other)

other をこのリソースにコピーし、2つのリソースを同一にする。このQCoapResource への参照を返します。

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