PySide6.QtBluetooth.QBluetoothServiceInfo

class QBluetoothServiceInfo

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

Synopsis

Methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

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.

class AttributeId

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

Constant

Description

QBluetoothServiceInfo.ServiceRecordHandle

Specifies a service record from which attributes can be retrieved.

QBluetoothServiceInfo.ServiceClassIds

UUIDs of service classes that the service conforms to. The most common service classes are defined in ( ServiceClassUuid )

QBluetoothServiceInfo.ServiceRecordState

Attibute changes when any other service attribute is added, deleted or modified.

QBluetoothServiceInfo.ServiceId

UUID that uniquely identifies the service.

QBluetoothServiceInfo.ProtocolDescriptorList

List of protocols used by the service. The most common protocol Uuids are defined in ProtocolUuid

QBluetoothServiceInfo.BrowseGroupList

List of browse groups the service is in.

QBluetoothServiceInfo.LanguageBaseAttributeIdList

List of language base attribute IDs to support human-readable attributes.

QBluetoothServiceInfo.ServiceInfoTimeToLive

Number of seconds for which the service record is expected to remain valid and unchanged.

QBluetoothServiceInfo.ServiceAvailability

Value indicating the availability of the service.

QBluetoothServiceInfo.BluetoothProfileDescriptorList

List of profiles to which the service conforms.

QBluetoothServiceInfo.DocumentationUrl

URL that points to the documentation on the service..

QBluetoothServiceInfo.ClientExecutableUrl

URL that refers to the location of an application that can be used to utilize the service.

QBluetoothServiceInfo.IconUrl

URL to the location of the icon representing the service.

QBluetoothServiceInfo.AdditionalProtocolDescriptorList

Additional protocols used by the service. This attribute extends ProtocolDescriptorList.

QBluetoothServiceInfo.PrimaryLanguageBase

Base index for primary language text descriptors.

QBluetoothServiceInfo.ServiceName

Name of the Bluetooth service in the primary language.

QBluetoothServiceInfo.ServiceDescription

Description of the Bluetooth service in the primary language.

QBluetoothServiceInfo.ServiceProvider

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

class Protocol

This enum describes the socket protocol used by the service.

Constant

Description

QBluetoothServiceInfo.UnknownProtocol

The service uses an unknown socket protocol.

QBluetoothServiceInfo.L2capProtocol

The service uses the L2CAP socket protocol. This protocol is not supported for direct socket connections on Android.

QBluetoothServiceInfo.RfcommProtocol

The service uses the RFCOMM socket protocol.

__init__()

Construct a new invalid QBluetoothServiceInfo ;

__init__(other)
Parameters:

otherQBluetoothServiceInfo

Construct a new QBluetoothServiceInfo that is a copy of other.

The two copies continue to share the same underlying data which does not detach upon write.

attribute(attributeId)
Parameters:

attributeId – int

Return type:

object

Returns the value of the attribute attributeId.

See also

setAttribute()

attributes()
Return type:

.list of quint16

Returns a list of all attribute ids that the QBluetoothServiceInfo object has.

contains(attributeId)
Parameters:

attributeId – int

Return type:

bool

Returns true if the QBluetoothServiceInfo object contains the attribute attributeId, otherwise returns false.

device()
Return type:

QBluetoothDeviceInfo

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

See also

setDevice()

isComplete()
Return type:

bool

Returns true if the QBluetoothServiceInfo object is considered complete, otherwise returns false.

A complete QBluetoothServiceInfo object contains a ProtocolDescriptorList attribute.

isRegistered()
Return type:

bool

Returns true if the service information is registered with the platform’s Service Discovery Protocol (SDP) implementation, otherwise returns false.

isValid()
Return type:

bool

Returns true if the QBluetoothServiceInfo object is valid, otherwise returns false.

An invalid QBluetoothServiceInfo object will have no attributes.

protocolDescriptor(protocol)
Parameters:

protocolProtocolUuid

Return type:

Sequence

Returns the protocol parameters as a Sequence for protocol protocol.

An empty Sequence is returned if protocol is not supported.

protocolServiceMultiplexer()
Return type:

int

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 Sequence returned by attribute ( ProtocolDescriptorList ).

registerService([localAdapter=QBluetoothAddress()])
Parameters:

localAdapterQBluetoothAddress

Return type:

bool

Registers this service with the platform’s 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 again with the changes.

The localAdapter parameter determines the local Bluetooth adapter under which the service should be registered. If localAdapter is null the default Bluetooth adapter will be used. If this service info object is already registered via a local adapter and this is function is called using a different local adapter, the previous registration is removed and the service reregistered using the new adapter.

removeAttribute(attributeId)
Parameters:

attributeId – int

Removes the attribute attributeId from the QBluetoothServiceInfo object.

If the service information is already registered with the platforms SDP database, the database entry will not be updated until registerService() was called again.

serverChannel()
Return type:

int

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 Sequence returned by attribute (QBluetootherServiceInfo::ProtocolDescriptorList).

