summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth/btchat
Commit message (Collapse)AuthorAgeFilesLines
* Port from qAsConst() to std::as_const()Marc Mutz2022-11-122-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-1310-467/+20
| | | | | | | | | | | | 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>
* Remove unsupported Android bluetooth codepathsJuha Vuolle2022-05-121-4/+3
| | | | | | | | | | | | | | | Minimum Android level supported on Qt 6 is Android 6 / API Level 23. This commit removes older unsupported code in order to simplify. This concerns primarily: - sdkVersion() checks - Java reflections (API availability was uncertain) Task-number: QTBUG-102497 Pick-to: 6.2 6.3 Change-Id: Ia90248a0a8f8e32130b8394998c2676c97a02eb5 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Port simple cases of count() to size()Marc Mutz2022-04-111-1/+1
| | | | | | | | | | | | | | | The count() methods on QByteArray and QString are deprecated. The ones on other Qt containers will likely follow soon, so port them all to size(). The changes which also require int -> qsizetype will come in a follow-up patch. Pick-to: 6.3 Change-Id: I23e364019b9cfc457d93f4a3bb4660fe8d790da8 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Improve examples CMakeLists.txtKai Köhne2022-02-211-7/+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>
* BtChat: fix crash when no adapter is foundIvan Solovev2021-11-161-2/+12
| | | | | | | | | | | | | | | | | The example was assuming that QBluetoothLocalDevice::allDevices() always returns a non-empty list. This is not true for the cases when desktop has no bluetooth adapters, as well as for WinRT implementation (it always returns empty list for now). This patch fixes the crash and provides some information messages to the console. Note that WinRT implementation has an extended warning, because it returns an empty list even if the adapter actually exists. Fixes: QTBUG-98323 Pick-to: 6.2 Change-Id: Iaa81465cf6be2febf20526c11909667fd60728b3 Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> 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>
* Remove AndroidExtras dependencies and port to new Qt 6 Android APIsVille Voutilainen2021-06-043-13/+2
| | | | | | | | | Task-number: QTBUG-93811 Change-Id: Ia3eb9ad90f27614db5997e1f41f13e050f5f4ab7 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
* rename error signals to errorOccurredAndreas Buhr2021-03-221-3/+1
| | | | | | | | | | | 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>
* Decouple QBluetoothSocket and QAbstractSocket, introduce scoped enumsAndreas Buhr2021-03-121-2/+2
| | | | | | | | | | | QBluetoothSocket enum values were tied to QAbstractSocket enum values. But there is no dependency, the coupling is not required. This patch removes the coupling and changes to scoped enums for improved type safety. Task-number: QTBUG-62877 Change-Id: I206b1d438d74b976d3e0d32da5713d22b597dd90 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Update screenshots in QtBluetooth Example documentationAndreas Buhr2021-03-111-0/+0
| | | | | Change-Id: Ie0f602e875604f592bc689f6f3ecc00133e9960f Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Use scoped enum for constants in QBluetoothUuidAndreas Buhr2021-03-111-5/+5
| | | | | | | | | | | | 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>
* Unify logging preparation across bluetooth examplesAndreas Buhr2021-02-251-2/+2
| | | | | | | | 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>
* Bring btchat example documentation in line with implementationAndreas Buhr2021-02-241-1/+1
| | | | | | | | Btchat example documentation mentioned a QRfcommServer where a QBluetoothServer is created. This patch updates the documentation. Change-Id: I1278a4c576aea8d5745dbb8405b1401a27d02146 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* QtBluetooth examples: make server device discoverableAndreas Buhr2021-02-221-2/+4
| | | | | | | | | | When trying the bluetooth examples on devices which do not know each other, they do not find each other, because the have to be paired first. This could lead to some frustration. This patch sets the server device into discoverable mode first. Change-Id: I2873f957d36a45cd86e282e274e198e560a243ad Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Beautify btchat output: Remove double newlineAndreas Buhr2021-02-171-1/+1
| | | | | | | | | | | We sometimes had double newlines. When the btchat server sent messages to the btchat client, they were displayed incorrectly on the client. This patch duplicates the removal of the transmitted newline, which was already present in the ChatServer::readSocket() method, to the ChatClient::readSocket() method. Change-Id: Ia890dac9d464df7312d9ea62292c130fc9cb16c1 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Beautify btchat: Leave focus on text input on send messageAndreas Buhr2021-02-152-0/+4
| | | | | | | | | | With this patch, one can use btchat like every chat application: Just type a message, press return, type the next message. Before, it was necessary to move the focus to the text input again after each message. Change-Id: I534143340284477810c93bbeebabb5d02132a208 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Beautify btchat example: print a newline after error messagesAndreas Buhr2021-02-151-1/+1
| | | | | Change-Id: Ia13637a4fce69460423d0ca5afaebca62df5d085 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Beautify btchat example: Print name of leaving clientsAndreas Buhr2021-02-152-2/+6
| | | | | | | | | | Btchat code tried to print the name of leaving clients, but socket->peerName(), which was called, does not work any more when then disconnected signal is triggered. This patch adds a map storing the names of the clients. Thus we can print who left the chat. Change-Id: I11aa998fc5da358db2c74508be6618150c94ea08 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Adapt btchat example for AndroidAndreas Buhr2021-02-123-1/+30
| | | | | | | | | | The btchat example was unusable on Android because QListWidget:: itemActivated had to be triggered to select a partner to chat with. This is impossible on Android. This patch adds a QPushButton to confirm the chat partner. Change-Id: I3abb4eb35a983202dc6a7a551419b1c4ba1cfd51 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix btchat standalone build: find AndroidExtras before linking itAndreas Buhr2021-02-111-0/+1
| | | | | | | | | The btchat standalone build fails because AndroidExtras is linked which is unknown to CMake at that point. This patch adds the required find_package call. Change-Id: I378575a5dd4fe42a89712f903d5cbfa6b539acec 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>
* Port qtconnectivity to cmakeOliver Wolff2019-10-241-0/+41
| | | | | | | | | | 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>
* Eradicate Java-style iterators and mark the module free of themMarc Mutz2019-06-181-6/+4
| | | | | | | | | Java-style iterators are scheduled for deprecation, or at the very least banned from use in Qt code. Change-Id: If50aade7e5a57f247ec8c0e77103dfd2d2160c3c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Update Bluetooth examples for high-DPI displays and nullptrAndre de la Rocha2019-06-061-0/+1
| | | | | | | | | 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>
* Fix the BluetoothProfileDescriptorStructureAlex Blasche2018-10-151-3/+7
| | | | | | | | | | | As per spec this is meant to be a list/sequence within a sequence and the version was missing too. For simplicity version 1.0 is used. Fixes: QTBUG-58529 Change-Id: I57090148aadf60ea1fbbb207ff0a4ae61e06caf2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Remove unused snippet section markersAlex Blasche2018-10-151-3/+0
| | | | | | | This section is not used by any part of the documentation. Change-Id: I3cfc5ff187bfe43bbd75302b45b7dcc6eddb113c Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Clean up btchat exampleOliver Wolff2018-08-169-70/+90
| | | | | | | | | | | - Replace old connect syntax - Clean up includes - Replace 0 with nullptr - Add socket error handling Change-Id: Id4c7634db29a23184d3ce2d92ffa39c71505de12 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Replace foreach with for loop and set QT_NO_FOREACHOliver Wolff2018-08-151-1/+1
| | | | | | | | 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>
* qtlite: Skip building examples when configured with no-feature-itemviewsRainer Keller2018-01-121-0/+1
| | | | | | Task-number: QTBUG-53141 Change-Id: Id256f00349d8bee8e4176005eea3bcba595899a2 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix outdated BSD license headerKai Koehne2017-10-179-27/+117
| | | | | Change-Id: I28f5936913a6127806325df34af4bf71a142e72e Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix outdated FDL license headerKai Koehne2017-10-161-5/+5
| | | | | Change-Id: Ia26b0bf499f8a0b6040e82bc1d460bee688bfbf6 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Btchat example should be fullscreen on mobileAlex Blasche2017-06-291-0/+4
| | | | | Change-Id: Ib311037a4ccf147dcd083ff13c327e29e0dc08f4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Adjust btchat example to Android UUID SDP discovery bugAlex Blasche2017-06-282-0/+15
| | | | | | Task-number: QTBUG-61392 Change-Id: Ia7d680a40b0fe359dfb5fe69ad9f3e83fe9ccb7d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Remove wrong attribute assignment from btchat exampleOliver Wolff2017-01-301-1/+0
| | | | | Change-Id: If6695194644fa0eceec80808115fd09af895a220 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Update copyright headersJani Heikkinen2015-02-1610-42/+42
| | | | | | | | | 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>
* Fix crashing btchat example when selecting remote devicev5.4.1Alex Blasche2015-01-292-0/+4
| | | | | | | | | | | | | | | | | The example immidiately destroys the QBluetoothServiceDiscoveryAgent when the user selects a remote chat service from the remote selector dialog. This may happen even when the scheduled QtConcurrent call to runSdpScan() was still pending. The subsequent signal callback into the deleted parent caused a crash. Unfortunately QtConcurrent::run() returns a QFuture which does not permit stopping the pending thread execution. Therefore the runSdpScan() had to be rewritten using QProcess to properly destruct pending calls. Change-Id: I1ed5e147feb94a26240901a02d836056eddabbf6 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Register PublicBrowseGroup as sequenceAlex Blasche2015-01-211-1/+3
| | | | | | | | | | | | | | | | | | Based on Bluetooth spec Vol3 PartB 5.1.7 the BrowseGroupList consists of a data element sequence. The current approach was not correct. This was discovered because Bluez5 doesn't add a custom service to the Extended Inquiry Response (EIR) unless it is in a sequence. If the service is not part of the EIR other platforms such as Windows report an error or won't simply see the service. This was not a problem when using Bluez4 because it was more tolerant towards such mistakes and added the custom service to the EIR anyway. Task-number: QTBUG-43806 Change-Id: Ib0ca59005c940249fb6aefd8ecafe5b2ceff3878 Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com>
* New QML based Bt chat clientAlex Blasche2014-09-301-0/+1
| | | | | | Change-Id: I235c54591dbbf04aa58c024093beca8c068b4aed Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Merge branch 'dev' into btleAlex Blasche2014-05-262-3/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/bluetooth/bluetooth.pro src/bluetooth/bluez/bluez.pri src/bluetooth/doc/src/bluetooth-index.qdoc src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp src/bluetooth/qbluetoothdeviceinfo.cpp src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp src/bluetooth/qbluetoothservicediscoveryagent_p.h src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp Change-Id: I88b22c51a4ee95b067ef8d2b2fddb5cbff4566f8
| * Merge remote-tracking branch 'origin/release' into stableJani Heikkinen2014-04-231-2/+5
| |\ | | | | | | | | | Change-Id: Ic86710cdf2550f5cf70c81af3f351d6712cd1b0e
| | * Doc: Improved example documentationJerome Pasion2014-04-141-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -include a section about running the example (from qtbase/doc/global) -added links to Qt Bluetooth or Qt NFC -updated copyright year -added markup to a string and other small corrections -added \brief Task-number: QTBUG-33597 Change-Id: Ia65821549a0e2e3fbf164188982114b4741be233 Reviewed-by: Alex Blasche <alexander.blasche@digia.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
| * | Use extended SDP discovery in btchat example.Alex Blasche2014-04-141-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | Android's minimal service discovery is very limited and more often than not fails entirely. Using FulklDiscovery dramatically increases the chance to find the remote SPP chat server. Task-number: QTBUG-38140 Change-Id: I1df55f74a6896312236ef06485c4063c9e893e6c Reviewed-by: Nedim Hadzic <nhadzic@blackberry.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | Merge branch 'dev' into btleAlex Blasche2014-02-171-0/+3
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/bluetooth/bluetooth.pro src/bluetooth/doc/src/examples.qdoc src/bluetooth/qbluetoothdevicediscoveryagent_qnx.cpp src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp src/bluetooth/qbluetoothservicediscoveryagent_p.h src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp Change-Id: Ie1577e4b0f469cd5a6b05a61cbe94f180a64448d
| * Fix make install rules to all examples in QtConnectivity repoAlex Blasche2013-11-281-0/+3
| | | | | | | | | | | | | | | | | | This was highlighted during the testing of the Qt 5.2.0 package. Change-Id: I94b27f02a6621bccb9f0ce0d0cc184a449014573 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | Implemented Bluetooth Low Energy gatt service and characteristics discoveryNedim Hadzic2013-11-041-0/+2
|/ | | | | | | | | Bluez v4.x does not have total support for LE devices, a new approach, using gatttool command was implemented. Auto-tests and documentation will be in other commits. Change-Id: Iee711cc111199e15956052eebb7593bd3a5e27c8 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Doc: language and style review doc qtconnectivityNico Vertriest2013-10-141-41/+41
| | | | | | | | Reviewed doc Bluetooth and NFC Task-number: QTBUG-32173 Change-Id: I80f81c2123c3ee4fc269f471123f332dc39ee958 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>