PySide6.QtBluetooth.QBluetoothServiceInfo

class QBluetoothServiceInfo

QBluetoothServiceInfo 类允许访问蓝牙服务的属性。More_

概要

方法

注意

本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。

详细描述

QBluetoothServiceInfo 提供了关于蓝牙设备提供的服务的信息。此外,它还可以用于在本地设备上注册新服务。请注意,这种注册仅影响蓝牙SDP条目。任何监听传入连接的服务器(例如RFCOMM服务器)必须在调用registerService()之前启动。注销必须按相反的顺序进行。

QBluetoothServiceInfo 不是传统意义上的值类型。所有相同服务信息对象的副本共享相同的数据,因为它们在更改时不会分离。这确保了两个副本可以(取消)注册相同的蓝牙服务。

在iOS上,这个类无法使用,因为该平台没有公开可能允许访问QBluetoothServiceInfo相关功能的API。

class AttributeId

蓝牙服务属性。请查阅蓝牙核心规范以获取这些属性的更详细描述。

常量

描述

QBluetoothServiceInfo.ServiceRecordHandle

指定一个可以从中检索属性的服务记录。

QBluetoothServiceInfo.ServiceClassIds

服务所符合的服务类的UUID。最常见的服务类在 (ServiceClassUuid) 中定义。

QBluetoothServiceInfo.ServiceRecordState

当任何其他服务属性被添加、删除或修改时,属性会发生变化。

QBluetoothServiceInfo.ServiceId

唯一标识服务的UUID。

QBluetoothServiceInfo.ProtocolDescriptorList

服务使用的协议列表。最常见的协议Uuids在ProtocolUuid中定义

QBluetoothServiceInfo.BrowseGroupList

服务所在的浏览组列表。

QBluetoothServiceInfo.LanguageBaseAttributeIdList

支持人类可读属性的语言基础属性ID列表。

QBluetoothServiceInfo.ServiceInfoTimeToLive

服务记录预计保持有效和不变的秒数。

QBluetoothServiceInfo.ServiceAvailability

表示服务可用性的值。

QBluetoothServiceInfo.BluetoothProfileDescriptorList

服务符合的配置文件列表。

QBluetoothServiceInfo.DocumentationUrl

指向服务文档的URL。

QBluetoothServiceInfo.ClientExecutableUrl

指向可用于利用服务的应用程序位置的URL。

QBluetoothServiceInfo.IconUrl

表示服务的图标位置的URL。

QBluetoothServiceInfo.AdditionalProtocolDescriptorList

服务使用的附加协议。此属性扩展了ProtocolDescriptorList

QBluetoothServiceInfo.PrimaryLanguageBase

主要语言文本描述符的基础索引。

QBluetoothServiceInfo.ServiceName

蓝牙服务的主要语言名称。

QBluetoothServiceInfo.ServiceDescription

蓝牙服务的主要语言描述。

QBluetoothServiceInfo.ServiceProvider

提供蓝牙服务主要语言的公司/实体的名称。

注意

在Windows上,当创建服务时,ServiceClassIds和ProtocolDescriptorList会自动设置为默认值。手动设置这些属性的值将不起作用,并可能在此平台上导致意外结果。

class Protocol

此枚举描述了服务使用的套接字协议。

常量

描述

QBluetoothServiceInfo.UnknownProtocol

该服务使用未知的套接字协议。

QBluetoothServiceInfo.L2capProtocol

该服务使用L2CAP套接字协议。此协议在Android上不支持直接套接字连接。

QBluetoothServiceInfo.RfcommProtocol

该服务使用RFCOMM套接字协议。

__init__()

构造一个新的无效的QBluetoothServiceInfo ;

__init__(other)
Parameters:

其他QBluetoothServiceInfo

构造一个新的QBluetoothServiceInfo,它是other的副本。

两个副本继续共享相同的基础数据,这些数据在写入时不会分离。

attribute(attributeId)
Parameters:

attributeId – int

Return type:

对象

返回属性attributeId的值。

另请参阅

setAttribute()

attributes()
Return type:

.quint16的列表

返回QBluetoothServiceInfo对象拥有的所有属性ID的列表。

