QLowEnergyServiceData Class

The QLowEnergyServiceData class is used to set up GATT service data. More...

Header: #include <QLowEnergyServiceData>
qmake: QT += bluetooth
Since: Qt 5.7

This class was introduced in Qt 5.7.

Public Types

enum ServiceType { ServiceTypePrimary, ServiceTypeSecondary }

Public Functions

QLowEnergyServiceData(const QLowEnergyServiceData &other)
QLowEnergyServiceData()
QLowEnergyServiceData &operator=(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

Detailed Description

An Object of this class provides a service to be added to a GATT server via QLowEnergyController::addService().

Member Type Documentation

enum QLowEnergyServiceData::ServiceType

The type of GATT service.

ConstantValueDescription
QLowEnergyServiceData::ServiceTypePrimary0x2800The service is a primary service.
QLowEnergyServiceData::ServiceTypeSecondary0x2801The service is a secondary service. Secondary services are included by other services to implement some higher-level functionality.

Member Function Documentation

QLowEnergyServiceData::QLowEnergyServiceData(const QLowEnergyServiceData &other)

Constructs a new object of this class that is a copy of other.

QLowEnergyServiceData::QLowEnergyServiceData()

Creates a new invalid object of this class.

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

Makes this object a copy of other and returns the new value of this object.

QLowEnergyServiceData::~QLowEnergyServiceData()

Destroys this object.

void QLowEnergyServiceData::addCharacteristic(const QLowEnergyCharacteristicData &characteristic)

Adds characteristic to the list of characteristics, if it is valid.

See also setCharacteristics().

void QLowEnergyServiceData::addIncludedService(QLowEnergyService *service)

Adds service to the list of included services. The service object must have been returned from a call to QLowEnergyController::addService. This requirement prevents circular includes (which are forbidden by the Bluetooth specification), and also helps to support the use case of including more than one service of the same type.

See also setIncludedServices().

QList<QLowEnergyCharacteristicData> QLowEnergyServiceData::characteristics() const

Returns the list of characteristics.

See also setCharacteristics().

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

Returns the list of included services.

See also setIncludedServices().

bool QLowEnergyServiceData::isValid() const

Returns true if this service is has a non-null UUID.

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

Sets the list of characteristics to characteristics. Only valid characteristics are considered.

See also characteristics() and addCharacteristic().

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

Sets the list of included services to services. All objects in this list must have been returned from a call to QLowEnergyController::addService.

See also includedServices() and addIncludedService().

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

Sets the type of this service to type.

See also type().

void QLowEnergyServiceData::setUuid(const QBluetoothUuid &uuid)

Sets the UUID of this service to uuid.

See also uuid().

void QLowEnergyServiceData::swap(QLowEnergyServiceData &other)

Swaps this object with other.

QLowEnergyServiceData::ServiceType QLowEnergyServiceData::type() const

Returns the type of this service.

See also setType().

QBluetoothUuid QLowEnergyServiceData::uuid() const

Returns the UUID of this service.

See also setUuid().

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