serviceAvailability()
Return type:

int

This is a convenience function. It is equivalent to calling attribute( ServiceAvailability ).toUInt().

Returns the availability of the service.

serviceClassUuids()
Return type:

.list of QBluetoothUuid

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

This is a convenience function. It is equivalent to calling attribute( ServiceClassIds ).value< Sequence >() and subsequently iterating over its QBluetoothUuid entries.

See also

attribute()

serviceDescription()
Return type:

str

This is a convenience function. It is equivalent to calling attribute( ServiceDescription ).toString().

Returns the service description in the primary language.

serviceName()
Return type:

str

This is a convenience function. It is equivalent to calling attribute( ServiceName ).toString().

Returns the service name in the primary language.

serviceProvider()
Return type:

str

This is a convenience function. It is equivalent to calling attribute( ServiceProvider ).toString().

Returns the service provider in the primary language.

serviceUuid()
Return type:

QBluetoothUuid

This is a convenience function. It is equivalent to calling attribute( ServiceId ).value< QBluetoothUuid >().

Returns the custom UUID of the service. This UUID may be null. UUIDs based on Bluetooth SIG standards should be retrieved via serviceClassUuids() .

setAttribute(attributeId, value)
Parameters:

This is a convenience function.

Sets the attribute identified by attributeId to value.

If the service information is already registered with the platform’s SDP database, the database entry will not be updated until registerService() was called again.

See also

attribute()

setAttribute(attributeId, value)
Parameters:
  • attributeId – int

  • valueSequence

This is a convenience function.

Sets the attribute identified by attributeId to value.

If the service information is already registered with the platform’s SDP database, the database entry will not be updated until registerService() was called again.

setAttribute(attributeId, value)
Parameters:

This is a convenience function.

Sets the attribute identified by attributeId to value.

If the service information is already registered with the platform’s SDP database, the database entry will not be updated until registerService() was called again.

setAttribute(attributeId, value)
Parameters:
  • attributeId – int

  • value – object

Sets the attribute identified by attributeId to value.

If the service information is already registered with the platform’s SDP database, the database entry will not be updated until registerService() was called again.

Note

If an attribute expectes a byte-encoded value (e.g. Bluetooth HID services), it should be set as QByteArray.

setDevice(info)
Parameters:

infoQBluetoothDeviceInfo

Sets the Bluetooth device that provides this service to device.

See also

device()

setServiceAvailability(availability)
Parameters:

availability – int

This is a convenience function. It is equivalent to calling setAttribute ( ServiceAvailability , availability).

Sets the availabiltiy of the service to availability.

setServiceDescription(description)
Parameters:

description – str

This is a convenience function. It is equivalent to calling setAttribute ( ServiceDescription , description).

Sets the service description in the primary language to description.

setServiceName(name)
Parameters:

name – str

This is a convenience function. It is equivalent to calling setAttribute ( ServiceName , name).

Sets the service name in the primary language to name.

setServiceProvider(provider)
Parameters:

provider – str

This is a convenience function. It is equivalent to calling setAttribute ( ServiceProvider , provider).

Sets the service provider in the primary language to provider.

setServiceUuid(uuid)
Parameters:

uuidQBluetoothUuid

This is a convenience function. It is equivalent to calling setAttribute ( ServiceId , uuid).

Sets the custom service UUID to uuid. This function should not be used to set a standardized service UUID.

socketProtocol()
Return type:

Protocol

Returns the protocol that the QBluetoothServiceInfo object uses.

unregisterService()
Return type:

bool

Unregisters this service with the platform’s Service Discovery Protocol (SDP) implementation. After this, the service will no longer be findable by other devices through service discovery.

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

class Sequence

The Sequence class stores attributes of a Bluetooth Data Element Sequence. More_

Synopsis

Methods

Static functions

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

__init__()

Constructs a new empty sequence.

__init__(list)
Parameters:

list – .list of QVariant

Constructs a new sequence that is a copy of list.

append(arg__1)
Parameters:

arg__1 – object

append(l)
Parameters:

l – .list of QVariant

at(i)
Parameters:

i – int

Return type:

object

back()
Return type:

object

capacity()
Return type:

int

clear()
constData()
Return type:

object

constFirst()
Return type:

object

constLast()
Return type:

object

count()
Return type:

int

data()
Return type:

object

empty()
Return type:

bool

first()
Return type:

object

first(n)
Parameters:

n – int

Return type:

.list of QVariant

static fromList(list)
Parameters:

list – .list of QVariant

Return type:

.list of QVariant

static fromVector(vector)
Parameters:

vector – .list of QVariant

Return type:

.list of QVariant

front()
Return type:

object

insert(arg__1, arg__2)
Parameters:
  • arg__1 – int

  • arg__2 – object

isEmpty()
Return type:

bool

isSharedWith(other)
Parameters:

other – .list of QVariant

Return type:

bool

last()
Return type:

object

last(n)
Parameters:

n – int

Return type:

.list of QVariant

length()
Return type:

int

static maxSize()
Return type:

int

max_size()
Return type:

int

mid(pos[, len=-1])
Parameters:
  • pos – int

  • len – int

Return type:

.list of QVariant

move(from, to)
Parameters:
  • from – int

  • to – int

__add__(l)
Parameters:

l – .list of QVariant

Return type:

.list of QVariant

__iadd__(l)
Parameters:

l – .list of QVariant

Return type:

.list of QVariant

__lshift__(l)
Parameters:

l – .list of QVariant

Return type:

.list of QVariant

operator(i)
Parameters:

i – int

Return type:

object

pop_back()
pop_front()
prepend(arg__1)
Parameters:

arg__1 – object

push_back(arg__1)
Parameters:

arg__1 – object

push_front(arg__1)
Parameters:

arg__1 – object

remove(i[, n=1])
Parameters:
  • i – int

  • n – int

removeAll(arg__1)
Parameters:

arg__1 – object

removeAt(i)
Parameters:

i – int

removeFirst()
removeLast()
removeOne(arg__1)
Parameters:

arg__1 – object

reserve(size)
Parameters:

size – int

resize(size)
Parameters:

size – int

resizeForOverwrite(size)
Parameters:

size – int

shrink_to_fit()
size()
Return type:

int

sliced(pos)
Parameters:

pos – int

Return type:

.list of QVariant

sliced(pos, n)
Parameters:
  • pos – int

  • n – int

Return type:

.list of QVariant

squeeze()
swap(other)
Parameters:

other – .list of QVariant

swapItemsAt(i, j)
Parameters:
  • i – int

  • j – int

takeAt(i)
Parameters:

i – int

Return type:

object

toList()
Return type:

.list of QVariant

toVector()
Return type:

.list of QVariant

value(i)
Parameters:

i – int

Return type:

object

class Alternative

The Alternative class stores attributes of a Bluetooth Data Element Alternative. More_

Synopsis

Methods

Static functions

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

__init__()

Constructs a new empty alternative.

__init__(list)
Parameters:

list – .list of QVariant

Constructs a new alternative that is a copy of list.

append(arg__1)
Parameters:

arg__1 – object

append(l)
Parameters:

l – .list of QVariant

at(i)
Parameters:

i – int

Return type:

object

back()
Return type:

object

capacity()
Return type:

int

clear()
constData()
Return type:

object

constFirst()
Return type:

object

constLast()
Return type:

object

count()
Return type:

int

data()
Return type:

object

empty()
Return type:

bool

first()
Return type:

object

first(n)
Parameters:

n – int

Return type:

.list of QVariant

static fromList(list)
Parameters:

list – .list of QVariant

Return type:

.list of QVariant

static fromVector(vector)
Parameters:

vector – .list of QVariant

Return type:

.list of QVariant

front()
Return type:

object

insert(arg__1, arg__2)
Parameters:
  • arg__1 – int

  • arg__2 – object

isEmpty()
Return type:

bool

isSharedWith(other)
Parameters:

other – .list of QVariant

Return type:

bool

last()
Return type:

object

last(n)
Parameters:

n – int

Return type:

.list of QVariant

length()
Return type:

int

static maxSize()
Return type:

int

max_size()
Return type:

int

mid(pos[, len=-1])
Parameters:
  • pos – int

  • len – int

Return type:

.list of QVariant

move(from, to)
Parameters:
  • from – int

  • to – int

__add__(l)
Parameters:

l – .list of QVariant

Return type:

.list of QVariant

__iadd__(l)
Parameters:

l – .list of QVariant

Return type:

.list of QVariant

__lshift__(l)
Parameters:

l – .list of QVariant

Return type:

.list of QVariant

operator(i)
Parameters:

i – int

Return type:

object

pop_back()
pop_front()
prepend(arg__1)
Parameters:

arg__1 – object

push_back(arg__1)
Parameters:

arg__1 – object

push_front(arg__1)
Parameters:

arg__1 – object

remove(i[, n=1])
Parameters:
  • i – int

  • n – int

removeAll(arg__1)
Parameters:

arg__1 – object

removeAt(i)
Parameters:

i – int

removeFirst()
removeLast()
removeOne(arg__1)
Parameters:

arg__1 – object

reserve(size)
Parameters:

size – int

resize(size)
Parameters:

size – int

resizeForOverwrite(size)
Parameters:

size – int

shrink_to_fit()
size()
Return type:

int

sliced(pos)
Parameters:

pos – int

Return type:

.list of QVariant

sliced(pos, n)
Parameters:
  • pos – int

  • n – int

Return type:

.list of QVariant

squeeze()
swap(other)
Parameters:

other – .list of QVariant

swapItemsAt(i, j)
Parameters:
  • i – int

  • j – int

takeAt(i)
Parameters:

i – int

Return type:

object

toList()
Return type:

.list of QVariant

toVector()
Return type:

.list of QVariant

value(i)
Parameters:

i – int

Return type:

object