contains(attributeId)
Parameters:

attributeId – int

Return type:

布尔

如果 QBluetoothServiceInfo 对象包含属性 attributeId,则返回 true,否则返回 false。

device()
Return type:

QBluetoothDeviceInfo

返回提供此服务的蓝牙设备的地址。

另请参阅

setDevice()

isComplete()
Return type:

布尔

如果QBluetoothServiceInfo对象被认为是完整的,则返回true,否则返回false。

一个完整的 QBluetoothServiceInfo 对象包含一个 ProtocolDescriptorList 属性。

isRegistered()
Return type:

布尔

如果服务信息已注册到平台的Service Discovery Protocol (SDP)实现中,则返回true,否则返回false。

isValid()
Return type:

布尔

如果 QBluetoothServiceInfo 对象有效,则返回 true,否则返回 false。

一个无效的 QBluetoothServiceInfo 对象将没有任何属性。

protocolDescriptor(protocol)
Parameters:

协议ProtocolUuid

Return type:

Sequence

返回协议protocol的参数作为Sequence

如果protocol不被支持,则返回一个空的Sequence

protocolServiceMultiplexer()
Return type:

整数

这是一个便捷函数。返回支持L2CAP协议的服务协议/服务多路复用器,否则返回-1。

此函数等同于从attributeProtocolDescriptorList)返回的Sequence中提取信息。

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

localAdapterQBluetoothAddress

Return type:

布尔

将此服务注册到平台的服务发现协议(SDP)实现中,使其在其他设备执行服务发现时可被发现。如果服务成功注册,则返回true,否则返回false。一旦注册,记录将无法更改。必须取消注册并重新注册服务以进行更改。

localAdapter 参数决定了服务应注册的本地蓝牙适配器。如果 localAdapternull,则将使用默认的蓝牙适配器。如果此服务信息对象已通过本地适配器注册,并且此函数使用不同的本地适配器调用,则先前的注册将被移除,并使用新的适配器重新注册服务。

removeAttribute(attributeId)
Parameters:

attributeId – int

QBluetoothServiceInfo对象中移除属性attributeId

如果服务信息已经注册到平台的SDP数据库中,数据库条目将不会更新,直到再次调用registerService()

serverChannel()
Return type:

整数

这是一个便捷函数。返回支持RFCOMM协议的服务的服务器通道,否则返回-1。

此函数等同于从attribute(QBluetootherServiceInfo::ProtocolDescriptorList)返回的Sequence中提取信息。

serviceAvailability()
Return type:

整数

这是一个便捷函数。它等同于调用 attribute( ServiceAvailability ).toUInt()。

返回服务的可用性。

serviceClassUuids()
Return type:

QBluetoothUuid的列表

返回描述此服务符合的服务类别的UUID列表。

这是一个便捷函数。它等同于调用 attribute( ServiceClassIds ).value< Sequence >() 然后遍历其 QBluetoothUuid 条目。

另请参阅

attribute()

serviceDescription()
Return type:

字符串

这是一个便捷函数。它等同于调用 attribute( ServiceDescription ).toString()。

返回主要语言的服务描述。

serviceName()
Return type:

字符串

这是一个便捷函数。它等同于调用 attribute( ServiceName ).toString()。

返回主要语言中的服务名称。

serviceProvider()
Return type:

字符串

这是一个便捷函数。它等同于调用 attribute( ServiceProvider ).toString()。

返回主要语言的服务提供商。

serviceUuid()
Return type:

QBluetoothUuid

这是一个便捷函数。它等同于调用 attribute( ServiceId ).value< QBluetoothUuid >()。

返回服务的自定义UUID。此UUID可能为空。基于Bluetooth SIG标准的UUID应通过serviceClassUuids()获取。

setAttribute(attributeId, value)
Parameters:

这是一个方便的函数。

attributeId标识的属性设置为value

如果服务信息已经注册到平台的SDP数据库中,数据库条目将不会更新,直到再次调用registerService()

另请参阅

attribute()

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

  • valueSequence

这是一个方便的函数。

attributeId标识的属性设置为value

如果服务信息已经注册到平台的SDP数据库中,数据库条目将不会更新,直到再次调用registerService()

