このページでは

QLowEnergyDescriptor Class

QLowEnergyDescriptor クラスは、Bluetooth Low Energy デскриプタに関する情報を格納します。詳細...

ヘッダー: #include <QLowEnergyDescriptor>
CMake: find_package(Qt6 REQUIRED COMPONENTS Bluetooth)
target_link_libraries(mytarget PRIVATE Qt6::Bluetooth)
qmake: QT += bluetooth

パブリック関数

QLowEnergyDescriptor()
QLowEnergyDescriptor(const QLowEnergyDescriptor &other)
~QLowEnergyDescriptor()
bool isValid() const
QString name() const
QBluetoothUuid::DescriptorType type() const
QBluetoothUuid uuid() const
QByteArray value() const
QLowEnergyDescriptor &operator=(const QLowEnergyDescriptor &other)
bool operator!=(const QLowEnergyDescriptor &a, const QLowEnergyDescriptor &b)
bool operator==(const QLowEnergyDescriptor &a, const QLowEnergyDescriptor &b)

詳細な説明

QLowEnergyDescriptor は、Bluetooth Low Energy デскриプタの `name()`、`uuid()`、および `value()` に関する情報を提供します。デскриプタは Bluetooth Low Energy 特性によってカプセル化されており、その特性に関する追加のコンテキスト情報(データ形式、通知の有効化など)を提供します。

記述子の値は、この記述子が属するサービスを管理するQLowEnergyService インスタンスを介して書き込むことができます。QLowEnergyService::writeDescriptor()関数は新しい値を書き込みます。成功すると、QLowEnergyService::descriptorWritten()シグナルが発信されます。このオブジェクトのキャッシュされたvalue()は、それに応じて更新されます。

QLowEnergyService およびQLowEnergyCharacteristicも参照してください 。

メンバ関数のドキュメント

QLowEnergyDescriptor::QLowEnergyDescriptor()

新しい QLowEnergyDescriptor を生成します。このクラスのデフォルトコンストラクタで生成されたインスタンスは、常に無効です。

QLowEnergyDescriptor::QLowEnergyDescriptor(const QLowEnergyDescriptor &other)

other のコピーとなる新しいQLowEnergyDescriptorを作成します。

2つのコピーは引き続き同じ基となるデータを共有し、書き込みを行ってもそのデータは切り離されることはありません。

[noexcept] QLowEnergyDescriptor::~QLowEnergyDescriptor()

QLowEnergyDescriptor オブジェクトを破棄します。

bool QLowEnergyDescriptor::isValid() const

QLowEnergyDescriptor オブジェクトが有効な場合はtrue を返し、そうでない場合はfalse を返します。

無効な記述子インスタンスは、いかなるサービスにも関連付けられていない(デフォルトで生成されたもの)か、あるいは、例えば基になるBluetooth Low Energyデバイスとの接続が切断されたことにより、関連付けられたサービスがもはや有効でなくなったものです。一度無効になったオブジェクトは、再び有効になることはありません。

注: 基になるデバイスとの接続切断によりQLowEnergyDescriptor インスタンスが無効になった場合 、現在のインスタンスにカプセル化された情報は、切断時の状態のまま保持されます。したがって、切断イベント発生後もその情報を取得することができます。

QString QLowEnergyDescriptor::name() const

デскриプタの人間が読みやすい名前を返します。

この名前は、記述子のtype()に基づいています。記述子の種類の完全な一覧は、Bluetooth.orgの「Descriptors」セクションで確認できます。

type() が不明な場合、返される文字列は空になります。

type() およびQBluetoothUuid::descriptorToString()も参照してください 。

QBluetoothUuid::DescriptorType QLowEnergyDescriptor::type() const

記述子の型を返します。

name()も参照してください 。

QBluetoothUuid QLowEnergyDescriptor::uuid() const

isValid()がtrue を返した場合、この記述子のUUIDを返します。それ以外の場合は、null のUUIDを返します。

QByteArray QLowEnergyDescriptor::value() const

デскриプタのキャッシュされた値を返します。

キャッシュされた記述子の値は、QLowEnergyService::writeDescriptor() またはQLowEnergyService::readDescriptor() を使用して更新できます。

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

other のコピーを作成し、それをこのQLowEnergyDescriptor オブジェクトに割り当てます。2つのコピーは、引き続き同じサービスおよびコントローラーの詳細情報を共有します。

関連する非メンバー

bool operator!=(const QLowEnergyDescriptor &a, const QLowEnergyDescriptor &b)

a がb と等しくない場合はtrue を返し、それ以外の場合はfalse を返します。

2つのQLowEnergyDescriptor インスタンスは、同じリモートBluetooth Low Energyデバイス上の同じディスクリプタを参照している場合、または両方のインスタンスがデフォルトコンストラクタで生成された場合、等しいとみなされます。

bool operator==(const QLowEnergyDescriptor &a, const QLowEnergyDescriptor &b)

a がb と等しい場合はtrue を返し、そうでない場合はfalse を返します。

2つのQLowEnergyDescriptor インスタンスは、同じリモートBluetooth Low Energyデバイス上の同じディスクリプタを参照している場合、または両方のインスタンスがデフォルトコンストラクタで生成された場合、等価であるとみなされます。

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