QBluetoothPermission#
Access Bluetooth peripherals. More…
New in version 6.5.
Synopsis#
Functions#
def
communicationModes
()def
setCommunicationModes
(modes)def
swap
(other)
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
android.permission.ACCESS_FINE_LOCATION
Please see the individual usage declaration types for how to add them to your project.
Note
Currently on Android the android.permission.ACCESS_FINE_LOCATION
permission is requested together with Bluetooth permissions. This is required for Bluetooth to work properly, unless the application provides a strong assertion in the application manifest that it does not use Bluetooth to derive a physical location. This permission coupling may change in future.
See also
QPermission
requestPermission()
checkPermission()
Application Permissions
- class PySide6.QtCore.QBluetoothPermission#
PySide6.QtCore.QBluetoothPermission(other)
- Parameters:
- PySide6.QtCore.QBluetoothPermission.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.
Note
For now the Access
mode on Android also requests the precise location
permission. This permission coupling may change in the future.
New in version 6.6.
- PySide6.QtCore.QBluetoothPermission.communicationModes()#
- Return type:
Combination of
QBluetoothPermission.CommunicationMode
Returns the allowed Bluetooth communication modes.
See also
- PySide6.QtCore.QBluetoothPermission.setCommunicationModes(modes)#
- Parameters:
modes – Combination of
QBluetoothPermission.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.
See also
- PySide6.QtCore.QBluetoothPermission.swap(other)#
- Parameters: