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
QLowEnergyCharacteristicData Class Reference

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

#include <qlowenergycharacteristicdata.h>

+ Collaboration diagram for QLowEnergyCharacteristicData:

Public Member Functions

 QLowEnergyCharacteristicData ()
 Creates a new invalid object of this class.
 
 QLowEnergyCharacteristicData (const QLowEnergyCharacteristicData &other)
 Constructs a new object of this class that is a copy of other.
 
 ~QLowEnergyCharacteristicData ()
 Destroys this object.
 
QLowEnergyCharacteristicDataoperator= (const QLowEnergyCharacteristicData &other)
 Makes this object a copy of other and returns the new value of this object.
 
QBluetoothUuid uuid () const
 Returns the UUID of this characteristic.
 
void setUuid (const QBluetoothUuid &uuid)
 Sets the UUID of this characteristic to uuid.
 
QByteArray value () const
 Returns the value of this characteristic.
 
void setValue (const QByteArray &value)
 Sets the value of this characteristic to value.
 
QLowEnergyCharacteristic::PropertyTypes properties () const
 Returns the properties of this characteristic.
 
void setProperties (QLowEnergyCharacteristic::PropertyTypes properties)
 Sets the properties of this characteristic to properties.
 
QList< QLowEnergyDescriptorDatadescriptors () const
 Returns the descriptors of this characteristic.
 
void setDescriptors (const QList< QLowEnergyDescriptorData > &descriptors)
 Sets the descriptors of this characteristic to descriptors.
 
void addDescriptor (const QLowEnergyDescriptorData &descriptor)
 Adds descriptor to the list of descriptors of this characteristic, if it is valid.
 
void setReadConstraints (QBluetooth::AttAccessConstraints constraints)
 Specifies that clients need to fulfill constraints to read the value of this characteristic.
 
QBluetooth::AttAccessConstraints readConstraints () const
 Returns the constraints needed for a client to read the value of this characteristic.
 
void setWriteConstraints (QBluetooth::AttAccessConstraints constraints)
 Specifies that clients need to fulfill constraints to write the value of this characteristic.
 
QBluetooth::AttAccessConstraints writeConstraints () const
 Returns the constraints needed for a client to write the value of this characteristic.
 
void setValueLength (int minimum, int maximum)
 Specifies minimum and maximum to be the smallest and largest length, respectively, that the value of this characteristic can have.
 
int minimumValueLength () const
 Returns the minimum length in bytes that the value of this characteristic can have.
 
int maximumValueLength () const
 Returns the maximum length in bytes that the value of this characteristic can have.
 
bool isValid () const
 Returns true if and only if this characteristic is valid, that is, it has a non-null UUID.
 
void swap (QLowEnergyCharacteristicData &other) noexcept
 Swaps this object with other.
 

Friends

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

Detailed Description

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

Since
5.7

An Object of this class provides a characteristic to be added to a \l QLowEnergyServiceData object via \l QLowEnergyServiceData::addCharacteristic().

See also
QLowEnergyServiceData
QLowEnergyController::addService

Definition at line 13 of file qlowenergycharacteristicdata.h.

Constructor & Destructor Documentation

◆ QLowEnergyCharacteristicData() [1/2]

QLowEnergyCharacteristicData::QLowEnergyCharacteristicData ( )

Creates a new invalid object of this class.

Definition at line 51 of file qlowenergycharacteristicdata.cpp.

◆ QLowEnergyCharacteristicData() [2/2]

QLowEnergyCharacteristicData::QLowEnergyCharacteristicData ( const QLowEnergyCharacteristicData & other)

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

Definition at line 57 of file qlowenergycharacteristicdata.cpp.

◆ ~QLowEnergyCharacteristicData()

QLowEnergyCharacteristicData::~QLowEnergyCharacteristicData ( )

Destroys this object.

Definition at line 63 of file qlowenergycharacteristicdata.cpp.

Member Function Documentation

◆ addDescriptor()

void QLowEnergyCharacteristicData::addDescriptor ( const QLowEnergyDescriptorData & descriptor)

Adds descriptor to the list of descriptors of this characteristic, if it is valid.

See also
setDescriptors()

Definition at line 135 of file qlowenergycharacteristicdata.cpp.

References QLowEnergyCharacteristicDataPrivate::descriptors, QLowEnergyDescriptorData::isValid(), and qCWarning.

Referenced by setDescriptors().

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

◆ descriptors()

QList< QLowEnergyDescriptorData > QLowEnergyCharacteristicData::descriptors ( ) const

Returns the descriptors of this characteristic.

Definition at line 114 of file qlowenergycharacteristicdata.cpp.

References QLowEnergyCharacteristicDataPrivate::descriptors.

Referenced by setDescriptors().

+ Here is the caller graph for this function:

◆ isValid()

bool QLowEnergyCharacteristicData::isValid ( ) const

Returns true if and only if this characteristic is valid, that is, it has a non-null UUID.

Definition at line 213 of file qlowenergycharacteristicdata.cpp.

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

Referenced by QLowEnergyServiceData::addCharacteristic().

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

◆ maximumValueLength()

int QLowEnergyCharacteristicData::maximumValueLength ( ) const

Returns the maximum length in bytes that the value of this characteristic can have.

By default, there is no limit beyond the constraints of the data type.

Definition at line 205 of file qlowenergycharacteristicdata.cpp.

References QLowEnergyCharacteristicDataPrivate::maximumValueLength.

◆ minimumValueLength()

int QLowEnergyCharacteristicData::minimumValueLength ( ) const

Returns the minimum length in bytes that the value of this characteristic can have.

The default is zero.

Definition at line 196 of file qlowenergycharacteristicdata.cpp.

References QLowEnergyCharacteristicDataPrivate::minimumValueLength.