setAttribute(attributeId, value)
Parameters:

这是一个方便的函数。

attributeId标识的属性设置为value

如果服务信息已经注册到平台的SDP数据库中,数据库条目将不会更新,直到再次调用registerService()

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

  • value – 对象

attributeId标识的属性设置为value

如果服务信息已经注册到平台的SDP数据库中,数据库条目将不会更新,直到再次调用registerService()

注意

如果一个属性期望一个字节编码的值(例如蓝牙HID服务),则应将其设置为QByteArray。

setDevice(info)
Parameters:

信息QBluetoothDeviceInfo

将提供此服务的蓝牙设备设置为device

另请参阅

device()

setServiceAvailability(availability)
Parameters:

可用性 – int

这是一个便捷函数。它等同于调用 setAttribute ( ServiceAvailability , availability)。

设置服务的可用性为 availability

setServiceDescription(description)
Parameters:

描述 – str

这是一个便捷函数。它等同于调用 setAttribute ( ServiceDescription , description)。

将主要语言中的服务描述设置为description

setServiceName(name)
Parameters:

name – str

这是一个便捷函数。它等同于调用 setAttribute ( ServiceName , name)。

将主要语言中的服务名称设置为name

setServiceProvider(provider)
Parameters:

provider – str

这是一个便捷函数。它等同于调用 setAttribute ( ServiceProvider , provider)。

将主要语言中的服务提供商设置为provider

setServiceUuid(uuid)
Parameters:

uuidQBluetoothUuid

这是一个便捷函数。它等同于调用 setAttribute ( ServiceId , uuid)。

设置自定义服务UUID为uuid。此函数不应用于设置标准化服务UUID。

socketProtocol()
Return type:

协议

返回QBluetoothServiceInfo对象使用的协议。

unregisterService()
Return type:

布尔

取消在平台的Service Discovery Protocol (SDP)实现中注册此服务。此后,其他设备将无法通过服务发现找到该服务。

如果服务成功注销,则返回 true,否则返回 false。

class Sequence

Sequence 类存储蓝牙数据元素序列的属性。More_

概要

方法

静态函数

注意

本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。

详细描述

__init__()

构造一个新的空序列。

__init__(list)
Parameters:

list – QVariant 的列表

构造一个新的序列,它是list的副本。

append(arg__1)
Parameters:

arg__1 – 对象

append(l)
Parameters:

l – QVariant 的列表

at(i)
Parameters:

i – 整数

Return type:

对象

back()
Return type:

对象

capacity()
Return type:

整数

clear()
constData()
Return type:

对象

constFirst()
Return type:

对象

constLast()
Return type:

对象

count()
Return type:

整数

data()
Return type:

对象

empty()
Return type:

布尔

first()
Return type:

对象

first(n)
Parameters:

n – 整数

Return type:

.QVariant 列表

static fromList(list)
Parameters:

list – QVariant 的列表

Return type:

.QVariant 列表

static fromVector(vector)
Parameters:

vector – QVariant 的列表

Return type:

.QVariant 列表

front()
Return type:

对象

insert(arg__1, arg__2)
Parameters:
  • arg__1 – 整数

  • arg__2 – 对象

isEmpty()
Return type:

布尔

isSharedWith(other)
Parameters:

其他 – .list of QVariant

Return type:

布尔

last()
Return type:

对象

last(n)
Parameters:

n – 整数

Return type:

.QVariant 列表

length()
Return type:

整数

static maxSize()
Return type:

整数

max_size()
Return type:

整数

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

  • len – int

Return type:

.QVariant 列表

move(from, to)
Parameters:
  • from – 整数

  • to – int

__add__(l)
Parameters:

l – QVariant 的列表

Return type:

.QVariant 列表

__iadd__(l)
Parameters:

l – QVariant 的列表

Return type:

.QVariant 列表

__lshift__(l)
Parameters:

l – QVariant 的列表

Return type:

.QVariant 列表

operator(i)
Parameters:

i – 整数

Return type:

对象

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

arg__1 – 对象

push_back(arg__1)
Parameters:

arg__1 – 对象

