Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QLowEnergyServiceData Class Reference

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

#include <qlowenergyservicedata.h>

+ Collaboration diagram for QLowEnergyServiceData:

Public Types

enum  ServiceType { ServiceTypePrimary = 0x2800 , ServiceTypeSecondary = 0x2801 }
 The type of GATT service. More...
 

Public Member Functions

 QLowEnergyServiceData ()
 Creates a new invalid object of this class.
 
 QLowEnergyServiceData (const QLowEnergyServiceData &other)
 Constructs a new object of this class that is a copy of other.
 
 ~QLowEnergyServiceData ()
 Destroys this object.
 
QLowEnergyServiceDataoperator= (const QLowEnergyServiceData &other)
 Makes this object a copy of other and returns the new value of this object.
 
ServiceType type () const
 Returns the type of this service.
 
void setType (ServiceType type)
 Sets the type of this service to type.
 
QBluetoothUuid uuid () const
 Returns the UUID of this service.
 
void setUuid (const QBluetoothUuid &uuid)
 Sets the UUID of this service to uuid.
 
QList< QLowEnergyService * > includedServices () const
 Returns the list of included services.
 
void setIncludedServices (const QList< QLowEnergyService * > &services)
 Sets the list of included services to services.
 
void addIncludedService (QLowEnergyService *service)
 Adds service to the list of included services.
 
QList< QLowEnergyCharacteristicDatacharacteristics () const
 Returns the list of characteristics.
 
void setCharacteristics (const QList< QLowEnergyCharacteristicData > &characteristics)
 Sets the list of characteristics to characteristics.
 
void addCharacteristic (const QLowEnergyCharacteristicData &characteristic)
 Adds characteristic to the list of characteristics, if it is valid.
 
bool isValid () const
 Returns true if this service is has a non-null UUID.
 
void swap (QLowEnergyServiceData &other) noexcept
 Swaps this object with other.
 

Friends

bool operator== (const QLowEnergyServiceData &a, const QLowEnergyServiceData &b)
 Returns true if a and b are equal with respect to their public state, otherwise returns false.
 
bool operator!= (const QLowEnergyServiceData &a, const QLowEnergyServiceData &b)
 Returns true if a and b are unequal with respect to their public state, otherwise returns false.
 

Detailed Description

The QLowEnergyServiceData class is used to set up GATT service data. \inmodule QtBluetooth.

Since
5.7

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

Definition at line 17 of file qlowenergyservicedata.h.

Member Enumeration Documentation

◆ ServiceType

The type of GATT service.

\value ServiceTypePrimary The service is a primary service. \value ServiceTypeSecondary The service is a secondary service. Secondary services are included by other services to implement some higher-level functionality.

Enumerator
ServiceTypePrimary 
ServiceTypeSecondary 

Definition at line 34 of file qlowenergyservicedata.h.

Constructor & Destructor Documentation

◆ QLowEnergyServiceData() [1/2]

QLowEnergyServiceData::QLowEnergyServiceData ( )

Creates a new invalid object of this class.

Definition at line 48 of file qlowenergyservicedata.cpp.

◆ QLowEnergyServiceData() [2/2]

QLowEnergyServiceData::QLowEnergyServiceData ( const QLowEnergyServiceData & other)

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

Definition at line 53 of file qlowenergyservicedata.cpp.

◆ ~QLowEnergyServiceData()

QLowEnergyServiceData::~QLowEnergyServiceData ( )

Destroys this object.

Definition at line 58 of file qlowenergyservicedata.cpp.

Member Function Documentation

◆ addCharacteristic()

void QLowEnergyServiceData::addCharacteristic ( const QLowEnergyCharacteristicData & characteristic)

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

See also
setCharacteristics()

Definition at line 145 of file qlowenergyservicedata.cpp.

References QLowEnergyServiceDataPrivate::characteristics, QLowEnergyCharacteristicData::isValid(), and qCWarning.

Referenced by setCharacteristics().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addIncludedService()

