summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@insta.fi>2022-05-13 10:00:08 +0300
committerJuha Vuolle <juha.vuolle@insta.fi>2022-05-30 17:29:15 +0300
commite24f99cc1dc3fa4e8131e590b0663695c4f81b63 (patch)
tree562bfe28f90fa93019e81153c01c0178aabff4c0 /tests
parent3aafe9d5ce117858143dbb527f742cf875aa83e8 (diff)
downloadqtconnectivity-e24f99cc1dc3fa4e8131e590b0663695c4f81b63.tar.gz
Use the new "permissions error" code on macOS
Qt 6.4 introduces new error code for permission errors (QTBUG-102373). This commit makes use of the new error code. This consists of two parts: 1) If the bluetooth permission key is missing from the application's Info.plist and we know it's needed => permission error. This is limited to Low Energy because classic bluetooth does not need it on macOS, and iOS does not support classic bluetooth. If the key is missing, it is an application development/deployment error and we should not make too many of these checks - few places is enough. 2) At runtime the platform prompts for bluetooth permission and the user may disallow it => permission error. Amends: d58d134d25695dd044fc13d57a4d754b1dfb4e4a Fixes: QTBUG-103388 Change-Id: I96de202e9ac8c33e51bc126389f62091d03eab70 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/bluetoothtestdevice/bluetoothtestdevice.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/bluetoothtestdevice/bluetoothtestdevice.cpp b/tests/bluetoothtestdevice/bluetoothtestdevice.cpp
index e6104952..49605d58 100644
--- a/tests/bluetoothtestdevice/bluetoothtestdevice.cpp
+++ b/tests/bluetoothtestdevice/bluetoothtestdevice.cpp
@@ -310,6 +310,18 @@ int main(int argc, char *argv[])
const QScopedPointer<QLowEnergyController> leController(
QLowEnergyController::createPeripheral());
#endif // Q_OS_IOS
+
+ QObject::connect(leController.data(), &QLowEnergyController::errorOccurred,
+ [](QLowEnergyController::Error error) {
+ qDebug() << "Bluetoothtestdevice QLowEnergyController errorOccurred:" << error;
+ });
+
+ QObject::connect(leController.data(), &QLowEnergyController::stateChanged,
+ [](QLowEnergyController::ControllerState state) {
+ qDebug() << "Bluetoothtestdevice QLowEnergyController stateChanged:" << state;
+ });
+
+
QList<QSharedPointer<QLowEnergyService>> services;
for (const auto &serviceData : serviceDefinitions) {