push_front(arg__1)
Parameters:

arg__1 – 对象

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

  • n – 整数

removeAll(arg__1)
Parameters:

arg__1 – 对象

removeAt(i)
Parameters:

i – 整数

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

arg__1 – 对象

reserve(size)
Parameters:

size – int

resize(size)
Parameters:

size – int

resizeForOverwrite(size)
Parameters:

size – int

shrink_to_fit()
size()
Return type:

整数

sliced(pos)
Parameters:

pos – 整数

Return type:

.QVariant 列表

sliced(pos, n)
Parameters:
  • pos – 整数

  • n – 整数

Return type:

.QVariant 列表

squeeze()
swap(other)
Parameters:

其他 – .QVariant 列表

swapItemsAt(i, j)
Parameters:
  • i – 整数

  • j – int

takeAt(i)
Parameters:

i – 整数

Return type:

对象

toList()
Return type:

.QVariant 列表

toVector()
Return type:

.QVariant 列表

value(i)
Parameters:

i – 整数

Return type:

对象

class Alternative

Alternative 类存储蓝牙数据元素替代方案的属性。More_

概要

方法

静态函数

注意

本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。

详细描述

__init__()

构造一个新的空替代项。

__init__(list)
Parameters:

list – QVariant 的列表

构造一个新的替代方案,它是list的副本。

append(arg__1)
Parameters:

arg__1 – 对象

append(l)
Parameters:

l – QVariant 的列表

at(i)
Parameters:

i – 整数

Return type:

对象

back()
Return type:

对象

capacity()
Return type:

整数

clear()
constData()
Return type:

对象

constFirst()
Return type:

对象

constLast()
Return type:

对象

count()
Return type:

整数

data()
Return type:

对象

empty()
Return type:

布尔

first()
Return type:

对象

first(n)
Parameters:

n – 整数

Return type:

.QVariant 列表

static fromList(list)
Parameters:

list – QVariant 的列表

Return type:

.QVariant 列表

static fromVector(vector)
Parameters:

vector – QVariant 的列表

Return type:

.QVariant 列表

front()
Return type:

对象

insert(arg__1, arg__2)
Parameters:
  • arg__1 – 整数

  • arg__2 – 对象

isEmpty()
Return type:

布尔

isSharedWith(other)
Parameters:

其他 – .list of QVariant

Return type:

布尔

last()
Return type:

对象

last(n)
Parameters:

n – 整数

Return type:

.QVariant 列表

length()
Return type:

整数

static maxSize()
Return type:

整数

max_size()
Return type:

整数

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

  • len – int

Return type:

.QVariant 列表

move(from, to)
Parameters:
  • from – 整数

  • to – int

__add__(l)
Parameters:

l – QVariant 的列表

Return type:

.QVariant 列表

__iadd__(l)
Parameters:

l – QVariant 的列表

Return type:

.QVariant 列表

__lshift__(l)
Parameters:

l – QVariant 的列表

Return type:

.QVariant 列表

operator(i)
Parameters:

i – 整数

Return type:

对象

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

arg__1 – 对象

push_back(arg__1)
Parameters:

arg__1 – 对象

push_front(arg__1)
Parameters:

arg__1 – 对象

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

  • n – 整数

removeAll(arg__1)
Parameters:

arg__1 – 对象

removeAt(i)
Parameters:

i – 整数

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

arg__1 – 对象

reserve(size)
Parameters:

size – int

resize(size)
Parameters:

size – int

resizeForOverwrite(size)
Parameters:

size – int

shrink_to_fit()
size()
Return type:

整数

sliced(pos)
Parameters:

pos – 整数

Return type:

.QVariant 列表

sliced(pos, n)
Parameters:
  • pos – 整数

  • n – 整数

Return type:

.QVariant 列表

squeeze()
swap(other)
Parameters:

其他 – .list of QVariant

swapItemsAt(i, j)
Parameters:
  • i – 整数

  • j – int

takeAt(i)
Parameters:

i – 整数

Return type:

对象

toList()
Return type:

.QVariant 列表

toVector()
Return type:

.QVariant 列表

value(i)
Parameters:

i – 整数

Return type:

对象