2022-06-08 11:30:04 +00:00
|
|
|
// Copyright (C) 2021 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2011-12-09 14:27:12 +00:00
|
|
|
|
|
|
|
|
#include "device.h"
|
|
|
|
|
|
2023-03-17 12:53:40 +00:00
|
|
|
#include <QtCore/qloggingcategory.h>
|
|
|
|
|
#include <QtWidgets/qapplication.h>
|
2011-12-09 14:27:12 +00:00
|
|
|
|
2023-01-04 12:08:23 +00:00
|
|
|
#if QT_CONFIG(permissions)
|
2023-03-17 12:53:40 +00:00
|
|
|
#include <QtCore/qpermissions.h>
|
2023-01-04 12:08:23 +00:00
|
|
|
#endif
|
|
|
|
|
|
2011-12-09 14:27:12 +00:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
|
{
|
2021-02-22 14:05:28 +00:00
|
|
|
// QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
|
2011-12-09 14:27:12 +00:00
|
|
|
QApplication app(argc, argv);
|
|
|
|
|
DeviceDiscoveryDialog d;
|
|
|
|
|
|
2023-01-04 12:08:23 +00:00
|
|
|
d.show();
|
|
|
|
|
|
|
|
|
|
// Check, and if needed, request a permission to use Bluetooth.
|
|
|
|
|
#if QT_CONFIG(permissions)
|
|
|
|
|
const auto permissionStatus = app.checkPermission(QBluetoothPermission{});
|
|
|
|
|
if (permissionStatus == Qt::PermissionStatus::Undetermined) {
|
|
|
|
|
app.requestPermission(QBluetoothPermission{}, [](const QPermission &){
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// Else means either 'Granted' or 'Denied' and both normally must be
|
|
|
|
|
// changed using the system's settings application.
|
|
|
|
|
#endif // QT_CONFIG(permissions)
|
|
|
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
|
}
|