◆ operator=()

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

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

Definition at line 68 of file qlowenergycharacteristicdata.cpp.

References other().

+ Here is the call graph for this function:

◆ properties()

QLowEnergyCharacteristic::PropertyTypes QLowEnergyCharacteristicData::properties ( ) const

Returns the properties of this characteristic.

Definition at line 99 of file qlowenergycharacteristicdata.cpp.

References QLowEnergyCharacteristicDataPrivate::properties.

Referenced by setProperties().

+ Here is the caller graph for this function:

◆ readConstraints()

QBluetooth::AttAccessConstraints QLowEnergyCharacteristicData::readConstraints ( ) const

Returns the constraints needed for a client to read the value of this characteristic.

If \l properties() does not include \l QLowEnergyCharacteristic::Read, this value is irrelevant. By default, there are no read constraints.

Definition at line 156 of file qlowenergycharacteristicdata.cpp.

References QLowEnergyCharacteristicDataPrivate::readConstraints.

◆ setDescriptors()

void QLowEnergyCharacteristicData::setDescriptors ( const QList< QLowEnergyDescriptorData > & descriptors)

Sets the descriptors of this characteristic to descriptors.

Only valid descriptors are considered.

See also
addDescriptor()

Definition at line 124 of file qlowenergycharacteristicdata.cpp.

References addDescriptor(), QList< T >::clear(), QLowEnergyCharacteristicDataPrivate::descriptors, and descriptors().

+ Here is the call graph for this function:

◆ setProperties()

void QLowEnergyCharacteristicData::setProperties ( QLowEnergyCharacteristic::PropertyTypes properties)

Sets the properties of this characteristic to properties.

Definition at line 105 of file qlowenergycharacteristicdata.cpp.

References QLowEnergyCharacteristic::Indicate, QLowEnergyCharacteristic::Notify, QLowEnergyCharacteristicDataPrivate::properties, properties(), qCWarning, and QLowEnergyCharacteristicDataPrivate::uuid.

+ Here is the call graph for this function:

◆ setReadConstraints()

void QLowEnergyCharacteristicData::setReadConstraints ( QBluetooth::AttAccessConstraints constraints)

Specifies that clients need to fulfill constraints to read the value of this characteristic.

Definition at line 146 of file qlowenergycharacteristicdata.cpp.

References QLowEnergyCharacteristicDataPrivate::readConstraints.

◆ setUuid()

void QLowEnergyCharacteristicData::setUuid ( const QBluetoothUuid & uuid)

Sets the UUID of this characteristic to uuid.

Definition at line 81 of file qlowenergycharacteristicdata.cpp.

References QLowEnergyCharacteristicDataPrivate::uuid, and uuid().

+ Here is the call graph for this function:

◆ setValue()

void QLowEnergyCharacteristicData::setValue ( const QByteArray & value)

Sets the value of this characteristic to value.

Definition at line 93 of file qlowenergycharacteristicdata.cpp.

References QLowEnergyCharacteristicDataPrivate::value, and value().

+ Here is the call graph for this function:

◆ setValueLength()

void QLowEnergyCharacteristicData::setValueLength ( int minimum,
int maximum )

Specifies minimum and maximum to be the smallest and largest length, respectively, that the value of this characteristic can have.

The unit is bytes. If minimum and maximum are equal, the characteristic has a fixed-length value.

Definition at line 186 of file qlowenergycharacteristicdata.cpp.

References QLowEnergyCharacteristicDataPrivate::maximumValueLength, QLowEnergyCharacteristicDataPrivate::minimumValueLength, and qMax().

+ Here is the call graph for this function:

◆ setWriteConstraints()

void QLowEnergyCharacteristicData::setWriteConstraints ( QBluetooth::AttAccessConstraints constraints)

Specifies that clients need to fulfill constraints to write the value of this characteristic.

Definition at line 164 of file qlowenergycharacteristicdata.cpp.

References QLowEnergyCharacteristicDataPrivate::writeConstraints.

◆ swap()

void QLowEnergyCharacteristicData::swap ( QLowEnergyCharacteristicData & other)
inlinenoexcept

Swaps this object with other.

Definition at line 57 of file qlowenergycharacteristicdata.h.

References d, and other().

+ Here is the call graph for this function:

◆ uuid()

QBluetoothUuid QLowEnergyCharacteristicData::uuid ( ) const

Returns the UUID of this characteristic.

Definition at line 75 of file qlowenergycharacteristicdata.cpp.

References QLowEnergyCharacteristicDataPrivate::uuid.

Referenced by isValid(), and setUuid().

+ Here is the caller graph for this function:

◆ value()

QByteArray QLowEnergyCharacteristicData::value ( ) const

Returns the value of this characteristic.

Definition at line 87 of file qlowenergycharacteristicdata.cpp.

References QLowEnergyCharacteristicDataPrivate::value.

Referenced by setValue().

+ Here is the caller graph for this function:

◆ writeConstraints()

QBluetooth::AttAccessConstraints QLowEnergyCharacteristicData::writeConstraints ( ) const

Returns the constraints needed for a client to write the value of this characteristic.

If \l properties() does not include either of \l QLowEnergyCharacteristic::Write, \l QLowEnergyCharacteristic::WriteNoResponse and \l QLowEnergyCharacteristic::WriteSigned, this value is irrelevant. By default, there are no write constraints.

Definition at line 176 of file qlowenergycharacteristicdata.cpp.

References QLowEnergyCharacteristicDataPrivate::writeConstraints.

Friends And Related Symbol Documentation

◆ operator!=

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

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

Definition at line 26 of file qlowenergycharacteristicdata.h.

◆ operator==

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

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

Definition at line 21 of file qlowenergycharacteristicdata.h.


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