QBluetoothServiceInfo Class

The QBluetoothServiceInfo class enables access to the attributes of a Bluetooth service. More...

Header: #include <QBluetoothServiceInfo>
qmake: QT += bluetooth
Since: Qt 5.2

This class was introduced in Qt 5.2.

Public Types

class Alternative
class Sequence
enum AttributeId { ServiceRecordHandle, ServiceClassIds, ServiceRecordState, ServiceId, ProtocolDescriptorList, …, ServiceProvider }
enum Protocol { UnknownProtocol, L2capProtocol, RfcommProtocol }

Detailed Description

QBluetoothServiceInfo provides information about a service offered by a Bluetooth device. In addition it can be used to register new services on the local device. Note that such a registration only affects the Bluetooth SDP entries. Any server listening for incoming connections (e.g an RFCOMM server) must be started before registerService() is called. Deregistration must happen in the reverse order.

QBluetoothServiceInfo is not a value type in the traditional sense. All copies of the same service info object share the same data as they do not detach upon changing them. This ensures that two copies can (de)register the same Bluetooth service.

On iOS, this class cannot be used because the platform does not expose an API which may permit access to QBluetoothServiceInfo related features.

Member Type Documentation

enum QBluetoothServiceInfo::AttributeId

Bluetooth service attributes. Please check the Bluetooth Core Specification for a more detailed description of these attributes.

ConstantValueDescription
QBluetoothServiceInfo::ServiceRecordHandle0x0000Specifies a service record from which attributes can be retrieved.
QBluetoothServiceInfo::ServiceClassIds0x0001UUIDs of service classes that the service conforms to. The most common service classes are defined in (QBluetoothUuid::ServiceClassUuid)
QBluetoothServiceInfo::ServiceRecordState0x0002Attibute changes when any other service attribute is added, deleted or modified.
QBluetoothServiceInfo::ServiceId0x0003UUID that uniquely identifies the service.
QBluetoothServiceInfo::ProtocolDescriptorList0x0004List of protocols used by the service. The most common protocol Uuids are defined in QBluetoothUuid::ProtocolUuid
QBluetoothServiceInfo::BrowseGroupList0x0005List of browse groups the service is in.
QBluetoothServiceInfo::LanguageBaseAttributeIdList0x0006List of language base attribute IDs to support human-readable attributes.
QBluetoothServiceInfo::ServiceInfoTimeToLive0x0007Number of seconds for which the service record is expected to remain valid and unchanged.
QBluetoothServiceInfo::ServiceAvailability0x0008Value indicating the availability of the service.
QBluetoothServiceInfo::BluetoothProfileDescriptorList0x0009List of profiles to which the service conforms.
QBluetoothServiceInfo::DocumentationUrl0x000AURL that points to the documentation on the service..
QBluetoothServiceInfo::ClientExecutableUrl0x000BURL that refers to the location of an application that can be used to utilize the service.
QBluetoothServiceInfo::IconUrl0x000CURL to the location of the icon representing the service.
QBluetoothServiceInfo::AdditionalProtocolDescriptorList0x000DAdditional protocols used by the service. This attribute extends ProtocolDescriptorList.
QBluetoothServiceInfo::PrimaryLanguageBase0x0100Base index for primary language text descriptors.
QBluetoothServiceInfo::ServiceNamePrimaryLanguageBase + 0x0000Name of the Bluetooth service in the primary language.
QBluetoothServiceInfo::ServiceDescriptionPrimaryLanguageBase + 0x0001Description of the Bluetooth service in the primary language.
QBluetoothServiceInfo::ServiceProviderPrimaryLanguageBase + 0x0002Name of the company / entity that provides the Bluetooth service primary language.

Note: On Windows ServiceClassIds and ProtocolDescriptorList are automatically set to default values when a service is created. Manually setting values for these attributes will not work and might lead to unexpected results on this platform.

enum QBluetoothServiceInfo::Protocol

This enum describes the socket protocol used by the service.

ConstantValueDescription
QBluetoothServiceInfo::UnknownProtocol0The service uses an unknown socket protocol.
QBluetoothServiceInfo::L2capProtocol1The service uses the L2CAP socket protocol. This protocol is not supported for direct socket connections on Android.
QBluetoothServiceInfo::RfcommProtocol2The service uses the RFCOMM socket protocol.