QLowEnergyDescriptor Class | Qt Bluetooth | Qt 6.11.1
Description: The QLowEnergyDescriptor class stores information about the Bluetooth Low Energy descriptor.

- Qt 6.11
- Qt Bluetooth
- C++ Classes
- QLowEnergyDescriptor
- Qt 6.11.1 Reference Documentation

# QLowEnergyDescriptor Class

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

Header: | `#include <QLowEnergyDescriptor>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS Bluetooth)` `target_link_libraries(mytarget PRIVATE Qt6::Bluetooth)`
qmake: | `QT += bluetooth`

- List of all members, including inherited members

## Public Functions

| QLowEnergyDescriptor()
| QLowEnergyDescriptor(const QLowEnergyDescriptor &other)
| ~QLowEnergyDescriptor()
bool | isValid() const
QString | name() const
QBluetoothUuid::DescriptorType | type() const
QBluetoothUuid | uuid() const
QByteArray | value() const
QLowEnergyDescriptor & | operator=(const QLowEnergyDescriptor &other)

## Related Non-Members

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

## Detailed Description

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 QLowEnergyService::writeDescriptor() function writes the new value. The QLowEnergyService::descriptorWritten() signal is emitted upon success. The cached value() of this object is updated accordingly.

See also QLowEnergyService and QLowEnergyCharacteristic.

## Member Function Documentation

### QLowEnergyDescriptor::QLowEnergyDescriptor()

Construct a new QLowEnergyDescriptor. A default-constructed instance of this class is always invalid.

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

### `[noexcept]` QLowEnergyDescriptor::~QLowEnergyDescriptor()

Destroys the QLowEnergyDescriptor object.

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

### QString QLowEnergyDescriptor::name() const

Returns the human-readable name of the descriptor.

The name is based on the descriptor's type(). The complete list of descriptor types can be found under Bluetooth.org Descriptors.

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

See also type() and QBluetoothUuid::descriptorToString().

### QBluetoothUuid::DescriptorType QLowEnergyDescriptor::type() const

Returns the type of the descriptor.

See also name().

### QBluetoothUuid QLowEnergyDescriptor::uuid() const

Returns the UUID of this descriptor if isValid() returns `true`; otherwise a null UUID.

### QByteArray QLowEnergyDescriptor::value() const

Returns the cached value of the descriptor.

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

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

## Related Non-Members

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

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.

### bool operator==(const QLowEnergyDescriptor &a, const QLowEnergyDescriptor &b)

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.