QLowEnergyDescriptor Class

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

头: #include <QLowEnergyDescriptor>
qmake: QT += bluetooth
Since: Qt 5.4

公共函数

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

详细描述

QLowEnergyDescriptor provides information about a Bluetooth Low Energy descriptor's name (), uuid (),和 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.

另请参阅 QLowEnergyService and QLowEnergyCharacteristic .

成员函数文档编制

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.

QLowEnergyDescriptor:: QLowEnergyDescriptor ()

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

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

制作副本为 other 并将其赋值给此 QLowEnergyDescriptor object. The two copies continue to share the same service and controller details.

QLowEnergyDescriptor:: ~QLowEnergyDescriptor ()

销毁 QLowEnergyDescriptor 对象。

bool QLowEnergyDescriptor:: isValid () const

返回 true 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.

注意: 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.

另请参阅 type () 和 QBluetoothUuid::descriptorToString ().

QBluetoothUuid::DescriptorType QLowEnergyDescriptor:: type () const

Returns the type of the descriptor.

另请参阅 name ().

QBluetoothUuid QLowEnergyDescriptor:: uuid () const

Returns the UUID of this descriptor if isValid () 返回 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 () 或 QLowEnergyService::readDescriptor ().

相关非成员

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

返回 true if a 不等于 b ;否则 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 )

返回 true if a 等于 b ;否则 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.