QBluetoothPermission Class

Bluetooth 주변기기에 액세스하세요. 더 보기...

헤더: #include <QPermissions>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
이후: Qt 6.5

공용 형

(since 6.6) enum CommunicationMode { Access, Advertise, Default }
flags CommunicationModes

공용 함수

(since 6.6) QBluetoothPermission::CommunicationModes communicationModes() const
(since 6.6) void setCommunicationModes(QBluetoothPermission::CommunicationModes modes)

상세 설명

요구사항

런타임에 이 권한을 요청하려면 빌드 시점에 다음과 같은 플랫폼별 사용 선언을 해야 합니다:

플랫폼Type
Apple사용 설명NSBluetoothAlwaysUsageDescription
Androiduses-permission최대 Android 11(API 레벨 31 미만):
  • android.permission.BLUETOOTH
  • android.permission.ACCESS_FINE_LOCATION

Android 12(API 레벨 >= 31)부터:

  • android.permission.BLUETOOTH_ADVERTISE
  • android.permission.BLUETOOTH_CONNECT
  • android.permission.BLUETOOTH_SCAN

프로젝트에 추가하는 방법은 개별 사용 선언 유형을 참조하세요.

참고: Qt 6.8.1부터 API 레벨 >= 31인 경우 더 이상 ACCESS_FINE_LOCATION 권한이 요청되지 않습니다. 이로 인해 일부 블루투스 스캔 결과가 제한될 수 있습니다. 이러한 결과가 필요한 사용자는 위치 권한을 별도로 요청하고( precise location 참조 ) BLUETOOTH_SCAN 권한에 android:usesPermissionFlags="neverForLocation" 속성이 설정되어 있지 않은지 확인해야 합니다. 애플리케이션 매니페스트에서 권한을 설정하고 사용자 지정하는 방법은 이 가이드를 참조하세요.

QPermission, QCoreApplication::requestPermission(), QCoreApplication::checkPermission() 및 애플리케이션 권한도참조하세요 .

멤버 유형 문서

[since 6.6] 열거형 QBluetoothPermission::CommunicationMode
플래그 QBluetoothPermission::CommunicationModes

허용되는 블루투스 통신 모드를 제어하는 데 사용되는 열거형입니다.

상수설명
QBluetoothPermission::Access0x01이 장치가 다른 블루투스 장치에 액세스할 수 있도록 허용합니다. 여기에는 주변 장치를 검색하고 해당 장치에 연결하는 것이 포함됩니다.
QBluetoothPermission::Advertise0x02다른 Bluetooth 장치가 이 장치를 검색할 수 있도록 허용합니다.
QBluetoothPermission::DefaultAccess | Advertise이 구성은 기본적으로 사용됩니다.

참고: 세분화된 권한은 현재 Android 12 이상에서만 지원됩니다. 이전 Android 버전과 Apple 운영 체제에서는 모든 모드에서 전체 Bluetooth 액세스가 가능합니다.

이 열거형은 Qt 6.6에 도입되었습니다.

CommunicationModes 유형은 QFlags<CommunicationMode>에 대한 typedef입니다. 통신 모드 값의 OR 조합을 저장합니다.

멤버 함수 문서

[since 6.6] QBluetoothPermission::CommunicationModes QBluetoothPermission::communicationModes() const

허용된 블루투스 통신 모드를 반환합니다.

이 함수는 Qt 6.6에 도입되었습니다.

setCommunicationModes()도 참조하십시오 .

[since 6.6] void QBluetoothPermission::setCommunicationModes(QBluetoothPermission::CommunicationModes modes)

허용되는 블루투스 통신 모드를 modes 로 설정합니다.

참고: 기본으로 구성된 CommunicationModes 인스턴스는 의미가 없으므로 이러한 모드를 설정하려고 하면 qWarning() 이 발생하고 Default 모드를 사용하도록 되돌아갑니다.

이 함수는 Qt 6.6에 도입되었습니다.

communicationModes()도 참조하십시오 .

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.