En esta página

QLowEnergyServiceData Class

La clase QLowEnergyServiceData se utiliza para configurar los datos del servicio GATT. Más...

Cabecera: #include <QLowEnergyServiceData>
CMake: find_package(Qt6 REQUIRED COMPONENTS Bluetooth)
target_link_libraries(mytarget PRIVATE Qt6::Bluetooth)
qmake: QT += bluetooth

Tipos Públicos

enum ServiceType { ServiceTypePrimary, ServiceTypeSecondary }

Funciones Públicas

QLowEnergyServiceData()
QLowEnergyServiceData(const QLowEnergyServiceData &other)
~QLowEnergyServiceData()
void addCharacteristic(const QLowEnergyCharacteristicData &characteristic)
void addIncludedService(QLowEnergyService *service)
QList<QLowEnergyCharacteristicData> characteristics() const
QList<QLowEnergyService *> includedServices() const
bool isValid() const
void setCharacteristics(const QList<QLowEnergyCharacteristicData> &characteristics)
void setIncludedServices(const QList<QLowEnergyService *> &services)
void setType(QLowEnergyServiceData::ServiceType type)
void setUuid(const QBluetoothUuid &uuid)
void swap(QLowEnergyServiceData &other)
QLowEnergyServiceData::ServiceType type() const
QBluetoothUuid uuid() const
QLowEnergyServiceData &operator=(const QLowEnergyServiceData &other)
bool operator!=(const QLowEnergyServiceData &a, const QLowEnergyServiceData &b)
bool operator==(const QLowEnergyServiceData &a, const QLowEnergyServiceData &b)

Descripción detallada

Un objeto de esta clase proporciona un servicio que se añade a un servidor GATT a través de QLowEnergyController::addService().

Documentación de los tipos de miembros

enum QLowEnergyServiceData::ServiceType

El tipo de servicio GATT.

ConstanteValorDescripción
QLowEnergyServiceData::ServiceTypePrimary0x2800El servicio es un servicio primario.
QLowEnergyServiceData::ServiceTypeSecondary0x2801El servicio es un servicio secundario. Los servicios secundarios son incluidos por otros servicios para implementar alguna funcionalidad de nivel superior.

Documentación de las funciones miembro

QLowEnergyServiceData::QLowEnergyServiceData()

Crea un nuevo objeto inválido de esta clase.

QLowEnergyServiceData::QLowEnergyServiceData(const QLowEnergyServiceData &other)

Construye un nuevo objeto de esta clase que es una copia de other.

[noexcept] QLowEnergyServiceData::~QLowEnergyServiceData()

Destruye este objeto.

void QLowEnergyServiceData::addCharacteristic(const QLowEnergyCharacteristicData &characteristic)

Añade characteristic a la lista de características, si es válida.

Véase también setCharacteristics().

void QLowEnergyServiceData::addIncludedService(QLowEnergyService *service)

Añade service a la lista de servicios incluidos. El objeto service debe haber sido devuelto por una llamada a QLowEnergyController::addService. Este requisito evita las inclusiones circulares (que están prohibidas por la especificación Bluetooth), y también ayuda a soportar el caso de uso de incluir más de un servicio del mismo tipo.

Véase también setIncludedServices().

QList<QLowEnergyCharacteristicData> QLowEnergyServiceData::characteristics() const

Devuelve la lista de características.

Véase también setCharacteristics().

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

Devuelve la lista de servicios incluidos.

Véase también setIncludedServices().

bool QLowEnergyServiceData::isValid() const

Devuelve true si este servicio tiene un UUID no nulo.

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

Establece la lista de características en characteristics. Sólo se tienen en cuenta las características válidas.

Véase también characteristics() y addCharacteristic().

void QLowEnergyServiceData::setIncludedServices(const QList<QLowEnergyService *> &services)

Establece la lista de servicios incluidos en services. Todos los objetos de esta lista deben haber sido devueltos por una llamada a QLowEnergyController::addService.

Véase también includedServices() y addIncludedService().

void QLowEnergyServiceData::setType(QLowEnergyServiceData::ServiceType type)

Establece el tipo de este servicio en type.

Véase también type().

void QLowEnergyServiceData::setUuid(const QBluetoothUuid &uuid)

Establece el UUID de este servicio en uuid.

Véase también uuid().

[noexcept] void QLowEnergyServiceData::swap(QLowEnergyServiceData &other)

Intercambia este objeto con other.

QLowEnergyServiceData::ServiceType QLowEnergyServiceData::type() const

Devuelve el tipo de este servicio.

Véase también setType().

QBluetoothUuid QLowEnergyServiceData::uuid() const

Devuelve el UUID de este servicio.

Véase también setUuid().

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

Hace de este objeto una copia de other y devuelve el nuevo valor de este objeto.

No miembros relacionados

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

Devuelve true si a y b son desiguales con respecto a su estado público, en caso contrario devuelve false.

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

Devuelve true si a y b son iguales con respecto a su estado público, en caso contrario devuelve false.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.