QCoapMessage Class
QCoapMessageクラスは、リクエストやリプライのCoAPメッセージに関する情報を保持します。詳細...
ヘッダー | #include <QCoapMessage> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Coap) target_link_libraries(mytarget PRIVATE Qt6::Coap) |
qmake: | QT += coap |
継承元: |
注意:このクラスの関数はすべてリエントラントです。
パブリック型
enum class | Type { Confirmable, NonConfirmable, Acknowledgment, Reset } |
パブリック関数
QCoapMessage() | |
QCoapMessage(const QCoapMessage &other) | |
~QCoapMessage() | |
void | addOption(const QCoapOption &option) |
void | addOption(QCoapOption::OptionName name, const QByteArray &value = QByteArray()) |
void | clearOptions() |
bool | hasOption(QCoapOption::OptionName name) const |
quint16 | messageId() const |
QCoapOption | option(QCoapOption::OptionName name) const |
QCoapOption | optionAt(int index) const |
int | optionCount() const |
const QList<QCoapOption> & | options() const |
QList<QCoapOption> | options(QCoapOption::OptionName name) const |
QByteArray | payload() const |
void | removeOption(QCoapOption::OptionName name) |
void | removeOption(const QCoapOption &option) |
void | setMessageId(quint16 id) |
void | setOptions(const QList<QCoapOption> &options) |
void | setPayload(const QByteArray &payload) |
void | setToken(const QByteArray &token) |
void | setType(const QCoapMessage::Type &type) |
void | setVersion(quint8 version) |
void | swap(QCoapMessage &other) |
QByteArray | token() const |
quint8 | tokenLength() const |
QCoapMessage::Type | type() const |
quint8 | version() const |
QCoapMessage & | operator=(QCoapMessage &&other) |
QCoapMessage & | operator=(const QCoapMessage &other) |
QCoapOption 、QCoapReply 、QCoapRequestも参照 。
メンバ型ドキュメント
enum class QCoapMessage::Type
メッセージのタイプを示す。
定数 | 値 | 説明 |
---|---|---|
QCoapMessage::Type::Confirmable | 0 | 確認可能メッセージ。宛先エンドポイントはメッセージを確認する必要があります。 |
QCoapMessage::Type::NonConfirmable | 1 | 確認不可メッセージ。宛先エンドポイントはメッセージを確認する必要はありません。 |
QCoapMessage::Type::Acknowledgment | 2 | 確認応答メッセージ。Confirmable メッセージへの返信として送受信されるメッセージ。 |
QCoapMessage::Type::Reset | 3 | リセット・メッセージ。このメッセージ・タイプは、エラーの発生時や、進行中の送信を停止する場合に使用される。(例えば、観測をキャンセルするときに使用する)。 |
メンバー関数ドキュメント
QCoapMessage::QCoapMessage()
新しいQCoapMessageを構築します。
QCoapMessage::QCoapMessage(const QCoapMessage &other)
other の浅いコピーを構築する。
[noexcept]
QCoapMessage::~QCoapMessage()
QCoapMessage を破壊する。
void QCoapMessage::addOption(const QCoapOption &option)
与えられた CoAPoption を追加します。
void QCoapMessage::addOption(QCoapOption::OptionName name, const QByteArray &value = QByteArray())
これはオーバーロードされた関数である。
与えられたname とvalue で CoAP オプションを追加する。
void QCoapMessage::clearOptions()
すべてのオプションを削除する。
bool QCoapMessage::hasOption(QCoapOption::OptionName name) const
メッセージにname のオプションがひとつでも含まれていれば、true
を返す。
quint16 QCoapMessage::messageId() const
メッセージ ID を返します。
setMessageId()も参照してください 。
QCoapOption QCoapMessage::option(QCoapOption::OptionName name) const
与えられたname を持つ最初のオプションを検索して返します。そのようなオプションがない場合は、空の値を持つ無効なQCoapOption を返します。
QCoapOption QCoapMessage::optionAt(int index) const
index の位置にあるオプションを返す。
int QCoapMessage::optionCount() const
オプションの数を返します。
const QList<QCoapOption> &QCoapMessage::options() const
オプションのリストを返します。
setOptions()も参照ください 。
QList<QCoapOption> QCoapMessage::options(QCoapOption::OptionName name) const
与えられたname を持つオプションのリストを検索して返します。
QByteArray QCoapMessage::payload() const
ペイロードを返します。
setPayload()も参照 。
void QCoapMessage::removeOption(QCoapOption::OptionName name)
与えられたname を持つすべてのオプションを削除する。CoAP プロトコルでは、同じオプションを繰り返すことができる。
void QCoapMessage::removeOption(const QCoapOption &option)
与えられたoption を削除する。
void QCoapMessage::setMessageId(quint16 id)
メッセージIDをid に設定する。
messageId()も参照のこと 。
void QCoapMessage::setOptions(const QList<QCoapOption> &options)
メッセージ・オプションをoptions に設定する。
options()も参照のこと 。
void QCoapMessage::setPayload(const QByteArray &payload)
メッセージのペイロードをpayload に設定します。 ペイロードは、CoAP Content-Formats Registry で定義されているコンテンツ・フォーマットのいずれかで表現できます。
注: CoAPはXMLやJSONなどの一般的なコンテンツ・フォーマットをサポートしていますが、これらはテキスト・ベースであるため、ペイロードも処理も重くなります。CoAPで推奨されるコンテンツ・フォーマットの1つはCBORで、このようなコンテキストで使用するように設計されている。
payload()、QCborStreamWriter 、QCborStreamReaderも参照のこと 。
void QCoapMessage::setToken(const QByteArray &token)
メッセージ・トークンをtoken に設定する。
token()も参照 。
void QCoapMessage::setType(const QCoapMessage::Type &type)
メッセージ・タイプをtype に設定する。
type()も参照のこと 。
void QCoapMessage::setVersion(quint8 version)
CoAP バージョンをversion に設定する。
version()も参照のこと 。
[noexcept]
void QCoapMessage::swap(QCoapMessage &other)
このメッセージをother と交換する。この操作は非常に速く、失敗することはない。
QByteArray QCoapMessage::token() const
メッセージ・トークンを返します。
setToken()も参照 。
quint8 QCoapMessage::tokenLength() const
トークンの長さを返します。
QCoapMessage::Type QCoapMessage::type() const
メッセージ・タイプを返します。
setType()も参照 。
quint8 QCoapMessage::version() const
CoAP バージョンを返す。
setVersion()も参照 。
[noexcept]
QCoapMessage &QCoapMessage::operator=(QCoapMessage &&other)
other をこのメッセージに移動し、このQCoapMessage への参照を返す。
QCoapMessage &QCoapMessage::operator=(const QCoapMessage &other)
other の内容をこのメッセージにコピーする。このQCoapMessage への参照を返す。
© 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.