このページでは

QLowEnergyServiceData Class

QLowEnergyServiceData クラスは、GATT サービスデータを設定するために使用されます。詳細...

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

パブリック型

enum ServiceType { ServiceTypePrimary, ServiceTypeSecondary }

パブリック関数

QLowEnergyServiceData()
QLowEnergyServiceData(const QLowEnergyServiceData &other)
~QLowEnergyServiceData()
void addCharacteristic(const QLowEnergyCharacteristicData &characteristic)
void addIncludedService(QLowEnergyService *service)
QList<QLowEnergyCharacteristicData> characteristics() const
QList<QLowEnergyService *> includedServices() const
bool isValid() const
void setCharacteristics(const QList<QLowEnergyCharacteristicData> &characteristics)
void setIncludedServices(const QList<QLowEnergyService *> &services)
void setType(QLowEnergyServiceData::ServiceType type)
void setUuid(const QBluetoothUuid &uuid)
void swap(QLowEnergyServiceData &other)
QLowEnergyServiceData::ServiceType type() const
QBluetoothUuid uuid() const
QLowEnergyServiceData &operator=(const QLowEnergyServiceData &other)
bool operator!=(const QLowEnergyServiceData &a, const QLowEnergyServiceData &b)
bool operator==(const QLowEnergyServiceData &a, const QLowEnergyServiceData &b)

詳細な説明

このクラスのオブジェクトは、QLowEnergyController::addService() を通じて GATT サーバーに追加されるサービスを提供します。

メンバ型のドキュメント

enum QLowEnergyServiceData::ServiceType

GATTにおけるサービスの種類。

定数値説明
QLowEnergyServiceData::ServiceTypePrimary0x2800このサービスは一次サービスです。
QLowEnergyServiceData::ServiceTypeSecondary0x2801このサービスは二次サービスです。二次サービスは、より高レベルの機能を実装するために他のサービスに含まれます。

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

QLowEnergyServiceData::QLowEnergyServiceData()

このクラスの新しい無効なオブジェクトを作成します。

QLowEnergyServiceData::QLowEnergyServiceData(const QLowEnergyServiceData &other)

other のコピーである、このクラスの新しいオブジェクトを作成します。

[noexcept] QLowEnergyServiceData::~QLowEnergyServiceData()

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

void QLowEnergyServiceData::addCharacteristic(const QLowEnergyCharacteristicData &characteristic)

有効な場合、特性の一覧に「characteristic 」を追加します。

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

void QLowEnergyServiceData::addIncludedService(QLowEnergyService *service)

service を、含まれるサービスのリストに追加します。service オブジェクトは、QLowEnergyController::addService の呼び出しによって返されたものでなければなりません。この要件は、Bluetooth仕様で禁止されている循環インクルードを防ぐとともに、同じタイプのサービスを複数含めるというユースケースのサポートにも役立ちます。

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

QList<QLowEnergyCharacteristicData> QLowEnergyServiceData::characteristics() const

特性のリストを返します。

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

QList<QLowEnergyService *> QLowEnergyServiceData::includedServices() const

含まれるサービスのリストを返します。

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

bool QLowEnergyServiceData::isValid() const

このサービスのUUIDがnullでない場合、true を返します。

void QLowEnergyServiceData::setCharacteristics(const QList<QLowEnergyCharacteristicData> &characteristics)

特性のリストを `characteristics` に設定します。有効な特性のみが考慮されます。

characteristics() およびaddCharacteristic()も参照してください 。

void QLowEnergyServiceData::setIncludedServices(const QList<QLowEnergyService *> &services)

含まれるサービスのリストを `services` に設定します。このリスト内のすべてのオブジェクトは、QLowEnergyController::addService の呼び出しによって返されたものでなければなりません。

includedServices() およびaddIncludedService()も参照してください 。

void QLowEnergyServiceData::setType(QLowEnergyServiceData::ServiceType type)

このサービスのタイプを「type 」に設定します。

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

void QLowEnergyServiceData::setUuid(const QBluetoothUuid &uuid)

このサービスのUUIDをuuid に設定します。

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

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

このオブジェクトを `other` と入れ替えます。

QLowEnergyServiceData::ServiceType QLowEnergyServiceData::type() const

このサービスの型を返します。

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

QBluetoothUuid QLowEnergyServiceData::uuid() const

このサービスのUUIDを返します。

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

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

このオブジェクトをother のコピーにし、このオブジェクトの新しい値を返します。

関連する非メンバー関数

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

a とb のパブリック状態が等しくない場合、true を返し、それ以外の場合はfalse を返します。

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

a とb のパブリック状態が等しい場合は `true ` を返し、そうでない場合は `false` を返します。

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