QBluetoothServiceInfo

#include <QtConnectivity/QBluetoothServiceInfo>

The QBluetoothServiceInfo class provides information about services.

QtConnectivity

QBluetoothServiceInfo provides information about a service offered by a Bluetooth device.


Overview

Classes

Alternative

The Alternative class provides a data type for Bluetooth Data Element Alternative attributes.

Sequence

The Sequence class provides a data type for Bluetooth Data Element Sequence attributes.

Public Types Index

enum AttributeId

ServiceRecordHandle = 0x0000, ServiceClassIds = 0x0001, ServiceId = 0x0003, ProtocolDescriptorList = 0x0004, BrowseGroupList = 0x0005, ServiceAvailability = 0x0008, PrimaryLanguageBase = 0x0100, ServiceName = PrimaryLanguageBase + 0x0000, ServiceDescription = PrimaryLanguageBase + 0x0001, ServiceProvider = PrimaryLanguageBase + 0x0002

enum Protocol

UnknownProtocol, L2capProtocol, RfcommProtocol

Public Attributes Index

Protected Attributes Index

QBluetoothServiceInfoPrivate *d_ptr

Public Functions Index

QBluetoothServiceInfo ()
QBluetoothServiceInfo (const QBluetoothServiceInfo &other)
~QBluetoothServiceInfo ()
QVariantattribute (quint16 attributeId) const
QList< quint16 >attributes () const
boolcontains (quint16 attributeId) const
QBluetoothDeviceInfodevice () const
boolisComplete () const
boolisRegistered () const
boolisValid () const
QBluetoothServiceInfo &operator= (const QBluetoothServiceInfo &other)
QBluetoothServiceInfo::SequenceprotocolDescriptor (QBluetoothUuid::ProtocolUuid protocol) const
intprotocolServiceMultiplexer () const
boolregisterService () const
voidremoveAttribute (quint16 attributeId)
intserverChannel () const
quint8serviceAvailability () const
QList< QBluetoothUuid >serviceClassUuids () const
QStringserviceDescription () const
QStringserviceName () const
QStringserviceProvider () const
QBluetoothUuidserviceUuid () const
voidsetAttribute (quint16 attributeId, const QVariant &value)
voidsetAttribute (quint16 attributeId, const QBluetoothUuid &value)
voidsetAttribute (quint16 attributeId, const QBluetoothServiceInfo::Sequence &value)
voidsetAttribute (quint16 attributeId, const QBluetoothServiceInfo::Alternative &value)
voidsetDevice (const QBluetoothDeviceInfo &info)
voidsetServiceAvailability (quint8 availability)
voidsetServiceDescription (const QString &description)
voidsetServiceName (const QString &name)
voidsetServiceProvider (const QString &provider)
voidsetServiceUuid (const QBluetoothUuid &uuid)
QBluetoothServiceInfo::ProtocolsocketProtocol () const
boolunregisterService () const

Public Types

AttributeId

Bluetooth service attributes.

ServiceClassIds UUIDs of service classes that the service conforms to. ServiceId UUID that uniquely identifies the service. ProtocolDescriptorList List of protocols used by the service. BrowseGroupList List of browse groups the service is in. ServiceAvailability Value indicating the availability of the service. PrimaryLanguageBase Base index for primary language text descriptors. ServiceRecordHandle Specifies a service record from which attributes can be retrieved ServiceName Name of the Bluetooth service in the primary language. ServiceDescription Description of the Bluetooth service in the primary language. ServiceProvider Name of the company / entity that provides the Bluetooth service primary language.

ServiceRecordHandle = 0x0000
ServiceClassIds = 0x0001
ServiceId = 0x0003
ProtocolDescriptorList = 0x0004
BrowseGroupList = 0x0005
ServiceAvailability = 0x0008
PrimaryLanguageBase = 0x0100
ServiceName = PrimaryLanguageBase + 0x0000
ServiceDescription = PrimaryLanguageBase + 0x0001
ServiceProvider = PrimaryLanguageBase + 0x0002

Protocol

This enum describes the socket protocol used by the service.

UnknownProtocol The service uses an unknown socket protocol. L2capProtocol The service uses the L2CAP socket protocol. RfcommProtocol The service uses the RFCOMM socket protocol.

UnknownProtocol
L2capProtocol
RfcommProtocol

Public Attributes

QString suuid ()

Protected Attributes

QBluetoothServiceInfoPrivate * d_ptr ()

Public Functions

QBluetoothServiceInfo ()

Construct a new invalid QBluetoothServiceInfo;.