void QLowEnergyServiceData::addIncludedService ( QLowEnergyService * service)

Adds service to the list of included services.

The service object must have been returned from a call to \l 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()

Definition at line 118 of file qlowenergyservicedata.cpp.

References QLowEnergyServiceDataPrivate::includedServices.

◆ characteristics()

QList< QLowEnergyCharacteristicData > QLowEnergyServiceData::characteristics ( ) const

Returns the list of characteristics.

Definition at line 124 of file qlowenergyservicedata.cpp.

References QLowEnergyServiceDataPrivate::characteristics.

Referenced by QtBluezPeripheralApplication::addService(), QLowEnergyControllerPrivateAndroid::addToGenericAttributeList(), and setCharacteristics().

+ Here is the caller graph for this function:

◆ includedServices()

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

Returns the list of included services.

Definition at line 94 of file qlowenergyservicedata.cpp.

References QLowEnergyServiceDataPrivate::includedServices.

Referenced by QtBluezPeripheralApplication::addService(), and QLowEnergyControllerPrivateAndroid::addToGenericAttributeList().

+ Here is the caller graph for this function:

◆ isValid()

bool QLowEnergyServiceData::isValid ( ) const

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

Definition at line 154 of file qlowenergyservicedata.cpp.

References QUuid::isNull(), and uuid().

+ Here is the call graph for this function:

◆ operator=()

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

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

Definition at line 63 of file qlowenergyservicedata.cpp.

References other().

+ Here is the call graph for this function:

◆ setCharacteristics()

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

Sets the list of characteristics to characteristics.

Only valid characteristics are considered.

See also
addCharacteristic()

Definition at line 134 of file qlowenergyservicedata.cpp.

References addCharacteristic(), QLowEnergyServiceDataPrivate::characteristics, characteristics(), and QList< T >::clear().

+ Here is the call graph for this function:

◆ setIncludedServices()

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 \l QLowEnergyController::addService.

See also
addIncludedService()

Definition at line 105 of file qlowenergyservicedata.cpp.

References QLowEnergyServiceDataPrivate::includedServices, and services.

◆ setType()

void QLowEnergyServiceData::setType ( ServiceType type)

Sets the type of this service to type.

Definition at line 76 of file qlowenergyservicedata.cpp.

References QLowEnergyServiceDataPrivate::type, and type().

+ Here is the call graph for this function:

◆ setUuid()

void QLowEnergyServiceData::setUuid ( const QBluetoothUuid & uuid)

Sets the UUID of this service to uuid.

Definition at line 88 of file qlowenergyservicedata.cpp.

References QLowEnergyServiceDataPrivate::uuid, and uuid().

+ Here is the call graph for this function:

◆ swap()

void QLowEnergyServiceData::swap ( QLowEnergyServiceData & other)
inlinenoexcept

Swaps this object with other.

Definition at line 51 of file qlowenergyservicedata.h.

References d, and other().

+ Here is the call graph for this function:

◆ type()

QLowEnergyServiceData::ServiceType QLowEnergyServiceData::type ( ) const

Returns the type of this service.

Definition at line 70 of file qlowenergyservicedata.cpp.

References QLowEnergyServiceDataPrivate::type.

Referenced by QLowEnergyControllerPrivateAndroid::addToGenericAttributeList(), and setType().

+ Here is the caller graph for this function:

◆ uuid()

QBluetoothUuid QLowEnergyServiceData::uuid ( ) const

Returns the UUID of this service.

Definition at line 82 of file qlowenergyservicedata.cpp.

References QLowEnergyServiceDataPrivate::uuid.

Referenced by isValid(), and setUuid().

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ operator!=

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

Returns true if a and b are unequal with respect to their public state, otherwise returns false.

Definition at line 29 of file qlowenergyservicedata.h.

◆ operator==

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

Returns true if a and b are equal with respect to their public state, otherwise returns false.

Definition at line 25 of file qlowenergyservicedata.h.


The documentation for this class was generated from the following files: