├── .cmake.conf ├── .gitreview ├── .tag ├── CMakeLists.txt ├── LICENSES ├── Apache-2.0.txt ├── BSD-3-Clause.txt ├── GFDL-1.3-no-invariants-only.txt ├── GPL-2.0-only.txt ├── GPL-3.0-only.txt ├── LGPL-3.0-only.txt ├── LicenseRef-Qt-Commercial.txt └── Qt-GPL-exception-1.0.txt ├── REUSE.toml ├── cmake ├── FindBlueZ.cmake └── FindPCSCLITE.cmake ├── coin ├── axivion │ ├── ci_config_linux.json │ └── start_analysis.sh └── module_config.yaml ├── config.tests ├── bluez │ ├── CMakeLists.txt │ └── main.cpp ├── bluez_le │ ├── CMakeLists.txt │ └── main.cpp ├── linux_crypto_api │ ├── CMakeLists.txt │ └── main.cpp └── winrt_bt │ ├── CMakeLists.txt │ └── main.cpp ├── configure.cmake ├── dependencies.yaml ├── dist ├── REUSE.toml ├── changes-5.10.0 ├── changes-5.10.1 ├── changes-5.11.0 ├── changes-5.11.1 ├── changes-5.11.2 ├── changes-5.12.0 ├── changes-5.12.1 ├── changes-5.12.2 ├── changes-5.12.3 ├── changes-5.12.4 ├── changes-5.12.5 ├── changes-5.13.0 ├── changes-5.13.1 ├── changes-5.13.2 ├── changes-5.14.0 ├── changes-5.14.1 ├── changes-5.14.2 ├── changes-5.15.0 ├── changes-5.15.1 ├── changes-5.15.2 ├── changes-5.2.1 ├── changes-5.3.0 ├── changes-5.3.1 ├── changes-5.3.2 ├── changes-5.4.0 ├── changes-5.4.1 ├── changes-5.4.2 ├── changes-5.5.0 ├── changes-5.5.1 ├── changes-5.6.0 ├── changes-5.6.1 ├── changes-5.6.2 ├── changes-5.6.3 ├── changes-5.7.0 ├── changes-5.7.1 ├── changes-5.8.0 ├── changes-5.9.0 ├── changes-5.9.1 ├── changes-5.9.2 ├── changes-5.9.3 ├── changes-5.9.4 ├── changes-5.9.5 └── changes-5.9.6 ├── examples ├── CMakeLists.txt ├── bluetooth │ ├── CMakeLists.txt │ ├── bluetooth.pro │ ├── btchat │ │ ├── CMakeLists.txt │ │ ├── btchat.pro │ │ ├── chat.cpp │ │ ├── chat.h │ │ ├── chat.ui │ │ ├── chatclient.cpp │ │ ├── chatclient.h │ │ ├── chatserver.cpp │ │ ├── chatserver.h │ │ ├── doc │ │ │ ├── images │ │ │ │ └── btchat-example.png │ │ │ └── src │ │ │ │ └── btchat.qdoc │ │ ├── icons │ │ │ └── btchat │ │ │ │ ├── 24x24 │ │ │ │ ├── bluetooth.png │ │ │ │ ├── bluetooth_dark.png │ │ │ │ ├── send.png │ │ │ │ └── send_dark.png │ │ │ │ ├── 24x24@2 │ │ │ │ ├── bluetooth.png │ │ │ │ ├── bluetooth_dark.png │ │ │ │ ├── send.png │ │ │ │ └── send_dark.png │ │ │ │ ├── 24x24@3 │ │ │ │ ├── bluetooth.png │ │ │ │ ├── bluetooth_dark.png │ │ │ │ ├── send.png │ │ │ │ └── send_dark.png │ │ │ │ ├── 24x24@4 │ │ │ │ ├── bluetooth.png │ │ │ │ ├── bluetooth_dark.png │ │ │ │ ├── send.png │ │ │ │ └── send_dark.png │ │ │ │ └── index.theme │ │ ├── main.cpp │ │ ├── remoteselector.cpp │ │ ├── remoteselector.h │ │ └── remoteselector.ui │ ├── heartrate-game │ │ ├── App.qml │ │ ├── BluetoothAlarmDialog.qml │ │ ├── BottomLine.qml │ │ ├── CMakeLists.txt │ │ ├── Connect.qml │ │ ├── GameButton.qml │ │ ├── GamePage.qml │ │ ├── GameSettings.qml │ │ ├── Main.qml │ │ ├── Measure.qml │ │ ├── README.md │ │ ├── SplashScreen.qml │ │ ├── Stats.qml │ │ ├── StatsLabel.qml │ │ ├── TitleBar.qml │ │ ├── bluetoothbaseclass.cpp │ │ ├── bluetoothbaseclass.h │ │ ├── connectionhandler.cpp │ │ ├── connectionhandler.h │ │ ├── devicefinder.cpp │ │ ├── devicefinder.h │ │ ├── devicehandler.cpp │ │ ├── devicehandler.h │ │ ├── deviceinfo.cpp │ │ ├── deviceinfo.h │ │ ├── doc │ │ │ ├── images │ │ │ │ ├── heartgame-result.webp │ │ │ │ ├── heartgame-running.webp │ │ │ │ ├── heartgame-search.webp │ │ │ │ └── heartgame-start.webp │ │ │ └── src │ │ │ │ └── heartrate-game.qdoc │ │ ├── heartrate-game.pro │ │ ├── heartrate-global.h │ │ ├── images │ │ │ ├── alert.svg │ │ │ ├── bluetooth.svg │ │ │ ├── bt_off_to_on.png │ │ │ ├── clock.svg │ │ │ ├── heart.png │ │ │ ├── logo.png │ │ │ ├── progress.svg │ │ │ └── search.svg │ │ ├── main.cpp │ │ └── qmldir │ ├── heartrate-server │ │ ├── CMakeLists.txt │ │ ├── doc │ │ │ └── src │ │ │ │ └── heartrate-server.qdoc │ │ ├── heartrate-server.pro │ │ └── main.cpp │ ├── lowenergyscanner │ │ ├── CMakeLists.txt │ │ ├── Characteristics.qml │ │ ├── Devices.qml │ │ ├── Dialog.qml │ │ ├── Header.qml │ │ ├── Label.qml │ │ ├── Main.qml │ │ ├── Menu.qml │ │ ├── Services.qml │ │ ├── assets │ │ │ └── busy_dark.png │ │ ├── characteristicinfo.cpp │ │ ├── characteristicinfo.h │ │ ├── device.cpp │ │ ├── device.h │ │ ├── deviceinfo.cpp │ │ ├── deviceinfo.h │ │ ├── doc │ │ │ ├── images │ │ │ │ ├── lowenergyscanner-chars.png │ │ │ │ ├── lowenergyscanner-devices.png │ │ │ │ └── lowenergyscanner-services.png │ │ │ └── src │ │ │ │ └── lowenergyscanner.qdoc │ │ ├── lowenergyscanner.pro │ │ ├── main.cpp │ │ ├── qmldir │ │ ├── serviceinfo.cpp │ │ └── serviceinfo.h │ └── shared │ │ ├── Info.cmake.ios.plist │ │ ├── Info.cmake.macos.plist │ │ ├── Info.qmake.ios.plist │ │ └── Info.qmake.macos.plist ├── examples.pro └── nfc │ ├── CMakeLists.txt │ ├── annotatedurl │ ├── CMakeLists.txt │ ├── Info.plist │ ├── android │ │ └── AndroidManifest.xml │ ├── annotatedurl.cpp │ ├── annotatedurl.h │ ├── annotatedurl.pro │ ├── doc │ │ ├── images │ │ │ ├── annotatedurl.png │ │ │ ├── annotatedurl2.png │ │ │ └── annotatedurl3.png │ │ └── src │ │ │ └── annotatedurl.qdoc │ ├── main.cpp │ ├── mainwindow.cpp │ └── mainwindow.h │ ├── ndefeditor │ ├── CMakeLists.txt │ ├── Info.cmake.plist │ ├── Info.qmake.plist │ ├── Main.qml │ ├── MainWindow.qml │ ├── NdefRecordDelegate.qml │ ├── doc │ │ ├── images │ │ │ └── ndefeditor.png │ │ └── src │ │ │ └── ndefeditor.qdoc │ ├── icons │ │ └── ndefeditor │ │ │ ├── 20x20 │ │ │ ├── add.png │ │ │ ├── arrow_back.png │ │ │ ├── file_download.png │ │ │ ├── file_upload.png │ │ │ ├── link.png │ │ │ └── text_snippet.png │ │ │ ├── 20x20@2 │ │ │ ├── add.png │ │ │ ├── arrow_back.png │ │ │ ├── file_download.png │ │ │ ├── file_upload.png │ │ │ ├── link.png │ │ │ └── text_snippet.png │ │ │ ├── 20x20@3 │ │ │ ├── add.png │ │ │ ├── arrow_back.png │ │ │ ├── file_download.png │ │ │ ├── file_upload.png │ │ │ ├── link.png │ │ │ └── text_snippet.png │ │ │ ├── 20x20@4 │ │ │ ├── add.png │ │ │ ├── arrow_back.png │ │ │ ├── file_download.png │ │ │ ├── file_upload.png │ │ │ ├── link.png │ │ │ └── text_snippet.png │ │ │ ├── REUSE.toml │ │ │ ├── index.theme │ │ │ └── qt_attribution.json │ ├── main.cpp │ ├── ndefeditor.pro │ ├── ndefmessagemodel.cpp │ ├── ndefmessagemodel.h │ ├── nfcmanager.cpp │ ├── nfcmanager.h │ ├── nfctarget.cpp │ ├── nfctarget.h │ └── qmldir │ └── nfc.pro ├── licenseRule.json ├── qt_cmdline.cmake ├── src ├── CMakeLists.txt ├── android │ ├── CMakeLists.txt │ ├── bluetooth │ │ ├── AndroidManifest.xml │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── org │ │ │ └── qtproject │ │ │ └── qt │ │ │ └── android │ │ │ └── bluetooth │ │ │ ├── QtBluetoothBroadcastReceiver.java │ │ │ ├── QtBluetoothGattCharacteristic.java │ │ │ ├── QtBluetoothGattDescriptor.java │ │ │ ├── QtBluetoothInputStreamThread.java │ │ │ ├── QtBluetoothLE.java │ │ │ ├── QtBluetoothLEServer.java │ │ │ ├── QtBluetoothSocketServer.java │ │ │ └── QtBluetoothUtility.java │ └── nfc │ │ ├── AndroidManifest.xml │ │ ├── CMakeLists.txt │ │ └── src │ │ └── org │ │ └── qtproject │ │ └── qt │ │ └── android │ │ └── nfc │ │ ├── QtNfc.java │ │ └── QtNfcBroadcastReceiver.java ├── bluetooth │ ├── CMakeLists.txt │ ├── android │ │ ├── androidbroadcastreceiver.cpp │ │ ├── androidbroadcastreceiver_p.h │ │ ├── androidutils.cpp │ │ ├── androidutils_p.h │ │ ├── devicediscoverybroadcastreceiver.cpp │ │ ├── devicediscoverybroadcastreceiver_p.h │ │ ├── inputstreamthread.cpp │ │ ├── inputstreamthread_p.h │ │ ├── jni_android.cpp │ │ ├── jni_android_p.h │ │ ├── localdevicebroadcastreceiver.cpp │ │ ├── localdevicebroadcastreceiver_p.h │ │ ├── lowenergynotificationhub.cpp │ │ ├── lowenergynotificationhub_p.h │ │ ├── serveracceptancethread.cpp │ │ ├── serveracceptancethread_p.h │ │ ├── servicediscoverybroadcastreceiver.cpp │ │ └── servicediscoverybroadcastreceiver_p.h │ ├── bluez │ │ ├── REUSE.toml │ │ ├── adapter1_bluez5.cpp │ │ ├── adapter1_bluez5_p.h │ │ ├── battery1.cpp │ │ ├── battery1_p.h │ │ ├── bluetoothmanagement.cpp │ │ ├── bluetoothmanagement_p.h │ │ ├── bluez5_helper.cpp │ │ ├── bluez5_helper_p.h │ │ ├── bluez_data.cpp │ │ ├── bluez_data_p.h │ │ ├── bluezperipheralapplication.cpp │ │ ├── bluezperipheralapplication_p.h │ │ ├── bluezperipheralconnectionmanager.cpp │ │ ├── bluezperipheralconnectionmanager_p.h │ │ ├── bluezperipheralobjects.cpp │ │ ├── bluezperipheralobjects_p.h │ │ ├── device1_bluez5.cpp │ │ ├── device1_bluez5_p.h │ │ ├── gattchar1.cpp │ │ ├── gattchar1_p.h │ │ ├── gattcharacteristic1adaptor.cpp │ │ ├── gattcharacteristic1adaptor_p.h │ │ ├── gattdesc1.cpp │ │ ├── gattdesc1_p.h │ │ ├── gattdescriptor1adaptor.cpp │ │ ├── gattdescriptor1adaptor_p.h │ │ ├── gattmanager1.cpp │ │ ├── gattmanager1_p.h │ │ ├── gattservice1.cpp │ │ ├── gattservice1_p.h │ │ ├── gattservice1adaptor.cpp │ │ ├── gattservice1adaptor_p.h │ │ ├── generate │ │ ├── hcimanager.cpp │ │ ├── hcimanager_p.h │ │ ├── leadvertisement1adaptor.cpp │ │ ├── leadvertisement1adaptor_p.h │ │ ├── leadvertisingmanager1.cpp │ │ ├── leadvertisingmanager1_p.h │ │ ├── objectmanager.cpp │ │ ├── objectmanager_p.h │ │ ├── objectmanageradaptor.cpp │ │ ├── objectmanageradaptor_p.h │ │ ├── org.bluez.Adapter1.xml │ │ ├── org.bluez.Battery1.xml │ │ ├── org.bluez.Device1.xml │ │ ├── org.bluez.GattCharacteristic1.xml │ │ ├── org.bluez.GattDescriptor1.xml │ │ ├── org.bluez.GattManager1.xml │ │ ├── org.bluez.GattService1.xml │ │ ├── org.bluez.LEAdvertisement1.xml │ │ ├── org.bluez.LEAdvertisingManager1.xml │ │ ├── org.bluez.Profile1.xml │ │ ├── org.bluez.ProfileManager1.xml │ │ ├── org.freedesktop.dbus.objectmanager.xml │ │ ├── org.freedesktop.dbus.properties.xml │ │ ├── profile1.cpp │ │ ├── profile1_p.h │ │ ├── profile1context.cpp │ │ ├── profile1context_p.h │ │ ├── profilemanager1.cpp │ │ ├── profilemanager1_p.h │ │ ├── properties.cpp │ │ ├── properties_p.h │ │ ├── propertiesadaptor.cpp │ │ ├── propertiesadaptor_p.h │ │ ├── remotedevicemanager.cpp │ │ ├── remotedevicemanager_p.h │ │ ├── servicemap.cpp │ │ └── servicemap_p.h │ ├── configure.cmake │ ├── darwin │ │ ├── btcentralmanager.mm │ │ ├── btcentralmanager_p.h │ │ ├── btconnectionmonitor.mm │ │ ├── btconnectionmonitor_p.h │ │ ├── btdelegates.cpp │ │ ├── btdelegates_p.h │ │ ├── btdeviceinquiry.mm │ │ ├── btdeviceinquiry_p.h │ │ ├── btdevicepair.mm │ │ ├── btdevicepair_p.h │ │ ├── btgcdtimer.mm │ │ ├── btgcdtimer_p.h │ │ ├── btl2capchannel.mm │ │ ├── btl2capchannel_p.h │ │ ├── btledeviceinquiry.mm │ │ ├── btledeviceinquiry_p.h │ │ ├── btnotifier.cpp │ │ ├── btnotifier_p.h │ │ ├── btperipheralmanager.mm │ │ ├── btperipheralmanager_p.h │ │ ├── btraii.mm │ │ ├── btraii_p.h │ │ ├── btrfcommchannel.mm │ │ ├── btrfcommchannel_p.h │ │ ├── btsdpinquiry.mm │ │ ├── btsdpinquiry_p.h │ │ ├── btservicerecord.mm │ │ ├── btservicerecord_p.h │ │ ├── btsocketlistener.mm │ │ ├── btsocketlistener_p.h │ │ ├── btutility.mm │ │ ├── btutility_p.h │ │ ├── uistrings.cpp │ │ └── uistrings_p.h │ ├── doc │ │ ├── images │ │ │ └── peripheral-structure.png │ │ ├── qt6-changes.qdoc │ │ ├── qtbluetooth.qdocconf │ │ ├── snippets │ │ │ ├── CMakeLists.txt │ │ │ ├── doc_src_qtbluetooth.cpp │ │ │ └── snippets.pro │ │ └── src │ │ │ ├── bluetooth-cpp.qdoc │ │ │ ├── bluetooth-index.qdoc │ │ │ ├── bluetooth-le-overview.qdoc │ │ │ ├── bluetooth-overview.qdoc │ │ │ ├── bluetooth-toc.qdoc │ │ │ └── examples.qdoc │ ├── dummy │ │ ├── dummy_helper.cpp │ │ └── dummy_helper_p.h │ ├── lecmaccalculator.cpp │ ├── lecmaccalculator_p.h │ ├── qbluetooth.cpp │ ├── qbluetooth.h │ ├── qbluetoothaddress.cpp │ ├── qbluetoothaddress.h │ ├── qbluetoothdevicediscoveryagent.cpp │ ├── qbluetoothdevicediscoveryagent.h │ ├── qbluetoothdevicediscoveryagent_android.cpp │ ├── qbluetoothdevicediscoveryagent_bluez.cpp │ ├── qbluetoothdevicediscoveryagent_darwin.mm │ ├── qbluetoothdevicediscoveryagent_p.cpp │ ├── qbluetoothdevicediscoveryagent_p.h │ ├── qbluetoothdevicediscoveryagent_winrt.cpp │ ├── qbluetoothdeviceinfo.cpp │ ├── qbluetoothdeviceinfo.h │ ├── qbluetoothdeviceinfo_p.h │ ├── qbluetoothdevicewatcher_winrt.cpp │ ├── qbluetoothdevicewatcher_winrt_p.h │ ├── qbluetoothhostinfo.cpp │ ├── qbluetoothhostinfo.h │ ├── qbluetoothhostinfo_p.h │ ├── qbluetoothlocaldevice.cpp │ ├── qbluetoothlocaldevice.h │ ├── qbluetoothlocaldevice_android.cpp │ ├── qbluetoothlocaldevice_bluez.cpp │ ├── qbluetoothlocaldevice_macos.mm │ ├── qbluetoothlocaldevice_p.cpp │ ├── qbluetoothlocaldevice_p.h │ ├── qbluetoothlocaldevice_winrt.cpp │ ├── qbluetoothserver.cpp │ ├── qbluetoothserver.h │ ├── qbluetoothserver_android.cpp │ ├── qbluetoothserver_bluez.cpp │ ├── qbluetoothserver_macos.mm │ ├── qbluetoothserver_p.cpp │ ├── qbluetoothserver_p.h │ ├── qbluetoothserver_winrt.cpp │ ├── qbluetoothservicediscoveryagent.cpp │ ├── qbluetoothservicediscoveryagent.h │ ├── qbluetoothservicediscoveryagent_android.cpp │ ├── qbluetoothservicediscoveryagent_bluez.cpp │ ├── qbluetoothservicediscoveryagent_macos.mm │ ├── qbluetoothservicediscoveryagent_p.cpp │ ├── qbluetoothservicediscoveryagent_p.h │ ├── qbluetoothservicediscoveryagent_winrt.cpp │ ├── qbluetoothserviceinfo.cpp │ ├── qbluetoothserviceinfo.h │ ├── qbluetoothserviceinfo_android.cpp │ ├── qbluetoothserviceinfo_bluez.cpp │ ├── qbluetoothserviceinfo_macos.mm │ ├── qbluetoothserviceinfo_p.cpp │ ├── qbluetoothserviceinfo_p.h │ ├── qbluetoothserviceinfo_winrt.cpp │ ├── qbluetoothsocket.cpp │ ├── qbluetoothsocket.h │ ├── qbluetoothsocket_android.cpp │ ├── qbluetoothsocket_android_p.h │ ├── qbluetoothsocket_bluez.cpp │ ├── qbluetoothsocket_bluez_p.h │ ├── qbluetoothsocket_bluezdbus.cpp │ ├── qbluetoothsocket_bluezdbus_p.h │ ├── qbluetoothsocket_dummy.cpp │ ├── qbluetoothsocket_dummy_p.h │ ├── qbluetoothsocket_macos.mm │ ├── qbluetoothsocket_macos_p.h │ ├── qbluetoothsocket_winrt.cpp │ ├── qbluetoothsocket_winrt_p.h │ ├── qbluetoothsocketbase.cpp │ ├── qbluetoothsocketbase_p.h │ ├── qbluetoothutils_winrt.cpp │ ├── qbluetoothutils_winrt_p.h │ ├── qbluetoothuuid.cpp │ ├── qbluetoothuuid.h │ ├── qbluetoothuuid_darwin.mm │ ├── qleadvertiser_bluez.cpp │ ├── qleadvertiser_bluez_p.h │ ├── qleadvertiser_bluezdbus.cpp │ ├── qleadvertiser_bluezdbus_p.h │ ├── qlowenergyadvertisingdata.cpp │ ├── qlowenergyadvertisingdata.h │ ├── qlowenergyadvertisingparameters.cpp │ ├── qlowenergyadvertisingparameters.h │ ├── qlowenergycharacteristic.cpp │ ├── qlowenergycharacteristic.h │ ├── qlowenergycharacteristicdata.cpp │ ├── qlowenergycharacteristicdata.h │ ├── qlowenergyconnectionparameters.cpp │ ├── qlowenergyconnectionparameters.h │ ├── qlowenergycontroller.cpp │ ├── qlowenergycontroller.h │ ├── qlowenergycontroller_android.cpp │ ├── qlowenergycontroller_android_p.h │ ├── qlowenergycontroller_bluez.cpp │ ├── qlowenergycontroller_bluez_p.h │ ├── qlowenergycontroller_bluezdbus.cpp │ ├── qlowenergycontroller_bluezdbus_p.h │ ├── qlowenergycontroller_darwin.mm │ ├── qlowenergycontroller_darwin_p.h │ ├── qlowenergycontroller_dummy.cpp │ ├── qlowenergycontroller_dummy_p.h │ ├── qlowenergycontroller_winrt.cpp │ ├── qlowenergycontroller_winrt_p.h │ ├── qlowenergycontrollerbase.cpp │ ├── qlowenergycontrollerbase_p.h │ ├── qlowenergydescriptor.cpp │ ├── qlowenergydescriptor.h │ ├── qlowenergydescriptordata.cpp │ ├── qlowenergydescriptordata.h │ ├── qlowenergyservice.cpp │ ├── qlowenergyservice.h │ ├── qlowenergyservicedata.cpp │ ├── qlowenergyservicedata.h │ ├── qlowenergyserviceprivate.cpp │ ├── qlowenergyserviceprivate_p.h │ ├── qprivatelinearbuffer_p.h │ ├── qtbluetoothglobal.h │ ├── qtbluetoothglobal_p.h │ └── removed_api.cpp ├── global │ └── CMakeLists.txt ├── nfc │ ├── ApiChangesQt6.txt │ ├── CMakeLists.txt │ ├── android │ │ ├── androidjninfc.cpp │ │ ├── androidjninfc_p.h │ │ ├── androidmainnewintentlistener.cpp │ │ └── androidmainnewintentlistener_p.h │ ├── configure.cmake │ ├── doc │ │ ├── qtnfc.qdocconf │ │ ├── snippets │ │ │ ├── main.cpp │ │ │ └── nfc.cpp │ │ └── src │ │ │ ├── examples.qdoc │ │ │ ├── nfc-android.qdoc │ │ │ ├── nfc-cpp.qdoc │ │ │ ├── nfc-features.qdoc │ │ │ ├── nfc-index.qdoc │ │ │ ├── nfc-overview.qdoc │ │ │ ├── nfc-pcsc.qdoc │ │ │ ├── nfc-toc.qdoc │ │ │ └── qt6-changes.qdoc │ ├── ios │ │ ├── qiosndefnotifier.cpp │ │ ├── qiosndefnotifier_p.h │ │ ├── qiosnfcndefsessiondelegate.mm │ │ ├── qiosnfcndefsessiondelegate_p.h │ │ ├── qiostagreaderdelegate.mm │ │ └── qiostagreaderdelegate_p.h │ ├── ndef │ │ ├── qndefaccessfsm_p.h │ │ ├── qnfctagtype4ndeffsm.cpp │ │ └── qnfctagtype4ndeffsm_p.h │ ├── neard │ │ ├── REUSE.toml │ │ ├── neard_dbus_types_p.h │ │ ├── neard_helper.cpp │ │ ├── neard_helper_p.h │ │ ├── org.freedesktop.dbus.objectmanager.xml │ │ ├── org.freedesktop.dbus.properties.xml │ │ ├── org.neard.Adapter.xml │ │ └── org.neard.Tag.xml │ ├── pcsc │ │ ├── qpcsc.cpp │ │ ├── qpcsc_p.h │ │ ├── qpcsccard.cpp │ │ ├── qpcsccard_p.h │ │ ├── qpcscmanager.cpp │ │ ├── qpcscmanager_p.h │ │ ├── qpcscslot.cpp │ │ └── qpcscslot_p.h │ ├── qapduutils.cpp │ ├── qapduutils_p.h │ ├── qndeffilter.cpp │ ├── qndeffilter.h │ ├── qndefmessage.cpp │ ├── qndefmessage.h │ ├── qndefnfcsmartposterrecord.cpp │ ├── qndefnfcsmartposterrecord.h │ ├── qndefnfcsmartposterrecord_p.h │ ├── qndefnfctextrecord.cpp │ ├── qndefnfctextrecord.h │ ├── qndefnfcurirecord.cpp │ ├── qndefnfcurirecord.h │ ├── qndefrecord.cpp │ ├── qndefrecord.h │ ├── qndefrecord_p.h │ ├── qnearfieldmanager.cpp │ ├── qnearfieldmanager.h │ ├── qnearfieldmanager_android.cpp │ ├── qnearfieldmanager_android_p.h │ ├── qnearfieldmanager_generic.cpp │ ├── qnearfieldmanager_generic_p.h │ ├── qnearfieldmanager_ios.mm │ ├── qnearfieldmanager_ios_p.h │ ├── qnearfieldmanager_neard.cpp │ ├── qnearfieldmanager_neard_p.h │ ├── qnearfieldmanager_p.h │ ├── qnearfieldmanager_pcsc.cpp │ ├── qnearfieldmanager_pcsc_p.h │ ├── qnearfieldtarget.cpp │ ├── qnearfieldtarget.h │ ├── qnearfieldtarget_android.cpp │ ├── qnearfieldtarget_android_p.h │ ├── qnearfieldtarget_ios.mm │ ├── qnearfieldtarget_ios_p.h │ ├── qnearfieldtarget_neard_p.cpp │ ├── qnearfieldtarget_neard_p.h │ ├── qnearfieldtarget_p.cpp │ ├── qnearfieldtarget_p.h │ ├── qnearfieldtarget_pcsc.cpp │ ├── qnearfieldtarget_pcsc_p.h │ ├── qtnfcglobal.h │ └── qtnfcglobal_p.h └── tools │ └── sdpscanner │ ├── CMakeLists.txt │ ├── main.cpp │ └── qt_attribution.json └── tests ├── CMakeLists.txt ├── auto ├── CMakeLists.txt ├── bic │ └── data │ │ ├── QtBluetooth.5.10.0.linux-gcc-amd64.txt │ │ ├── QtBluetooth.5.11.0.linux-gcc-amd64.txt │ │ ├── QtBluetooth.5.12.0.linux-gcc-amd64.txt │ │ ├── QtBluetooth.5.13.0.linux-gcc-amd64.txt │ │ ├── QtBluetooth.5.14.0.linux-gcc-amd64.txt │ │ ├── QtBluetooth.5.2.0.linux-gcc-amd64.txt │ │ ├── QtBluetooth.5.3.0.linux-gcc-amd64.txt │ │ ├── QtBluetooth.5.4.0.linux-gcc-amd64.txt │ │ ├── QtBluetooth.5.6.0.linux-gcc-amd64.txt │ │ ├── QtBluetooth.5.7.0.linux-gcc-amd64.txt │ │ ├── QtBluetooth.5.8.0.linux-gcc-amd64.txt │ │ ├── QtBluetooth.5.9.0.linux-gcc-amd64.txt │ │ ├── QtNfc.5.10.0.linux-gcc-amd64.txt │ │ ├── QtNfc.5.11.0.linux-gcc-amd64.txt │ │ ├── QtNfc.5.12.0.linux-gcc-amd64.txt │ │ ├── QtNfc.5.13.0.linux-gcc-amd64.txt │ │ ├── QtNfc.5.14.0.linux-gcc-amd64.txt │ │ ├── QtNfc.5.2.0.linux-gcc-amd64.txt │ │ ├── QtNfc.5.3.0.linux-gcc-amd64.txt │ │ ├── QtNfc.5.4.0.linux-gcc-amd64.txt │ │ ├── QtNfc.5.6.0.linux-gcc-amd64.txt │ │ ├── QtNfc.5.7.0.linux-gcc-amd64.txt │ │ ├── QtNfc.5.8.0.linux-gcc-amd64.txt │ │ └── QtNfc.5.9.0.linux-gcc-amd64.txt ├── cmake │ └── CMakeLists.txt ├── nfccommons │ ├── qnearfieldmanager_emulator.cpp │ ├── qnearfieldmanager_emulator_p.h │ ├── qnearfieldtagtype1.cpp │ ├── qnearfieldtagtype1_p.h │ ├── qnearfieldtagtype2.cpp │ ├── qnearfieldtagtype2_p.h │ ├── qnearfieldtarget_emulator.cpp │ ├── qnearfieldtarget_emulator_p.h │ ├── qtlv.cpp │ ├── qtlv_p.h │ ├── targetemulator.cpp │ └── targetemulator_p.h ├── nfcdata │ ├── Qt Labs Website Tag Type1.nfc │ └── Qt Website Tag Type1.nfc ├── qbluetoothaddress │ ├── CMakeLists.txt │ └── tst_qbluetoothaddress.cpp ├── qbluetoothdevicediscoveryagent │ ├── CMakeLists.txt │ └── tst_qbluetoothdevicediscoveryagent.cpp ├── qbluetoothdeviceinfo │ ├── CMakeLists.txt │ └── tst_qbluetoothdeviceinfo.cpp ├── qbluetoothhostinfo │ ├── CMakeLists.txt │ └── tst_qbluetoothhostinfo.cpp ├── qbluetoothlocaldevice │ ├── CMakeLists.txt │ └── tst_qbluetoothlocaldevice.cpp ├── qbluetoothserver │ ├── CMakeLists.txt │ └── tst_qbluetoothserver.cpp ├── qbluetoothservicediscoveryagent │ ├── CMakeLists.txt │ └── tst_qbluetoothservicediscoveryagent.cpp ├── qbluetoothserviceinfo │ ├── CMakeLists.txt │ └── tst_qbluetoothserviceinfo.cpp ├── qbluetoothsocket │ ├── CMakeLists.txt │ ├── README.txt │ └── tst_qbluetoothsocket.cpp ├── qbluetoothuuid │ ├── CMakeLists.txt │ └── tst_qbluetoothuuid.cpp ├── qlowenergycharacteristic │ ├── CMakeLists.txt │ └── tst_qlowenergycharacteristic.cpp ├── qlowenergycontroller-gattserver │ ├── CMakeLists.txt │ ├── README │ ├── server │ │ ├── CMakeLists.txt │ │ └── qlowenergycontroller-gattserver.cpp │ └── test │ │ ├── CMakeLists.txt │ │ └── tst_qlowenergycontroller-gattserver.cpp ├── qlowenergycontroller │ ├── CMakeLists.txt │ └── tst_qlowenergycontroller.cpp ├── qlowenergydescriptor │ ├── CMakeLists.txt │ └── tst_qlowenergydescriptor.cpp ├── qlowenergyservice │ ├── CMakeLists.txt │ └── tst_qlowenergyservice.cpp ├── qndeffilter │ ├── CMakeLists.txt │ └── tst_qndeffilter.cpp ├── qndefmessage │ ├── CMakeLists.txt │ └── tst_qndefmessage.cpp ├── qndefnfcsmartposterrecord │ ├── CMakeLists.txt │ └── tst_qndefnfcsmartposterrecord.cpp ├── qndefrecord │ ├── CMakeLists.txt │ └── tst_qndefrecord.cpp ├── qnearfieldmanager │ ├── CMakeLists.txt │ └── tst_qnearfieldmanager.cpp ├── qnearfieldtagtype1 │ ├── CMakeLists.txt │ └── tst_qnearfieldtagtype1.cpp └── qnearfieldtagtype2 │ ├── CMakeLists.txt │ ├── nfcdata │ ├── Dynamic Empty Tag.nfc │ └── Empty Tag.nfc │ └── tst_qnearfieldtagtype2.cpp ├── bluetoothtestdevice ├── CMakeLists.txt └── bluetoothtestdevice.cpp ├── bttestui ├── Button.qml ├── CMakeLists.txt ├── README ├── btlocaldevice.cpp ├── btlocaldevice.h ├── main.cpp └── main.qml ├── global └── global.cfg ├── manual ├── CMakeLists.txt ├── examples │ └── btscanner │ │ ├── CMakeLists.txt │ │ ├── Info.plist │ │ ├── btscanner.pro │ │ ├── device.cpp │ │ ├── device.h │ │ ├── device.ui │ │ ├── main.cpp │ │ ├── service.cpp │ │ ├── service.h │ │ └── service.ui ├── qlowenergycontroller │ ├── CMakeLists.txt │ └── tst_qlowenergycontroller_device.cpp └── qlowenergycontroller_peripheral │ ├── CMakeLists.txt │ └── tst_qlowenergycontroller_peripheral.cpp └── shared ├── Info.ios.plist ├── Info.macos.plist └── bttestutil_p.h /.cmake.conf: -------------------------------------------------------------------------------- 1 | set(QT_REPO_MODULE_VERSION "6.10.0") 2 | set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1") 3 | set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_AS_CONST=1") 4 | list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_FOREACH=1") 5 | list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_QSNPRINTF=1") 6 | -------------------------------------------------------------------------------- /.gitreview: -------------------------------------------------------------------------------- 1 | [gerrit] 2 | host=codereview.qt-project.org 3 | project=qt/qtconnectivity 4 | defaultbranch=dev 5 | -------------------------------------------------------------------------------- /.tag: -------------------------------------------------------------------------------- 1 | 304b59c9baeb207c58ea6d223915308f6500962d 2 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | cmake_minimum_required(VERSION 3.16) 5 | 6 | include(.cmake.conf) 7 | project(QtConnectivity 8 | VERSION "${QT_REPO_MODULE_VERSION}" 9 | DESCRIPTION "Qt Connectivity Libraries" 10 | HOMEPAGE_URL "https://qt.io/" 11 | LANGUAGES CXX C 12 | ) 13 | 14 | find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core) 15 | find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS 16 | Network DBus Gui Widgets Quick QuickControls2) 17 | qt_internal_project_setup() 18 | 19 | qt_build_repo() 20 | -------------------------------------------------------------------------------- /LICENSES/BSD-3-Clause.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) . 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 7 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 8 | 9 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 10 | -------------------------------------------------------------------------------- /LICENSES/LicenseRef-Qt-Commercial.txt: -------------------------------------------------------------------------------- 1 | Licensees holding valid commercial Qt licenses may use this software in 2 | accordance with the the terms contained in a written agreement between 3 | you and The Qt Company. Alternatively, the terms and conditions that were 4 | accepted by the licensee when buying and/or downloading the 5 | software do apply. 6 | 7 | For the latest licensing terms and conditions, see https://www.qt.io/terms-conditions. 8 | For further information use the contact form at https://www.qt.io/contact-us. 9 | -------------------------------------------------------------------------------- /LICENSES/Qt-GPL-exception-1.0.txt: -------------------------------------------------------------------------------- 1 | The Qt Company GPL Exception 1.0 2 | 3 | Exception 1: 4 | 5 | As a special exception you may create a larger work which contains the 6 | output of this application and distribute that work under terms of your 7 | choice, so long as the work is not otherwise derived from or based on 8 | this application and so long as the work does not in itself generate 9 | output that contains the output from this application in its original 10 | or modified form. 11 | 12 | Exception 2: 13 | 14 | As a special exception, you have permission to combine this application 15 | with Plugins licensed under the terms of your choice, to produce an 16 | executable, and to copy and distribute the resulting executable under 17 | the terms of your choice. However, the executable must be accompanied 18 | by a prominent notice offering all users of the executable the entire 19 | source code to this application, excluding the source code of the 20 | independent modules, but including any changes you have made to this 21 | application, under the terms of this license. 22 | 23 | -------------------------------------------------------------------------------- /cmake/FindBlueZ.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | set(BlueZ_FOUND 0) 5 | 6 | find_package(PkgConfig QUIET) 7 | 8 | pkg_check_modules(BLUEZ bluez IMPORTED_TARGET) 9 | 10 | if(TARGET PkgConfig::BLUEZ) 11 | set(BlueZ_FOUND 1) 12 | endif() 13 | -------------------------------------------------------------------------------- /cmake/FindPCSCLITE.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | if(WIN32) 5 | add_library(PkgConfig::PCSCLITE INTERFACE IMPORTED) 6 | target_link_libraries(PkgConfig::PCSCLITE INTERFACE winscard) 7 | set(PCSCLITE_FOUND 1) 8 | elseif(MACOS) 9 | qt_internal_find_apple_system_framework(FWPCSC PCSC) 10 | add_library(PkgConfig::PCSCLITE INTERFACE IMPORTED) 11 | target_link_libraries(PkgConfig::PCSCLITE INTERFACE ${FWPCSC}) 12 | set(PCSCLITE_FOUND 1) 13 | else() 14 | find_package(PkgConfig QUIET) 15 | 16 | pkg_check_modules(PCSCLITE libpcsclite IMPORTED_TARGET) 17 | endif() 18 | 19 | if(NOT TARGET PkgConfig::PCSCLITE) 20 | set(PCSCLITE_FOUND 0) 21 | endif() 22 | -------------------------------------------------------------------------------- /coin/axivion/ci_config_linux.json: -------------------------------------------------------------------------------- 1 | { 2 | "Project": { 3 | "BuildSystemIntegration": { 4 | "child_order": [ 5 | "LinkLibraries" 6 | ] 7 | }, 8 | "LinkLibraries": { 9 | "_active": true, 10 | "_copy_from": "AxivionLinker", 11 | "input_files": [ 12 | "$(env:TARGET_NAME)" 13 | ], 14 | "ir": "$(env:IRNAME)" 15 | } 16 | }, 17 | "_Format": "1.0", 18 | "_Version": "7.6.2", 19 | "_VersionNum": [ 20 | 7, 21 | 6, 22 | 2, 23 | 12725 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /coin/axivion/start_analysis.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2024 The Qt Company Ltd. 3 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 4 | 5 | $HOME/bauhaus-suite/setup.sh --non-interactive 6 | 7 | export PATH=/home/qt/bauhaus-suite/bin:$PATH 8 | 9 | export BAUHAUS_CONFIG=$(cd $(dirname $(readlink -f $0)) && pwd) 10 | export AXIVION_VERSION_NAME=$(git rev-parse HEAD) 11 | export EXCLUDE_FILES="build/*:src/3rdparty/*" 12 | export CAFECC_BASEPATH="/home/qt/work/qt/$TESTED_MODULE_COIN" 13 | gccsetup --cc gcc --cxx g++ --config "$BAUHAUS_CONFIG" 14 | cd "$CAFECC_BASEPATH" 15 | BAUHAUS_IR_COMPRESSION=none COMPILE_ONLY=1 cmake -G Ninja -DAXIVION_ANALYSIS_TOOLCHAIN_FILE=/home/qt/bauhaus-suite/profiles/cmake/axivion-launcher-toolchain.cmake -DCMAKE_PREFIX_PATH=/home/qt/work/qt/qtconnectivity/build -DCMAKE_PROJECT_INCLUDE_BEFORE=/home/qt/bauhaus-suite/profiles/cmake/axivion-before-project-hook.cmake -B build -S . --fresh 16 | cmake --build build -j4 17 | for MODULE in qtnfc qtbluetooth; do 18 | export MODULE 19 | export PLUGINS="" 20 | export IRNAME=build/$MODULE.ir 21 | if [ "$MODULE" == "qtnfc" ] 22 | then 23 | export TARGET_NAME="build/lib/libQt6Nfc.so.*.ir" 24 | export PACKAGE="Add-ons" 25 | elif [ "$MODULE" == "qtbluetooth" ] 26 | then 27 | export TARGET_NAME="build/lib/libQt6Bluetooth.so.*.ir" 28 | export PACKAGE="Add-ons" 29 | fi 30 | axivion_ci "$@" 31 | done 32 | -------------------------------------------------------------------------------- /coin/module_config.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | accept_configuration: 3 | condition: property 4 | property: features 5 | not_contains_value: Disable 6 | 7 | instructions: 8 | Build: 9 | - type: EnvironmentVariable 10 | variableName: VERIFY_SOURCE_SBOM 11 | variableValue: "ON" 12 | - !include "{{qt/qtbase}}/coin_module_build_template_v2.yaml" 13 | 14 | Test: 15 | - !include "{{qt/qtbase}}/coin_module_test_template_v3.yaml" 16 | - !include "{{qt/qtbase}}/coin_module_test_docs.yaml" 17 | -------------------------------------------------------------------------------- /config.tests/bluez/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | cmake_minimum_required(VERSION 3.16) 5 | project(config_test_bluez LANGUAGES C CXX) 6 | 7 | if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH) 8 | set(CMAKE_SYSTEM_PREFIX_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH}") 9 | endif() 10 | if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH) 11 | set(CMAKE_SYSTEM_FRAMEWORK_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH}") 12 | endif() 13 | 14 | foreach(p ${QT_CONFIG_COMPILE_TEST_PACKAGES}) 15 | find_package(${p}) 16 | endforeach() 17 | 18 | if(QT_CONFIG_COMPILE_TEST_LIBRARIES) 19 | link_libraries(${QT_CONFIG_COMPILE_TEST_LIBRARIES}) 20 | endif() 21 | if(QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS) 22 | foreach(lib ${QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS}) 23 | if(TARGET ${lib}) 24 | link_libraries(${lib}) 25 | endif() 26 | endforeach() 27 | endif() 28 | 29 | add_executable(${PROJECT_NAME} 30 | main.cpp 31 | ) 32 | target_compile_options(${PROJECT_NAME} PRIVATE 33 | -fpermissive 34 | ) 35 | -------------------------------------------------------------------------------- /config.tests/bluez/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: BSD-3-Clause 3 | 4 | #include 5 | 6 | int main() 7 | { 8 | bdaddr_t anyTmp = {{0, 0, 0, 0, 0, 0}}; 9 | bdaddr_t localTmp = {{0, 0, 0, 0xff, 0xff, 0xff}}; 10 | 11 | bacmp(&anyTmp, &localTmp); 12 | 13 | uint32_t field0 = 1; 14 | uint16_t field1 = 1; 15 | 16 | field0 = htonl(field0); 17 | field1 = htons(field1); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /config.tests/bluez_le/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | cmake_minimum_required(VERSION 3.16) 5 | project(config_test_bluez_le LANGUAGES C CXX) 6 | 7 | if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH) 8 | set(CMAKE_SYSTEM_PREFIX_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH}") 9 | endif() 10 | if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH) 11 | set(CMAKE_SYSTEM_FRAMEWORK_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH}") 12 | endif() 13 | 14 | foreach(p ${QT_CONFIG_COMPILE_TEST_PACKAGES}) 15 | find_package(${p}) 16 | endforeach() 17 | 18 | if(QT_CONFIG_COMPILE_TEST_LIBRARIES) 19 | link_libraries(${QT_CONFIG_COMPILE_TEST_LIBRARIES}) 20 | endif() 21 | if(QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS) 22 | foreach(lib ${QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS}) 23 | if(TARGET ${lib}) 24 | link_libraries(${lib}) 25 | endif() 26 | endforeach() 27 | endif() 28 | 29 | add_executable(${PROJECT_NAME} 30 | main.cpp 31 | ) 32 | -------------------------------------------------------------------------------- /config.tests/bluez_le/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: BSD-3-Clause 3 | 4 | #include 5 | #include 6 | 7 | int main() 8 | { 9 | sockaddr_l2 addr; 10 | memset(&addr, 0, sizeof(addr)); 11 | addr.l2_family = AF_BLUETOOTH; 12 | addr.l2_cid = 4; 13 | addr.l2_bdaddr_type = BDADDR_LE_PUBLIC; 14 | } 15 | -------------------------------------------------------------------------------- /config.tests/linux_crypto_api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | cmake_minimum_required(VERSION 3.16) 5 | project(config_test_linux_crypto_api LANGUAGES C CXX) 6 | 7 | if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH) 8 | set(CMAKE_SYSTEM_PREFIX_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH}") 9 | endif() 10 | if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH) 11 | set(CMAKE_SYSTEM_FRAMEWORK_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH}") 12 | endif() 13 | 14 | foreach(p ${QT_CONFIG_COMPILE_TEST_PACKAGES}) 15 | find_package(${p}) 16 | endforeach() 17 | 18 | if(QT_CONFIG_COMPILE_TEST_LIBRARIES) 19 | link_libraries(${QT_CONFIG_COMPILE_TEST_LIBRARIES}) 20 | endif() 21 | if(QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS) 22 | foreach(lib ${QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS}) 23 | if(TARGET ${lib}) 24 | link_libraries(${lib}) 25 | endif() 26 | endforeach() 27 | endif() 28 | 29 | add_executable(${PROJECT_NAME} 30 | main.cpp 31 | ) 32 | -------------------------------------------------------------------------------- /config.tests/linux_crypto_api/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: BSD-3-Clause 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | int main() 10 | { 11 | sockaddr_alg sa; 12 | sa.salg_family = AF_ALG; 13 | sa.salg_type[0] = 0; 14 | sa.salg_name[0] = 0; 15 | setsockopt(3, 279 /* SOL_ALG */, ALG_SET_KEY, "dummy", 5); 16 | } 17 | -------------------------------------------------------------------------------- /config.tests/winrt_bt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | cmake_minimum_required(VERSION 3.16) 5 | project(config_test_winrt LANGUAGES C CXX) 6 | 7 | if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH) 8 | set(CMAKE_SYSTEM_PREFIX_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH}") 9 | endif() 10 | if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH) 11 | set(CMAKE_SYSTEM_FRAMEWORK_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH}") 12 | endif() 13 | 14 | foreach(p ${QT_CONFIG_COMPILE_TEST_PACKAGES}) 15 | find_package(${p}) 16 | endforeach() 17 | 18 | if(QT_CONFIG_COMPILE_TEST_LIBRARIES) 19 | link_libraries(${QT_CONFIG_COMPILE_TEST_LIBRARIES}) 20 | endif() 21 | if(QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS) 22 | foreach(lib ${QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS}) 23 | if(TARGET ${lib}) 24 | link_libraries(${lib}) 25 | endif() 26 | endforeach() 27 | endif() 28 | 29 | add_executable(${PROJECT_NAME} 30 | main.cpp 31 | ) 32 | target_link_libraries(${PROJECT_NAME} PUBLIC 33 | runtimeobject 34 | ) 35 | -------------------------------------------------------------------------------- /config.tests/winrt_bt/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: BSD-3-Clause 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #if defined(_WIN32) && defined(__INTEL_COMPILER) 9 | #error "Windows ICC fails to build the WinRT backend (QTBUG-68026)." 10 | #endif 11 | 12 | int main() 13 | { 14 | Microsoft::WRL::ComPtr deviceInformationStatics; 15 | ABI::Windows::Foundation::GetActivationFactory(Microsoft::WRL::Wrappers::HString::MakeReference 16 | (RuntimeClass_Windows_Devices_Enumeration_DeviceInformation).Get(), &deviceInformationStatics); 17 | 18 | (void)Microsoft::WRL::ComPtr().Get(); 19 | (void)Microsoft::WRL::ComPtr().Get(); 20 | (void)Microsoft::WRL::ComPtr().Get(); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /configure.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2025 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | 5 | 6 | #### Inputs 7 | 8 | 9 | 10 | #### Libraries 11 | 12 | 13 | 14 | #### Tests 15 | 16 | 17 | 18 | #### Features 19 | 20 | qt_feature("bluetooth" PUBLIC 21 | LABEL "Qt Bluetooth" 22 | PURPOSE "The Bluetooth API provides connectivity between Bluetooth enabled devices." 23 | CONDITION TARGET Qt::Network 24 | ) 25 | qt_feature("nfc" PUBLIC 26 | LABEL "Qt NFC" 27 | PURPOSE "The NFC API provides connectivity between NFC enabled devices." 28 | ) 29 | 30 | qt_configure_add_summary_section(NAME "Qt Connectivity") 31 | qt_configure_add_summary_entry(ARGS "bluetooth") 32 | qt_configure_add_summary_entry(ARGS "nfc") 33 | qt_configure_end_summary_section() # end of "Qt Connectivity" section 34 | -------------------------------------------------------------------------------- /dependencies.yaml: -------------------------------------------------------------------------------- 1 | dependencies: 2 | ../qtbase: 3 | ref: a867a16ef0a29f9b8b7196d0959e980ee17d7876 4 | required: true 5 | ../qtdeclarative: 6 | ref: fa4568622cc19e5a876238d6cfca2e95936f8bdd 7 | required: false 8 | -------------------------------------------------------------------------------- /dist/REUSE.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[annotations]] 4 | path = ["*"] 5 | precedence = "override" 6 | comment = "Licensed as documentation." 7 | SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd." 8 | SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only" 9 | -------------------------------------------------------------------------------- /dist/changes-5.10.1: -------------------------------------------------------------------------------- 1 | Qt 5.10.1 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.10.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.10 series is binary compatible with the 5.9.x series. 10 | Applications compiled for 5.9 will continue to run with 5.10. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | This release contains all fixes included in the Qt 5.9.4 release. 21 | 22 | **************************************************************************** 23 | * Qt 5.10.1 Changes * 24 | **************************************************************************** 25 | 26 | QtBluetooth 27 | ----------- 28 | 29 | - Fixed missing QML version bump. The QML import statement for QtBluetooth 30 | was still 5.9. 31 | - Added various documentation improvements, e.g. special handling for iOS 32 | use cases. 33 | 34 | QtNfc 35 | ----- 36 | 37 | - Fixed missing QML version bump. The QML import statement for QtNfc 38 | was still 5.9. 39 | - Added various improvements to all NFC examples. 40 | -------------------------------------------------------------------------------- /dist/changes-5.13.1: -------------------------------------------------------------------------------- 1 | Qt 5.13.1 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.13.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.13 series is binary compatible with the 5.12.x series. 10 | Applications compiled for 5.12 will continue to run with 5.13. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Qt 5.13.1 Changes * 22 | **************************************************************************** 23 | 24 | QtBluetooth 25 | ----------- 26 | 27 | - [QTBUG-62520] Improved stability of QBluetoothSocket::connectToService() 28 | on WinRT. 29 | 30 | - [QTBUG-62294] Added implementation for QBluetoothLocalSocket on WinRT. Note 31 | that the platform only supports pairingStatus() related features. 32 | 33 | - Improved stability of QLowEnergyController on WinRT. 34 | 35 | - [QTBUG-75907] Reduced number of asserts in QLowEnergyController on WinRT. 36 | 37 | -------------------------------------------------------------------------------- /dist/changes-5.13.2: -------------------------------------------------------------------------------- 1 | Qt 5.13.2 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.13.0 through 5.13.1. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.13 series is binary compatible with the 5.12.x series. 10 | Applications compiled for 5.12 will continue to run with 5.13. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Qt 5.13.2 Changes * 22 | **************************************************************************** 23 | 24 | QtBluetooth 25 | ----------- 26 | 27 | - [QTQAINFRA-2139] Fixed QMutex related compile error when using clang on 28 | Windows. 29 | 30 | - [QTBUG-78201] Fixed a case where an existing descriptor was not discovered 31 | during the service discovery due to not being readable. This issue happened 32 | on Android. 33 | 34 | - Fixed a few minor documentation issues. 35 | 36 | -------------------------------------------------------------------------------- /dist/changes-5.14.1: -------------------------------------------------------------------------------- 1 | Qt 5.14.1 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.14.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.14 series is binary compatible with the 5.13.x series. 10 | Applications compiled for 5.13 will continue to run with 5.14. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * QtBluetooth * 22 | **************************************************************************** 23 | 24 | - BlueZ-DBus: 25 | * Invalidate btle service when it has disappeared 26 | -------------------------------------------------------------------------------- /dist/changes-5.15.0: -------------------------------------------------------------------------------- 1 | Qt 5.15 introduces many new features and improvements as well as bugfixes 2 | over the 5.14.x series. For more details, refer to the online documentation 3 | included in this distribution. The documentation is also available online: 4 | 5 | https://doc.qt.io/qt-5/index.html 6 | 7 | The Qt version 5.15 series is binary compatible with the 5.14.x series. 8 | Applications compiled for 5.14 will continue to run with 5.15. 9 | 10 | Some of the changes listed in this file include issue tracking numbers 11 | corresponding to tasks in the Qt Bug Tracker: 12 | 13 | https://bugreports.qt.io/ 14 | 15 | Each of these identifiers can be entered in the bug tracker to obtain more 16 | information about a particular change. 17 | 18 | **************************************************************************** 19 | * QtBluetooth * 20 | **************************************************************************** 21 | 22 | - On macOS, fixed missing writeNotify notifications in QBluetoothSocket. 23 | 24 | - Fixed several deprecation warnings introduced by changes in other Qt modules. 25 | 26 | -------------------------------------------------------------------------------- /dist/changes-5.15.1: -------------------------------------------------------------------------------- 1 | Qt 5.15.1 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.15.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.15 series is binary compatible with the 5.14.x series. 10 | Applications compiled for 5.14 will continue to run with 5.15. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | - This release contains only minor code improvements. 21 | -------------------------------------------------------------------------------- /dist/changes-5.15.2: -------------------------------------------------------------------------------- 1 | Qt 5.15.2 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.15.1. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5.15/index.html 8 | 9 | The Qt version 5.15 series is binary compatible with the 5.14.x series. 10 | Applications compiled for 5.14 will continue to run with 5.15. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Qt 5.15.2 * 22 | **************************************************************************** 23 | 24 | This release only contains minor changes. 25 | -------------------------------------------------------------------------------- /dist/changes-5.4.1: -------------------------------------------------------------------------------- 1 | Qt 5.4.1 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.4.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5.4 8 | 9 | The Qt version 5.4 series is binary compatible with the 5.3.x series. 10 | Applications compiled for 5.3 will continue to run with 5.4. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | http://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Library * 22 | **************************************************************************** 23 | 24 | QtBluetooth 25 | ----------- 26 | 27 | - General: 28 | * Extended documentation with regards to Bluetooth Low Energy. The 29 | affected classes were QLowEnergyController and QLowEnergyService. 30 | * LowEnergyScanner and chat examples improved. 31 | 32 | - QBluetoothServer: 33 | * [QTBUG-43806] Fixed SDP registration of PublicBrowseGroup in BlueZ 5.x. 34 | 35 | - QLowEnergyController: 36 | * Fixed blocking of ATT command processing due to a reconnect to the target 37 | device. 38 | 39 | -------------------------------------------------------------------------------- /dist/changes-5.9.3: -------------------------------------------------------------------------------- 1 | Qt 5.9.3 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.9.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.9 series is binary compatible with the 5.8.x series. 10 | Applications compiled for 5.8 will continue to run with 5.9. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Qt 5.9.3 Changes * 22 | **************************************************************************** 23 | 24 | QtBluetooth 25 | ----------- 26 | 27 | - Updated FDL and BSD license headers throughout the module 28 | - [QTBUG-63630] Added warning about incorrect thread/runloop usage on Apple 29 | platforms. The IOBluetooth framework used by QtBluetooth requires CFRunLoops 30 | - [QTBUG-63210] Fixed build using -no-pch on Windows 31 | 32 | QtNfc 33 | ----- 34 | 35 | - Updated FDL and BSD license headers throughout the module 36 | - [QTBUG-62858] Fixed writing of NDefMessages on Android 37 | 38 | -------------------------------------------------------------------------------- /dist/changes-5.9.4: -------------------------------------------------------------------------------- 1 | Qt 5.9.4 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.9.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.9 series is binary compatible with the 5.8.x series. 10 | Applications compiled for 5.8 will continue to run with 5.9. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Qt 5.9.4 Changes * 22 | **************************************************************************** 23 | 24 | QtBLuetooth 25 | ----------- 26 | 27 | - [QTBUG-64669] Fixed hanging service discovery state when remote device 28 | does not respond to ATT read requests. 29 | - [QTBUG-64597] Fixed compilation of heartrate server example with disabled 30 | gui module. 31 | - Added minor improvements to Windows UWP builds. 32 | -------------------------------------------------------------------------------- /dist/changes-5.9.5: -------------------------------------------------------------------------------- 1 | Qt 5.9.5 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.9.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.9 series is binary compatible with the 5.8.x series. 10 | Applications compiled for 5.9 will continue to run with 5.9. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Qt 5.9.5 Changes * 22 | **************************************************************************** 23 | 24 | QtBluetooth 25 | ----------- 26 | 27 | - [QTBUG-65801] Fixed never ending QBLuetoothDeviceDiscoveryAhgent::start(ClassMethod) 28 | on WinRT/UWP. 29 | - Fixed internal cleanup issue in QBluetoothSocket on WinRT/UWP. 30 | -------------------------------------------------------------------------------- /dist/changes-5.9.6: -------------------------------------------------------------------------------- 1 | Qt 5.9.6 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.9.0 through 5.9.5. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.9 series is binary compatible with the 5.8.x series. 10 | Applications compiled for 5.8 will continue to run with 5.9. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Qt 5.9.6 Changes * 22 | **************************************************************************** 23 | 24 | - This release contains only minor code improvements. 25 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | qt_examples_build_begin(EXTERNAL_BUILD) 5 | 6 | if(TARGET Qt6::Bluetooth) 7 | add_subdirectory(bluetooth) 8 | endif() 9 | if(TARGET Qt6::Nfc) 10 | add_subdirectory(nfc) 11 | endif() 12 | 13 | qt_examples_build_end() 14 | -------------------------------------------------------------------------------- /examples/bluetooth/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | qt_internal_add_example(heartrate-server) 5 | if(TARGET Qt6::Widgets) 6 | qt_internal_add_example(btchat) 7 | endif() 8 | if(TARGET Qt6::Quick) 9 | qt_internal_add_example(lowenergyscanner) 10 | qt_internal_add_example(heartrate-game) 11 | endif() 12 | -------------------------------------------------------------------------------- /examples/bluetooth/bluetooth.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS += heartrate-server 4 | 5 | qtHaveModule(widgets) { 6 | SUBDIRS += btchat 7 | } 8 | 9 | qtHaveModule(quick): SUBDIRS += lowenergyscanner \ 10 | heartrate-game 11 | -------------------------------------------------------------------------------- /examples/bluetooth/btchat/chat.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #include 5 | 6 | #include 7 | 8 | QT_BEGIN_NAMESPACE 9 | namespace Ui { 10 | class Chat; 11 | } 12 | QT_END_NAMESPACE 13 | 14 | class ChatServer; 15 | class ChatClient; 16 | 17 | //! [declaration] 18 | class Chat : public QDialog 19 | { 20 | Q_OBJECT 21 | 22 | public: 23 | explicit Chat(QWidget *parent = nullptr); 24 | ~Chat(); 25 | 26 | signals: 27 | void sendMessage(const QString &message); 28 | 29 | private slots: 30 | void connectClicked(); 31 | void sendClicked(); 32 | 33 | void showMessage(const QString &sender, const QString &message); 34 | 35 | void clientConnected(const QString &name); 36 | void clientDisconnected(const QString &name); 37 | void clientDisconnected(); 38 | void connected(const QString &name); 39 | void reactOnSocketError(const QString &error); 40 | 41 | void newAdapterSelected(); 42 | 43 | void initBluetooth(); 44 | 45 | void updateIcons(Qt::ColorScheme scheme); 46 | 47 | private: 48 | int adapterFromUserSelection() const; 49 | int currentAdapterIndex = 0; 50 | Ui::Chat *ui; 51 | 52 | ChatServer *server = nullptr; 53 | QList clients; 54 | QList localAdapters; 55 | 56 | QString localName; 57 | }; 58 | //! [declaration] 59 | -------------------------------------------------------------------------------- /examples/bluetooth/btchat/chatclient.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #ifndef CHATCLIENT_H 5 | #define CHATCLIENT_H 6 | 7 | #include 8 | 9 | #include 10 | 11 | QT_FORWARD_DECLARE_CLASS(QBluetoothServiceInfo) 12 | 13 | //! [declaration] 14 | class ChatClient : public QObject 15 | { 16 | Q_OBJECT 17 | 18 | public: 19 | explicit ChatClient(QObject *parent = nullptr); 20 | ~ChatClient(); 21 | 22 | void startClient(const QBluetoothServiceInfo &remoteService); 23 | void stopClient(); 24 | 25 | public slots: 26 | void sendMessage(const QString &message); 27 | 28 | signals: 29 | void messageReceived(const QString &sender, const QString &message); 30 | void connected(const QString &name); 31 | void disconnected(); 32 | void socketErrorOccurred(const QString &errorString); 33 | 34 | private slots: 35 | void readSocket(); 36 | void connected(); 37 | void onSocketErrorOccurred(QBluetoothSocket::SocketError); 38 | 39 | private: 40 | QBluetoothSocket *socket = nullptr; 41 | }; 42 | //! [declaration] 43 | 44 | #endif // CHATCLIENT_H 45 | -------------------------------------------------------------------------------- /examples/bluetooth/btchat/chatserver.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #ifndef CHATSERVER_H 5 | #define CHATSERVER_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | QT_FORWARD_DECLARE_CLASS(QBluetoothServer) 13 | QT_FORWARD_DECLARE_CLASS(QBluetoothSocket) 14 | 15 | //! [declaration] 16 | class ChatServer : public QObject 17 | { 18 | Q_OBJECT 19 | 20 | public: 21 | explicit ChatServer(QObject *parent = nullptr); 22 | ~ChatServer(); 23 | 24 | void startServer(const QBluetoothAddress &localAdapter = QBluetoothAddress()); 25 | void stopServer(); 26 | 27 | public slots: 28 | void sendMessage(const QString &message); 29 | 30 | signals: 31 | void messageReceived(const QString &sender, const QString &message); 32 | void clientConnected(const QString &name); 33 | void clientDisconnected(const QString &name); 34 | 35 | private slots: 36 | void clientConnected(); 37 | void clientDisconnected(); 38 | void readSocket(); 39 | 40 | private: 41 | QBluetoothServer *rfcommServer = nullptr; 42 | QBluetoothServiceInfo serviceInfo; 43 | QList clientSockets; 44 | QMap clientNames; 45 | }; 46 | //! [declaration] 47 | 48 | #endif // CHATSERVER_H 49 | -------------------------------------------------------------------------------- /examples/bluetooth/btchat/doc/images/btchat-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/btchat/doc/images/btchat-example.png -------------------------------------------------------------------------------- /examples/bluetooth/btchat/icons/btchat/24x24/bluetooth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/btchat/icons/btchat/24x24/bluetooth.png -------------------------------------------------------------------------------- /examples/bluetooth/btchat/icons/btchat/24x24/bluetooth_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/btchat/icons/btchat/24x24/bluetooth_dark.png -------------------------------------------------------------------------------- /examples/bluetooth/btchat/icons/btchat/24x24/send.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/btchat/icons/btchat/24x24/send.png -------------------------------------------------------------------------------- /examples/bluetooth/btchat/icons/btchat/24x24/send_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/btchat/icons/btchat/24x24/send_dark.png -------------------------------------------------------------------------------- /examples/bluetooth/btchat/icons/btchat/24x24@2/bluetooth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/btchat/icons/btchat/24x24@2/bluetooth.png -------------------------------------------------------------------------------- /examples/bluetooth/btchat/icons/btchat/24x24@2/bluetooth_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/btchat/icons/btchat/24x24@2/bluetooth_dark.png -------------------------------------------------------------------------------- /examples/bluetooth/btchat/icons/btchat/24x24@2/send.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/btchat/icons/btchat/24x24@2/send.png -------------------------------------------------------------------------------- /examples/bluetooth/btchat/icons/btchat/24x24@2/send_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/btchat/icons/btchat/24x24@2/send_dark.png -------------------------------------------------------------------------------- /examples/bluetooth/btchat/icons/btchat/24x24@3/bluetooth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/btchat/icons/btchat/24x24@3/bluetooth.png -------------------------------------------------------------------------------- /examples/bluetooth/btchat/icons/btchat/24x24@3/bluetooth_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/btchat/icons/btchat/24x24@3/bluetooth_dark.png -------------------------------------------------------------------------------- /examples/bluetooth/btchat/icons/btchat/24x24@3/send.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/btchat/icons/btchat/24x24@3/send.png -------------------------------------------------------------------------------- /examples/bluetooth/btchat/icons/btchat/24x24@3/send_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/btchat/icons/btchat/24x24@3/send_dark.png -------------------------------------------------------------------------------- /examples/bluetooth/btchat/icons/btchat/24x24@4/bluetooth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/btchat/icons/btchat/24x24@4/bluetooth.png -------------------------------------------------------------------------------- /examples/bluetooth/btchat/icons/btchat/24x24@4/bluetooth_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/btchat/icons/btchat/24x24@4/bluetooth_dark.png -------------------------------------------------------------------------------- /examples/bluetooth/btchat/icons/btchat/24x24@4/send.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/btchat/icons/btchat/24x24@4/send.png -------------------------------------------------------------------------------- /examples/bluetooth/btchat/icons/btchat/24x24@4/send_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/btchat/icons/btchat/24x24@4/send_dark.png -------------------------------------------------------------------------------- /examples/bluetooth/btchat/icons/btchat/index.theme: -------------------------------------------------------------------------------- 1 | [Icon Theme] 2 | Name=btchat 3 | Directories=24x24,24x24@2,24x24@3,24x24@4 4 | 5 | [24x24] 6 | Size=24 7 | Type=Fixed 8 | 9 | [24x24@2] 10 | Size=24 11 | Scale=2 12 | Type=Fixed 13 | 14 | [24x24@3] 15 | Size=24 16 | Scale=3 17 | Type=Fixed 18 | 19 | [24x24@4] 20 | Size=24 21 | Scale=4 22 | Type=Fixed 23 | -------------------------------------------------------------------------------- /examples/bluetooth/btchat/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #include "chat.h" 5 | 6 | #include 7 | 8 | #include 9 | 10 | using namespace Qt::StringLiterals; 11 | 12 | int main(int argc, char *argv[]) 13 | { 14 | // QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true")); 15 | QApplication app(argc, argv); 16 | 17 | QIcon::setThemeName(u"btchat"_s); 18 | 19 | Chat d; 20 | QObject::connect(&d, &Chat::accepted, &app, &QApplication::quit); 21 | 22 | #if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) 23 | d.showMaximized(); 24 | #else 25 | d.show(); 26 | #endif 27 | 28 | app.exec(); 29 | 30 | return 0; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/BottomLine.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | import QtQuick 5 | 6 | Rectangle { 7 | anchors.horizontalCenter: parent.horizontalCenter 8 | anchors.bottom: parent.bottom 9 | width: parent.width 10 | height: parent.height * 0.05 11 | } 12 | -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/GameButton.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | import QtQuick 5 | 6 | Rectangle { 7 | id: button 8 | color: baseColor 9 | onEnabledChanged: checkColor() 10 | radius: GameSettings.buttonRadius 11 | 12 | property color baseColor: GameSettings.buttonColor 13 | property color pressedColor: GameSettings.buttonPressedColor 14 | property color disabledColor: GameSettings.disabledButtonColor 15 | 16 | signal clicked 17 | 18 | function checkColor() { 19 | if (!button.enabled) { 20 | button.color = disabledColor 21 | } else { 22 | if (mouseArea.containsPress) 23 | button.color = pressedColor 24 | else 25 | button.color = baseColor 26 | } 27 | } 28 | 29 | MouseArea { 30 | id: mouseArea 31 | anchors.fill: parent 32 | onPressed: button.checkColor() 33 | onReleased: button.checkColor() 34 | onClicked: { 35 | button.checkColor() 36 | button.clicked() 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/README.md: -------------------------------------------------------------------------------- 1 | # HeartRateGame # 2 | 3 | Demonstrates how to check a Bluetooth-connection, discover LE-devices, connect 4 | to devices, discover services and finally connect to a heartrate-service. 5 | The purpose of the game is increase the heartrate so much as possible in 60s. 6 | Relax before starting the game. Don't be too nervous, it increases the heartrate! 7 | 8 | -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/SplashScreen.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | import QtQuick 5 | import HeartRateGame 6 | 7 | Item { 8 | id: root 9 | 10 | property bool appIsReady: false 11 | property bool splashIsReady: false 12 | property bool ready: appIsReady && splashIsReady 13 | 14 | anchors.fill: parent 15 | 16 | Image { 17 | anchors.centerIn: parent 18 | width: Math.min(parent.height, parent.width) * 0.6 19 | height: GameSettings.heightForWidth(width, sourceSize) 20 | source: "images/logo.png" 21 | } 22 | 23 | Timer { 24 | id: splashTimer 25 | interval: 1000 26 | onTriggered: root.splashIsReady = true 27 | } 28 | 29 | Component.onCompleted: splashTimer.start() 30 | } 31 | -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/StatsLabel.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | import QtQuick 5 | 6 | Item { 7 | height: GameSettings.fieldHeight 8 | width: parent.width 9 | 10 | property alias title: leftText.text 11 | property alias value: rightText.text 12 | 13 | Text { 14 | id: leftText 15 | anchors.left: parent.left 16 | height: parent.height 17 | width: parent.width * 0.45 18 | horizontalAlignment: Text.AlignRight 19 | verticalAlignment: Text.AlignVCenter 20 | font.pixelSize: GameSettings.mediumFontSize 21 | color: GameSettings.textColor 22 | } 23 | 24 | Text { 25 | id: rightText 26 | anchors.right: parent.right 27 | height: parent.height 28 | width: parent.width * 0.45 29 | horizontalAlignment: Text.AlignLeft 30 | verticalAlignment: Text.AlignVCenter 31 | font.pixelSize: GameSettings.mediumFontSize 32 | color: GameSettings.textColor 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/bluetoothbaseclass.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #include "bluetoothbaseclass.h" 5 | 6 | BluetoothBaseClass::BluetoothBaseClass(QObject *parent) : QObject(parent) 7 | { 8 | } 9 | 10 | QString BluetoothBaseClass::error() const 11 | { 12 | return m_error; 13 | } 14 | 15 | QString BluetoothBaseClass::info() const 16 | { 17 | return m_info; 18 | } 19 | 20 | void BluetoothBaseClass::setError(const QString &error) 21 | { 22 | if (m_error != error) { 23 | m_error = error; 24 | emit errorChanged(); 25 | } 26 | } 27 | 28 | void BluetoothBaseClass::setInfo(const QString &info) 29 | { 30 | if (m_info != info) { 31 | m_info = info; 32 | emit infoChanged(); 33 | } 34 | } 35 | 36 | BluetoothBaseClass::IconType BluetoothBaseClass::icon() const 37 | { 38 | return m_icon; 39 | } 40 | 41 | void BluetoothBaseClass::setIcon(IconType icon) 42 | { 43 | if (m_icon != icon) { 44 | m_icon = icon; 45 | emit iconChanged(); 46 | } 47 | } 48 | 49 | void BluetoothBaseClass::clearMessages() 50 | { 51 | setInfo(""); 52 | setError(""); 53 | setIcon(IconNone); 54 | } 55 | -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/connectionhandler.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #ifndef CONNECTIONHANDLER_H 5 | #define CONNECTIONHANDLER_H 6 | 7 | #include 8 | 9 | #include 10 | 11 | #include 12 | 13 | class ConnectionHandler : public QObject 14 | { 15 | Q_OBJECT 16 | 17 | Q_PROPERTY(bool alive READ alive NOTIFY deviceChanged) 18 | Q_PROPERTY(bool hasPermission READ hasPermission NOTIFY deviceChanged) 19 | Q_PROPERTY(QString name READ name NOTIFY deviceChanged) 20 | Q_PROPERTY(QString address READ address NOTIFY deviceChanged) 21 | Q_PROPERTY(bool requiresAddressType READ requiresAddressType CONSTANT) 22 | 23 | QML_ELEMENT 24 | public: 25 | explicit ConnectionHandler(QObject *parent = nullptr); 26 | 27 | bool alive() const; 28 | bool hasPermission() const; 29 | bool requiresAddressType() const; 30 | QString name() const; 31 | QString address() const; 32 | 33 | signals: 34 | void deviceChanged(); 35 | 36 | private slots: 37 | void hostModeChanged(QBluetoothLocalDevice::HostMode mode); 38 | void initLocalDevice(); 39 | 40 | private: 41 | QBluetoothLocalDevice *m_localDevice = nullptr; 42 | bool m_hasPermission = false; 43 | }; 44 | 45 | #endif // CONNECTIONHANDLER_H 46 | -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/deviceinfo.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #include "deviceinfo.h" 5 | #include "heartrate-global.h" 6 | 7 | #include 8 | #include 9 | 10 | using namespace Qt::StringLiterals; 11 | 12 | DeviceInfo::DeviceInfo(const QBluetoothDeviceInfo &info): 13 | m_device(info) 14 | { 15 | } 16 | 17 | QBluetoothDeviceInfo DeviceInfo::getDevice() const 18 | { 19 | return m_device; 20 | } 21 | 22 | QString DeviceInfo::getName() const 23 | { 24 | if (simulator) 25 | return u"Demo BT Device"_s; 26 | return m_device.name(); 27 | } 28 | 29 | QString DeviceInfo::getAddress() const 30 | { 31 | if (simulator) 32 | return u"00:11:22:33:44:55"_s; 33 | #ifdef Q_OS_DARWIN 34 | // workaround for Core Bluetooth: 35 | return m_device.deviceUuid().toString(); 36 | #else 37 | return m_device.address().toString(); 38 | #endif 39 | } 40 | 41 | void DeviceInfo::setDevice(const QBluetoothDeviceInfo &device) 42 | { 43 | m_device = device; 44 | emit deviceChanged(); 45 | } 46 | -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/deviceinfo.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #ifndef DEVICEINFO_H 5 | #define DEVICEINFO_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | class DeviceInfo: public QObject 13 | { 14 | Q_OBJECT 15 | 16 | Q_PROPERTY(QString deviceName READ getName NOTIFY deviceChanged) 17 | Q_PROPERTY(QString deviceAddress READ getAddress NOTIFY deviceChanged) 18 | 19 | public: 20 | DeviceInfo(const QBluetoothDeviceInfo &device); 21 | 22 | void setDevice(const QBluetoothDeviceInfo &device); 23 | QString getName() const; 24 | QString getAddress() const; 25 | QBluetoothDeviceInfo getDevice() const; 26 | 27 | signals: 28 | void deviceChanged(); 29 | 30 | private: 31 | QBluetoothDeviceInfo m_device; 32 | }; 33 | 34 | #endif // DEVICEINFO_H 35 | -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/doc/images/heartgame-result.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/heartrate-game/doc/images/heartgame-result.webp -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/doc/images/heartgame-running.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/heartrate-game/doc/images/heartgame-running.webp -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/doc/images/heartgame-search.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/heartrate-game/doc/images/heartgame-search.webp -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/doc/images/heartgame-start.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/heartrate-game/doc/images/heartgame-start.webp -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/heartrate-game.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | TARGET = heartrate-game 3 | 4 | QT += qml quick bluetooth 5 | 6 | CONFIG += qmltypes 7 | QML_IMPORT_NAME = HeartRateGame 8 | QML_IMPORT_MAJOR_VERSION = 1 9 | 10 | HEADERS += \ 11 | connectionhandler.h \ 12 | deviceinfo.h \ 13 | devicefinder.h \ 14 | devicehandler.h \ 15 | bluetoothbaseclass.h \ 16 | heartrate-global.h 17 | 18 | SOURCES += main.cpp \ 19 | connectionhandler.cpp \ 20 | deviceinfo.cpp \ 21 | devicefinder.cpp \ 22 | devicehandler.cpp \ 23 | bluetoothbaseclass.cpp 24 | 25 | qml_resources.files = \ 26 | qmldir \ 27 | App.qml \ 28 | BluetoothAlarmDialog.qml \ 29 | BottomLine.qml \ 30 | Connect.qml \ 31 | GameButton.qml \ 32 | GamePage.qml \ 33 | GameSettings.qml \ 34 | Measure.qml \ 35 | SplashScreen.qml \ 36 | Stats.qml \ 37 | StatsLabel.qml \ 38 | TitleBar.qml \ 39 | Main.qml \ 40 | images/alert.svg \ 41 | images/bluetooth.svg \ 42 | images/bt_off_to_on.png \ 43 | images/clock.svg \ 44 | images/heart.png \ 45 | images/logo.png \ 46 | images/progress.svg \ 47 | images/search.svg 48 | 49 | qml_resources.prefix = /qt/qml/HeartRateGame 50 | 51 | RESOURCES = qml_resources 52 | 53 | ios: QMAKE_INFO_PLIST = ../shared/Info.qmake.ios.plist 54 | macos: QMAKE_INFO_PLIST = ../shared/Info.qmake.macos.plist 55 | 56 | target.path = $$[QT_INSTALL_EXAMPLES]/bluetooth/heartrate-game 57 | INSTALLS += target 58 | -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/heartrate-global.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #ifndef HEARTRATEGLOBAL_H 5 | #define HEARTRATEGLOBAL_H 6 | 7 | extern bool simulator; 8 | 9 | #endif // HEARTRATEGLOBAL_H 10 | -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/images/alert.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/images/bluetooth.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/images/bt_off_to_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/heartrate-game/images/bt_off_to_on.png -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/images/clock.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/images/heart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/heartrate-game/images/heart.png -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/heartrate-game/images/logo.png -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/images/search.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-game/qmldir: -------------------------------------------------------------------------------- 1 | module HeartRateGame 2 | prefer :/qt/qml/HeartRateGame/ 3 | App 1.0 App.qml 4 | BluetoothAlarmDialog 1.0 BluetoothAlarmDialog.qml 5 | BottomLine 1.0 BottomLine.qml 6 | Connect 1.0 Connect.qml 7 | GameButton 1.0 GameButton.qml 8 | GamePage 1.0 GamePage.qml 9 | singleton GameSettings 1.0 GameSettings.qml 10 | Measure 1.0 Measure.qml 11 | SplashScreen 1.0 SplashScreen.qml 12 | Stats 1.0 Stats.qml 13 | StatsLabel 1.0 StatsLabel.qml 14 | TitleBar 1.0 TitleBar.qml 15 | Main 1.0 Main.qml 16 | -------------------------------------------------------------------------------- /examples/bluetooth/heartrate-server/heartrate-server.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | TARGET = heartrate-server 3 | 4 | QT = core bluetooth 5 | android|darwin: QT += gui 6 | 7 | CONFIG += console 8 | 9 | SOURCES += main.cpp 10 | 11 | ios: QMAKE_INFO_PLIST = ../shared/Info.qmake.ios.plist 12 | macos: QMAKE_INFO_PLIST = ../shared/Info.qmake.macos.plist 13 | 14 | target.path = $$[QT_INSTALL_EXAMPLES]/bluetooth/heartrate-server 15 | INSTALLS += target 16 | -------------------------------------------------------------------------------- /examples/bluetooth/lowenergyscanner/Dialog.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 BlackBerry Limited. All rights reserved. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | import QtQuick 5 | 6 | Rectangle { 7 | id: dialog 8 | width: parent.width / 3 * 2 9 | height: dialogTextId.height + background.height + 20 10 | z: 50 11 | property string dialogText: "" 12 | property bool busyImage: true 13 | border.width: 1 14 | border.color: "#363636" 15 | radius: 10 16 | 17 | Text { 18 | id: dialogTextId 19 | horizontalAlignment: Text.AlignHCenter 20 | verticalAlignment: Text.AlignVCenter 21 | anchors.horizontalCenter: parent.horizontalCenter 22 | anchors.top: parent.top 23 | anchors.topMargin: 10 24 | 25 | elide: Text.ElideMiddle 26 | text: dialog.dialogText 27 | color: "#363636" 28 | wrapMode: Text.Wrap 29 | } 30 | 31 | Image { 32 | id: background 33 | 34 | width: 20 35 | height: 20 36 | anchors.top: dialogTextId.bottom 37 | anchors.horizontalCenter: dialogTextId.horizontalCenter 38 | visible: parent.busyImage 39 | source: "assets/busy_dark.png" 40 | fillMode: Image.PreserveAspectFit 41 | NumberAnimation on rotation { 42 | duration: 3000 43 | from: 0 44 | to: 360 45 | loops: Animation.Infinite 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /examples/bluetooth/lowenergyscanner/Header.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 BlackBerry Limited. All rights reserved. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | import QtQuick 5 | 6 | Rectangle { 7 | id: header 8 | width: parent.width 9 | height: 70 10 | border.width: 1 11 | border.color: "#363636" 12 | radius: 5 13 | property string headerText: "" 14 | 15 | Text { 16 | horizontalAlignment: Text.AlignHCenter 17 | verticalAlignment: Text.AlignVCenter 18 | anchors.fill: parent 19 | text: header.headerText 20 | font.bold: true 21 | font.pointSize: 20 22 | elide: Text.ElideMiddle 23 | color: "#363636" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /examples/bluetooth/lowenergyscanner/Label.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 BlackBerry Limited. All rights reserved. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | import QtQuick 5 | 6 | Text { 7 | property string textContent: "" 8 | font.pointSize: 20 9 | anchors.horizontalCenter: parent.horizontalCenter 10 | color: "#363636" 11 | horizontalAlignment: Text.AlignHCenter 12 | elide: Text.ElideMiddle 13 | width: parent.width 14 | wrapMode: Text.Wrap 15 | text: textContent 16 | } 17 | -------------------------------------------------------------------------------- /examples/bluetooth/lowenergyscanner/Main.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | import QtQuick 5 | import QtQuick.Layouts 6 | 7 | Window { 8 | id: main 9 | 10 | width: 300 11 | height: 600 12 | visible: true 13 | 14 | StackLayout { 15 | id: pagesLayout 16 | anchors.fill: parent 17 | currentIndex: 0 18 | 19 | Devices { 20 | onShowServices: pagesLayout.currentIndex = 1 21 | } 22 | Services { 23 | onShowDevices: pagesLayout.currentIndex = 0 24 | onShowCharacteristics: pagesLayout.currentIndex = 2 25 | } 26 | Characteristics { 27 | onShowDevices: pagesLayout.currentIndex = 0 28 | onShowServices: pagesLayout.currentIndex = 1 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /examples/bluetooth/lowenergyscanner/assets/busy_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/lowenergyscanner/assets/busy_dark.png -------------------------------------------------------------------------------- /examples/bluetooth/lowenergyscanner/characteristicinfo.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 BlackBerry Limited. All rights reserved. 2 | // Copyright (C) 2017 The Qt Company Ltd. 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 4 | 5 | #ifndef CHARACTERISTICINFO_H 6 | #define CHARACTERISTICINFO_H 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | class CharacteristicInfo: public QObject 16 | { 17 | Q_OBJECT 18 | Q_PROPERTY(QString characteristicName READ getName NOTIFY characteristicChanged) 19 | Q_PROPERTY(QString characteristicUuid READ getUuid NOTIFY characteristicChanged) 20 | Q_PROPERTY(QString characteristicValue READ getValue NOTIFY characteristicChanged) 21 | Q_PROPERTY(QString characteristicPermission READ getPermission NOTIFY characteristicChanged) 22 | 23 | QML_ANONYMOUS 24 | 25 | public: 26 | CharacteristicInfo() = default; 27 | CharacteristicInfo(const QLowEnergyCharacteristic &characteristic); 28 | void setCharacteristic(const QLowEnergyCharacteristic &characteristic); 29 | QString getName() const; 30 | QString getUuid() const; 31 | QString getValue() const; 32 | QString getPermission() const; 33 | QLowEnergyCharacteristic getCharacteristic() const; 34 | 35 | Q_SIGNALS: 36 | void characteristicChanged(); 37 | 38 | private: 39 | QLowEnergyCharacteristic m_characteristic; 40 | }; 41 | 42 | #endif // CHARACTERISTICINFO_H 43 | -------------------------------------------------------------------------------- /examples/bluetooth/lowenergyscanner/deviceinfo.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 BlackBerry Limited. All rights reserved. 2 | // Copyright (C) 2017 The Qt Company Ltd. 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 4 | 5 | #include "deviceinfo.h" 6 | 7 | #ifdef Q_OS_DARWIN 8 | # include 9 | #else 10 | # include 11 | #endif 12 | 13 | DeviceInfo::DeviceInfo(const QBluetoothDeviceInfo &d) 14 | { 15 | device = d; 16 | } 17 | 18 | QString DeviceInfo::getAddress() const 19 | { 20 | #ifdef Q_OS_DARWIN 21 | // On OS X and iOS we do not have addresses, 22 | // only unique UUIDs generated by Core Bluetooth. 23 | return device.deviceUuid().toString(); 24 | #else 25 | return device.address().toString(); 26 | #endif 27 | } 28 | 29 | QString DeviceInfo::getName() const 30 | { 31 | return device.name(); 32 | } 33 | 34 | QBluetoothDeviceInfo DeviceInfo::getDevice() 35 | { 36 | return device; 37 | } 38 | 39 | void DeviceInfo::setDevice(const QBluetoothDeviceInfo &dev) 40 | { 41 | device = QBluetoothDeviceInfo(dev); 42 | Q_EMIT deviceChanged(); 43 | } 44 | -------------------------------------------------------------------------------- /examples/bluetooth/lowenergyscanner/deviceinfo.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 BlackBerry Limited. All rights reserved. 2 | // Copyright (C) 2017 The Qt Company Ltd. 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 4 | 5 | #ifndef DEVICEINFO_H 6 | #define DEVICEINFO_H 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | class DeviceInfo: public QObject 16 | { 17 | Q_OBJECT 18 | Q_PROPERTY(QString deviceName READ getName NOTIFY deviceChanged) 19 | Q_PROPERTY(QString deviceAddress READ getAddress NOTIFY deviceChanged) 20 | 21 | QML_ANONYMOUS 22 | 23 | public: 24 | DeviceInfo() = default; 25 | DeviceInfo(const QBluetoothDeviceInfo &d); 26 | QString getAddress() const; 27 | QString getName() const; 28 | QBluetoothDeviceInfo getDevice(); 29 | void setDevice(const QBluetoothDeviceInfo &dev); 30 | 31 | Q_SIGNALS: 32 | void deviceChanged(); 33 | 34 | private: 35 | QBluetoothDeviceInfo device; 36 | }; 37 | 38 | #endif // DEVICEINFO_H 39 | -------------------------------------------------------------------------------- /examples/bluetooth/lowenergyscanner/doc/images/lowenergyscanner-chars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/lowenergyscanner/doc/images/lowenergyscanner-chars.png -------------------------------------------------------------------------------- /examples/bluetooth/lowenergyscanner/doc/images/lowenergyscanner-devices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/lowenergyscanner/doc/images/lowenergyscanner-devices.png -------------------------------------------------------------------------------- /examples/bluetooth/lowenergyscanner/doc/images/lowenergyscanner-services.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/bluetooth/lowenergyscanner/doc/images/lowenergyscanner-services.png -------------------------------------------------------------------------------- /examples/bluetooth/lowenergyscanner/lowenergyscanner.pro: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2023 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | TEMPLATE = app 5 | TARGET = lowenergyscanner 6 | 7 | QT += quick bluetooth 8 | 9 | CONFIG += qmltypes 10 | QML_IMPORT_NAME = Scanner 11 | QML_IMPORT_MAJOR_VERSION = 1 12 | 13 | SOURCES += main.cpp \ 14 | device.cpp \ 15 | deviceinfo.cpp \ 16 | serviceinfo.cpp \ 17 | characteristicinfo.cpp 18 | 19 | HEADERS += \ 20 | device.h \ 21 | deviceinfo.h \ 22 | serviceinfo.h \ 23 | characteristicinfo.h 24 | 25 | qml_resources.files = \ 26 | qmldir \ 27 | Characteristics.qml \ 28 | Devices.qml \ 29 | Dialog.qml \ 30 | Header.qml \ 31 | Label.qml \ 32 | Main.qml \ 33 | Menu.qml \ 34 | Services.qml \ 35 | assets/busy_dark.png 36 | 37 | qml_resources.prefix = /qt/qml/Scanner 38 | 39 | RESOURCES = qml_resources 40 | 41 | ios: QMAKE_INFO_PLIST = ../shared/Info.qmake.ios.plist 42 | macos: QMAKE_INFO_PLIST = ../shared/Info.qmake.macos.plist 43 | 44 | target.path = $$[QT_INSTALL_EXAMPLES]/bluetooth/lowenergyscanner 45 | INSTALLS += target 46 | -------------------------------------------------------------------------------- /examples/bluetooth/lowenergyscanner/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 BlackBerry Limited. All rights reserved. 2 | // Copyright (C) 2017 The Qt Company Ltd. 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 4 | 5 | #include "device.h" 6 | 7 | #include 8 | 9 | #include 10 | 11 | #include 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | // QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true")); 16 | QGuiApplication app(argc, argv); 17 | 18 | QQmlApplicationEngine engine; 19 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed, &app, 20 | []() { QCoreApplication::exit(1); }, Qt::QueuedConnection); 21 | engine.loadFromModule("Scanner", "Main"); 22 | 23 | return app.exec(); 24 | } 25 | -------------------------------------------------------------------------------- /examples/bluetooth/lowenergyscanner/qmldir: -------------------------------------------------------------------------------- 1 | module Scanner 2 | prefer :/qt/qml/Scanner/ 3 | Characteristics 1.0 Characteristics.qml 4 | Devices 1.0 Devices.qml 5 | Dialog 1.0 Dialog.qml 6 | Header 1.0 Header.qml 7 | Label 1.0 Label.qml 8 | Main 1.0 Main.qml 9 | Menu 1.0 Menu.qml 10 | Services 1.0 Services.qml 11 | 12 | -------------------------------------------------------------------------------- /examples/bluetooth/lowenergyscanner/serviceinfo.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 BlackBerry Limited. All rights reserved. 2 | // Copyright (C) 2017 The Qt Company Ltd. 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 4 | 5 | #ifndef SERVICEINFO_H 6 | #define SERVICEINFO_H 7 | 8 | #include 9 | 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | class QLowEnergyService; 14 | QT_END_NAMESPACE 15 | 16 | class ServiceInfo: public QObject 17 | { 18 | Q_OBJECT 19 | Q_PROPERTY(QString serviceName READ getName NOTIFY serviceChanged) 20 | Q_PROPERTY(QString serviceUuid READ getUuid NOTIFY serviceChanged) 21 | Q_PROPERTY(QString serviceType READ getType NOTIFY serviceChanged) 22 | 23 | QML_ANONYMOUS 24 | 25 | public: 26 | ServiceInfo() = default; 27 | ServiceInfo(QLowEnergyService *service); 28 | QLowEnergyService *service() const; 29 | QString getUuid() const; 30 | QString getName() const; 31 | QString getType() const; 32 | 33 | Q_SIGNALS: 34 | void serviceChanged(); 35 | 36 | private: 37 | QLowEnergyService *m_service = nullptr; 38 | }; 39 | 40 | #endif // SERVICEINFO_H 41 | -------------------------------------------------------------------------------- /examples/bluetooth/shared/Info.cmake.macos.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleExecutable 6 | ${MACOSX_BUNDLE_EXECUTABLE_NAME} 7 | CFBundleIconFile 8 | ${MACOSX_BUNDLE_ICON_FILE} 9 | CFBundleIdentifier 10 | ${MACOSX_BUNDLE_GUI_IDENTIFIER} 11 | CFBundlePackageType 12 | APPL 13 | CFBundleSignature 14 | ???? 15 | LSMinimumSystemVersion 16 | ${CMAKE_OSX_DEPLOYMENT_TARGET} 17 | NSPrincipalClass 18 | NSApplication 19 | NSBluetoothAlwaysUsageDescription 20 | Qt BT Example wants to access your Bluetooth adapter 21 | NSSupportsAutomaticGraphicsSwitching 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/bluetooth/shared/Info.qmake.macos.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleExecutable 6 | ${EXECUTABLE_NAME} 7 | CFBundleIconFile 8 | 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundlePackageType 12 | APPL 13 | CFBundleSignature 14 | ???? 15 | LSMinimumSystemVersion 16 | ${MACOSX_DEPLOYMENT_TARGET} 17 | NSPrincipalClass 18 | NSApplication 19 | NSBluetoothAlwaysUsageDescription 20 | Qt BT Example wants to access your Bluetooth adapter 21 | NSSupportsAutomaticGraphicsSwitching 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/examples.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | qtHaveModule(bluetooth): SUBDIRS += bluetooth 4 | qtHaveModule(nfc): SUBDIRS += nfc 5 | -------------------------------------------------------------------------------- /examples/nfc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | if(TARGET Qt6::Widgets) 5 | qt_internal_add_example(annotatedurl) 6 | endif() 7 | if(TARGET Qt6::QuickControls2) 8 | qt_internal_add_example(ndefeditor) 9 | endif() 10 | -------------------------------------------------------------------------------- /examples/nfc/annotatedurl/annotatedurl.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #ifndef ANNOTATEDURL_H 5 | #define ANNOTATEDURL_H 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | QT_FORWARD_DECLARE_CLASS(QNearFieldTarget) 14 | QT_FORWARD_DECLARE_CLASS(QPixmap) 15 | QT_FORWARD_DECLARE_CLASS(QUrl) 16 | 17 | //! [0] 18 | class AnnotatedUrl : public QObject 19 | { 20 | Q_OBJECT 21 | 22 | public: 23 | explicit AnnotatedUrl(QObject *parent = 0); 24 | ~AnnotatedUrl(); 25 | 26 | void startDetection(); 27 | 28 | signals: 29 | void annotatedUrl(const QUrl &url, const QString &title, const QPixmap &pixmap); 30 | void nfcStateChanged(bool enabled); 31 | void tagError(const QString &error); 32 | 33 | public slots: 34 | void targetDetected(QNearFieldTarget *target); 35 | void targetLost(QNearFieldTarget *target); 36 | void handleMessage(const QNdefMessage &message, QNearFieldTarget *target); 37 | void handlePolledNdefMessage(QNdefMessage message); 38 | void handleAdapterStateChange(QNearFieldManager::AdapterState state); 39 | 40 | private: 41 | QNearFieldManager *manager; 42 | QNdefFilter messageFilter; 43 | }; 44 | //! [0] 45 | 46 | #endif // ANNOTATEDURL_H 47 | -------------------------------------------------------------------------------- /examples/nfc/annotatedurl/annotatedurl.pro: -------------------------------------------------------------------------------- 1 | QT += nfc widgets 2 | 3 | CONFIG += strict_flags 4 | 5 | TARGET = annotatedurl 6 | 7 | SOURCES += main.cpp \ 8 | mainwindow.cpp \ 9 | annotatedurl.cpp 10 | 11 | HEADERS += mainwindow.h \ 12 | annotatedurl.h 13 | 14 | ios: QMAKE_INFO_PLIST = Info.plist 15 | 16 | android { 17 | ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android 18 | 19 | DISTFILES += \ 20 | android/AndroidManifest.xml 21 | } 22 | 23 | target.path = $$[QT_INSTALL_EXAMPLES]/nfc/annotatedurl 24 | INSTALLS += target 25 | -------------------------------------------------------------------------------- /examples/nfc/annotatedurl/doc/images/annotatedurl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/annotatedurl/doc/images/annotatedurl.png -------------------------------------------------------------------------------- /examples/nfc/annotatedurl/doc/images/annotatedurl2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/annotatedurl/doc/images/annotatedurl2.png -------------------------------------------------------------------------------- /examples/nfc/annotatedurl/doc/images/annotatedurl3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/annotatedurl/doc/images/annotatedurl3.png -------------------------------------------------------------------------------- /examples/nfc/annotatedurl/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #include "annotatedurl.h" 5 | #include "mainwindow.h" 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | //! [0] 14 | int main(int argc, char *argv[]) 15 | { 16 | QApplication a(argc, argv); 17 | MainWindow mainWindow; 18 | AnnotatedUrl annotatedUrl; 19 | 20 | QObject::connect(&annotatedUrl, &AnnotatedUrl::annotatedUrl, 21 | &mainWindow, &MainWindow::displayAnnotatedUrl); 22 | QObject::connect(&annotatedUrl, &AnnotatedUrl::nfcStateChanged, 23 | &mainWindow, &MainWindow::nfcStateChanged); 24 | QObject::connect(&annotatedUrl, &AnnotatedUrl::tagError, 25 | &mainWindow, &MainWindow::showTagError); 26 | 27 | annotatedUrl.startDetection(); 28 | mainWindow.show(); 29 | 30 | return a.exec(); 31 | } 32 | //! [0] 33 | -------------------------------------------------------------------------------- /examples/nfc/annotatedurl/mainwindow.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #ifndef MAINWINDOW_H 5 | #define MAINWINDOW_H 6 | 7 | #include 8 | 9 | #include 10 | 11 | QT_FORWARD_DECLARE_CLASS(QMouseEvent) 12 | QT_FORWARD_DECLARE_CLASS(QUrl) 13 | QT_FORWARD_DECLARE_CLASS(QString) 14 | QT_FORWARD_DECLARE_CLASS(QLabel) 15 | QT_FORWARD_DECLARE_CLASS(QScreen) 16 | 17 | class MainWindow : public QWidget 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | explicit MainWindow(QWidget *parent = 0); 23 | ~MainWindow(); 24 | 25 | public slots: 26 | void displayAnnotatedUrl(const QUrl &url, const QString &title, const QPixmap &pixmap); 27 | void nfcStateChanged(bool enabled); 28 | void showTagError(const QString &message); 29 | 30 | protected: 31 | void mouseReleaseEvent(QMouseEvent *event) override; 32 | void moveEvent(QMoveEvent *event) override; 33 | 34 | private slots: 35 | void updateWidgetLayout(Qt::ScreenOrientation orientation); 36 | 37 | private: 38 | void handleScreenChange(); 39 | 40 | QLabel *m_titleLabel; 41 | QLabel *m_infoLabel; 42 | QLabel *m_uriLabel; 43 | QLabel *m_landscapeIconLabel; 44 | QLabel *m_portraitIconLabel; 45 | QScreen *m_screen = nullptr; 46 | QPixmap m_pixmap; 47 | }; 48 | 49 | #endif // MAINWINDOW_H 50 | -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/Main.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | MainWindow { 5 | width: 480 6 | height: 640 7 | visible: true 8 | title: qsTr("NDEF Editor") 9 | } 10 | -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/NdefRecordDelegate.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | pragma ComponentBehavior: Bound 5 | import QtQuick 6 | import QtQuick.Controls 7 | import QtQuick.Layouts 8 | 9 | import NdefEditorModule 10 | 11 | SwipeDelegate { 12 | required property int index 13 | required property int recordType 14 | required property string recordText 15 | 16 | id: delegate 17 | 18 | contentItem: ColumnLayout { 19 | Label { 20 | text: qsTr("Record %L1 - %2").arg(delegate.index + 1).arg( 21 | delegate.describeRecordType(delegate.recordType)) 22 | font.bold: true 23 | } 24 | 25 | Label { 26 | text: delegate.recordText 27 | elide: Text.ElideRight 28 | maximumLineCount: 1 29 | Layout.fillWidth: true 30 | } 31 | } 32 | 33 | swipe.left: Button { 34 | text: qsTr("Delete") 35 | padding: 12 36 | height: delegate.height 37 | anchors.left: delegate.left 38 | SwipeDelegate.onClicked: delegate.deleteClicked() 39 | } 40 | 41 | function describeRecordType(type) { 42 | switch (type) { 43 | case NdefMessageModel.TextRecord: return qsTr("Text") 44 | case NdefMessageModel.UriRecord: return qsTr("URI") 45 | default: return qsTr("Other") 46 | } 47 | } 48 | 49 | signal deleteClicked() 50 | } 51 | -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/doc/images/ndefeditor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/doc/images/ndefeditor.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/doc/src/ndefeditor.qdoc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only 3 | 4 | /*! 5 | \example ndefeditor 6 | \title NDEF Editor 7 | \examplecategory {Connectivity} 8 | \meta tags {nfc, ndef} 9 | \brief Reads and writes NFC Data Exchange Format (NDEF) messages to NFC Forum Tags. 10 | 11 | The NDEF Editor example uses \l{Qt NFC} to read and write NFC Data Exchange Format 12 | (NDEF) messages to NFC Forum Tags. NDEF messages can be composed by 13 | adding text and URI records. Records can be deleted by swiping them to the left. 14 | 15 | Press \b {Write to Tag} to write the records to an NFC tag. 16 | 17 | Press \b {Read Tag} to read the contents of an NFC tag. A successful read of an 18 | NFC tag replaces the manually added records with the NDEF message from the tag. 19 | If the read operation was cancelled or failed, the NDEF message remains 20 | unchanged. 21 | 22 | \image ndefeditor.png 23 | 24 | \sa {Qt NFC} 25 | */ 26 | -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20/add.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20/arrow_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20/arrow_back.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20/file_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20/file_download.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20/file_upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20/file_upload.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20/link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20/link.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20/text_snippet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20/text_snippet.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20@2/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20@2/add.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20@2/arrow_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20@2/arrow_back.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20@2/file_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20@2/file_download.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20@2/file_upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20@2/file_upload.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20@2/link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20@2/link.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20@2/text_snippet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20@2/text_snippet.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20@3/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20@3/add.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20@3/arrow_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20@3/arrow_back.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20@3/file_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20@3/file_download.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20@3/file_upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20@3/file_upload.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20@3/link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20@3/link.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20@3/text_snippet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20@3/text_snippet.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20@4/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20@4/add.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20@4/arrow_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20@4/arrow_back.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20@4/file_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20@4/file_download.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20@4/file_upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20@4/file_upload.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20@4/link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20@4/link.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/20x20@4/text_snippet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/examples/nfc/ndefeditor/icons/ndefeditor/20x20@4/text_snippet.png -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/REUSE.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[annotations]] 4 | path = ["20x20/*", "20x20@2/*", "20x20@3/*", "20x20@4/*"] 5 | precedence = "closest" 6 | SPDX-FileCopyrightText = "Copyright 2018 Google, Inc. All Rights Reserved." 7 | SPDX-License-Identifier = "Apache-2.0" 8 | -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/index.theme: -------------------------------------------------------------------------------- 1 | [Icon Theme] 2 | Name=ndefeditor 3 | Directories=20x20,20x20@2,20x20@3,20x20@4 4 | 5 | [20x20] 6 | Size=20 7 | Type=Fixed 8 | 9 | [20x20@2] 10 | Size=20 11 | Scale=2 12 | Type=Fixed 13 | 14 | [20x20@3] 15 | Size=20 16 | Scale=3 17 | Type=Fixed 18 | 19 | [20x20@4] 20 | Size=20 21 | Scale=4 22 | Type=Fixed 23 | -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/icons/ndefeditor/qt_attribution.json: -------------------------------------------------------------------------------- 1 | { 2 | "Id": "ndefeditor", 3 | "Name": "Selected Material Icons", 4 | "QDocModule": "qtnfc", 5 | "QtUsage": "Used in NDEF Editor example for Qt NFC.", 6 | "QtParts": [ 7 | "examples" 8 | ], 9 | "Files": "20x20 20x20@2 20x20@3 20x20@4", 10 | "Homepage": "https://fonts.google.com/icons", 11 | "License": "Apache License Version 2.0", 12 | "LicenseId": "Apache-2.0", 13 | "Copyright": "Copyright 2018 Google, Inc. All Rights Reserved." 14 | } 15 | -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | int main(int argc, char *argv[]) 9 | { 10 | QGuiApplication app(argc, argv); 11 | 12 | QIcon::setThemeName("ndefeditor"); 13 | 14 | QQmlApplicationEngine engine; 15 | 16 | QObject::connect( 17 | &engine, &QQmlApplicationEngine::objectCreationFailed, &app, 18 | []() { QCoreApplication::exit(1); }, Qt::QueuedConnection); 19 | engine.loadFromModule("NdefEditorModule", "Main"); 20 | 21 | return app.exec(); 22 | } 23 | -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/nfcmanager.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #include "nfcmanager.h" 5 | 6 | #include 7 | 8 | #include "nfctarget.h" 9 | 10 | NfcManager::NfcManager(QObject *parent) : QObject(parent) 11 | { 12 | m_manager = new QNearFieldManager(this); 13 | 14 | connect(m_manager, &QNearFieldManager::targetDetected, this, [this](QNearFieldTarget *target) { 15 | auto jsTarget = new NfcTarget(target); 16 | QJSEngine::setObjectOwnership(jsTarget, QJSEngine::JavaScriptOwnership); 17 | Q_EMIT targetDetected(jsTarget); 18 | }); 19 | } 20 | 21 | void NfcManager::startTargetDetection() 22 | { 23 | m_manager->startTargetDetection(QNearFieldTarget::NdefAccess); 24 | } 25 | 26 | void NfcManager::stopTargetDetection() 27 | { 28 | m_manager->stopTargetDetection(); 29 | } 30 | -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/nfcmanager.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #ifndef NFCMANAGER_H 5 | #define NFCMANAGER_H 6 | 7 | #include 8 | 9 | #include 10 | 11 | #include "nfctarget.h" 12 | 13 | QT_FORWARD_DECLARE_CLASS(QNearFieldManager); 14 | 15 | class NfcManager : public QObject 16 | { 17 | Q_OBJECT 18 | QML_ELEMENT 19 | 20 | public: 21 | explicit NfcManager(QObject *parent = nullptr); 22 | 23 | Q_INVOKABLE void startTargetDetection(); 24 | Q_INVOKABLE void stopTargetDetection(); 25 | 26 | Q_SIGNALS: 27 | void targetDetected(NfcTarget *target); 28 | 29 | private: 30 | QNearFieldManager *m_manager; 31 | }; 32 | 33 | #endif // NFCMANAGER_H 34 | -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/nfctarget.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #include "nfctarget.h" 5 | 6 | NfcTarget::NfcTarget(QNearFieldTarget *target, QObject *parent) : QObject(parent), m_target(target) 7 | { 8 | target->setParent(this); 9 | 10 | connect(target, &QNearFieldTarget::ndefMessageRead, this, &NfcTarget::ndefMessageRead); 11 | connect(target, &QNearFieldTarget::requestCompleted, this, &NfcTarget::requestCompleted); 12 | connect(target, &QNearFieldTarget::error, this, &NfcTarget::error); 13 | } 14 | 15 | bool NfcTarget::readNdefMessages() 16 | { 17 | if (m_target.isNull()) 18 | return false; 19 | 20 | auto req = m_target->readNdefMessages(); 21 | return req.isValid(); 22 | } 23 | 24 | bool NfcTarget::writeNdefMessage(const QNdefMessage &message) 25 | { 26 | if (m_target.isNull()) 27 | return false; 28 | 29 | auto req = m_target->writeNdefMessages({ message }); 30 | return req.isValid(); 31 | } 32 | -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/nfctarget.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #ifndef NFCTARGET_H 5 | #define NFCTARGET_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | class NfcTarget : public QObject 15 | { 16 | Q_OBJECT 17 | QML_ELEMENT 18 | QML_UNCREATABLE("Created by NfcManager") 19 | 20 | public: 21 | explicit NfcTarget(QNearFieldTarget *target, QObject *parent = nullptr); 22 | 23 | Q_INVOKABLE bool readNdefMessages(); 24 | Q_INVOKABLE bool writeNdefMessage(const QNdefMessage &message); 25 | 26 | Q_SIGNALS: 27 | void ndefMessageRead(const QNdefMessage &message); 28 | void requestCompleted(); 29 | void error(QNearFieldTarget::Error error); 30 | 31 | private: 32 | QPointer m_target; 33 | }; 34 | 35 | #endif // NFCTARGET_H 36 | -------------------------------------------------------------------------------- /examples/nfc/ndefeditor/qmldir: -------------------------------------------------------------------------------- 1 | module NdefEditorModule 2 | prefer :/qt/qml/NdefEditorModule/ 3 | Main 1.0 Main.qml 4 | MainWindow 1.0 MainWindow.qml 5 | NdefRecordDelegate 1.0 NdefRecordDelegate.qml 6 | -------------------------------------------------------------------------------- /examples/nfc/nfc.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | qtHaveModule(widgets) { 3 | SUBDIRS += annotatedurl 4 | } 5 | qtHaveModule(quickcontrols2) { 6 | SUBDIRS += ndefeditor 7 | } 8 | -------------------------------------------------------------------------------- /qt_cmdline.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2025 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | qt_commandline_subconfig(src/bluetooth) 5 | qt_commandline_subconfig(src/nfc) 6 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | # Evaluate features to decide what to build. 5 | # The config files will be written in the src/global module. 6 | qt_feature_evaluate_features("${CMAKE_CURRENT_SOURCE_DIR}/../configure.cmake") 7 | 8 | add_subdirectory(global) 9 | if(QT_FEATURE_bluetooth) 10 | add_subdirectory(bluetooth) 11 | endif() 12 | if(QT_FEATURE_nfc) 13 | add_subdirectory(nfc) 14 | endif() 15 | if(ANDROID) 16 | add_subdirectory(android) 17 | endif() 18 | 19 | if(QT_FEATURE_bluez) 20 | add_subdirectory(tools/sdpscanner) 21 | endif() 22 | -------------------------------------------------------------------------------- /src/android/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | if(TARGET Qt::Bluetooth) 5 | add_subdirectory(bluetooth) 6 | endif() 7 | if(TARGET Qt::Nfc) 8 | add_subdirectory(nfc) 9 | endif() 10 | -------------------------------------------------------------------------------- /src/android/bluetooth/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/android/bluetooth/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | set(java_sources 5 | src/org/qtproject/qt/android/bluetooth/QtBluetoothBroadcastReceiver.java 6 | src/org/qtproject/qt/android/bluetooth/QtBluetoothInputStreamThread.java 7 | src/org/qtproject/qt/android/bluetooth/QtBluetoothLE.java 8 | src/org/qtproject/qt/android/bluetooth/QtBluetoothLEServer.java 9 | src/org/qtproject/qt/android/bluetooth/QtBluetoothSocketServer.java 10 | src/org/qtproject/qt/android/bluetooth/QtBluetoothGattCharacteristic.java 11 | src/org/qtproject/qt/android/bluetooth/QtBluetoothGattDescriptor.java 12 | src/org/qtproject/qt/android/bluetooth/QtBluetoothUtility.java 13 | ) 14 | 15 | qt_internal_add_jar(Qt${QtConnectivity_VERSION_MAJOR}AndroidBluetooth 16 | INCLUDE_JARS ${QT_ANDROID_JAR} 17 | SOURCES ${java_sources} 18 | OUTPUT_DIR "${QT_BUILD_DIR}/jar" 19 | ) 20 | 21 | qt_path_join(destination ${INSTALL_DATADIR} "jar") 22 | 23 | install_jar(Qt${QtConnectivity_VERSION_MAJOR}AndroidBluetooth 24 | DESTINATION ${destination} 25 | COMPONENT Devel 26 | ) 27 | 28 | add_dependencies(Bluetooth Qt${QtConnectivity_VERSION_MAJOR}AndroidBluetooth) 29 | -------------------------------------------------------------------------------- /src/android/nfc/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/android/nfc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | set(java_sources 5 | src/org/qtproject/qt/android/nfc/QtNfc.java 6 | src/org/qtproject/qt/android/nfc/QtNfcBroadcastReceiver.java 7 | ) 8 | 9 | qt_internal_add_jar(Qt${QtConnectivity_VERSION_MAJOR}AndroidNfc 10 | INCLUDE_JARS ${QT_ANDROID_JAR} 11 | SOURCES ${java_sources} 12 | OUTPUT_DIR "${QT_BUILD_DIR}/jar" 13 | ) 14 | 15 | qt_path_join(destination ${INSTALL_DATADIR} "jar") 16 | 17 | install_jar(Qt${QtConnectivity_VERSION_MAJOR}AndroidNfc 18 | DESTINATION ${destination} 19 | COMPONENT Devel 20 | ) 21 | 22 | add_dependencies(Nfc Qt${QtConnectivity_VERSION_MAJOR}AndroidNfc) 23 | -------------------------------------------------------------------------------- /src/android/nfc/src/org/qtproject/qt/android/nfc/QtNfcBroadcastReceiver.java: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 Governikus GmbH & Co. KG 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | package org.qtproject.qt.android.nfc; 5 | 6 | import android.content.BroadcastReceiver; 7 | import android.content.Context; 8 | import android.content.Intent; 9 | import android.content.IntentFilter; 10 | import android.nfc.NfcAdapter; 11 | 12 | class QtNfcBroadcastReceiver extends BroadcastReceiver 13 | { 14 | final private long qtObject; 15 | final private Context qtContext; 16 | 17 | QtNfcBroadcastReceiver(long obj, Context context) 18 | { 19 | qtObject = obj; 20 | qtContext = context; 21 | IntentFilter filter = new IntentFilter(NfcAdapter.ACTION_ADAPTER_STATE_CHANGED); 22 | qtContext.registerReceiver(this, filter); 23 | } 24 | 25 | void unregisterReceiver() 26 | { 27 | qtContext.unregisterReceiver(this); 28 | } 29 | 30 | @Override 31 | public void onReceive(Context context, Intent intent) 32 | { 33 | final int state = intent.getIntExtra(NfcAdapter.EXTRA_ADAPTER_STATE, NfcAdapter.STATE_OFF); 34 | jniOnReceive(qtObject, state); 35 | } 36 | 37 | native void jniOnReceive(long qtObject, int state); 38 | } 39 | -------------------------------------------------------------------------------- /src/bluetooth/android/androidutils_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QANDROIDBLUETOOTHUTILS_H 5 | #define QANDROIDBLUETOOTHUTILS_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is not part of the Qt API. It exists purely as an 12 | // implementation detail. This header file may change from version to 13 | // version without notice, or even be removed. 14 | // 15 | // We mean it. 16 | // 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | QT_BEGIN_NAMESPACE 23 | 24 | // Checks if a permssion is already authorized or not 25 | bool ensureAndroidPermission(QBluetoothPermission::CommunicationModes modes); 26 | 27 | // Returns the default bluetooth adapter, or an invalid object if not available 28 | QJniObject getDefaultBluetoothAdapter(); 29 | 30 | QT_END_NAMESPACE 31 | 32 | #endif // QANDROIDBLUETOOTHUTILS_H 33 | -------------------------------------------------------------------------------- /src/bluetooth/android/servicediscoverybroadcastreceiver_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef SERVICEDISCOVERYBROADCASTRECEIVER_H 5 | #define SERVICEDISCOVERYBROADCASTRECEIVER_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is not part of the Qt API. It exists purely as an 12 | // implementation detail. This header file may change from version to 13 | // version without notice, or even be removed. 14 | // 15 | // We mean it. 16 | // 17 | 18 | #include "android/androidbroadcastreceiver_p.h" 19 | #include 20 | #include 21 | #include 22 | 23 | QT_BEGIN_NAMESPACE 24 | 25 | class QBluetoothDeviceInfo; 26 | 27 | class ServiceDiscoveryBroadcastReceiver : public AndroidBroadcastReceiver 28 | { 29 | Q_OBJECT 30 | public: 31 | ServiceDiscoveryBroadcastReceiver(QObject* parent = nullptr); 32 | virtual void onReceive(JNIEnv *env, jobject context, jobject intent); 33 | virtual void onReceiveLeScan(JNIEnv *, jobject, jint, jbyteArray) {} 34 | 35 | static QList convertParcelableArray(const QJniArray &obj); 36 | 37 | signals: 38 | void uuidFetchFinished(const QBluetoothAddress &addr, const QList &serviceUuid); 39 | }; 40 | 41 | QT_END_NAMESPACE 42 | #endif // SERVICEDISCOVERYBROADCASTRECEIVER_H 43 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/REUSE.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[annotations]] 4 | path = ["**"] 5 | precedence = "closest" 6 | comment = "some generated files have no license in file" 7 | SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd." 8 | SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only" 9 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/adapter1_bluez5.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by qdbusxml2cpp version 0.8 3 | * Source file was org.bluez.Adapter1.xml 4 | * 5 | * qdbusxml2cpp is Copyright (C) The Qt Company Ltd. and other contributors. 6 | * 7 | * This is an auto-generated file. 8 | * This file may have been hand-edited. Look for HAND-EDIT comments 9 | * before re-generating it. 10 | */ 11 | 12 | #include "adapter1_bluez5_p.h" 13 | 14 | namespace QtBluetoothPrivate { 15 | 16 | /* 17 | * Implementation of interface class OrgBluezAdapter1Interface 18 | */ 19 | 20 | OrgBluezAdapter1Interface::OrgBluezAdapter1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) 21 | : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) 22 | { 23 | } 24 | 25 | OrgBluezAdapter1Interface::~OrgBluezAdapter1Interface() 26 | { 27 | } 28 | 29 | } // end of namespace QtBluetoothPrivate 30 | 31 | #include "moc_adapter1_bluez5_p.cpp" 32 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/battery1.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by qdbusxml2cpp version 0.8 3 | * Source file was org.bluez.Battery1.xml 4 | * 5 | * qdbusxml2cpp is Copyright (C) The Qt Company Ltd. and other contributors. 6 | * 7 | * This is an auto-generated file. 8 | * This file may have been hand-edited. Look for HAND-EDIT comments 9 | * before re-generating it. 10 | */ 11 | 12 | #include "battery1_p.h" 13 | 14 | namespace QtBluetoothPrivate { 15 | 16 | /* 17 | * Implementation of interface class OrgBluezBattery1Interface 18 | */ 19 | 20 | OrgBluezBattery1Interface::OrgBluezBattery1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) 21 | : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) 22 | { 23 | } 24 | 25 | OrgBluezBattery1Interface::~OrgBluezBattery1Interface() 26 | { 27 | } 28 | 29 | } // end of namespace QtBluetoothPrivate 30 | 31 | #include "moc_battery1_p.cpp" 32 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/bluez_data.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "bluez_data_p.h" 5 | 6 | QT_BEGIN_NAMESPACE 7 | 8 | QT_END_NAMESPACE 9 | 10 | #include "moc_bluez_data_p.cpp" 11 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/device1_bluez5.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by qdbusxml2cpp version 0.8 3 | * Source file was org.bluez.Device1.xml 4 | * 5 | * qdbusxml2cpp is Copyright (C) The Qt Company Ltd. and other contributors. 6 | * 7 | * This is an auto-generated file. 8 | * This file may have been hand-edited. Look for HAND-EDIT comments 9 | * before re-generating it. 10 | */ 11 | 12 | #include "device1_bluez5_p.h" 13 | 14 | namespace QtBluetoothPrivate { 15 | 16 | /* 17 | * Implementation of interface class OrgBluezDevice1Interface 18 | */ 19 | 20 | OrgBluezDevice1Interface::OrgBluezDevice1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) 21 | : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) 22 | { 23 | } 24 | 25 | OrgBluezDevice1Interface::~OrgBluezDevice1Interface() 26 | { 27 | } 28 | 29 | } // end of namespace QtBluetoothPrivate 30 | 31 | #include "moc_device1_bluez5_p.cpp" 32 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/gattchar1.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by qdbusxml2cpp version 0.8 3 | * Source file was org.bluez.GattCharacteristic1.xml 4 | * 5 | * qdbusxml2cpp is Copyright (C) The Qt Company Ltd. and other contributors. 6 | * 7 | * This is an auto-generated file. 8 | * This file may have been hand-edited. Look for HAND-EDIT comments 9 | * before re-generating it. 10 | */ 11 | 12 | #include "gattchar1_p.h" 13 | 14 | namespace QtBluetoothPrivate { 15 | 16 | /* 17 | * Implementation of interface class OrgBluezGattCharacteristic1Interface 18 | */ 19 | 20 | OrgBluezGattCharacteristic1Interface::OrgBluezGattCharacteristic1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) 21 | : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) 22 | { 23 | } 24 | 25 | OrgBluezGattCharacteristic1Interface::~OrgBluezGattCharacteristic1Interface() 26 | { 27 | } 28 | 29 | } // end of namespace QtBluetoothPrivate 30 | 31 | #include "moc_gattchar1_p.cpp" 32 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/gattdesc1.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by qdbusxml2cpp version 0.8 3 | * Source file was org.bluez.GattDescriptor1.xml 4 | * 5 | * qdbusxml2cpp is Copyright (C) The Qt Company Ltd. and other contributors. 6 | * 7 | * This is an auto-generated file. 8 | * This file may have been hand-edited. Look for HAND-EDIT comments 9 | * before re-generating it. 10 | */ 11 | 12 | #include "gattdesc1_p.h" 13 | 14 | namespace QtBluetoothPrivate { 15 | 16 | /* 17 | * Implementation of interface class OrgBluezGattDescriptor1Interface 18 | */ 19 | 20 | OrgBluezGattDescriptor1Interface::OrgBluezGattDescriptor1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) 21 | : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) 22 | { 23 | } 24 | 25 | OrgBluezGattDescriptor1Interface::~OrgBluezGattDescriptor1Interface() 26 | { 27 | } 28 | 29 | } // end of namespace QtBluetoothPrivate 30 | 31 | #include "moc_gattdesc1_p.cpp" 32 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/gattmanager1.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by qdbusxml2cpp version 0.8 3 | * Source file was org.bluez.GattManager1.xml 4 | * 5 | * qdbusxml2cpp is Copyright (C) The Qt Company Ltd. and other contributors. 6 | * 7 | * This is an auto-generated file. 8 | * This file may have been hand-edited. Look for HAND-EDIT comments 9 | * before re-generating it. 10 | */ 11 | 12 | #include "gattmanager1_p.h" 13 | 14 | namespace QtBluetoothPrivate { 15 | 16 | /* 17 | * Implementation of interface class OrgBluezGattManager1Interface 18 | */ 19 | 20 | OrgBluezGattManager1Interface::OrgBluezGattManager1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) 21 | : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) 22 | { 23 | } 24 | 25 | OrgBluezGattManager1Interface::~OrgBluezGattManager1Interface() 26 | { 27 | } 28 | 29 | } // end of namespace QtBluetoothPrivate 30 | 31 | #include "moc_gattmanager1_p.cpp" 32 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/gattservice1.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by qdbusxml2cpp version 0.8 3 | * Source file was org.bluez.GattService1.xml 4 | * 5 | * qdbusxml2cpp is Copyright (C) The Qt Company Ltd. and other contributors. 6 | * 7 | * This is an auto-generated file. 8 | * This file may have been hand-edited. Look for HAND-EDIT comments 9 | * before re-generating it. 10 | */ 11 | 12 | #include "gattservice1_p.h" 13 | 14 | namespace QtBluetoothPrivate { 15 | 16 | /* 17 | * Implementation of interface class OrgBluezGattService1Interface 18 | */ 19 | 20 | OrgBluezGattService1Interface::OrgBluezGattService1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) 21 | : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) 22 | { 23 | } 24 | 25 | OrgBluezGattService1Interface::~OrgBluezGattService1Interface() 26 | { 27 | } 28 | 29 | } // end of namespace QtBluetoothPrivate 30 | 31 | #include "moc_gattservice1_p.cpp" 32 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/leadvertisingmanager1.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by qdbusxml2cpp version 0.8 3 | * Source file was org.bluez.LEAdvertisingManager1.xml 4 | * 5 | * qdbusxml2cpp is Copyright (C) The Qt Company Ltd. and other contributors. 6 | * 7 | * This is an auto-generated file. 8 | * This file may have been hand-edited. Look for HAND-EDIT comments 9 | * before re-generating it. 10 | */ 11 | 12 | #include "leadvertisingmanager1_p.h" 13 | 14 | namespace QtBluetoothPrivate { 15 | 16 | /* 17 | * Implementation of interface class OrgBluezLEAdvertisingManager1Interface 18 | */ 19 | 20 | OrgBluezLEAdvertisingManager1Interface::OrgBluezLEAdvertisingManager1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) 21 | : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) 22 | { 23 | } 24 | 25 | OrgBluezLEAdvertisingManager1Interface::~OrgBluezLEAdvertisingManager1Interface() 26 | { 27 | } 28 | 29 | } // end of namespace QtBluetoothPrivate 30 | 31 | #include "moc_leadvertisingmanager1_p.cpp" 32 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/objectmanager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by qdbusxml2cpp version 0.8 3 | * Source file was org.freedesktop.dbus.objectmanager.xml 4 | * 5 | * qdbusxml2cpp is Copyright (C) The Qt Company Ltd. and other contributors. 6 | * 7 | * This is an auto-generated file. 8 | * This file may have been hand-edited. Look for HAND-EDIT comments 9 | * before re-generating it. 10 | */ 11 | 12 | #include "objectmanager_p.h" 13 | 14 | namespace QtBluetoothPrivate { 15 | 16 | /* 17 | * Implementation of interface class OrgFreedesktopDBusObjectManagerInterface 18 | */ 19 | 20 | OrgFreedesktopDBusObjectManagerInterface::OrgFreedesktopDBusObjectManagerInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) 21 | : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) 22 | { 23 | } 24 | 25 | OrgFreedesktopDBusObjectManagerInterface::~OrgFreedesktopDBusObjectManagerInterface() 26 | { 27 | } 28 | 29 | } // end of namespace QtBluetoothPrivate 30 | 31 | #include "moc_objectmanager_p.cpp" 32 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/org.bluez.Battery1.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/org.bluez.GattCharacteristic1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/org.bluez.GattDescriptor1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/org.bluez.GattManager1.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/org.bluez.GattService1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/org.bluez.LEAdvertisement1.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/org.bluez.LEAdvertisingManager1.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/org.bluez.Profile1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/org.bluez.ProfileManager1.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/org.freedesktop.dbus.objectmanager.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/org.freedesktop.dbus.properties.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/profile1.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by qdbusxml2cpp version 0.8 3 | * Source file was org.bluez.Profile1.xml 4 | * 5 | * qdbusxml2cpp is Copyright (C) The Qt Company Ltd. and other contributors. 6 | * 7 | * This is an auto-generated file. 8 | * This file may have been hand-edited. Look for HAND-EDIT comments 9 | * before re-generating it. 10 | */ 11 | 12 | #include "profile1_p.h" 13 | 14 | namespace QtBluetoothPrivate { 15 | 16 | /* 17 | * Implementation of interface class OrgBluezProfile1Interface 18 | */ 19 | 20 | OrgBluezProfile1Interface::OrgBluezProfile1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) 21 | : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) 22 | { 23 | } 24 | 25 | OrgBluezProfile1Interface::~OrgBluezProfile1Interface() 26 | { 27 | } 28 | 29 | } // end of namespace QtBluetoothPrivate 30 | 31 | #include "moc_profile1_p.cpp" 32 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/profile1context.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "profile1context_p.h" 5 | 6 | #include 7 | 8 | QT_BEGIN_NAMESPACE 9 | 10 | Q_DECLARE_LOGGING_CATEGORY(QT_BT_BLUEZ) 11 | 12 | OrgBluezProfile1ContextInterface::OrgBluezProfile1ContextInterface(QObject *parent) : QObject(parent) 13 | { 14 | } 15 | 16 | void OrgBluezProfile1ContextInterface::NewConnection(const QDBusObjectPath &/*remotePath*/, 17 | const QDBusUnixFileDescriptor &descriptor, 18 | const QVariantMap &/*properties*/) 19 | { 20 | qCDebug(QT_BT_BLUEZ) << "Profile Context: New Connection"; 21 | emit newConnection(descriptor); 22 | setDelayedReply(false); 23 | } 24 | 25 | void OrgBluezProfile1ContextInterface::RequestDisconnection(const QDBusObjectPath &/*remotePath*/) 26 | { 27 | qCDebug(QT_BT_BLUEZ) << "Profile Context: Request Disconnection"; 28 | setDelayedReply(false); 29 | } 30 | 31 | void OrgBluezProfile1ContextInterface::Release() 32 | { 33 | qCDebug(QT_BT_BLUEZ) << "Profile Context: Release"; 34 | } 35 | 36 | QT_END_NAMESPACE 37 | 38 | #include "moc_profile1context_p.cpp" 39 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/profilemanager1.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by qdbusxml2cpp version 0.8 3 | * Source file was org.bluez.ProfileManager1.xml 4 | * 5 | * qdbusxml2cpp is Copyright (C) The Qt Company Ltd. and other contributors. 6 | * 7 | * This is an auto-generated file. 8 | * This file may have been hand-edited. Look for HAND-EDIT comments 9 | * before re-generating it. 10 | */ 11 | 12 | #include "profilemanager1_p.h" 13 | 14 | namespace QtBluetoothPrivate { 15 | 16 | /* 17 | * Implementation of interface class OrgBluezProfileManager1Interface 18 | */ 19 | 20 | OrgBluezProfileManager1Interface::OrgBluezProfileManager1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) 21 | : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) 22 | { 23 | } 24 | 25 | OrgBluezProfileManager1Interface::~OrgBluezProfileManager1Interface() 26 | { 27 | } 28 | 29 | } // end of namespace QtBluetoothPrivate 30 | 31 | #include "moc_profilemanager1_p.cpp" 32 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/properties.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by qdbusxml2cpp version 0.8 3 | * Source file was org.freedesktop.dbus.properties.xml 4 | * 5 | * qdbusxml2cpp is Copyright (C) The Qt Company Ltd. and other contributors. 6 | * 7 | * This is an auto-generated file. 8 | * This file may have been hand-edited. Look for HAND-EDIT comments 9 | * before re-generating it. 10 | */ 11 | 12 | #include "properties_p.h" 13 | 14 | namespace QtBluetoothPrivate { 15 | 16 | /* 17 | * Implementation of interface class OrgFreedesktopDBusPropertiesInterface 18 | */ 19 | 20 | OrgFreedesktopDBusPropertiesInterface::OrgFreedesktopDBusPropertiesInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) 21 | : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) 22 | { 23 | } 24 | 25 | OrgFreedesktopDBusPropertiesInterface::~OrgFreedesktopDBusPropertiesInterface() 26 | { 27 | } 28 | 29 | } // end of namespace QtBluetoothPrivate 30 | 31 | #include "moc_properties_p.cpp" 32 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/servicemap.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "servicemap_p.h" 5 | 6 | QT_BEGIN_NAMESPACE 7 | 8 | QT_IMPL_METATYPE_EXTERN(ServiceMap) 9 | 10 | const QDBusArgument &operator>>(const QDBusArgument &argument, ServiceMap &serviceMap) 11 | { 12 | argument.beginMap(); 13 | 14 | while (!argument.atEnd()) { 15 | quint32 uuid; 16 | QString service; 17 | 18 | argument.beginMapEntry(); 19 | argument >> uuid; 20 | argument >> service; 21 | argument.endMapEntry(); 22 | 23 | serviceMap.insert(uuid, service); 24 | } 25 | 26 | argument.endMap(); 27 | 28 | return argument; 29 | } 30 | 31 | QT_END_NAMESPACE 32 | -------------------------------------------------------------------------------- /src/bluetooth/bluez/servicemap_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef SERVICEMAP_P_H 5 | #define SERVICEMAP_P_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is not part of the Qt API. It exists purely as an 12 | // implementation detail. This header file may change from version to 13 | // version without notice, or even be removed. 14 | // 15 | // We mean it. 16 | // 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | QT_BEGIN_NAMESPACE 26 | 27 | typedef QMap ServiceMap; 28 | 29 | const QDBusArgument &operator>>(const QDBusArgument &argument, ServiceMap &serviceMap); 30 | 31 | QT_END_NAMESPACE 32 | 33 | QT_DECL_METATYPE_EXTERN(ServiceMap, Q_BLUETOOTH_EXPORT) 34 | 35 | #endif // SERVICEMAP_P_H 36 | -------------------------------------------------------------------------------- /src/bluetooth/darwin/btconnectionmonitor_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef BTCONNECTIONMONITOR_P_H 5 | #define BTCONNECTIONMONITOR_P_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is not part of the Qt API. It exists purely as an 12 | // implementation detail. This header file may change from version to 13 | // version without notice, or even be removed. 14 | // 15 | // We mean it. 16 | // 17 | 18 | #include "btdelegates_p.h" 19 | 20 | #include 21 | 22 | #include 23 | 24 | #include 25 | 26 | #include 27 | 28 | @interface QT_MANGLE_NAMESPACE(DarwinBTConnectionMonitor) : NSObject 29 | 30 | - (id)initWithMonitor:(QT_PREPEND_NAMESPACE(DarwinBluetooth::ConnectionMonitor) *)monitor; 31 | - (void)connectionNotification:(id)notification withDevice:(IOBluetoothDevice *)device; 32 | - (void)connectionClosedNotification:(id)notification withDevice:(IOBluetoothDevice *)device; 33 | 34 | - (void)stopMonitoring; 35 | @end 36 | 37 | QT_NAMESPACE_ALIAS_OBJC_CLASS(DarwinBTConnectionMonitor); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/bluetooth/darwin/btdelegates.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "btdelegates_p.h" 5 | 6 | #if defined(Q_OS_MACOS) 7 | 8 | QT_BEGIN_NAMESPACE 9 | 10 | namespace DarwinBluetooth { 11 | 12 | DeviceInquiryDelegate::~DeviceInquiryDelegate() 13 | { 14 | } 15 | 16 | PairingDelegate::~PairingDelegate() 17 | { 18 | } 19 | 20 | SDPInquiryDelegate::~SDPInquiryDelegate() 21 | { 22 | } 23 | 24 | ChannelDelegate::~ChannelDelegate() 25 | { 26 | } 27 | 28 | ConnectionMonitor::~ConnectionMonitor() 29 | { 30 | } 31 | 32 | SocketListener::~SocketListener() 33 | { 34 | } 35 | 36 | } // namespace DarwinBluetooth 37 | 38 | QT_END_NAMESPACE 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/bluetooth/darwin/btnotifier.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "btnotifier_p.h" 5 | -------------------------------------------------------------------------------- /src/bluetooth/darwin/btservicerecord_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef BTSERVICERECORD_P_H 5 | #define BTSERVICERECORD_P_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is not part of the Qt API. It exists purely as an 12 | // implementation detail. This header file may change from version to 13 | // version without notice, or even be removed. 14 | // 15 | // We mean it. 16 | // 17 | 18 | #include "btutility_p.h" 19 | 20 | #include 21 | 22 | #include 23 | 24 | QT_BEGIN_NAMESPACE 25 | 26 | class QBluetoothServiceInfo; 27 | 28 | namespace DarwinBluetooth { 29 | 30 | ObjCStrongReference iobluetooth_service_dictionary(const QBluetoothServiceInfo &serviceInfo); 31 | 32 | } // namespace DarwinBluetooth 33 | 34 | QT_END_NAMESPACE 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/bluetooth/doc/images/peripheral-structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtconnectivity/304b59c9baeb207c58ea6d223915308f6500962d/src/bluetooth/doc/images/peripheral-structure.png -------------------------------------------------------------------------------- /src/bluetooth/doc/snippets/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | # ![0] 5 | find_package(Qt6 REQUIRED COMPONENTS Bluetooth) 6 | target_link_libraries(mytarget PRIVATE Qt6::Bluetooth) 7 | # ![0] 8 | -------------------------------------------------------------------------------- /src/bluetooth/doc/snippets/snippets.pro: -------------------------------------------------------------------------------- 1 | #! [contacts project modification] 2 | QT += bluetooth 3 | #! [contacts project modification] 4 | -------------------------------------------------------------------------------- /src/bluetooth/doc/src/bluetooth-cpp.qdoc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only 3 | /*! 4 | 5 | \module QtBluetooth 6 | 7 | \title Qt Bluetooth C++ Classes 8 | \brief Enables basic Bluetooth operations like scanning for devices and connecting them. 9 | \ingroup modules 10 | \qtvariable bluetooth 11 | \since 5.2 12 | 13 | 14 | The \l{Qt Bluetooth} C++ API enables an application to scan for devices and 15 | connect and interact with them in a more flexible way. 16 | 17 | To use the C++ library in your application, add the following configuration 18 | option to your \c .pro file: 19 | 20 | \snippet snippets.pro contacts project modification 21 | */ 22 | 23 | -------------------------------------------------------------------------------- /src/bluetooth/doc/src/bluetooth-toc.qdoc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2024 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only 3 | 4 | /*! 5 | \page bluetooth-toc.html 6 | \title Qt Bluetooth module topics 7 | 8 | The following list has links to all the individual topics (HTML files) 9 | in the Qt Bluetooth module. 10 | 11 | \list 12 | \li \l {Qt Bluetooth Overview}{Overview} 13 | \li \l {Bluetooth Low Energy Overview} 14 | \li \l {Changes to Qt Bluetooth}{Upgrading from Qt 5} 15 | \endlist 16 | 17 | */ 18 | -------------------------------------------------------------------------------- /src/bluetooth/dummy/dummy_helper.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include 5 | #include 6 | 7 | #include "dummy_helper_p.h" 8 | 9 | QT_BEGIN_NAMESPACE 10 | 11 | Q_DECLARE_LOGGING_CATEGORY(QT_BT) 12 | 13 | Q_GLOBAL_STATIC_WITH_ARGS(bool, dummyWarningPrinted, (false)) 14 | 15 | void printDummyWarning() 16 | { 17 | if (!*dummyWarningPrinted()) { 18 | qCWarning(QT_BT) << "Dummy backend running. Qt Bluetooth module is non-functional."; 19 | *dummyWarningPrinted() = true; 20 | } 21 | } 22 | 23 | QT_END_NAMESPACE 24 | -------------------------------------------------------------------------------- /src/bluetooth/dummy/dummy_helper_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef DUMMY_HELPER_H 5 | #define DUMMY_HELPER_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is not part of the Qt API. It exists purely as an 12 | // implementation detail. This header file may change from version to 13 | // version without notice, or even be removed. 14 | // 15 | // We mean it. 16 | // 17 | 18 | #include "QtCore/private/qglobal_p.h" 19 | 20 | QT_BEGIN_NAMESPACE 21 | 22 | void printDummyWarning(); 23 | 24 | QT_END_NAMESPACE 25 | 26 | #endif // DUMMY_HELPER_H 27 | -------------------------------------------------------------------------------- /src/bluetooth/lecmaccalculator_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | #ifndef LECMACCALCULATOR_H 4 | #define LECMACCALCULATOR_H 5 | 6 | // 7 | // W A R N I N G 8 | // ------------- 9 | // 10 | // This file is not part of the Qt API. It exists purely as an 11 | // implementation detail. This header file may change from version to 12 | // version without notice, or even be removed. 13 | // 14 | // We mean it. 15 | // 16 | 17 | #include 18 | #include 19 | 20 | QT_BEGIN_NAMESPACE 21 | 22 | class Q_AUTOTEST_EXPORT LeCmacCalculator 23 | { 24 | public: 25 | LeCmacCalculator(); 26 | ~LeCmacCalculator(); 27 | 28 | static QByteArray createFullMessage(const QByteArray &message, quint32 signCounter); 29 | 30 | quint64 calculateMac(const QByteArray &message, QUuid::Id128Bytes csrk) const; 31 | 32 | // Convenience function. 33 | bool verify(const QByteArray &message, QUuid::Id128Bytes csrk, quint64 expectedMac) const; 34 | 35 | private: 36 | int m_baseSocket = -1; 37 | }; 38 | 39 | 40 | QT_END_NAMESPACE 41 | 42 | #endif // Header guard 43 | -------------------------------------------------------------------------------- /src/bluetooth/qbluetooth.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QBLUETOOTH_H 5 | #define QBLUETOOTH_H 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | namespace QBluetooth { 15 | Q_NAMESPACE_EXPORT(Q_BLUETOOTH_EXPORT) 16 | // TODO Qt 6: Merge these two enums? But note that ATT Authorization has no equivalent 17 | // on the socket security level. 18 | 19 | enum class Security { 20 | NoSecurity = 0x00, 21 | Authorization = 0x01, 22 | Authentication = 0x02, 23 | Encryption = 0x04, 24 | Secure = 0x08 25 | }; 26 | Q_ENUM_NS(Security) 27 | Q_DECLARE_FLAGS(SecurityFlags, Security) 28 | Q_DECLARE_OPERATORS_FOR_FLAGS(SecurityFlags) 29 | 30 | enum class AttAccessConstraint { 31 | AttAuthorizationRequired = 0x1, 32 | AttAuthenticationRequired = 0x2, 33 | AttEncryptionRequired = 0x4, 34 | }; 35 | Q_ENUM_NS(AttAccessConstraint) 36 | 37 | Q_DECLARE_FLAGS(AttAccessConstraints, AttAccessConstraint) 38 | Q_DECLARE_OPERATORS_FOR_FLAGS(AttAccessConstraints) 39 | 40 | } 41 | 42 | typedef quint16 QLowEnergyHandle; 43 | 44 | QT_END_NAMESPACE 45 | 46 | #endif // QBLUETOOTH_H 47 | -------------------------------------------------------------------------------- /src/bluetooth/qbluetoothhostinfo.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QBLUETOOTHHOSTINFO_H 5 | #define QBLUETOOTHHOSTINFO_H 6 | 7 | #include 8 | #include 9 | 10 | QT_BEGIN_NAMESPACE 11 | 12 | class QBluetoothHostInfoPrivate; 13 | class Q_BLUETOOTH_EXPORT QBluetoothHostInfo 14 | { 15 | public: 16 | QBluetoothHostInfo(); 17 | QBluetoothHostInfo(const QBluetoothHostInfo &other); 18 | ~QBluetoothHostInfo(); 19 | 20 | QBluetoothHostInfo &operator=(const QBluetoothHostInfo &other); 21 | friend bool operator==(const QBluetoothHostInfo &a, const QBluetoothHostInfo &b) 22 | { 23 | return equals(a, b); 24 | } 25 | friend bool operator!=(const QBluetoothHostInfo &a, const QBluetoothHostInfo &b) 26 | { 27 | return !equals(a, b); 28 | } 29 | 30 | QBluetoothAddress address() const; 31 | void setAddress(const QBluetoothAddress &address); 32 | 33 | QString name() const; 34 | void setName(const QString &name); 35 | 36 | private: 37 | static bool equals(const QBluetoothHostInfo &a, const QBluetoothHostInfo &b); 38 | Q_DECLARE_PRIVATE(QBluetoothHostInfo) 39 | QBluetoothHostInfoPrivate *d_ptr; 40 | }; 41 | 42 | QT_END_NAMESPACE 43 | 44 | QT_DECL_METATYPE_EXTERN(QBluetoothHostInfo, Q_BLUETOOTH_EXPORT) 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/bluetooth/qbluetoothhostinfo_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QBLUETOOTHHOSTINFO_P_H 5 | #define QBLUETOOTHHOSTINFO_P_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is not part of the Qt API. It exists purely as an 12 | // implementation detail. This header file may change from version to 13 | // version without notice, or even be removed. 14 | // 15 | // We mean it. 16 | // 17 | 18 | #include "qbluetoothhostinfo.h" 19 | #include "private/qglobal_p.h" 20 | 21 | QT_BEGIN_NAMESPACE 22 | 23 | class QBluetoothHostInfoPrivate 24 | { 25 | public: 26 | QBluetoothHostInfoPrivate() 27 | { 28 | } 29 | 30 | QBluetoothAddress m_address; 31 | QString m_name; 32 | }; 33 | 34 | QT_END_NAMESPACE 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/bluetooth/qbluetoothservicediscoveryagent_p.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "qbluetoothservicediscoveryagent.h" 5 | #include "qbluetoothservicediscoveryagent_p.h" 6 | #ifndef QT_IOS_BLUETOOTH 7 | #include "dummy/dummy_helper_p.h" 8 | #endif 9 | 10 | QT_BEGIN_NAMESPACE 11 | 12 | QBluetoothServiceDiscoveryAgentPrivate::QBluetoothServiceDiscoveryAgentPrivate( 13 | QBluetoothServiceDiscoveryAgent *qp, const QBluetoothAddress &deviceAdapter) 14 | : error(QBluetoothServiceDiscoveryAgent::NoError), 15 | state(Inactive), 16 | mode(QBluetoothServiceDiscoveryAgent::MinimalDiscovery), 17 | singleDevice(false), 18 | q_ptr(qp) 19 | { 20 | #ifndef QT_IOS_BLUETOOTH 21 | printDummyWarning(); 22 | #endif 23 | Q_UNUSED(deviceAdapter); 24 | } 25 | 26 | QBluetoothServiceDiscoveryAgentPrivate::~QBluetoothServiceDiscoveryAgentPrivate() 27 | { 28 | } 29 | 30 | void QBluetoothServiceDiscoveryAgentPrivate::start(const QBluetoothAddress &address) 31 | { 32 | Q_UNUSED(address); 33 | } 34 | 35 | void QBluetoothServiceDiscoveryAgentPrivate::stop() 36 | { 37 | } 38 | 39 | QT_END_NAMESPACE 40 | 41 | #include "moc_qbluetoothservicediscoveryagent_p.cpp" 42 | -------------------------------------------------------------------------------- /src/bluetooth/qbluetoothserviceinfo_p.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "qbluetoothserviceinfo.h" 5 | #include "qbluetoothserviceinfo_p.h" 6 | #ifndef QT_IOS_BLUETOOTH 7 | #include "dummy/dummy_helper_p.h" 8 | #endif 9 | 10 | QT_BEGIN_NAMESPACE 11 | 12 | QBluetoothServiceInfoPrivate::QBluetoothServiceInfoPrivate() 13 | { 14 | #ifndef QT_IOS_BLUETOOTH 15 | printDummyWarning(); 16 | #endif 17 | } 18 | 19 | QBluetoothServiceInfoPrivate::~QBluetoothServiceInfoPrivate() 20 | { 21 | } 22 | 23 | bool QBluetoothServiceInfoPrivate::isRegistered() const 24 | { 25 | return false; 26 | } 27 | 28 | bool QBluetoothServiceInfoPrivate::registerService(const QBluetoothAddress &localAdapter) 29 | { 30 | Q_UNUSED(localAdapter); 31 | return false; 32 | } 33 | 34 | bool QBluetoothServiceInfoPrivate::unregisterService() 35 | { 36 | return false; 37 | } 38 | 39 | QT_END_NAMESPACE 40 | 41 | #include "moc_qbluetoothserviceinfo_p.cpp" 42 | -------------------------------------------------------------------------------- /src/bluetooth/qbluetoothsocketbase.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "qbluetoothsocketbase_p.h" 5 | 6 | QT_BEGIN_NAMESPACE 7 | 8 | QBluetoothSocketBasePrivate::QBluetoothSocketBasePrivate(QObject *parent) : QObject(parent) 9 | { 10 | 11 | } 12 | 13 | QBluetoothSocketBasePrivate::~QBluetoothSocketBasePrivate() 14 | { 15 | 16 | } 17 | 18 | QT_END_NAMESPACE 19 | 20 | #include "moc_qbluetoothsocketbase_p.cpp" 21 | -------------------------------------------------------------------------------- /src/bluetooth/qbluetoothuuid_darwin.mm: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "darwin/btutility_p.h" 5 | 6 | #include "qbluetoothuuid.h" 7 | 8 | QT_BEGIN_NAMESPACE 9 | 10 | /*! 11 | \brief Constructs a new QBluetoothUuid, containing a copy of the \a cbUuid CBUUID. 12 | 13 | \note this function is only available on Apple platforms. 14 | 15 | \since 6.6 16 | \ingroup platform-type-conversions 17 | */ 18 | QBluetoothUuid QBluetoothUuid::fromCBUUID(CBUUID *cbUuid) 19 | { 20 | if (!cbUuid) 21 | return {}; 22 | 23 | return DarwinBluetooth::qt_uuid(cbUuid); 24 | } 25 | 26 | /*! 27 | \brief Creates a CBUUID from a QBluetoothUuid. 28 | 29 | The resulting CBUUID is autoreleased. 30 | 31 | \note this function is only available on Apple platforms. 32 | 33 | \since 6.6 34 | \ingroup platform-type-conversions 35 | */ 36 | 37 | CBUUID *QBluetoothUuid::toCBUUID() const 38 | { 39 | const auto cbUuidGuard = DarwinBluetooth::cb_uuid(*this); 40 | // cb_uuid returns a strong reference (RAII object). Let 41 | // it do its job and release, but we return auto-released 42 | // CBUUID, as documented. 43 | return [[cbUuidGuard.data() retain] autorelease]; 44 | } 45 | 46 | QT_END_NAMESPACE 47 | -------------------------------------------------------------------------------- /src/bluetooth/qlowenergyserviceprivate.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "qlowenergyserviceprivate_p.h" 5 | 6 | #include "qlowenergycontrollerbase_p.h" 7 | 8 | QT_BEGIN_NAMESPACE 9 | 10 | QT_IMPL_METATYPE_EXTERN_TAGGED(QSharedPointer, 11 | QSharedPointer_QLowEnergyServicePrivate) 12 | 13 | QLowEnergyServicePrivate::QLowEnergyServicePrivate(QObject *parent) : QObject(parent) { } 14 | 15 | QLowEnergyServicePrivate::~QLowEnergyServicePrivate() 16 | { 17 | } 18 | 19 | void QLowEnergyServicePrivate::setController(QLowEnergyControllerPrivate *control) 20 | { 21 | controller = control; 22 | 23 | if (control) 24 | setState(QLowEnergyService::RemoteService); 25 | else 26 | setState(QLowEnergyService::InvalidService); 27 | } 28 | 29 | void QLowEnergyServicePrivate::setError(QLowEnergyService::ServiceError newError) 30 | { 31 | lastError = newError; 32 | emit errorOccurred(newError); 33 | } 34 | 35 | void QLowEnergyServicePrivate::setState(QLowEnergyService::ServiceState newState) 36 | { 37 | if (state == newState) 38 | return; 39 | 40 | state = newState; 41 | emit stateChanged(newState); 42 | } 43 | 44 | QT_END_NAMESPACE 45 | 46 | #include "moc_qlowenergyserviceprivate_p.cpp" 47 | -------------------------------------------------------------------------------- /src/bluetooth/qtbluetoothglobal.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | #ifndef QTBLUETOOTH_H 4 | #define QTBLUETOOTH_H 5 | 6 | #include 7 | #include // for feature detection 8 | #include 9 | 10 | #endif // QTBLUETOOTH_H 11 | -------------------------------------------------------------------------------- /src/bluetooth/qtbluetoothglobal_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QTBLUETOOTHGLOBAL_P_H 5 | #define QTBLUETOOTHGLOBAL_P_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is not part of the Qt API. It exists purely as an 12 | // implementation detail. This header file may change from version to 13 | // version without notice, or even be removed. 14 | // 15 | // We mean it. 16 | // 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #endif // QTBLUETOOTHGLOBAL_P_H 25 | -------------------------------------------------------------------------------- /src/global/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2025 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## Tools Module: 6 | ##################################################################### 7 | 8 | qt_internal_add_module(Connectivity 9 | INTERNAL_MODULE 10 | HEADER_MODULE 11 | CONFIGURE_FILE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../configure.cmake" 12 | MODULE_INTERFACE_NAME Connectivity # Specify the 'Connectivity' name explicitly to avoid 13 | # warning related to the expected name of internal module. 14 | NO_GENERATE_CPP_EXPORTS 15 | ) 16 | -------------------------------------------------------------------------------- /src/nfc/android/androidjninfc_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 Centria research and development 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | #ifndef ANDROIDJNINFC_H 4 | #define ANDROIDJNINFC_H 5 | 6 | // 7 | // W A R N I N G 8 | // ------------- 9 | // 10 | // This file is not part of the Qt API. It exists purely as an 11 | // implementation detail. This header file may change from version to 12 | // version without notice, or even be removed. 13 | // 14 | // We mean it. 15 | // 16 | 17 | #include "qglobal.h" 18 | 19 | #include 20 | #include 21 | 22 | QT_BEGIN_NAMESPACE 23 | 24 | Q_DECLARE_JNI_CLASS(QtNfc, "org/qtproject/qt/android/nfc/QtNfc") 25 | Q_DECLARE_JNI_CLASS(QtNfcBroadcastReceiver, "org/qtproject/qt/android/nfc/QtNfcBroadcastReceiver") 26 | 27 | Q_DECLARE_JNI_CLASS(NdefMessage, "android/nfc/NdefMessage") 28 | 29 | namespace QtNfc { 30 | bool startDiscovery(); 31 | bool stopDiscovery(); 32 | QtJniTypes::Intent getStartIntent(); 33 | bool isEnabled(); 34 | bool isSupported(); 35 | QtJniTypes::Parcelable getTag(const QtJniTypes::Intent &intent); 36 | } // namespace QtNfc 37 | 38 | QT_END_NAMESPACE 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/nfc/configure.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | qt_find_package(PCSCLITE PROVIDED_TARGETS PkgConfig::PCSCLITE) 5 | 6 | qt_feature("pcsclite" PUBLIC 7 | LABEL "Use the PCSCLite library to access NFC devices" 8 | CONDITION PCSCLITE_FOUND) 9 | 10 | qt_feature("neard" PUBLIC 11 | LABEL "Use neard to access NFC devices" 12 | CONDITION LINUX AND QT_FEATURE_dbus AND NOT QT_FEATURE_pcsclite) 13 | 14 | qt_configure_add_summary_section(NAME "Qt Nfc details") 15 | qt_configure_add_summary_entry(ARGS pcslite) 16 | qt_configure_add_summary_entry(ARGS neard) 17 | qt_configure_end_summary_section() 18 | -------------------------------------------------------------------------------- /src/nfc/doc/snippets/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | int main(int /*argc*/, char ** /*argv*/) 5 | { 6 | return 0; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /src/nfc/doc/snippets/nfc.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | QT_USE_NAMESPACE 10 | 11 | void snippet_recordConversion() 12 | { 13 | QNdefRecord record; 14 | 15 | //! [Record conversion] 16 | if (record.isRecordType()) { 17 | QNdefNfcTextRecord textRecord(record); 18 | 19 | qDebug() << textRecord.text(); 20 | } 21 | //! [Record conversion] 22 | } 23 | 24 | //! [Specialized class definition] 25 | class ExampleComF : public QNdefRecord 26 | { 27 | public: 28 | Q_DECLARE_NDEF_RECORD(ExampleComF, QNdefRecord::ExternalRtd, "example.com:f", 29 | QByteArray(sizeof(int), char(0))) 30 | 31 | int foo() const; 32 | void setFoo(int v); 33 | }; 34 | 35 | Q_DECLARE_ISRECORDTYPE_FOR_NDEF_RECORD(ExampleComF, QNdefRecord::ExternalRtd, "example.com:f") 36 | //! [Specialized class definition] 37 | -------------------------------------------------------------------------------- /src/nfc/doc/src/examples.qdoc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 Aaron McCarthy 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only 3 | 4 | /*! 5 | \page nfc-examples.html 6 | \title Qt NFC Examples 7 | \brief Examples for the Qt NFC module. 8 | 9 | This is a variety of examples that cover the entire range of the Qt NFC API. You will find them 10 | in their own documentation, but they are also accessible from here. 11 | 12 | \section2 C++ Examples 13 | \table 80% 14 | \header 15 | \li Example 16 | \li Description 17 | \row 18 | \li \l{annotatedurl}{Annotated URL} 19 | \li Displays URLs stored on NFC Forum Tags. 20 | \row 21 | \li \l{ndefeditor}{NDEF Editor} 22 | \li Create new or modify existing NDEF messages on NFC Forum Tags. 23 | \endtable 24 | */ 25 | 26 | -------------------------------------------------------------------------------- /src/nfc/doc/src/nfc-cpp.qdoc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 Aaron McCarthy 2 | // Copyright (C) 2021 The Qt Company Ltd. 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only 4 | /*! 5 | 6 | \module QtNfc 7 | \ingroup modules 8 | \qtcmakepackage Nfc 9 | \qtvariable nfc 10 | 11 | \title Qt NFC C++ Classes 12 | \brief An API for accessing NFC Forum Tags. 13 | 14 | The \l{Qt NFC} C++ API enables an application to access NFC Forum Tags. 15 | 16 | \include module-use.qdocinc using qt module 17 | 18 | \badcode 19 | find_package(Qt6 REQUIRED COMPONENTS Nfc) 20 | target_link_libraries(mytarget PRIVATE Qt::Nfc) 21 | \endcode 22 | 23 | \include module-use.qdocinc building with qmake 24 | 25 | \badcode 26 | QT += nfc 27 | \endcode 28 | 29 | */ 30 | 31 | -------------------------------------------------------------------------------- /src/nfc/doc/src/nfc-pcsc.qdoc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only 3 | 4 | /*! 5 | \page qtnfc-pcsc.html 6 | \title PC/SC in Qt NFC 7 | \ingroup connectivity-nfc 8 | \inmodule QtNfc 9 | \since 6.4 10 | \brief Notes on PC/SC support in Qt Nfc. 11 | 12 | PC/SC support is provided using native APIs on macOS and Windows, and using 13 | \l{https://pcsclite.apdu.fr/}{PCSCLite} library on other platforms. The API 14 | can be used for accessing both wired and wireless smartcards and storage cards. 15 | 16 | \section1 Limitations 17 | 18 | \list 19 | \li The current API does not provide means to distinguish between separate 20 | readers/slots. 21 | \li NDEF access is only provided for NFC Type 4 tags. 22 | \li Other applications starting transactions on cards may block Qt applications 23 | from using Qt Nfc API. 24 | \li QNearFieldTarget::sendCommand() used with a PC/SC target starts 25 | a transaction that remains active until QNearFieldTarget::disconnect() 26 | is called. This transaction prevents other applications from accessing 27 | this target. 28 | \li The backend is polling for new tags, that means that there 29 | may be a delay up to the full polling interval before new tags are reported. 30 | The default polling interval is 100 milliseconds. It can be adjusted 31 | by setting environment valiable \c{QT_NFC_POLL_INTERVAL_MS} to an integer 32 | value in milliseconds. 33 | \endlist 34 | */ 35 | -------------------------------------------------------------------------------- /src/nfc/doc/src/nfc-toc.qdoc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2024 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only 3 | 4 | /*! 5 | \page nfc-toc.html 6 | \title Qt NFC module topics 7 | 8 | The following list has links to all the individual topics (HTML files) 9 | in the Qt NFC module. 10 | 11 | \list 12 | \li \l {Qt NFC Overview} 13 | \li \l {Supported NFC Features} 14 | \li \l {Qt NFC on Android} 15 | \li \l {PC/SC in Qt NFC}{PC/SC support} 16 | \li \l {Changes to Qt NFC}{Upgrading from Qt 5} 17 | \endlist 18 | 19 | */ 20 | -------------------------------------------------------------------------------- /src/nfc/ios/qiosndefnotifier.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "qiosndefnotifier_p.h" 5 | 6 | QT_BEGIN_NAMESPACE 7 | 8 | Q_LOGGING_CATEGORY(QT_IOS_NFC, "qt.nfc.ios") 9 | 10 | QT_END_NAMESPACE 11 | 12 | -------------------------------------------------------------------------------- /src/nfc/ios/qiostagreaderdelegate_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020 Governikus GmbH & Co. KG 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QIOSTAGREADERDELEGATE_P_H 5 | #define QIOSTAGREADERDELEGATE_P_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is not part of the Qt API. It exists purely as an 12 | // implementation detail. This header file may change from version to 13 | // version without notice, or even be removed. 14 | // 15 | // We mean it. 16 | // 17 | 18 | #include 19 | 20 | #import 21 | #import 22 | #import 23 | 24 | QT_BEGIN_NAMESPACE 25 | 26 | class QNearFieldManagerPrivateImpl; 27 | 28 | QT_END_NAMESPACE 29 | 30 | API_AVAILABLE(ios(13.0)) 31 | @interface QT_MANGLE_NAMESPACE(QIosTagReaderDelegate) 32 | : NSObject 33 | 34 | @property QNearFieldManagerPrivateImpl *listener; 35 | @property bool sessionStoppedByApplication; 36 | @property (nonatomic, strong) NSString *message; 37 | @property (nonatomic, strong) NFCTagReaderSession *session; 38 | 39 | - (instancetype)initWithListener:(QNearFieldManagerPrivateImpl *)listener; 40 | 41 | - (void)startSession; 42 | - (void)stopSession:(QString)message; 43 | 44 | - (void)alertMessage:(QString)message; 45 | 46 | @end 47 | 48 | #endif // QIOSTAGREADERDELEGATE_P_H 49 | -------------------------------------------------------------------------------- /src/nfc/neard/REUSE.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[annotations]] 4 | path = ["org.freedesktop.dbus.objectmanager.xml", 5 | "org.freedesktop.dbus.properties.xml", 6 | "org.neard.Adapter.xml", 7 | "org.neard.Tag.xml"] 8 | precedence = "closest" 9 | SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd." 10 | SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only" 11 | -------------------------------------------------------------------------------- /src/nfc/neard/neard_dbus_types_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // Copyright (C) 2016 BasysKom GmbH. 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 4 | 5 | #ifndef NEARD_DBUS_TYPES_P_H 6 | #define NEARD_DBUS_TYPES_P_H 7 | 8 | // 9 | // W A R N I N G 10 | // ------------- 11 | // 12 | // This file is not part of the Qt API. It exists purely as an 13 | // implementation detail. This header file may change from version to 14 | // version without notice, or even be removed. 15 | // 16 | // We mean it. 17 | // 18 | 19 | #include 20 | #include 21 | 22 | typedef QMap InterfaceList; 23 | typedef QMap ManagedObjectList; 24 | 25 | Q_DECLARE_METATYPE(InterfaceList) 26 | Q_DECLARE_METATYPE(ManagedObjectList) 27 | 28 | #endif // NEARD_DBUS_TYPES_P_H 29 | -------------------------------------------------------------------------------- /src/nfc/neard/org.freedesktop.dbus.objectmanager.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/nfc/neard/org.neard.Adapter.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/nfc/neard/org.neard.Tag.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/nfc/pcsc/qpcsc.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "qpcsc_p.h" 5 | 6 | QT_BEGIN_NAMESPACE 7 | 8 | using namespace Qt::StringLiterals; 9 | 10 | namespace QPcsc { 11 | 12 | QString errorMessage(LONG error) 13 | { 14 | #ifdef Q_OS_WIN 15 | return (u"0x%1"_s).arg(error, 8, 16, QLatin1Char('0')); 16 | #else 17 | return QString::fromUtf8(pcsc_stringify_error(error)); 18 | #endif 19 | } 20 | 21 | } // namespace QPcsc 22 | 23 | qsizetype QPcscSlotName::nameSize(QPcscSlotName::CPtr p) 24 | { 25 | #ifdef Q_OS_WIN 26 | return wcslen(p); 27 | #else 28 | return strlen(p); 29 | #endif 30 | } 31 | 32 | QT_END_NAMESPACE 33 | -------------------------------------------------------------------------------- /src/nfc/pcsc/qpcscslot_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QPCSCSLOT_P_H 5 | #define QPCSCSLOT_P_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is not part of the Qt API. It exists purely as an 12 | // implementation detail. This header file may change from version to 13 | // version without notice, or even be removed. 14 | // 15 | // We mean it. 16 | // 17 | 18 | #include "qpcsc_p.h" 19 | #include 20 | #include 21 | 22 | QT_BEGIN_NAMESPACE 23 | 24 | class QPcscManager; 25 | class QPcscCard; 26 | 27 | class QPcscSlot : public QObject 28 | { 29 | Q_OBJECT 30 | public: 31 | QPcscSlot(const QPcscSlotName &name, QPcscManager *manager); 32 | ~QPcscSlot() override; 33 | 34 | const QPcscSlotName &name() const { return m_name; } 35 | void processStateChange(DWORD eventId, bool createCards); 36 | bool hasCard() const { return !m_insertedCard.isNull(); } 37 | void invalidateInsertedCard(); 38 | 39 | private: 40 | const QPcscSlotName m_name; 41 | QPointer m_insertedCard; 42 | }; 43 | 44 | QT_END_NAMESPACE 45 | 46 | #endif // QPCSCSLOT_P_H 47 | -------------------------------------------------------------------------------- /src/nfc/qapduutils_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QAPDUUTILS_P_H 5 | #define QAPDUUTILS_P_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is not part of the Qt API. It exists purely as an 12 | // implementation detail. This header file may change from version to 13 | // version without notice, or even be removed. 14 | // 15 | // We mean it. 16 | // 17 | 18 | #include 19 | 20 | QT_BEGIN_NAMESPACE 21 | 22 | class QResponseApdu 23 | { 24 | public: 25 | static constexpr uint16_t Empty = 0x0000; 26 | static constexpr uint16_t Success = 0x9000; 27 | 28 | explicit QResponseApdu(const QByteArray &response = {}); 29 | 30 | const QByteArray &data() const { return m_data; } 31 | uint16_t status() const { return m_status; } 32 | bool isOk() const { return m_status == Success; } 33 | 34 | private: 35 | QByteArray m_data; 36 | uint16_t m_status; 37 | }; 38 | 39 | namespace QCommandApdu { 40 | 41 | // INS byte values for command APDUs 42 | constexpr uint8_t Select = 0xA4; 43 | constexpr uint8_t ReadBinary = 0xB0; 44 | constexpr uint8_t GetData = 0xCA; 45 | constexpr uint8_t UpdateBinary = 0xD6; 46 | 47 | QByteArray build(uint8_t cla, uint8_t ins, uint8_t p1, uint8_t p2, QByteArrayView data, 48 | uint16_t ne = 0); 49 | }; 50 | 51 | QT_END_NAMESPACE 52 | 53 | #endif // QAPDUUTILS_P_H 54 | -------------------------------------------------------------------------------- /src/nfc/qndefnfctextrecord.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QNDEFNFCTEXTRECORD_H 5 | #define QNDEFNFCTEXTRECORD_H 6 | 7 | #include 8 | #include 9 | 10 | QT_BEGIN_NAMESPACE 11 | 12 | class Q_NFC_EXPORT QNdefNfcTextRecord : public QNdefRecord 13 | { 14 | public: 15 | #ifndef Q_QDOC 16 | Q_DECLARE_NDEF_RECORD(QNdefNfcTextRecord, QNdefRecord::NfcRtd, "T", QByteArray(1, char(0))) 17 | #else 18 | QNdefNfcTextRecord(); 19 | QNdefNfcTextRecord(const QNdefRecord& other); 20 | #endif 21 | 22 | QString locale() const; 23 | void setLocale(const QString &locale); 24 | 25 | QString text() const; 26 | void setText(const QString text); 27 | 28 | enum Encoding { 29 | Utf8, 30 | Utf16 31 | }; 32 | 33 | Encoding encoding() const; 34 | void setEncoding(Encoding encoding); 35 | }; 36 | 37 | QT_END_NAMESPACE 38 | 39 | Q_DECLARE_ISRECORDTYPE_FOR_NDEF_RECORD(QNdefNfcTextRecord, QNdefRecord::NfcRtd, "T") 40 | 41 | #endif // QNDEFNFCTEXTRECORD_H 42 | -------------------------------------------------------------------------------- /src/nfc/qndefnfcurirecord.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QNDEFNFCURIRECORD_H 5 | #define QNDEFNFCURIRECORD_H 6 | 7 | #include 8 | #include 9 | 10 | QT_FORWARD_DECLARE_CLASS(QUrl) 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | class Q_NFC_EXPORT QNdefNfcUriRecord : public QNdefRecord 15 | { 16 | public: 17 | #ifndef Q_QDOC 18 | Q_DECLARE_NDEF_RECORD(QNdefNfcUriRecord, QNdefRecord::NfcRtd, "U", QByteArray(0, char(0))) 19 | #else 20 | QNdefNfcUriRecord(); 21 | QNdefNfcUriRecord(const QNdefRecord& other); 22 | #endif 23 | 24 | QUrl uri() const; 25 | void setUri(const QUrl &uri); 26 | }; 27 | 28 | QT_END_NAMESPACE 29 | 30 | Q_DECLARE_ISRECORDTYPE_FOR_NDEF_RECORD(QNdefNfcUriRecord, QNdefRecord::NfcRtd, "U") 31 | 32 | #endif // QNDEFNFCURIRECORD_H 33 | -------------------------------------------------------------------------------- /src/nfc/qndefrecord_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QNDEFRECORD_P_H 5 | #define QNDEFRECORD_P_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is not part of the Qt API. It exists purely as an 12 | // implementation detail. This header file may change from version to 13 | // version without notice, or even be removed. 14 | // 15 | // We mean it. 16 | // 17 | 18 | #include "qtnfcglobal.h" 19 | 20 | #include 21 | #include 22 | 23 | QT_BEGIN_NAMESPACE 24 | 25 | class QNdefRecordPrivate : public QSharedData 26 | { 27 | public: 28 | QNdefRecordPrivate() : QSharedData() 29 | { 30 | typeNameFormat = 0; //TypeNameFormat::Empty 31 | } 32 | 33 | unsigned int typeNameFormat : 3; 34 | 35 | QByteArray type; 36 | QByteArray id; 37 | QByteArray payload; 38 | }; 39 | 40 | QT_END_NAMESPACE 41 | 42 | #endif // QNDEFRECORD_P_H 43 | -------------------------------------------------------------------------------- /src/nfc/qnearfieldmanager_generic.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include 5 | 6 | #include "qnearfieldmanager_generic_p.h" 7 | 8 | QT_BEGIN_NAMESPACE 9 | 10 | /* 11 | Constructs a new near field manager private implementation. 12 | */ 13 | QNearFieldManagerPrivateImpl::QNearFieldManagerPrivateImpl() 14 | { 15 | } 16 | 17 | /* 18 | Destroys the near field manager private implementation. 19 | */ 20 | QNearFieldManagerPrivateImpl::~QNearFieldManagerPrivateImpl() 21 | { 22 | } 23 | 24 | QT_END_NAMESPACE 25 | -------------------------------------------------------------------------------- /src/nfc/qnearfieldmanager_generic_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QNEARFIELDMANAGERIMPL_P_H 5 | #define QNEARFIELDMANAGERIMPL_P_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is not part of the Qt API. It exists purely as an 12 | // implementation detail. This header file may change from version to 13 | // version without notice, or even be removed. 14 | // 15 | // We mean it. 16 | // 17 | 18 | #include "qnearfieldmanager_p.h" 19 | 20 | QT_BEGIN_NAMESPACE 21 | 22 | class QNearFieldManagerPrivateImpl : public QNearFieldManagerPrivate 23 | { 24 | public: 25 | QNearFieldManagerPrivateImpl(); 26 | ~QNearFieldManagerPrivateImpl() override; 27 | }; 28 | 29 | QT_END_NAMESPACE 30 | 31 | #endif // QNEARFIELDMANAGERIMPL_P_H 32 | -------------------------------------------------------------------------------- /src/nfc/qtnfcglobal.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QTNFC_H 5 | #define QTNFC_H 6 | 7 | #include 8 | #include 9 | 10 | #endif // QTNFC_H 11 | -------------------------------------------------------------------------------- /src/nfc/qtnfcglobal_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QTNFCGLOBAL_P_H 5 | #define QTNFCGLOBAL_P_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is not part of the Qt API. It exists purely as an 12 | // implementation detail. This header file may change from version to 13 | // version without notice, or even be removed. 14 | // 15 | // We mean it. 16 | // 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | #endif // QTNFCGLOBAL_P_H 24 | -------------------------------------------------------------------------------- /src/tools/sdpscanner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## sdpscanner Tool: 6 | ##################################################################### 7 | 8 | if(NOT TARGET PkgConfig::BLUEZ) 9 | qt_find_package(BlueZ PROVIDED_TARGETS PkgConfig::BLUEZ) 10 | endif() 11 | 12 | qt_internal_add_app(sdpscanner 13 | INSTALL_DIR "${INSTALL_LIBEXECDIR}" 14 | SOURCES 15 | main.cpp 16 | DEFINES 17 | QT_NO_CONTEXTLESS_CONNECT 18 | LIBRARIES 19 | PkgConfig::BLUEZ 20 | ) 21 | -------------------------------------------------------------------------------- /src/tools/sdpscanner/qt_attribution.json: -------------------------------------------------------------------------------- 1 | { 2 | "Id": "bluez", 3 | "Name": "BlueZ", 4 | "QDocModule": "qtbluetooth", 5 | "QtUsage": "On Linux, Qt Bluetooth uses a separate executable, sdpscanner, 6 | to integrate with the official Linux Bluetooth protocol stack (BlueZ). The usage is limited 7 | to service discovery via SDP. The Qt Bluetooth library itself does NOT link against BlueZ. 8 | Communication between sdpscanner and QtBluetooth happens via stdin/stdout. Therefore 9 | QtBluetooth and user code linking to it is not considered a derivative work, and does not 10 | have to be released under GPL too.", 11 | "Description": "SDP Search via BlueZ", 12 | "Homepage": "http://www.bluez.org/", 13 | "LicenseId": "GPL-2.0-only", 14 | "License": "GNU General Public License v2.0 only (This does not force user code to be GPL'ed. For more info see details.)", 15 | "Comment": "No relevant PURL or CPE set, because the dependency is an external tool", 16 | "Copyright": "Copyright (C) 2000-2016 BlueZ Project." 17 | } 18 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | if(QT_BUILD_STANDALONE_TESTS) 5 | # Add qt_find_package calls for extra dependencies that need to be found when building 6 | # the standalone tests here. 7 | endif() 8 | 9 | if(TARGET Qt::Bluetooth) 10 | if(TARGET Qt::Quick) 11 | add_subdirectory(bttestui) 12 | endif() 13 | 14 | add_subdirectory(bluetoothtestdevice) 15 | endif() 16 | 17 | qt_build_tests() 18 | -------------------------------------------------------------------------------- /tests/auto/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | if(TARGET Qt::Bluetooth) 5 | add_subdirectory(qbluetoothaddress) 6 | add_subdirectory(qbluetoothdevicediscoveryagent) 7 | add_subdirectory(qbluetoothdeviceinfo) 8 | add_subdirectory(qbluetoothlocaldevice) 9 | add_subdirectory(qbluetoothhostinfo) 10 | add_subdirectory(qbluetoothservicediscoveryagent) 11 | add_subdirectory(qbluetoothserviceinfo) 12 | add_subdirectory(qbluetoothsocket) 13 | add_subdirectory(qbluetoothuuid) 14 | add_subdirectory(qbluetoothserver) 15 | add_subdirectory(qlowenergycharacteristic) 16 | add_subdirectory(qlowenergydescriptor) 17 | add_subdirectory(qlowenergycontroller) 18 | add_subdirectory(qlowenergycontroller-gattserver) 19 | add_subdirectory(qlowenergyservice) 20 | endif() 21 | if(TARGET Qt::Nfc) 22 | add_subdirectory(qndefmessage) 23 | add_subdirectory(qndefrecord) 24 | add_subdirectory(qnearfieldmanager) 25 | add_subdirectory(qnearfieldtagtype1) 26 | add_subdirectory(qnearfieldtagtype2) 27 | add_subdirectory(qndefnfcsmartposterrecord) 28 | add_subdirectory(qndeffilter) 29 | endif() 30 | if(TARGET Qt::Bluetooth AND TARGET Qt::Nfc) 31 | add_subdirectory(cmake) 32 | endif() 33 | -------------------------------------------------------------------------------- /tests/auto/nfcdata/Qt Labs Website Tag Type1.nfc: -------------------------------------------------------------------------------- 1 | [Target] 2 | Name=Qt Labs Website Tag 3 | Type=TagType1 4 | 5 | [TagType1] 6 | HR0=17 7 | HR1=0 8 | Data=@ByteArray(wfUD3\"\x11\0\xe1\x10\xe\0\x3(\x91\x1\rT\x5\x65n_USQt LabsQ\x1\x13U\x3labs.qt.nokia.com/\xfe\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x1`\0\0\0\0\0\0) 9 | -------------------------------------------------------------------------------- /tests/auto/qbluetoothaddress/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_qbluetoothaddress Test: 6 | ##################################################################### 7 | 8 | if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) 9 | cmake_minimum_required(VERSION 3.16) 10 | project(tst_qbluetoothaddress LANGUAGES CXX) 11 | find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) 12 | endif() 13 | 14 | qt_internal_add_test(tst_qbluetoothaddress 15 | SOURCES 16 | tst_qbluetoothaddress.cpp 17 | LIBRARIES 18 | Qt::Bluetooth 19 | ) 20 | -------------------------------------------------------------------------------- /tests/auto/qbluetoothdeviceinfo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_qbluetoothdeviceinfo Test: 6 | ##################################################################### 7 | 8 | if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) 9 | cmake_minimum_required(VERSION 3.16) 10 | project(tst_qbluetoothdeviceinfo LANGUAGES CXX) 11 | find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) 12 | endif() 13 | 14 | qt_internal_add_test(tst_qbluetoothdeviceinfo 15 | SOURCES 16 | tst_qbluetoothdeviceinfo.cpp 17 | LIBRARIES 18 | Qt::Bluetooth 19 | ) 20 | -------------------------------------------------------------------------------- /tests/auto/qbluetoothhostinfo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_qbluetoothhostinfo Test: 6 | ##################################################################### 7 | 8 | if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) 9 | cmake_minimum_required(VERSION 3.16) 10 | project(tst_qbluetoothhostinfo LANGUAGES CXX) 11 | find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) 12 | endif() 13 | 14 | qt_internal_add_test(tst_qbluetoothhostinfo 15 | SOURCES 16 | tst_qbluetoothhostinfo.cpp 17 | LIBRARIES 18 | Qt::Bluetooth 19 | ) 20 | -------------------------------------------------------------------------------- /tests/auto/qbluetoothlocaldevice/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_qbluetoothlocaldevice Test: 6 | ##################################################################### 7 | 8 | if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) 9 | cmake_minimum_required(VERSION 3.16) 10 | project(tst_qbluetoothlocaldevice LANGUAGES CXX) 11 | find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) 12 | endif() 13 | 14 | qt_internal_add_test(tst_qbluetoothlocaldevice 15 | SOURCES 16 | tst_qbluetoothlocaldevice.cpp 17 | LIBRARIES 18 | Qt::BluetoothPrivate 19 | ) 20 | 21 | ## Scopes: 22 | ##################################################################### 23 | 24 | qt_internal_extend_target(tst_qbluetoothlocaldevice CONDITION MACOS 25 | LIBRARIES 26 | Qt::Widgets 27 | ) 28 | -------------------------------------------------------------------------------- /tests/auto/qbluetoothserver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_qbluetoothserver Test: 6 | ##################################################################### 7 | 8 | if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) 9 | cmake_minimum_required(VERSION 3.16) 10 | project(tst_qbluetoothserver LANGUAGES CXX) 11 | find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) 12 | endif() 13 | 14 | qt_internal_add_test(tst_qbluetoothserver 15 | SOURCES 16 | tst_qbluetoothserver.cpp 17 | LIBRARIES 18 | Qt::BluetoothPrivate 19 | ) 20 | 21 | #### Keys ignored in scope 1:.:.:qbluetoothserver.pro:: 22 | # OTHER_FILES = "README.txt" 23 | 24 | ## Scopes: 25 | ##################################################################### 26 | 27 | qt_internal_extend_target(tst_qbluetoothserver CONDITION MACOS 28 | LIBRARIES 29 | Qt::Widgets 30 | ) 31 | -------------------------------------------------------------------------------- /tests/auto/qbluetoothserviceinfo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_qbluetoothserviceinfo Test: 6 | ##################################################################### 7 | 8 | if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) 9 | cmake_minimum_required(VERSION 3.16) 10 | project(tst_qbluetoothserviceinfo LANGUAGES CXX) 11 | find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) 12 | endif() 13 | 14 | qt_internal_add_test(tst_qbluetoothserviceinfo 15 | SOURCES 16 | tst_qbluetoothserviceinfo.cpp 17 | LIBRARIES 18 | Qt::Bluetooth 19 | ) 20 | 21 | ## Scopes: 22 | ##################################################################### 23 | 24 | qt_internal_extend_target(tst_qbluetoothserviceinfo CONDITION MACOS 25 | LIBRARIES 26 | Qt::Widgets 27 | ) 28 | 29 | qt_internal_extend_target(tst_qbluetoothserviceinfo CONDITION ANDROID AND NOT ANDROID_EMBEDDED 30 | DEFINES 31 | QT_ANDROID_BLUETOOTH 32 | ) 33 | -------------------------------------------------------------------------------- /tests/auto/qbluetoothsocket/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_qbluetoothsocket Test: 6 | ##################################################################### 7 | 8 | if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) 9 | cmake_minimum_required(VERSION 3.16) 10 | project(tst_qbluetoothsocket LANGUAGES CXX) 11 | find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) 12 | endif() 13 | 14 | qt_internal_add_test(tst_qbluetoothsocket 15 | SOURCES 16 | tst_qbluetoothsocket.cpp 17 | LIBRARIES 18 | Qt::BluetoothPrivate 19 | Qt::Network 20 | ) 21 | 22 | #### Keys ignored in scope 1:.:.:qbluetoothsocket.pro:: 23 | # OTHER_FILES = "README.txt" 24 | # testcase.timeout = "250" 25 | 26 | ## Scopes: 27 | ##################################################################### 28 | 29 | qt_internal_extend_target(tst_qbluetoothsocket CONDITION MACOS 30 | DEFINES 31 | QT_OSX_BLUETOOTH 32 | LIBRARIES 33 | Qt::Widgets 34 | ) 35 | 36 | qt_internal_extend_target(tst_qbluetoothsocket CONDITION ANDROID AND NOT ANDROID_EMBEDDED 37 | DEFINES 38 | QT_ANDROID_BLUETOOTH 39 | ) 40 | -------------------------------------------------------------------------------- /tests/auto/qbluetoothsocket/README.txt: -------------------------------------------------------------------------------- 1 | This test requires bttestui running on a remote machine, and for it to 2 | be discoverable and connectable to the device under test. The bttestui 3 | should run an rfcomm server (see UI option SListenUuid). 4 | 5 | bttestui is available in tests/bttestui. 6 | 7 | The unit test attempts to use service discovery to locate bttestui. 8 | -------------------------------------------------------------------------------- /tests/auto/qbluetoothuuid/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_qbluetoothuuid Test: 6 | ##################################################################### 7 | 8 | if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) 9 | cmake_minimum_required(VERSION 3.16) 10 | project(tst_qbluetoothuuid LANGUAGES CXX) 11 | find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) 12 | endif() 13 | 14 | qt_internal_add_test(tst_qbluetoothuuid 15 | SOURCES 16 | tst_qbluetoothuuid.cpp 17 | LIBRARIES 18 | Qt::Bluetooth 19 | Qt::CorePrivate 20 | ) 21 | -------------------------------------------------------------------------------- /tests/auto/qlowenergycharacteristic/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_qlowenergycharacteristic Test: 6 | ##################################################################### 7 | 8 | if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) 9 | cmake_minimum_required(VERSION 3.16) 10 | project(tst_qlowenergycharacteristic LANGUAGES CXX) 11 | find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) 12 | endif() 13 | 14 | qt_internal_add_test(tst_qlowenergycharacteristic 15 | SOURCES 16 | tst_qlowenergycharacteristic.cpp 17 | LIBRARIES 18 | Qt::Bluetooth 19 | ) 20 | 21 | set_target_properties(tst_qlowenergycharacteristic PROPERTIES 22 | MACOSX_BUNDLE TRUE 23 | ) 24 | 25 | if (APPLE AND NOT IOS) 26 | # Ninja has trouble with relative paths, convert to absolute as a workaround 27 | get_filename_component(SHARED_PLIST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../shared ABSOLUTE) 28 | set_target_properties(tst_qlowenergycharacteristic PROPERTIES 29 | MACOSX_BUNDLE_INFO_PLIST "${SHARED_PLIST_DIR}/Info.macos.plist" 30 | ) 31 | endif() 32 | -------------------------------------------------------------------------------- /tests/auto/qlowenergycontroller-gattserver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(server) 2 | add_subdirectory(test) 3 | -------------------------------------------------------------------------------- /tests/auto/qlowenergycontroller-gattserver/README: -------------------------------------------------------------------------------- 1 | This test is split into a server and a client part. The former is supplying data, and 2 | the latter is implementing the actual test application. 3 | To run a full test, follow these steps: 4 | 1) Start the server application on some machine that has a Bluetooth LE adapter 5 | and is close enough to the client machine. 6 | 2) On the client machine, set the QT_BT_GATTSERVER_TEST_ADDRESS environment variable 7 | to the address of the Bluetooth adapter on the server machine. 8 | 3) Run the test on the client. 9 | If you skip steps 1) or 2), only a few unit tests will be run. These do not require the 10 | test machine to have a Bluetooth adapter. 11 | -------------------------------------------------------------------------------- /tests/auto/qlowenergycontroller-gattserver/server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## server Binary: 6 | ##################################################################### 7 | 8 | qt_internal_add_executable(qlecontroller-server 9 | GUI 10 | OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" 11 | SOURCES 12 | qlowenergycontroller-gattserver.cpp 13 | LIBRARIES 14 | Qt::Bluetooth 15 | ) 16 | -------------------------------------------------------------------------------- /tests/auto/qlowenergycontroller-gattserver/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_qlowenergycontroller-gattserver Test: 6 | ##################################################################### 7 | 8 | if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) 9 | cmake_minimum_required(VERSION 3.16) 10 | project(tst_qlowenergycontroller-gattserver LANGUAGES CXX) 11 | find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) 12 | endif() 13 | 14 | qt_internal_add_test(tst_qlowenergycontroller-gattserver 15 | SOURCES 16 | tst_qlowenergycontroller-gattserver.cpp 17 | LIBRARIES 18 | Qt::Bluetooth 19 | Qt::BluetoothPrivate 20 | ) 21 | 22 | ## Scopes: 23 | ##################################################################### 24 | 25 | qt_internal_extend_target(tst_qlowenergycontroller-gattserver CONDITION QT_FEATURE_linux_crypto_api 26 | DEFINES 27 | CONFIG_LINUX_CRYPTO_API 28 | ) 29 | 30 | qt_internal_extend_target(tst_qlowenergycontroller-gattserver CONDITION QT_FEATURE_bluez_le 31 | DEFINES 32 | CONFIG_BLUEZ_LE 33 | ) 34 | 35 | qt_internal_extend_target(tst_qlowenergycontroller-gattserver CONDITION boot2qt 36 | DEFINES 37 | CHECK_CMAC_SUPPORT 38 | ) 39 | -------------------------------------------------------------------------------- /tests/auto/qlowenergydescriptor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_qlowenergydescriptor Test: 6 | ##################################################################### 7 | 8 | if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) 9 | cmake_minimum_required(VERSION 3.16) 10 | project(tst_qlowenergydescriptor LANGUAGES CXX) 11 | find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) 12 | endif() 13 | 14 | qt_internal_add_test(tst_qlowenergydescriptor 15 | SOURCES 16 | tst_qlowenergydescriptor.cpp 17 | LIBRARIES 18 | Qt::Bluetooth 19 | ) 20 | 21 | set_target_properties(tst_qlowenergydescriptor PROPERTIES 22 | MACOSX_BUNDLE TRUE 23 | ) 24 | 25 | if (APPLE AND NOT IOS) 26 | # Ninja has trouble with relative paths, convert to absolute as a workaround 27 | get_filename_component(SHARED_PLIST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../shared ABSOLUTE) 28 | set_target_properties(tst_qlowenergydescriptor PROPERTIES 29 | MACOSX_BUNDLE_INFO_PLIST "${SHARED_PLIST_DIR}/Info.macos.plist" 30 | ) 31 | endif() 32 | -------------------------------------------------------------------------------- /tests/auto/qlowenergyservice/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_qlowenergyservice Test: 6 | ##################################################################### 7 | 8 | if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) 9 | cmake_minimum_required(VERSION 3.16) 10 | project(tst_qlowenergyservice LANGUAGES CXX) 11 | find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) 12 | endif() 13 | 14 | qt_internal_add_test(tst_qlowenergyservice 15 | SOURCES 16 | tst_qlowenergyservice.cpp 17 | LIBRARIES 18 | Qt::Bluetooth 19 | ) 20 | -------------------------------------------------------------------------------- /tests/auto/qndeffilter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) 5 | cmake_minimum_required(VERSION 3.16) 6 | project(tst_qndeffilter LANGUAGES CXX) 7 | find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) 8 | endif() 9 | 10 | qt_internal_add_test(tst_qndeffilter 11 | SOURCES 12 | tst_qndeffilter.cpp 13 | LIBRARIES 14 | Qt::Nfc 15 | ) 16 | -------------------------------------------------------------------------------- /tests/auto/qndefmessage/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_qndefmessage Test: 6 | ##################################################################### 7 | 8 | if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) 9 | cmake_minimum_required(VERSION 3.16) 10 | project(tst_qndefmessage LANGUAGES CXX) 11 | find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) 12 | endif() 13 | 14 | qt_internal_add_test(tst_qndefmessage 15 | SOURCES 16 | tst_qndefmessage.cpp 17 | LIBRARIES 18 | Qt::Nfc 19 | ) 20 | -------------------------------------------------------------------------------- /tests/auto/qndefnfcsmartposterrecord/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_qndefnfcsmartposterrecord Test: 6 | ##################################################################### 7 | 8 | if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) 9 | cmake_minimum_required(VERSION 3.16) 10 | project(tst_qndefnfcsmartposterrecord LANGUAGES CXX) 11 | find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) 12 | endif() 13 | 14 | qt_internal_add_test(tst_qndefnfcsmartposterrecord 15 | SOURCES 16 | tst_qndefnfcsmartposterrecord.cpp 17 | LIBRARIES 18 | Qt::Nfc 19 | ) 20 | -------------------------------------------------------------------------------- /tests/auto/qndefrecord/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_qndefrecord Test: 6 | ##################################################################### 7 | 8 | if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) 9 | cmake_minimum_required(VERSION 3.16) 10 | project(tst_qndefrecord LANGUAGES CXX) 11 | find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) 12 | endif() 13 | 14 | qt_internal_add_test(tst_qndefrecord 15 | SOURCES 16 | tst_qndefrecord.cpp 17 | LIBRARIES 18 | Qt::Nfc 19 | ) 20 | -------------------------------------------------------------------------------- /tests/auto/qnearfieldtagtype2/nfcdata/Empty Tag.nfc: -------------------------------------------------------------------------------- 1 | [Target] 2 | Name=Empty Tag 3 | Type=TagType2 4 | 5 | [TagType2] 6 | Data=@ByteArray(\x11\x11\x11\0\x11\x11\x11\x11\0\0\0\0\xe1\x10\x6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0) 7 | -------------------------------------------------------------------------------- /tests/bttestui/Button.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 3 | 4 | import QtQuick 5 | 6 | Rectangle 7 | { 8 | id: button 9 | signal clicked() 10 | property string buttonText 11 | width: powerOn.width + 10 12 | height: powerOn.height + 10 13 | border.color: "black" 14 | border.width: 2 15 | radius: 4 16 | 17 | 18 | Text { 19 | id: powerOn 20 | text: buttonText 21 | font.pointSize: 16 22 | anchors.centerIn: parent 23 | } 24 | MouseArea { 25 | anchors.fill: parent 26 | onClicked: button.clicked() 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/bttestui/README: -------------------------------------------------------------------------------- 1 | This application is a graphical test application for Bluetooth. 2 | It is able to invoke close to all API features offered by the QtBluetooth API. 3 | It includes features like: 4 | 5 | 1.) Turning Bluetooth on/off 6 | 2.) Pairing with remote devices 7 | 3.) Discovery of services and devices 8 | 4.) Connecting to a remote SPP profile using RFCOMM 9 | 5.) Start of a SPP Bluetooth server 10 | 11 | Some features require interaction with remote devices. In particular this involves 12 | pairing and the direct connecting to remote SPP servers. The remote test device address 13 | is hardcoded via BTCHAT_DEVICE_ADDR. 14 | 15 | Also, the test application reuses the service uuid employed by the btchat example 16 | (see examples/bluetooth/btchat). It can either directly connect to the remote 17 | btchat app server or create its own btchat server. 18 | 19 | Note that the application is purposely very liberal with regards to the amount of its 20 | debug output. This is done to be able to confirm proper working of the tested 21 | APIs. 22 | -------------------------------------------------------------------------------- /tests/global/global.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /tests/manual/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | if(TARGET Qt::Bluetooth) 5 | add_subdirectory(qlowenergycontroller) 6 | add_subdirectory(qlowenergycontroller_peripheral) 7 | add_subdirectory(examples/btscanner) 8 | endif() 9 | 10 | -------------------------------------------------------------------------------- /tests/manual/examples/btscanner/btscanner.pro: -------------------------------------------------------------------------------- 1 | TARGET = btscanner 2 | 3 | QT = core bluetooth widgets 4 | requires(qtConfig(listwidget)) 5 | TEMPLATE = app 6 | 7 | SOURCES = \ 8 | main.cpp \ 9 | device.cpp \ 10 | service.cpp 11 | 12 | ios: QMAKE_INFO_PLIST = Info.plist 13 | macos: QMAKE_INFO_PLIST = ../../../../examples/bluetooth/shared/Info.qmake.macos.plist 14 | 15 | HEADERS = \ 16 | device.h \ 17 | service.h 18 | 19 | FORMS = \ 20 | device.ui \ 21 | service.ui 22 | 23 | target.path = $$[QT_INSTALL_EXAMPLES]/bluetooth/btscanner 24 | INSTALLS += target 25 | -------------------------------------------------------------------------------- /tests/manual/examples/btscanner/device.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #ifndef DEVICE_H 5 | #define DEVICE_H 6 | 7 | #include 8 | 9 | #include 10 | 11 | QT_BEGIN_NAMESPACE 12 | class QBluetoothAddress; 13 | class QBluetoothDeviceDiscoveryAgent; 14 | class QBluetoothDeviceInfo; 15 | class QListWidgetItem; 16 | 17 | namespace Ui { 18 | class DeviceDiscovery; 19 | } 20 | QT_END_NAMESPACE 21 | 22 | class DeviceDiscoveryDialog : public QDialog 23 | { 24 | Q_OBJECT 25 | 26 | public: 27 | DeviceDiscoveryDialog(QWidget *parent = nullptr); 28 | ~DeviceDiscoveryDialog(); 29 | 30 | public slots: 31 | void addDevice(const QBluetoothDeviceInfo &info); 32 | void on_power_clicked(bool clicked); 33 | void on_discoverable_clicked(bool clicked); 34 | void displayPairingMenu(const QPoint &pos); 35 | void pairingDone(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing); 36 | private slots: 37 | void startScan(); 38 | void stopScan(); 39 | void scanFinished(); 40 | void itemActivated(QListWidgetItem *item); 41 | void hostModeStateChanged(QBluetoothLocalDevice::HostMode mode); 42 | 43 | private: 44 | QBluetoothDeviceDiscoveryAgent *discoveryAgent; 45 | QBluetoothLocalDevice *localDevice; 46 | Ui::DeviceDiscovery *ui; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /tests/manual/examples/btscanner/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #include "device.h" 5 | 6 | #include 7 | #include 8 | 9 | #if QT_CONFIG(permissions) 10 | #include 11 | #endif 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | // QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true")); 16 | QApplication app(argc, argv); 17 | DeviceDiscoveryDialog d; 18 | 19 | d.show(); 20 | 21 | // Check, and if needed, request a permission to use Bluetooth. 22 | #if QT_CONFIG(permissions) 23 | const auto permissionStatus = app.checkPermission(QBluetoothPermission{}); 24 | if (permissionStatus == Qt::PermissionStatus::Undetermined) { 25 | app.requestPermission(QBluetoothPermission{}, [](const QPermission &){ 26 | }); 27 | } 28 | // Else means either 'Granted' or 'Denied' and both normally must be 29 | // changed using the system's settings application. 30 | #endif // QT_CONFIG(permissions) 31 | 32 | return app.exec(); 33 | } 34 | -------------------------------------------------------------------------------- /tests/manual/examples/btscanner/service.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #ifndef SERVICE_H 5 | #define SERVICE_H 6 | 7 | #include 8 | 9 | QT_BEGIN_NAMESPACE 10 | class QBluetoothAddress; 11 | class QBluetoothServiceDiscoveryAgent; 12 | class QBluetoothServiceInfo; 13 | 14 | namespace Ui { 15 | class ServiceDiscovery; 16 | } 17 | QT_END_NAMESPACE 18 | 19 | class ServiceDiscoveryDialog : public QDialog 20 | { 21 | Q_OBJECT 22 | 23 | public: 24 | ServiceDiscoveryDialog(const QString &name, const QBluetoothAddress &address, 25 | QWidget *parent = nullptr); 26 | ~ServiceDiscoveryDialog(); 27 | 28 | public slots: 29 | void addService(const QBluetoothServiceInfo &info); 30 | 31 | private: 32 | QBluetoothServiceDiscoveryAgent *discoveryAgent; 33 | Ui::ServiceDiscovery *ui; 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/shared/Info.ios.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDisplayName 6 | ${MACOSX_BUNDLE_EXECUTABLE_NAME} 7 | CFBundleExecutable 8 | ${MACOSX_BUNDLE_EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | ${MACOSX_BUNDLE_ICON_FILE} 11 | CFBundleIdentifier 12 | ${MACOSX_BUNDLE_GUI_IDENTIFIER} 13 | CFBundleName 14 | ${MACOSX_BUNDLE_BUNDLE_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | ${MACOSX_BUNDLE_SHORT_VERSION_STRING} 19 | CFBundleVersion 20 | ${MACOSX_BUNDLE_BUNDLE_VERSION} 21 | LSRequiresIPhoneOS 22 | 23 | NSBluetoothAlwaysUsageDescription 24 | BT test component wants to access your bluetooth adapter 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UISupportedInterfaceOrientations 28 | 29 | UIInterfaceOrientationPortrait 30 | UIInterfaceOrientationPortraitUpsideDown 31 | UIInterfaceOrientationLandscapeLeft 32 | UIInterfaceOrientationLandscapeRight 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /tests/shared/Info.macos.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleExecutable 6 | ${MACOSX_BUNDLE_EXECUTABLE_NAME} 7 | CFBundleIconFile 8 | ${MACOSX_BUNDLE_ICON_FILE} 9 | CFBundleIdentifier 10 | ${MACOSX_BUNDLE_GUI_IDENTIFIER} 11 | CFBundlePackageType 12 | APPL 13 | CFBundleSignature 14 | ???? 15 | LSMinimumSystemVersion 16 | ${CMAKE_OSX_DEPLOYMENT_TARGET} 17 | NSPrincipalClass 18 | NSApplication 19 | NSBluetoothAlwaysUsageDescription 20 | BT test component wants to access your bluetooth adapter 21 | NSSupportsAutomaticGraphicsSwitching 22 | 23 | 24 | 25 | --------------------------------------------------------------------------------