QBluetoothServiceInfo (

Construct a new QBluetoothServiceInfo that is a copy of other.

~QBluetoothServiceInfo ()

Destructor.

QVariant attribute (
  • quint16attributeId)

Returns the value of the attribute attributeId.

QList< quint16 > attributes ()

Returns a list of all attribute ids that this service info has.

bool contains (
  • quint16attributeId)

Returns true if the service info contains the attribute attributeId; otherwise returns false.

QBluetoothDeviceInfo device ()

Returns the address of the Bluetooth device that provides this service.

bool isComplete ()

Returns true if the Bluetooth service info object is considered complete; otherwise returns false.

A complete service info contains a ProtocolDescriptorList attribute.

bool isRegistered ()

Returns true if the service info is registered with the platforms service discovery protocol (SDP) implementation; otherwise returns false.

bool isValid ()

Returns true if the Bluetooth service info object is valid; otherwise returns false.

An invalid Bluetooth service info has no attributes.

QBluetoothServiceInfo & operator= (

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

QBluetoothServiceInfo::Sequence protocolDescriptor (

Returns the protocol parameters as a QBluetoothServiceInfo::Sequence for protocol protocol.

An empty QBluetoothServiceInfo::Sequence is returned if protocol is not supported.

int protocolServiceMultiplexer ()

This is a convenience function.

Returns the protocol/service multiplexer for services which support the L2CAP protocol. Otherwise returns -1.

This function is equivalent to extracting the information from the QBluetoothServiceInfo::Sequence returned from QBluetoothServiceInfo::attribute(QBluetoothServiceInfo::ProtocolDescriptorList).

bool registerService ()

Registers this service with the platforms service discovery protocol (SDP) implementation, making it findable by other devices when they perform service discovery.

Returns true if the service is successfully registered, otherwise returns false. Once registered changes to the record cannot be made. The service must be unregistered and registered.

void removeAttribute (
  • quint16attributeId)

Removes the attribute attributeId from this service info.

int serverChannel ()

This is a convenience function.

Returns the server channel for services which support the RFCOMM protocol. Otherwise returns -1.

This function is equivalent to extracting the information from the QBluetoothServiceInfo::Sequence returned from QBluetoothServiceInfo::attribute(QBluetootherServiceInfo::ProtocolDescriptorList).

quint8 serviceAvailability ()

This is a convenience function.

QList< QBluetoothUuid > serviceClassUuids ()

This is a convenience function.

It is equivalent to calling attribute(QBluetoothServiceInfo::ServiceClassIds).value<QList<QBluetoothUuid> >().

Returns a list of UUIDs describing the service classes that this service conforms to.

See also:

attribute()

QString serviceDescription ()

This is a convenience function.

It is equivalent to calling attribute(QBluetoothServiceInfo::ServiceDescription).toString().

Returns the service description in the primary language.

QString serviceName ()

This is a convenience function.

It is equivalent to calling attribute(QBluetoothServiceInfo::ServiceName).toString().

Returns the service name in the primary language.

QString serviceProvider ()

This is a convenience function.

It is equivalent to calling attribute(QBluetoothServiceInfo::ServiceProvider).toString().

Returns the service provider in the primary language.

QBluetoothUuid serviceUuid ()

This is a convenience function.

It is equivalent to calling attribute(QBluetoothServiceInfo::ServiceId).value<QBluetoothUuid>().

Returns the UUID of the service.

void setAttribute (
  • quint16attributeId,
  • const QVariant &value )

Sets the attribute identified by attributeId to value.

IF the service info is registered with the platforms SDP database the database entry is also updated.

void setAttribute (

This is a convenience function.

Sets the attribute identified by attributeId to value.

void setAttribute (

This is a convenience function.

Sets the attribute identified by attributeId to value.

void setAttribute (

This is a convenience function.

Sets the attribute identified by attributeId to value.

void setDevice (

Sets the Bluetooth device that provides this service to device.

void setServiceAvailability (
  • quint8availability)

This is a convenience function.

It is equivalent to calling setAttribute(QBluetoothServiceInfo::ServiceAvailability, availability).

Sets the availabiltiy of the service to availability.

void setServiceDescription (

This is a convenience function.

It is equivalent to calling setAttribute(QBluetoothServiceInfo::ServiceDescription, description).

Sets the service description in the primary language to description.

void setServiceName (

This is a convenience function.

It is equivalent to calling setAttribute(QBluetoothServiceInfo::ServiceName, name).

Sets the service name in the primary language to name.

void setServiceProvider (

This is a convenience function.

It is equivalent to calling setAttribute(QBluetoothServiceInfo::ServiceProvider, provider).

Sets the service provider in the primary language to provider.

void setServiceUuid (

This is a convenience function.

It is equivalent to calling setAttribute(QBluetoothServiceInfo::ServiceId, uuid).

Sets the service UUID to uuid.

QBluetoothServiceInfo::Protocol socketProtocol ()

Returns the protocol that this service uses.

bool unregisterService ()

Unregisters this service with the platforms service discovery protocol (SDP) implementation.

This service will not longer be findable by other devices via service discovery.

Returns true if the service is successfully unregistered, otherwise returns false.

Last modified: 2014-06-24



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus