PySide6.QtCore.QBluetoothPermission

class QBluetoothPermission

Access Bluetooth peripherals. More

Added in version 6.5.

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

Requirements

To request this permission at runtime, the following platform specific usage declarations have to be made at build time:

Platform

Type

Apple

Usage description

NSBluetoothAlwaysUsageDescription

Android

uses-permission :ref:` <Application-Permissions>`

Up to Android 11 (API Level < 31):

  • android.permission.BLUETOOTH

  • android.permission.ACCESS_FINE_LOCATION

Starting from Android 12 (API Level >= 31):

  • android.permission.BLUETOOTH_ADVERTISE

  • android.permission.BLUETOOTH_CONNECT

  • android.permission.BLUETOOTH_SCAN

Please see the individual usage declaration types for how to add them to your project.

Note

Since Qt 6.8.1, the ACCESS_FINE_LOCATION permission is no longer requested if API Level >= 31. This may limit some Bluetooth scan results . Users needing these results need to request the location permission separately (see precise location ) and ensure that BLUETOOTH_SCAN permission doesn’t have the android:usesPermissionFlags="neverForLocation" attribute set. For setting and customizing permissions in the application manifest, see this guide .

See also

QPermission requestPermission() checkPermission() Application Permissions

class CommunicationMode

(inherits enum.Flag) This enum is used to control the allowed Bluetooth communication modes.

Constant

Description

QBluetoothPermission.Access

Allow this device to access other Bluetooth devices. This includes scanning for nearby devices and connecting to them.

QBluetoothPermission.Advertise

Allow other Bluetooth devices to discover this device.

QBluetoothPermission.Default

This configuration is used by default.

Note

The fine-grained permissions are currently supported only on Android 12 and newer. On older Android versions, as well as on Apple operating systems, any mode results in full Bluetooth access.

Added in version 6.6.

__init__()
__init__(other)
Parameters:

otherQBluetoothPermission

communicationModes()
Return type:

Combination of CommunicationMode

Returns the allowed Bluetooth communication modes.

setCommunicationModes(modes)
Parameters:

modes – Combination of CommunicationMode

Sets the allowed Bluetooth communication modes to modes.

Note

A default-constructed instance of CommunicationModes has no sense, so an attempt to set such a mode will raise a qWarning() and fall back to using the Default mode.

swap(other)
Parameters:

otherQBluetoothPermission