summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth/lowenergyscanner
Commit message (Collapse)AuthorAgeFilesLines
* Port from qAsConst() to std::as_const()Marc Mutz2022-11-121-2/+2
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. This is a 6.4 re-run of the script we ran in dev, in order to avoid conflicts between the branches when cherry-picking. Change-Id: I5eca3df3179dfb2b2682c75a479ba9a4259cc703 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-1317-823/+47
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Ifc22d8ae24532e9a1093ca613ed6590a1992bc39 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 664d2a1cf019f76adf433d41b1418e515ffce86c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Improve examples CMakeLists.txtKai Köhne2022-02-211-10/+4
| | | | | | | | | | | | | | | | - Remove automatic use of CMAKE_AUTORCC - Only opt into CMAKE_AUTOUIC if .ui files are involved - Remove explicit setting of CMAKE_INCLUDE_CURRENT_DIR - Combine multiple find_package(Qt6 ... calls) - use REQUIRED COMPONENTS - sort components alphabetically - Fix wrong indentations - Use (only) one empty line after multi-line commands Pick-to: 6.3 Change-Id: If1935beb09edd873c45842ae06d0f41267a9b36a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* macOS specific Info.plist file for Bluetooth ExamplesJuha Vuolle2021-11-112-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | The default generated Info.plist is not enough as the Bluetooth examples require NSBluetoothAlwaysUsageDescription key to work. Without this patch on macOS 12 there are two possible outcomes: 1) If the example is built with qmake, the application will crash and the crash report will indicate that the key is missing 2) If the example is built with CMake, the application will not start as it tries to use iOS specific .plist file The patch uses absolute paths in the example CMakeLists.txt files to work around a Ninja bug: https://gitlab.kitware.com/cmake/cmake/-/issues/20181 Using relative paths resulted in "multiple rules generate" errors if the QtConnectivity module is built with examples. Note that the plist files are only effective if the application is started as an app bundle, ie. not if launching the contained binary directly. Pick-to: 6.2 Task-number: QTBUG-98090 Change-Id: Iedb7eabbb8fde6ad1ba14ada1a7ee87ec1d708ba Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix 'width' of 'null' QML warnings in lowenergyscanner exampleJuha Vuolle2021-10-253-3/+3
| | | | | | | | | | | | | As per Qt documentation in https://doc.qt.io/qt-5/qml-qtquick-listview.html#example-usage the parent of a delegate can change and be 'null' at times. This commit refers explicitly to the containing view instead. Change-Id: I9c9a8c907daba2b6de52a246ae71cfde0c27e55b Fixes: QTBUG-97691 Pick-to: 6.2 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
* Bluetooth (examples): update CMakeLists.txt to include Info.plistTimur Pocheptsov2021-09-101-0/+6
| | | | | | | | Pick-to: 6.2 Change-Id: I87097dc605ff34db1f8d7fb92d055402693906e1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove error messages on lowenergyscanner example app exitJuha Vuolle2021-09-092-6/+6
| | | | | | | | | | | | | The QML View was created on heap and outlived the 'device' context property on stack. This resulted in distracting 'null' property access errors on exit. In addition remove unnecessary QML import versioning. Pick-to: 6.2 Change-Id: I5cb7d219582ef8e9a72a3f7e514e78fb16a54e2f Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
* CoreBluetooth: provide a description (in Info.plist) of BT usageTimur Pocheptsov2021-09-092-0/+41
| | | | | | | | | | | Our lowenergyscanner example can be built and deployed on iOS device. As such, it has to provide an explanation, why it needs an access to BT adapter, otherwise, it would crash with the most recent versions of iOS. Pick-to: 6.2 5.15 Change-Id: Iebcdf8af931002532aada0c452263effd342300e Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Raise cmake_minimum_required to VERSION 3.16 in examplesJoerg Bornemann2021-08-171-1/+1
| | | | | | | | Pick-to: 6.2 Task-number: QTBUG-95636 Change-Id: I2ae5ba6164cb5ed450c8924d484d30167461c10d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Increase timeout of lowenergyscannerAndreas Buhr2021-06-141-1/+1
| | | | | | | | | | The low timeout of five seconds leads to lots of frustration. This patch extends to 25 seconds, which is most of the time long enough. Pick-to: 6.2 Change-Id: I2157ac0e794011a65e306dd7451e35e1bc0e7c8d Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Make QLECharacteristic::handle() and QLEDescriptor::handle() privateAndreas Buhr2021-06-032-7/+0
| | | | | | | Task-number: QTBUG-62877 Task-number: QTBUG-94138 Change-Id: Id8c98e267c9b16f77a63f63f41638efbe627acaa Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Change QLowEnergyService::ServiceState enum to reflect future changesAndreas Buhr2021-04-082-6/+6
| | | | | | | | | | | | In the future, discoverDetails() should become optional. The state of a QLowEnergyService after its creation should have a name which does not imply it is not functional yet. This patch changes the name of the initial state from "DiscoveryRequired" to the neutral "RemoteService". Task-number: QTBUG-75340 Change-Id: Ib407e60f5fc7264a04a124561dacbcebb01bf252 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* rename error signals to errorOccurredAndreas Buhr2021-03-221-4/+3
| | | | | | | | | | | Currently, there is a name clash between the error getter and the error signal. This leads to extensive use of qOverload or similar. This patch renames all error signals to errorOccurred to resolve this. Task-number: QTBUG-62877 Change-Id: I615e2405f855433b6e142d820072c4d3f35ae28f Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Use scoped enum for constants in QBluetoothUuidAndreas Buhr2021-03-112-2/+2
| | | | | | | | | | | | QBluetoothUuid contains enums for ProtocolUuid, ServiceClassUuid, CharacteristicType and DescriptorType. So far, they all put their constants directly into the QBluetoothUuid namespace, making it easy to mix them up. This patch changes those to scoped enums. That way, each enum has its items in its own namespace. Change-Id: I86ea08ff31009dc8073d84cfe678e27920d693f7 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix clazy warningAlex Blasche2021-02-261-1/+1
| | | | | | | | Missing reference in range-for with non trivial type (QBluetoothDeviceInfo) Change-Id: I6f2e3092054376fdc52acdbeba149fe1a02b88fe Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
* Unify logging preparation across bluetooth examplesAndreas Buhr2021-02-251-1/+1
| | | | | | | | This patch streamlines all bluetooth examples to have logging prepared, but not activated, in main(). Change-Id: Idbc81e2937c56acdc17c8fb81de2b8afe384608d Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix deprecation warnings in lowenergyscanner exampleAndreas Buhr2021-02-232-4/+4
| | | | | | | | | | This patch fixes several warnings like assets/Services.qml:81:5: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... } Change-Id: Ic4af8f2fc76e437f7b4113e691f2b2461b273bbb Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Remove all *.pro files and all "special case" markers in CMakeLists.txtAndreas Buhr2021-01-151-2/+0
| | | | | | | | | | | | To use CMake only in the future to build QtConnectivity, all the traces from the qmake->CMake conversion can now be removed. This patch deletes all ".prev_CMakeLists.txt" files, in deletes all "*.pro" files and it removes all "special case" markers in CMakeLists.txt files. "special case" in "*.cmake" files are kept. Change-Id: Ia0f5d4de5d77b9f2e5cc8d97fc8f04077e042a6f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Update CMake scripts in QtConnectivityAndreas Buhr2020-12-211-0/+4
| | | | | | | | | Recreated all CMake files in QtConnectivity using run_pro2cmake.py . --only-existing -- --api-version 3 Furthermore, port bttestui to CMake. Change-Id: Idb55f1b4c1cff30d7824a42e3ee6923c39e698df Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Regenerate examples to use qt_add_executableAlexandru Croitor2020-10-201-2/+6
| | | | | | Task-number: QTBUG-87661 Change-Id: Ib6722991251673c6531667cb6b318b0531df5cda Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Remove usage of AA_EnableHighDpiScalingAlex Blasche2020-10-151-1/+0
| | | | | | | | | warning: ‘AA_EnableHighDpiScaling’ is deprecated: High-DPI scaling is always enabled. This attribute no longer has any effect. [-Wdeprecated-declarations] Change-Id: I335b72eeb71fa6eb5d9d980bec22e226a069e6d9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Merge remote-tracking branch 'origin/wip/cmake' into devOliver Wolff2020-07-031-0/+61
|\ | | | | | | Change-Id: Icb3abdf0b150b5b09c13f4b054b402ba5b6a9684
| * Port qtconnectivity to cmakeOliver Wolff2019-10-241-0/+61
| | | | | | | | | | | | | | | | | | | | Also removed dependencies.yaml at the same time, as the new dependency tracking is not used in wip/cmake at the moment. Task-number: QTBUG-78181 Change-Id: I39c23da8daeedd86b7720d66d48ab0af3762083c Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Rename QLEService::DiscoveringServices to DiscoveringServiceAlex Blasche2020-05-142-2/+2
|/ | | | | | | | | | | | Singular is a better fit to avoid the notion of several services being discovered at a given time. [ChangeLog][QtBluetooth][QLowEnergyService] Renamed DiscoveringServices enum value to DiscoveringService. Task-number: QTBUG-75344 Change-Id: I9ebe8a8ccba8bb49c55772ae81338f376826ee64 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Modify point when lowenergyscanner remembers found BTLE devicesAlex Blasche2019-08-071-5/+7
| | | | | | | | | | | | | | | Technically speaking, nothing really changes in the application. However devices found, when QBluetoothDeviceInfo::deviceDiscovered() is emitted, may not have the complete set of data for a given device. In particular, rssi and manufacturer data changes happen later. Later changes to the example may want to display these transient types of information at which point this change becomes essential. It makes the app simpler to adopt for testing purposes too. Change-Id: I119b6e80a9a92b16de2d3e6792132ceb06b577a4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Update Bluetooth examples for high-DPI displays and nullptrAndre de la Rocha2019-06-062-6/+7
| | | | | | | | | This change sets the Qt::AA_EnableHighDpiScaling application attribute. It also uses nullptr to initialize pointers and adds a trivial optimization to the low energy scanner example. Change-Id: Ia923573ad78108a2a6a72be4c0948ea97a7ec094 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-08-301-2/+6
|\ | | | | | | Change-Id: I20db491b185972148ad3fbe6953e5d6ce2889a7f
| * Provide more informative error messages in the BLE Scanner exampleShawn Rutledge2018-08-211-2/+6
| | | | | | | | | | | | | | | | | | QMetaEnum helps us avoid writing separate strings for each error description; it's not very verbose but it's way better than saying that most of the errors are "unknown". Change-Id: I61aaf3be6982a2987aabfa6be3192e1afb7df17a Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Cleanup lowenergyscanner example with clang tidy and clazy helpAlex Blasche2018-08-249-45/+37
| | | | | | | | | | Change-Id: Iaaf169b1ac9b3d4c348d9cabf737b395198a921f Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Remove direct usage of QLowEnergyController::ctorAlex Blasche2018-08-211-1/+1
| | | | | | | | | | | | | | | | QLowEnergyController::createCentral() is the official API to do the same. Change-Id: Idbd26d201b24add6697f6f9cdf1194511c160273 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Replace foreach with for loop and set QT_NO_FOREACHOliver Wolff2018-08-152-3/+4
|/ | | | | | | | To avoid unnecessary copies, const is used wherever possible. Change-Id: Ic743716512751cfd24fad5bd37c244b115dd26fe Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.9' into 5.11Liang Qi2018-02-181-1/+1
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I5dcafa278c0c51bc3d540ab46320e5a21ef51115
| * Fix stalling at characteristics updating in Low Energy Scanner exampleDenis Shienkov2018-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The method device.connectToService() can be finished quickly and Device::characteristicsUpdated() can be triggered before than the Characteristics.qml page will be loaded. Therefore we will get stuck in "Scanning for characteristics..." state. So, we need to call the device.connectToService() after loading of the Characteristics.qml page. Change-Id: Ic5c790f6f8dbeeae1e368c8a1c8ad8fb12a57087 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-10-3016-45/+205
|\| | | | | | | Change-Id: Iaa053dcb125490ee1e83d7e27cb75d4171297b9f
| * Fix outdated BSD license headerKai Koehne2017-10-1716-45/+205
| | | | | | | | | | Change-Id: I28f5936913a6127806325df34af4bf71a142e72e Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Merge remote-tracking branch 'gerrit/5.9' into 5.10v5.10.0-beta3Alex Blasche2017-10-171-5/+5
|\| | | | | | | Change-Id: I84bfe86751c27eabb4e75912ae3c0b4d3781faf1
| * Fix outdated FDL license headerKai Koehne2017-10-161-5/+5
| | | | | | | | | | Change-Id: Ia26b0bf499f8a0b6040e82bc1d460bee688bfbf6 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Rename qbluetoothglobal.h to qtbluetoothglobal.hOliver Wolff2017-08-302-1/+1
|/ | | | | | | | | | | | | ... and deprecate the former. By doing so we get the header file in line with other modules - see qtnetworkglobal.h for example. The include is not used in the examples so it is removed there. Change-Id: Ie6267738d4a45e45a0350d458a40654d8a952f4a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* lowenergyscanner: Use new connect syntaxOliver Wolff2017-07-041-18/+18
| | | | | | Change-Id: I87047bbc8b777f597ac4843c0c5466489d764f46 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Restrict the BTLE examples to Low Energy use casesAlex Blasche2016-12-071-1/+2
| | | | | | | | This change vastely descreases the search time. There is no need to perform a traditional SDP scan too. Change-Id: I63d7e16dca77fb1b1db42bb330f91e917a9dd054 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Reduce platform specific code linesAlex Blasche2015-05-121-9/+2
| | | | | | | | | | | | QLEController(QBluetoothAddress) ctor is not usable on iOS and OSX. On those platforms we have to use QLECOntroller(QBluetoothDeviceInfo). We mark the QBluetoothAddress based ctors of QLEController obsolete and remove most uses of them. This cleans up some ifdefs throughout the QtBluetooth code base. Change-Id: Ibe1e3fa271a29461e39fc3c0eeba7a910a250077 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Don't remain on Service list page if the BTLE controller disconnectedAlex Blasche2015-03-311-0/+4
| | | | | | | | When a disconnect happened, this change ensures a more consistent UI flow. Change-Id: I0faafd79ac82b701a35d43d43c04bf211d8cd803 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Don't mix pixel and point sizeAlex Blasche2015-03-312-2/+2
| | | | | | | | | | | The view is rather obscured because of this. Every other font size in this example uses point size except for these two elements. This mix of point and pizel size is not permitted. There seems to be a warning and probably related change in Qt 5.5 as well. Change-Id: I36a7e9f1648d23f5bc737393ae735bbc7d04b494 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Update copyright headersJani Heikkinen2015-02-1617-67/+67
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I3822a6484e8f7a420330de1cb1aeb0c3d1cf41b7 Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
* Bluetooth example - lowenergyscanner (OS X and iOS)Timur Pocheptsov2014-12-053-0/+15
| | | | | | | | | Core Bluetooth hides addresses and uses unique UUIDs instead. This patch updates/adjusts lowenergyscanner example to work with UUIDs on iOS and OS X instead of (empty on these platforms) device addresses. Change-Id: Iad0b35250f434b736616fe60e356f2088e6dc279 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-11-274-10/+10
|\ | | | | | | Change-Id: I6c1eabeea1b3397803e285d13cef147220ff5aa4
| * Improve lowenergyscanner status reportingAlex Blasche2014-11-244-10/+10
| | | | | | | | | | | | Change-Id: If6fccce951c2f3c3787cde2fa593e65da26f4370 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | lowenergyscanned - update example (iOS and OS X)Timur Pocheptsov2014-11-251-0/+4
| | | | | | | | | | | | | | | | With Core Bluetooth low energy controller must be created using device info, not address (which is invalid on OS X and iOS). Change-Id: I30cb3a061e2cd882981d7e65d636c63e57c36f8e Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | More lowenergyscanner example fixes.Alex Blasche2014-11-112-2/+13
|/ | | | | | | | | This fixes a UI display bug and a hanging UI when the service discovery aborts with an error. Change-Id: Ic84d7b885d777360c8f1396e3973623c1d2c550a Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Force lowenergyscanner to show empty list if we did not find servicesAlex Blasche2014-10-301-0/+3
| | | | | | | | | | Previously the UI was only updated when a new service was discovered on a device. In the extremely rare event of no services being found the UI was hanging in the "Searching for services" view. Change-Id: I245216ac4e373a765dea2e182ab541e8830417d0 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>