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) |
詳細説明
必要条件
実行時にこの権限を要求するには、ビルド時に以下のプラットフォーム固有の使用宣言を行う必要があります:
プラットフォーム | プラットフォーム | |
---|---|---|
アップル | 使用法の説明 | NSBluetoothAlwaysUsageDescription |
アンドロイド | uses-permission | Android 11 (API Level < 31)まで:
Android 12 (API Level >= 31)から:
|
プロジェクトへの追加方法については、個々の使用宣言タイプを参照してください。
注意: Qt 6.8.1以降、API Level >= 31の場合、ACCESS_FINE_LOCATIONパーミッションは要求されなくなりました。これにより、Bluetoothのスキャン結果が制限される場合があります。これらの結果を必要とするユーザーは、ロケーションパーミッションを別途要求し(precise location を参照)、BLUETOOTH_SCAN
パーミッションにandroid:usesPermissionFlags="neverForLocation"
属性が設定されていないことを確認する必要があります。アプリケーション マニフェストでのパーミッションの設定およびカスタマイズについては、このガイドを参照してください。
QPermission 、QCoreApplication::requestPermission()、QCoreApplication::checkPermission()、およびアプリケーション権限も参照してください 。
メンバ型ドキュメント
[since 6.6]
enum QBluetoothPermission::CommunicationMode
flags QBluetoothPermission::CommunicationModes
この enum は、許可された Bluetooth 通信モードを制御するために使用されます。
定数 | 値 | 説明 |
---|---|---|
QBluetoothPermission::Access | 0x01 | このデバイスが他の Bluetooth デバイスにアクセスすることを許可します。これには、近くのデバイスをスキャンして接続することが含まれます。 |
QBluetoothPermission::Advertise | 0x02 | 他のBluetoothデバイスがこのデバイスを検出することを許可します。 |
QBluetoothPermission::Default | Access | Advertise | この設定はデフォルトで使用されます。 |
注: きめ細かいパーミッションは、現在Android 12以降でのみサポートされています。古いバージョンの Android や Apple オペレーティングシステムでは、どのモードでも Bluetooth のフルアクセスになります。
この列挙型は Qt 6.6 で導入されました。
CommunicationModes 型はQFlags<CommunicationMode> の typedef です。これは、CommunicationMode 値の OR の組み合わせを格納します。
メンバー関数ドキュメント
[since 6.6]
QBluetoothPermission::CommunicationModes QBluetoothPermission::communicationModes() const
許可されている Bluetooth 通信モードを返します。
この関数は Qt 6.6 で導入されました。
setCommunicationModes()も参照してください 。
[since 6.6]
void QBluetoothPermission::setCommunicationModes(QBluetoothPermission::CommunicationModes modes)
許可される Bluetooth 通信モードを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.