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

\inmodule QtBluetooth More...

#include <qlowenergydescriptor.h>

+ Collaboration diagram for QLowEnergyDescriptor:

Public Member Functions

 QLowEnergyDescriptor ()
 Construct a new QLowEnergyDescriptor.
 
 QLowEnergyDescriptor (const QLowEnergyDescriptor &other)
 Construct a new QLowEnergyDescriptor that is a copy of other.
 
 ~QLowEnergyDescriptor ()
 Destroys the QLowEnergyDescriptor object.
 
QLowEnergyDescriptoroperator= (const QLowEnergyDescriptor &other)
 Makes a copy of other and assigns it to this QLowEnergyDescriptor object.
 
bool isValid () const
 Returns true if the QLowEnergyDescriptor object is valid, otherwise returns false.
 
QByteArray value () const
 Returns the cached value of the descriptor.
 
QBluetoothUuid uuid () const
 Returns the UUID of this descriptor if \l isValid() returns true; otherwise a \l {QUuid::isNull()}{null} UUID.
 
QString name () const
 Returns the human-readable name of the descriptor.
 
QBluetoothUuid::DescriptorType type () const
 Returns the type of the descriptor.
 

Friends

class QLowEnergyCharacteristic
 
class QLowEnergyService
 
class QLowEnergyControllerPrivate
 
class QLowEnergyControllerPrivateAndroid
 
class QLowEnergyControllerPrivateBluez
 
class QLowEnergyControllerPrivateBluezDBus
 
class QLowEnergyControllerPrivateCommon
 
class QLowEnergyControllerPrivateDarwin
 
class QLowEnergyControllerPrivateWinRT
 
bool operator== (const QLowEnergyDescriptor &a, const QLowEnergyDescriptor &b)
 Returns true if a is equal to b; otherwise false.
 
bool operator!= (const QLowEnergyDescriptor &a, const QLowEnergyDescriptor &b)
 Returns true if a is not equal to b; otherwise false.
 

Detailed Description

\inmodule QtBluetooth

The QLowEnergyDescriptor class stores information about the Bluetooth Low Energy descriptor.

Since
5.4

QLowEnergyDescriptor provides information about a Bluetooth Low Energy descriptor's name(), uuid(), and value(). Descriptors are encapsulated by Bluetooth Low Energy characteristics and provide additional contextual information about the characteristic (data format, notification activation and so on).

The descriptor value may be written via the QLowEnergyService instance that manages the service to which this descriptor belongs. The \l {QLowEnergyService::writeDescriptor()} function writes the new value. The \l {QLowEnergyService::descriptorWritten()} signal is emitted upon success. The cached value() of this object is updated accordingly.

See also
QLowEnergyService, QLowEnergyCharacteristic

Definition at line 18 of file qlowenergydescriptor.h.

Constructor & Destructor Documentation

◆ QLowEnergyDescriptor() [1/2]

QLowEnergyDescriptor::QLowEnergyDescriptor ( )

Construct a new QLowEnergyDescriptor.

A default-constructed instance of this class is always invalid.

Definition at line 45 of file qlowenergydescriptor.cpp.

◆ QLowEnergyDescriptor() [2/2]

QLowEnergyDescriptor::QLowEnergyDescriptor ( const QLowEnergyDescriptor & other)

Construct a new QLowEnergyDescriptor that is a copy of other.

The two copies continue to share the same underlying data which does not detach upon write.

Definition at line 56 of file qlowenergydescriptor.cpp.

References other().

+ Here is the call graph for this function:

◆ ~QLowEnergyDescriptor()

QLowEnergyDescriptor::~QLowEnergyDescriptor ( )

Destroys the QLowEnergyDescriptor object.

Definition at line 84 of file qlowenergydescriptor.cpp.

Member Function Documentation

◆ isValid()

bool QLowEnergyDescriptor::isValid ( ) const

Returns true if the QLowEnergyDescriptor object is valid, otherwise returns false.

An invalid descriptor instance is not associated with any service (default-constructed) or the associated service is no longer valid due to a disconnect from the underlying Bluetooth Low Energy device, for example. Once the object is invalid it cannot become valid anymore.

Note
If a QLowEnergyDescriptor instance turns invalid due to a disconnect from the underlying device, the information encapsulated by the current instance remains as it was at the time of the disconnect. Therefore it can be retrieved after the disconnect event.

Definition at line 173 of file qlowenergydescriptor.cpp.

References QLowEnergyService::InvalidService, QSharedPointer< T >::isNull(), and QLowEnergyServicePrivate::state.

Referenced by MyClass::enableCharNotifications(), QLowEnergyControllerPrivateBluezDBus::readDescriptor(), and QLowEnergyControllerPrivateBluezDBus::writeDescriptor().

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

◆ name()

QString QLowEnergyDescriptor::name ( ) const

Returns the human-readable name of the descriptor.

The name is based on the descriptor's \l type(). The complete list of descriptor types can be found under \l {https://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorsHomePage.aspx}{Bluetooth.org Descriptors}.

The returned string is empty if the \l type() is unknown.

See also
type(), QBluetoothUuid::descriptorToString()

Definition at line 247 of file qlowenergydescriptor.cpp.

References QBluetoothUuid::descriptorToString(), and type().

+ Here is the call graph for this function:

◆ operator=()

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

Makes a copy of other and assigns it to this QLowEnergyDescriptor object.

The two copies continue to share the same service and controller details.

Definition at line 93 of file qlowenergydescriptor.cpp.

References other().

+ Here is the call graph for this function:

◆ type()

QBluetoothUuid::DescriptorType QLowEnergyDescriptor::type ( ) const

Returns the type of the descriptor.

See also
name()

Definition at line 257 of file qlowenergydescriptor.cpp.

References QBluetoothUuid::CharacteristicAggregateFormat, QBluetoothUuid::CharacteristicExtendedProperties, QBluetoothUuid::CharacteristicPresentationFormat, QBluetoothUuid::CharacteristicUserDescription, QBluetoothUuid::ClientCharacteristicConfiguration, QBluetoothUuid::ExternalReportReference, ok, QBluetoothUuid::ReportReference, QBluetoothUuid::ServerCharacteristicConfiguration, QBluetoothUuid::toUInt16(), QBluetoothUuid::UnknownDescriptorType, uuid(), and QBluetoothUuid::ValidRange.

Referenced by name().

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

◆ uuid()

QBluetoothUuid QLowEnergyDescriptor::uuid ( ) const

Returns the UUID of this descriptor if \l isValid() returns true; otherwise a \l {QUuid::isNull()}{null} UUID.

Definition at line 188 of file qlowenergydescriptor.cpp.

References QLowEnergyServicePrivate::characteristicList, and QSharedPointer< T >::isNull().

Referenced by type(), QLowEnergyService::writeDescriptor(), and QLowEnergyControllerPrivateBluezDBus::writeDescriptor().

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

◆ value()

QByteArray QLowEnergyDescriptor::value ( ) const

Returns the cached value of the descriptor.

The cached descriptor value may be updated using \l QLowEnergyService::writeDescriptor() or \l QLowEnergyService::readDescriptor().

Definition at line 223 of file qlowenergydescriptor.cpp.

References QLowEnergyServicePrivate::characteristicList, QSharedPointer< T >::isNull(), and QByteArray().

Referenced by QLowEnergyControllerPrivateBluezDBus::readDescriptor().

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

Friends And Related Symbol Documentation

◆ operator!=

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

Returns true if a is not equal to b; otherwise false.

Two QLowEnergyDescriptor instances are considered to be equal if they refer to the same descriptor on the same remote Bluetooth Low Energy device or both instances have been default-constructed.

Definition at line 30 of file qlowenergydescriptor.h.

◆ operator==

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

Returns true if a is equal to b; otherwise false.

Two QLowEnergyDescriptor instances are considered to be equal if they refer to the same descriptor on the same remote Bluetooth Low Energy device or both instances have been default-constructed.

Definition at line 26 of file qlowenergydescriptor.h.

◆ QLowEnergyCharacteristic

friend class QLowEnergyCharacteristic
friend

Definition at line 49 of file qlowenergydescriptor.h.

◆ QLowEnergyControllerPrivate

friend class QLowEnergyControllerPrivate
friend

Definition at line 51 of file qlowenergydescriptor.h.

◆ QLowEnergyControllerPrivateAndroid

Definition at line 52 of file qlowenergydescriptor.h.

◆ QLowEnergyControllerPrivateBluez

friend class QLowEnergyControllerPrivateBluez
friend

Definition at line 53 of file qlowenergydescriptor.h.

◆ QLowEnergyControllerPrivateBluezDBus

Definition at line 54 of file qlowenergydescriptor.h.

◆ QLowEnergyControllerPrivateCommon

friend class QLowEnergyControllerPrivateCommon
friend

Definition at line 55 of file qlowenergydescriptor.h.

◆ QLowEnergyControllerPrivateDarwin

friend class QLowEnergyControllerPrivateDarwin
friend

Definition at line 56 of file qlowenergydescriptor.h.

◆ QLowEnergyControllerPrivateWinRT

friend class QLowEnergyControllerPrivateWinRT
friend

Definition at line 57 of file qlowenergydescriptor.h.

◆ QLowEnergyService

friend class QLowEnergyService
friend

Definition at line 50 of file qlowenergydescriptor.h.


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