summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore9
-rw-r--r--.qmake.conf2
-rw-r--r--LICENSE.GPL674
-rw-r--r--LICENSE.GPLv2292
-rw-r--r--LICENSE.LGPLv21 (renamed from LICENSE.LGPL)20
-rw-r--r--LICENSE.LGPLv3173
-rw-r--r--config.tests/bluez/main.cpp30
-rw-r--r--config.tests/bluez_le/bluez_le.pro8
-rw-r--r--config.tests/bluez_le/main.cpp44
-rw-r--r--config.tests/btapi10_2_1/main.cpp30
-rw-r--r--config.tests/libbb2/main.cpp28
-rw-r--r--examples/bluetooth/bluetooth.pro6
-rw-r--r--examples/bluetooth/btchat/chatserver.cpp2
-rw-r--r--examples/bluetooth/btfiletransfer/btfiletransfer.pro2
-rw-r--r--examples/bluetooth/btscanner/service.cpp12
-rw-r--r--examples/bluetooth/btscanner/service.h3
-rw-r--r--examples/bluetooth/heartlistener/assets/Button.qml77
-rw-r--r--examples/bluetooth/heartlistener/assets/Point.qml51
-rw-r--r--examples/bluetooth/heartlistener/assets/blue_heart.pngbin0 -> 7283 bytes
-rw-r--r--examples/bluetooth/heartlistener/assets/blue_heart_small.pngbin0 -> 250 bytes
-rw-r--r--examples/bluetooth/heartlistener/assets/busy_dark.pngbin0 -> 1130 bytes
-rw-r--r--examples/bluetooth/heartlistener/assets/dialog.qml61
-rw-r--r--examples/bluetooth/heartlistener/assets/draw.js74
-rw-r--r--examples/bluetooth/heartlistener/assets/home.qml186
-rw-r--r--examples/bluetooth/heartlistener/assets/main.qml84
-rw-r--r--examples/bluetooth/heartlistener/assets/monitor.qml154
-rw-r--r--examples/bluetooth/heartlistener/assets/results.qml291
-rw-r--r--examples/bluetooth/heartlistener/assets/star.pngbin0 -> 262 bytes
-rw-r--r--examples/bluetooth/heartlistener/deviceinfo.cpp58
-rw-r--r--examples/bluetooth/heartlistener/deviceinfo.h69
-rw-r--r--examples/bluetooth/heartlistener/doc/images/heartratefound.pngbin0 -> 31606 bytes
-rw-r--r--examples/bluetooth/heartlistener/doc/images/heartratemonitor.pngbin0 -> 46437 bytes
-rw-r--r--examples/bluetooth/heartlistener/doc/images/heartrateresults.pngbin0 -> 49402 bytes
-rw-r--r--examples/bluetooth/heartlistener/doc/src/heartlistener.qdoc83
-rw-r--r--examples/bluetooth/heartlistener/heartlistener.pro20
-rw-r--r--examples/bluetooth/heartlistener/heartrate.cpp441
-rw-r--r--examples/bluetooth/heartlistener/heartrate.h149
-rw-r--r--examples/bluetooth/heartlistener/main.cpp61
-rw-r--r--examples/bluetooth/heartlistener/resources.qrc16
-rw-r--r--examples/bluetooth/lowenergyscanner/assets/Characteristics.qml147
-rw-r--r--examples/bluetooth/lowenergyscanner/assets/Dialog.qml61
-rw-r--r--examples/bluetooth/lowenergyscanner/assets/Header.qml61
-rw-r--r--examples/bluetooth/lowenergyscanner/assets/Label.qml53
-rw-r--r--examples/bluetooth/lowenergyscanner/assets/Menu.qml90
-rw-r--r--examples/bluetooth/lowenergyscanner/assets/Services.qml136
-rw-r--r--examples/bluetooth/lowenergyscanner/assets/main.qml130
-rw-r--r--examples/bluetooth/lowenergyscanner/characteristicinfo.cpp147
-rw-r--r--examples/bluetooth/lowenergyscanner/characteristicinfo.h75
-rw-r--r--examples/bluetooth/lowenergyscanner/device.cpp307
-rw-r--r--examples/bluetooth/lowenergyscanner/device.h122
-rw-r--r--examples/bluetooth/lowenergyscanner/deviceinfo.cpp72
-rw-r--r--examples/bluetooth/lowenergyscanner/deviceinfo.h71
-rw-r--r--examples/bluetooth/lowenergyscanner/doc/images/lowenergyscanner-chars.pngbin0 -> 51040 bytes
-rw-r--r--examples/bluetooth/lowenergyscanner/doc/images/lowenergyscanner-devices.pngbin0 -> 40304 bytes
-rw-r--r--examples/bluetooth/lowenergyscanner/doc/images/lowenergyscanner-services.pngbin0 -> 58825 bytes
-rw-r--r--examples/bluetooth/lowenergyscanner/doc/src/lowenergyscanner.qdoc139
-rw-r--r--examples/bluetooth/lowenergyscanner/lowenergyscanner.pro25
-rw-r--r--examples/bluetooth/lowenergyscanner/main.cpp62
-rw-r--r--examples/bluetooth/lowenergyscanner/resources.qrc11
-rw-r--r--examples/bluetooth/lowenergyscanner/serviceinfo.cpp102
-rw-r--r--examples/bluetooth/lowenergyscanner/serviceinfo.h67
-rw-r--r--examples/bluetooth/picturetransfer/filetransfer.cpp2
-rw-r--r--examples/bluetooth/picturetransfer/main.cpp2
-rw-r--r--examples/bluetooth/pingpong/pingpong.cpp24
-rw-r--r--examples/bluetooth/scanner/qmlscanner.cpp2
-rw-r--r--examples/nfc/ndefeditor/mainwindow.cpp12
-rw-r--r--examples/nfc/ndefeditor/mimeimagerecordeditor.cpp24
-rw-r--r--examples/nfc/poster/qmlposter.cpp2
-rw-r--r--qtconnectivity.pro1
-rw-r--r--src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothBroadcastReceiver.java28
-rw-r--r--src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothInputStreamThread.java28
-rw-r--r--src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothSocketServer.java28
-rw-r--r--src/bluetooth/android/androidbroadcastreceiver.cpp28
-rw-r--r--src/bluetooth/android/androidbroadcastreceiver_p.h28
-rw-r--r--src/bluetooth/android/devicediscoverybroadcastreceiver.cpp28
-rw-r--r--src/bluetooth/android/devicediscoverybroadcastreceiver_p.h28
-rw-r--r--src/bluetooth/android/inputstreamthread.cpp28
-rw-r--r--src/bluetooth/android/inputstreamthread_p.h28
-rw-r--r--src/bluetooth/android/jni_android.cpp28
-rw-r--r--src/bluetooth/android/jni_android_p.h28
-rw-r--r--src/bluetooth/android/localdevicebroadcastreceiver.cpp28
-rw-r--r--src/bluetooth/android/localdevicebroadcastreceiver_p.h28
-rw-r--r--src/bluetooth/android/serveracceptancethread.cpp28
-rw-r--r--src/bluetooth/android/serveracceptancethread_p.h28
-rw-r--r--src/bluetooth/android/servicediscoverybroadcastreceiver.cpp28
-rw-r--r--src/bluetooth/android/servicediscoverybroadcastreceiver_p.h28
-rw-r--r--src/bluetooth/bluetooth.pro49
-rw-r--r--src/bluetooth/bluez/adapter1_bluez5.cpp26
-rw-r--r--src/bluetooth/bluez/adapter1_bluez5_p.h126
-rw-r--r--src/bluetooth/bluez/bluez.pri36
-rw-r--r--src/bluetooth/bluez/bluez5_helper.cpp323
-rw-r--r--src/bluetooth/bluez/bluez5_helper_p.h85
-rw-r--r--src/bluetooth/bluez/bluez_data_p.h114
-rw-r--r--src/bluetooth/bluez/device1_bluez5.cpp26
-rw-r--r--src/bluetooth/bluez/device1_bluez5_p.h151
-rw-r--r--src/bluetooth/bluez/obex_client1_bluez5.cpp26
-rw-r--r--src/bluetooth/bluez/obex_client1_bluez5_p.h63
-rw-r--r--src/bluetooth/bluez/obex_objectpush1_bluez5.cpp26
-rw-r--r--src/bluetooth/bluez/obex_objectpush1_bluez5_p.h100
-rw-r--r--src/bluetooth/bluez/obex_transfer1_bluez5.cpp26
-rw-r--r--src/bluetooth/bluez/obex_transfer1_bluez5_p.h91
-rw-r--r--src/bluetooth/bluez/objectmanager.cpp26
-rw-r--r--src/bluetooth/bluez/objectmanager_p.h63
-rw-r--r--src/bluetooth/bluez/org.bluez.Adapter1.xml23
-rw-r--r--src/bluetooth/bluez/org.bluez.Client1.xml15
-rw-r--r--src/bluetooth/bluez/org.bluez.Device1.xml31
-rw-r--r--src/bluetooth/bluez/org.bluez.ProfileManager1.xml16
-rw-r--r--src/bluetooth/bluez/org.bluez.obex.ObjectPush1.xml25
-rw-r--r--src/bluetooth/bluez/org.bluez.obex.Transfer1.xml16
-rw-r--r--src/bluetooth/bluez/org.freedesktop.dbus.objectmanager.xml19
-rw-r--r--src/bluetooth/bluez/org.freedesktop.dbus.properties.xml27
-rw-r--r--src/bluetooth/bluez/profile1.cpp26
-rw-r--r--src/bluetooth/bluez/profile1_p.h61
-rw-r--r--src/bluetooth/bluez/properties.cpp26
-rw-r--r--src/bluetooth/bluez/properties_p.h71
-rw-r--r--src/bluetooth/bluez/servicemap.cpp30
-rw-r--r--src/bluetooth/bluez/servicemap_p.h30
-rw-r--r--src/bluetooth/doc/images/peripheral-structure.pngbin0 -> 74765 bytes
-rw-r--r--src/bluetooth/doc/qtbluetooth.qdocconf1
-rw-r--r--src/bluetooth/doc/snippets/doc_src_qtbluetooth.cpp28
-rw-r--r--src/bluetooth/doc/src/bluetooth-index.qdoc15
-rw-r--r--src/bluetooth/doc/src/bluetooth-le-overview.qdoc254
-rw-r--r--src/bluetooth/doc/src/bluetooth-overview.qdoc13
-rw-r--r--src/bluetooth/doc/src/examples.qdoc7
-rw-r--r--src/bluetooth/qbluetooth.cpp38
-rw-r--r--src/bluetooth/qbluetooth.h53
-rw-r--r--src/bluetooth/qbluetoothaddress.cpp63
-rw-r--r--src/bluetooth/qbluetoothaddress.h39
-rw-r--r--src/bluetooth/qbluetoothaddress_p.h32
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent.cpp55
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent.h45
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp74
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp450
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp37
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_p.h73
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_qnx.cpp129
-rw-r--r--src/bluetooth/qbluetoothdeviceinfo.cpp123
-rw-r--r--src/bluetooth/qbluetoothdeviceinfo.h43
-rw-r--r--src/bluetooth/qbluetoothdeviceinfo_p.h31
-rw-r--r--src/bluetooth/qbluetoothglobal.h30
-rw-r--r--src/bluetooth/qbluetoothhostinfo.cpp38
-rw-r--r--src/bluetooth/qbluetoothhostinfo.h31
-rw-r--r--src/bluetooth/qbluetoothhostinfo_p.h34
-rw-r--r--src/bluetooth/qbluetoothlocaldevice.cpp51
-rw-r--r--src/bluetooth/qbluetoothlocaldevice.h37
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_android.cpp229
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_bluez.cpp975
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_p.cpp40
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_p.h79
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_qnx.cpp143
-rw-r--r--src/bluetooth/qbluetoothserver.cpp28
-rw-r--r--src/bluetooth/qbluetoothserver.h30
-rw-r--r--src/bluetooth/qbluetoothserver_android.cpp28
-rw-r--r--src/bluetooth/qbluetoothserver_bluez.cpp30
-rw-r--r--src/bluetooth/qbluetoothserver_p.cpp30
-rw-r--r--src/bluetooth/qbluetoothserver_p.h32
-rw-r--r--src/bluetooth/qbluetoothserver_qnx.cpp28
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent.cpp59
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent.h33
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_android.cpp138
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp572
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_p.cpp30
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_p.h56
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp139
-rw-r--r--src/bluetooth/qbluetoothserviceinfo.cpp30
-rw-r--r--src/bluetooth/qbluetoothserviceinfo.h30
-rw-r--r--src/bluetooth/qbluetoothserviceinfo_android.cpp28
-rw-r--r--src/bluetooth/qbluetoothserviceinfo_bluez.cpp266
-rw-r--r--src/bluetooth/qbluetoothserviceinfo_p.cpp30
-rw-r--r--src/bluetooth/qbluetoothserviceinfo_p.h33
-rw-r--r--src/bluetooth/qbluetoothserviceinfo_qnx.cpp28
-rw-r--r--src/bluetooth/qbluetoothsocket.cpp28
-rw-r--r--src/bluetooth/qbluetoothsocket.h33
-rw-r--r--src/bluetooth/qbluetoothsocket_android.cpp36
-rw-r--r--src/bluetooth/qbluetoothsocket_bluez.cpp151
-rw-r--r--src/bluetooth/qbluetoothsocket_p.cpp38
-rw-r--r--src/bluetooth/qbluetoothsocket_p.h58
-rw-r--r--src/bluetooth/qbluetoothsocket_qnx.cpp44
-rw-r--r--src/bluetooth/qbluetoothtransfermanager.cpp30
-rw-r--r--src/bluetooth/qbluetoothtransfermanager.h30
-rw-r--r--src/bluetooth/qbluetoothtransferreply.cpp45
-rw-r--r--src/bluetooth/qbluetoothtransferreply.h33
-rw-r--r--src/bluetooth/qbluetoothtransferreply_bluez.cpp276
-rw-r--r--src/bluetooth/qbluetoothtransferreply_bluez_p.h56
-rw-r--r--src/bluetooth/qbluetoothtransferreply_p.h30
-rw-r--r--src/bluetooth/qbluetoothtransferreply_qnx.cpp40
-rw-r--r--src/bluetooth/qbluetoothtransferreply_qnx_p.h30
-rw-r--r--src/bluetooth/qbluetoothtransferrequest.cpp30
-rw-r--r--src/bluetooth/qbluetoothtransferrequest.h30
-rw-r--r--src/bluetooth/qbluetoothtransferrequest_p.h30
-rw-r--r--src/bluetooth/qbluetoothuuid.cpp714
-rw-r--r--src/bluetooth/qbluetoothuuid.h158
-rw-r--r--src/bluetooth/qlowenergycharacteristic.cpp357
-rw-r--r--src/bluetooth/qlowenergycharacteristic.h103
-rw-r--r--src/bluetooth/qlowenergycontroller.cpp563
-rw-r--r--src/bluetooth/qlowenergycontroller.h104
-rw-r--r--src/bluetooth/qlowenergycontroller_bluez.cpp1183
-rw-r--r--src/bluetooth/qlowenergycontroller_p.cpp86
-rw-r--r--src/bluetooth/qlowenergycontroller_p.h158
-rw-r--r--src/bluetooth/qlowenergydescriptor.cpp311
-rw-r--r--src/bluetooth/qlowenergydescriptor.h85
-rw-r--r--src/bluetooth/qlowenergyservice.cpp508
-rw-r--r--src/bluetooth/qlowenergyservice.h113
-rw-r--r--src/bluetooth/qlowenergyserviceinfo.cpp172
-rw-r--r--src/bluetooth/qlowenergyserviceinfo.h73
-rw-r--r--src/bluetooth/qlowenergyserviceinfo_p.h50
-rw-r--r--src/bluetooth/qlowenergyserviceprivate.cpp72
-rw-r--r--src/bluetooth/qlowenergyserviceprivate_p.h105
-rw-r--r--src/bluetooth/qnx/ppshelpers.cpp28
-rw-r--r--src/bluetooth/qnx/ppshelpers_p.h30
-rw-r--r--src/bluetooth/qprivatelinearbuffer_p.h30
-rw-r--r--src/imports/bluetooth/plugin.cpp36
-rw-r--r--src/imports/bluetooth/plugins.qmltypes4
-rw-r--r--src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp34
-rw-r--r--src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h30
-rw-r--r--src/imports/bluetooth/qdeclarativebluetoothservice.cpp30
-rw-r--r--src/imports/bluetooth/qdeclarativebluetoothservice_p.h30
-rw-r--r--src/imports/bluetooth/qdeclarativebluetoothsocket.cpp30
-rw-r--r--src/imports/bluetooth/qdeclarativebluetoothsocket_p.h30
-rw-r--r--src/imports/nfc/plugin.cpp38
-rw-r--r--src/imports/nfc/plugins.qmltypes4
-rw-r--r--src/imports/nfc/qdeclarativendeffilter.cpp32
-rw-r--r--src/imports/nfc/qdeclarativendeffilter_p.h30
-rw-r--r--src/imports/nfc/qdeclarativendefmimerecord.cpp30
-rw-r--r--src/imports/nfc/qdeclarativendefmimerecord_p.h30
-rw-r--r--src/imports/nfc/qdeclarativendeftextrecord.cpp30
-rw-r--r--src/imports/nfc/qdeclarativendeftextrecord_p.h30
-rw-r--r--src/imports/nfc/qdeclarativendefurirecord.cpp30
-rw-r--r--src/imports/nfc/qdeclarativendefurirecord_p.h30
-rw-r--r--src/imports/nfc/qdeclarativenearfield.cpp30
-rw-r--r--src/imports/nfc/qdeclarativenearfield_p.h30
-rw-r--r--src/imports/nfc/qdeclarativenearfieldsocket.cpp30
-rw-r--r--src/imports/nfc/qdeclarativenearfieldsocket_p.h30
-rw-r--r--src/nfc/doc/qtnfc.qdocconf1
-rw-r--r--src/nfc/qllcpserver.cpp30
-rw-r--r--src/nfc/qllcpserver_p.cpp30
-rw-r--r--src/nfc/qllcpserver_p.h32
-rw-r--r--src/nfc/qllcpserver_p_p.h30
-rw-r--r--src/nfc/qllcpserver_qnx_p.cpp28
-rw-r--r--src/nfc/qllcpserver_qnx_p.h28
-rw-r--r--src/nfc/qllcpserver_simulator_p.cpp30
-rw-r--r--src/nfc/qllcpserver_simulator_p.h30
-rw-r--r--src/nfc/qllcpsocket.cpp30
-rw-r--r--src/nfc/qllcpsocket_p.cpp30
-rw-r--r--src/nfc/qllcpsocket_p.h32
-rw-r--r--src/nfc/qllcpsocket_p_p.h30
-rw-r--r--src/nfc/qllcpsocket_qnx_p.cpp28
-rw-r--r--src/nfc/qllcpsocket_qnx_p.h32
-rw-r--r--src/nfc/qllcpsocket_simulator_p.cpp30
-rw-r--r--src/nfc/qllcpsocket_simulator_p.h30
-rw-r--r--src/nfc/qndeffilter.cpp30
-rw-r--r--src/nfc/qndeffilter.h30
-rw-r--r--src/nfc/qndefmessage.cpp30
-rw-r--r--src/nfc/qndefmessage.h30
-rw-r--r--src/nfc/qndefnfcsmartposterrecord.cpp28
-rw-r--r--src/nfc/qndefnfcsmartposterrecord.h28
-rw-r--r--src/nfc/qndefnfcsmartposterrecord_p.h28
-rw-r--r--src/nfc/qndefnfctextrecord.cpp30
-rw-r--r--src/nfc/qndefnfctextrecord.h30
-rw-r--r--src/nfc/qndefnfcurirecord.cpp30
-rw-r--r--src/nfc/qndefnfcurirecord.h30
-rw-r--r--src/nfc/qndefrecord.cpp30
-rw-r--r--src/nfc/qndefrecord.h30
-rw-r--r--src/nfc/qndefrecord_p.h30
-rw-r--r--src/nfc/qnearfieldmanager.cpp30
-rw-r--r--src/nfc/qnearfieldmanager.h30
-rw-r--r--src/nfc/qnearfieldmanager_emulator.cpp30
-rw-r--r--src/nfc/qnearfieldmanager_emulator_p.h30
-rw-r--r--src/nfc/qnearfieldmanager_p.h30
-rw-r--r--src/nfc/qnearfieldmanager_qnx.cpp28
-rw-r--r--src/nfc/qnearfieldmanager_qnx_p.h30
-rw-r--r--src/nfc/qnearfieldmanager_simulator.cpp30
-rw-r--r--src/nfc/qnearfieldmanager_simulator_p.h30
-rw-r--r--src/nfc/qnearfieldmanagerimpl_p.cpp30
-rw-r--r--src/nfc/qnearfieldmanagerimpl_p.h30
-rw-r--r--src/nfc/qnearfieldmanagervirtualbase.cpp30
-rw-r--r--src/nfc/qnearfieldmanagervirtualbase_p.h30
-rw-r--r--src/nfc/qnearfieldsharemanager.cpp28
-rw-r--r--src/nfc/qnearfieldsharemanager.h28
-rw-r--r--src/nfc/qnearfieldsharemanager_p.h28
-rw-r--r--src/nfc/qnearfieldsharemanager_qnx_p.cpp28
-rw-r--r--src/nfc/qnearfieldsharemanager_qnx_p.h30
-rw-r--r--src/nfc/qnearfieldsharemanagerimpl_p.cpp28
-rw-r--r--src/nfc/qnearfieldsharemanagerimpl_p.h28
-rw-r--r--src/nfc/qnearfieldsharetarget.cpp28
-rw-r--r--src/nfc/qnearfieldsharetarget.h28
-rw-r--r--src/nfc/qnearfieldsharetarget_p.h28
-rw-r--r--src/nfc/qnearfieldsharetarget_qnx_p.cpp28
-rw-r--r--src/nfc/qnearfieldsharetarget_qnx_p.h30
-rw-r--r--src/nfc/qnearfieldsharetargetimpl_p.cpp28
-rw-r--r--src/nfc/qnearfieldsharetargetimpl_p.h28
-rw-r--r--src/nfc/qnearfieldtagtype1.cpp30
-rw-r--r--src/nfc/qnearfieldtagtype1_p.h30
-rw-r--r--src/nfc/qnearfieldtagtype2.cpp30
-rw-r--r--src/nfc/qnearfieldtagtype2_p.h30
-rw-r--r--src/nfc/qnearfieldtagtype3.cpp30
-rw-r--r--src/nfc/qnearfieldtagtype3_p.h30
-rw-r--r--src/nfc/qnearfieldtagtype4.cpp30
-rw-r--r--src/nfc/qnearfieldtagtype4_p.h30
-rw-r--r--src/nfc/qnearfieldtarget.cpp30
-rw-r--r--src/nfc/qnearfieldtarget.h30
-rw-r--r--src/nfc/qnearfieldtarget_emulator.cpp36
-rw-r--r--src/nfc/qnearfieldtarget_emulator_p.h30
-rw-r--r--src/nfc/qnearfieldtarget_p.h30
-rw-r--r--src/nfc/qnearfieldtarget_qnx_p.h40
-rw-r--r--src/nfc/qnfcglobal.h30
-rw-r--r--src/nfc/qnx/qnxnfceventfilter.cpp30
-rw-r--r--src/nfc/qnx/qnxnfceventfilter_p.h30
-rw-r--r--src/nfc/qnx/qnxnfcmanager.cpp31
-rw-r--r--src/nfc/qnx/qnxnfcmanager_p.h32
-rw-r--r--src/nfc/qnx/qnxnfcsharemanager_p.cpp28
-rw-r--r--src/nfc/qnx/qnxnfcsharemanager_p.h30
-rw-r--r--src/nfc/qqmlndefrecord.cpp36
-rw-r--r--src/nfc/qqmlndefrecord.h30
-rw-r--r--src/nfc/qtlv.cpp30
-rw-r--r--src/nfc/qtlv_p.h30
-rw-r--r--src/nfc/targetemulator.cpp42
-rw-r--r--src/nfc/targetemulator_p.h30
-rw-r--r--src/src.pro4
-rw-r--r--src/tools/sdpscanner/main.cpp319
-rw-r--r--src/tools/sdpscanner/sdpscanner.pro24
-rw-r--r--tests/auto/auto.pro6
-rw-r--r--tests/auto/qbluetoothaddress/tst_qbluetoothaddress.cpp30
-rw-r--r--tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp55
-rw-r--r--tests/auto/qbluetoothdeviceinfo/qbluetoothdeviceinfo.pro3
-rw-r--r--tests/auto/qbluetoothdeviceinfo/tst_qbluetoothdeviceinfo.cpp117
-rw-r--r--tests/auto/qbluetoothhostinfo/tst_qbluetoothhostinfo.cpp30
-rw-r--r--tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp36
-rw-r--r--tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp30
-rw-r--r--tests/auto/qbluetoothservicediscoveryagent/qbluetoothservicediscoveryagent.pro3
-rw-r--r--tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp69
-rw-r--r--tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp30
-rw-r--r--tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp34
-rw-r--r--tests/auto/qbluetoothtransfermanager/tst_qbluetoothtransfermanager.cpp30
-rw-r--r--tests/auto/qbluetoothtransferrequest/tst_qbluetoothtransferrequest.cpp30
-rw-r--r--tests/auto/qbluetoothuuid/tst_qbluetoothuuid.cpp45
-rw-r--r--tests/auto/qlowenergycharacteristic/qlowenergycharacteristic.pro9
-rw-r--r--tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp350
-rw-r--r--tests/auto/qlowenergycontroller/qlowenergycontroller.pro6
-rw-r--r--tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp1799
-rw-r--r--tests/auto/qlowenergydescriptor/qlowenergydescriptor.pro8
-rw-r--r--tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp318
-rw-r--r--tests/auto/qlowenergyserviceinfo/qlowenergyserviceinfo.pro9
-rw-r--r--tests/auto/qlowenergyserviceinfo/tst_qlowenergyserviceinfo.cpp243
-rw-r--r--tests/auto/qndefmessage/tst_qndefmessage.cpp91
-rw-r--r--tests/auto/qndefnfcsmartposterrecord/tst_qndefnfcsmartposterrecord.cpp28
-rw-r--r--tests/auto/qndefrecord/tst_qndefrecord.cpp44
-rw-r--r--tests/auto/qnearfieldmanager/tst_qnearfieldmanager.cpp30
-rw-r--r--tests/auto/qnearfieldtagtype1/tst_qnearfieldtagtype1.cpp34
-rw-r--r--tests/auto/qnearfieldtagtype2/tst_qnearfieldtagtype2.cpp34
-rw-r--r--tests/bttestui/Button.qml28
-rw-r--r--tests/bttestui/btlocaldevice.cpp69
-rw-r--r--tests/bttestui/btlocaldevice.h29
-rw-r--r--tests/bttestui/main.cpp28
-rw-r--r--tests/bttestui/main.qml28
-rw-r--r--tests/nfctestserver/main.cpp30
-rw-r--r--tests/nfctestserver/servercontroller.cpp30
-rw-r--r--tests/nfctestserver/servercontroller.h30
-rw-r--r--tests/nfctestserver/servicenames.h30
-rw-r--r--tests/nfctestserver/socketcontroller.cpp32
-rw-r--r--tests/nfctestserver/socketcontroller.h30
361 files changed, 19656 insertions, 6183 deletions
diff --git a/.gitignore b/.gitignore
index 53ff867f..a5f6a7ea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,10 +25,13 @@ tmp
imports/*
include
config.tests/bluez/bluez
+config.tests/bluez_le/bluez_le
examples/bluetooth/btchat/btchat
examples/bluetooth/btfiletransfer/btfiletransfer
examples/bluetooth/btscanner/btscanner
-examples/bluetooth/bttennis/bttennis
+examples/bluetooth/heartlistener/heartlistener
+examples/bluetooth/lowenergyscanner/lowenergyscanner
+examples/bluetooth/pingpong/pingpong
examples/bluetooth/picturetransfer/qml_picturetransfer
examples/bluetooth/scanner/qml_scanner
examples/nfc/annotatedurl/annotatedurl
@@ -50,6 +53,10 @@ tests/auto/qbluetoothsocket/tst_qbluetoothsocket
tests/auto/qbluetoothtransfermanager/tst_qbluetoothtransfermanager
tests/auto/qbluetoothtransferrequest/tst_qbluetoothtransferrequest
tests/auto/qbluetoothuuid/tst_qbluetoothuuid
+tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic
+tests/auto/qlowenergycontroller/tst_qlowenergycontroller
+tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor
+tests/auto/qlowenergyserviceinfo/tst_qlowenergyserviceinfo
tests/auto/qndefmessage/tst_qndefmessage
tests/auto/qndefnfcsmartposterrecord/tst_qndefnfcsmartposterrecord
tests/auto/qndefrecord/tst_qndefrecord
diff --git a/.qmake.conf b/.qmake.conf
index 60effa7d..17a3a578 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,4 +1,4 @@
load(qt_build_config)
CONFIG += qt_example_installs
-MODULE_VERSION = 5.3.2
+MODULE_VERSION = 5.4.0
diff --git a/LICENSE.GPL b/LICENSE.GPL
deleted file mode 100644
index 94a9ed02..00000000
--- a/LICENSE.GPL
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- <program> Copyright (C) <year> <name of author>
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/LICENSE.GPLv2 b/LICENSE.GPLv2
new file mode 100644
index 00000000..194c39cb
--- /dev/null
+++ b/LICENSE.GPLv2
@@ -0,0 +1,292 @@
+ GNU GENERAL PUBLIC LICENSE
+
+ The Qt Toolkit is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ Contact: http://www.qt-project.org/legal
+
+ You may use, distribute and copy the Qt GUI Toolkit under the terms of
+ GNU General Public License version 2, which is displayed below.
+
+-------------------------------------------------------------------------
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+Everyone is permitted to copy and distribute verbatim copies of this
+license document, but changing it is not allowed.
+
+Preamble
+
+ The licenses for most software are designed to take away your freedom
+to share and change it. By contrast, the GNU General Public License is
+intended to guarantee your freedom to share and change free software
+--to make sure the software is free for all its users. This General
+Public License applies to most of the Free Software Foundation's
+software and to any other program whose authors commit to using it.
+(Some other Free Software Foundation software is covered by the GNU
+Lesser General Public License instead.) You can apply it to your
+programs, too.
+
+When we speak of free software, we are referring to freedom, not price.
+Our General Public Licenses are designed to make sure that you have the
+freedom to distribute copies of free software (and charge for this
+service if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs; and that you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone
+to deny you these rights or to ask you to surrender the rights. These
+restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis
+ or for a fee, you must give the recipients all the rights that you
+have. You must make sure that they, too, receive or can get the source
+code. And you must show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+Finally, any free program is threatened constantly by software patents.
+We wish to avoid the danger that redistributors of a free program will
+individually obtain patent licenses, in effect making the program
+proprietary. To prevent this, we have made it clear that any patent
+must be licensed for everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and
+modification follow.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a
+notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of running
+the Program is not restricted, and the output from the Program is
+covered only if its contents constitute a work based on the Program
+(independent of having been made by running the Program). Whether that
+is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source
+code as you receive it, in any medium, provided that you conspicuously
+and appropriately publish on each copy an appropriate copyright notice
+and disclaimer of warranty; keep intact all the notices that refer to
+this License and to the absence of any warranty; and give any other
+recipients of the Program a copy of this License along with the
+Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of
+it, thus forming a work based on the Program, and copy and distribute
+such modifications or work under the terms of Section 1 above, provided
+that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but does
+ not normally print such an announcement, your work based on the
+ Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of a
+storage or distribution medium does not bring the other work under the
+scope of this License.
+
+3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software
+ interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your cost
+ of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to control
+compilation and installation of the executable. However, as a special
+exception, the source code distributed need not include anything that
+is normally distributed (in either source or binary form) with the
+major components (compiler, kernel, and so on) of the operating system
+on which the executable runs, unless that component itself accompanies
+the executable.
+
+If distribution of executable or object code is made by offering access
+to copy from a designated place, then offering equivalent access to
+copy the source code from the same place counts as distribution of the
+source code, even though third parties are not compelled to copy the
+source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt otherwise
+to copy, modify, sublicense or distribute the Program is void, and will
+automatically terminate your rights under this License. However,
+parties who have received copies, or rights, from you under this License
+will not have their licenses terminated so long as such parties remain
+in full compliance.
+
+5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further restrictions
+on the recipients' exercise of the rights granted herein. You are not
+responsible for enforcing compliance by third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent license
+would not permit royalty-free redistribution of the Program by all
+those who receive copies directly or indirectly through you, then the
+only way you could satisfy both it and this License would be to refrain
+entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License may
+add an explicit geographical distribution limitation excluding those
+countries, so that distribution is permitted only in or among countries
+not thus excluded. In such case, this License incorporates the limitation
+as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail
+to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Program does not specify a version
+number of this License, you may choose any version ever published by
+the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the
+author to ask for permission. For software which is copyrighted by
+the Free Software Foundation, write to the Free Software Foundation;
+we sometimes make exceptions for this. Our decision will be guided by
+the two goals of preserving the free status of all derivatives of our
+free software and of promoting the sharing and reuse of software
+generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
+ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH
+YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
+NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
+MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE
+TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+END OF TERMS AND CONDITIONS
diff --git a/LICENSE.LGPL b/LICENSE.LGPLv21
index 3788d79e..341aa9ee 100644
--- a/LICENSE.LGPL
+++ b/LICENSE.LGPLv21
@@ -1,6 +1,6 @@
- GNU LESSER GENERAL PUBLIC LICENSE
+ GNU LESSER GENERAL PUBLIC LICENSE
- The Qt Toolkit is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+ The Qt Toolkit is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
Contact: http://www.qt-project.org/legal
You may use, distribute and copy the Qt GUI Toolkit under the terms of
@@ -8,8 +8,8 @@
-------------------------------------------------------------------------
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@@ -20,7 +20,7 @@
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
- Preamble
+ Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
@@ -122,8 +122,8 @@ modification follow. Pay close attention to the difference between a
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
@@ -156,7 +156,7 @@ such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
-
+
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
@@ -442,7 +442,7 @@ decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
- NO WARRANTY
+ NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
@@ -465,7 +465,7 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
- END OF TERMS AND CONDITIONS
+ END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
diff --git a/LICENSE.LGPLv3 b/LICENSE.LGPLv3
new file mode 100644
index 00000000..aed671a0
--- /dev/null
+++ b/LICENSE.LGPLv3
@@ -0,0 +1,173 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+
+ The Qt Toolkit is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ Contact: http://www.qt-project.org/legal
+
+ You may use, distribute and copy the Qt GUI Toolkit under the terms of
+ GNU Lesser General Public License version 3, which is displayed below.
+
+-------------------------------------------------------------------------
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
+Everyone is permitted to copy and distribute verbatim copies of this
+licensedocument, but changing it is not allowed.
+
+This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+0. Additional Definitions.
+
+ As used herein, “this License” refers to version 3 of the GNU Lesser
+General Public License, and the “GNU GPL” refers to version 3 of the
+GNU General Public License.
+
+ “The Library” refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An “Application” is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A “Combined Work” is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the “Linked
+Version”.
+
+ The “Minimal Corresponding Source” for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The “Corresponding Application Code” for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort
+ to ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this
+ license document.
+
+4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that, taken
+together, effectively do not restrict modification of the portions of
+the Library contained in the Combined Work and reverse engineering for
+debugging such modifications, if you also do each of the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this
+ license document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of
+ this License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with
+ the Library. A suitable mechanism is one that (a) uses at run
+ time a copy of the Library already present on the user's
+ computer system, and (b) will operate properly with a modified
+ version of the Library that is interface-compatible with the
+ Linked Version.
+
+ e) Provide Installation Information, but only if you would
+ otherwise be required to provide such information under section 6
+ of the GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the Application
+ with a modified version of the Linked Version. (If you use option
+ 4d0, the Installation Information must accompany the Minimal
+ Corresponding Source and Corresponding Application Code. If you
+ use option 4d1, you must provide the Installation Information in
+ the manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.)
+
+5. Combined Libraries.
+
+ You may place library facilities that are a work based on the Library
+side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities, conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of
+ it is a work based on the Library, and explaining where to find
+ the accompanying uncombined form of the same work.
+
+6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+as you received it specifies that a certain numbered version of the
+GNU Lesser General Public License “or any later version” applies to
+it, you have the option of following the terms and conditions either
+of that published version or of any later version published by the
+Free Software Foundation. If the Library as you received it does not
+specify a version number of the GNU Lesser General Public License,
+you may choose any version of the GNU Lesser General Public License
+ever published by the Free Software Foundation.
+
+If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the Library.
+
diff --git a/config.tests/bluez/main.cpp b/config.tests/bluez/main.cpp
index c0aa7eca..c7867cdc 100644
--- a/config.tests/bluez/main.cpp
+++ b/config.tests/bluez/main.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtConnectivity module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/config.tests/bluez_le/bluez_le.pro b/config.tests/bluez_le/bluez_le.pro
new file mode 100644
index 00000000..27b19a45
--- /dev/null
+++ b/config.tests/bluez_le/bluez_le.pro
@@ -0,0 +1,8 @@
+TEMPLATE = app
+
+CONFIG += link_pkgconfig
+PKGCONFIG += bluez
+
+TARGET = bluez_le
+
+SOURCES += main.cpp
diff --git a/config.tests/bluez_le/main.cpp b/config.tests/bluez_le/main.cpp
new file mode 100644
index 00000000..11218b8e
--- /dev/null
+++ b/config.tests/bluez_le/main.cpp
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtConnectivity module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <bluetooth/bluetooth.h>
+#include <bluetooth/l2cap.h>
+
+int main()
+{
+ sockaddr_l2 addr;
+ memset(&addr, 0, sizeof(addr));
+ addr.l2_family = AF_BLUETOOTH;
+ addr.l2_cid = 4;
+ addr.l2_bdaddr_type = BDADDR_LE_PUBLIC;
+}
diff --git a/config.tests/btapi10_2_1/main.cpp b/config.tests/btapi10_2_1/main.cpp
index 7f8bed3e..e7d5812e 100644
--- a/config.tests/btapi10_2_1/main.cpp
+++ b/config.tests/btapi10_2_1/main.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtConnectivity module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/config.tests/libbb2/main.cpp b/config.tests/libbb2/main.cpp
index 0f7707f8..baa509b3 100644
--- a/config.tests/libbb2/main.cpp
+++ b/config.tests/libbb2/main.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtConnectivity module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/examples/bluetooth/bluetooth.pro b/examples/bluetooth/bluetooth.pro
index a0379f6c..4576956f 100644
--- a/examples/bluetooth/bluetooth.pro
+++ b/examples/bluetooth/bluetooth.pro
@@ -5,4 +5,8 @@ qtHaveModule(widgets) {
btfiletransfer
}
-qtHaveModule(quick): SUBDIRS += scanner picturetransfer pingpong
+qtHaveModule(quick): SUBDIRS += scanner \
+ picturetransfer \
+ pingpong \
+ lowenergyscanner \
+ heartlistener
diff --git a/examples/bluetooth/btchat/chatserver.cpp b/examples/bluetooth/btchat/chatserver.cpp
index 0b29b87b..6da4b471 100644
--- a/examples/bluetooth/btchat/chatserver.cpp
+++ b/examples/bluetooth/btchat/chatserver.cpp
@@ -83,7 +83,9 @@ void ChatServer::startServer(const QBluetoothAddress& localAdapter)
classId);
classId.prepend(QVariant::fromValue(QBluetoothUuid(serviceUuid)));
+
serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId);
+ serviceInfo.setAttribute(QBluetoothServiceInfo::BluetoothProfileDescriptorList,classId);
//! [Class Uuuid must contain at least 1 entry]
diff --git a/examples/bluetooth/btfiletransfer/btfiletransfer.pro b/examples/bluetooth/btfiletransfer/btfiletransfer.pro
index 00b16415..e5d47302 100644
--- a/examples/bluetooth/btfiletransfer/btfiletransfer.pro
+++ b/examples/bluetooth/btfiletransfer/btfiletransfer.pro
@@ -26,5 +26,5 @@ OTHER_FILES += \
RESOURCES += \
btfiletransfer.qrc
-target.path = $$[QT_INSTALL_EXAMPLES]/bluetooth/scanner
+target.path = $$[QT_INSTALL_EXAMPLES]/bluetooth/btfiletransfer
INSTALLS += target
diff --git a/examples/bluetooth/btscanner/service.cpp b/examples/bluetooth/btscanner/service.cpp
index d9172d69..d24837eb 100644
--- a/examples/bluetooth/btscanner/service.cpp
+++ b/examples/bluetooth/btscanner/service.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
@@ -44,6 +45,8 @@
#include <qbluetoothservicediscoveryagent.h>
#include <qbluetoothserviceinfo.h>
#include <qbluetoothlocaldevice.h>
+#include <qlowenergyserviceinfo.h>
+#include <qbluetoothuuid.h>
ServiceDiscoveryDialog::ServiceDiscoveryDialog(const QString &name,
@@ -74,6 +77,8 @@ ServiceDiscoveryDialog::ServiceDiscoveryDialog(const QString &name,
connect(discoveryAgent, SIGNAL(serviceDiscovered(QBluetoothServiceInfo)),
this, SLOT(addService(QBluetoothServiceInfo)));
connect(discoveryAgent, SIGNAL(finished()), ui->status, SLOT(hide()));
+ connect(discoveryAgent, SIGNAL(serviceDiscovered(const QLowEnergyServiceInfo&)),
+ this, SLOT(addLowEnergyService(const QLowEnergyServiceInfo&)));
discoveryAgent->start();
}
@@ -98,3 +103,10 @@ void ServiceDiscoveryDialog::addService(const QBluetoothServiceInfo &info)
ui->list->addItem(line);
}
+void ServiceDiscoveryDialog::addLowEnergyService(const QLowEnergyServiceInfo &gatt)
+{
+ QString line = gatt.serviceName();
+
+ ui->list->addItem(line);
+}
+
diff --git a/examples/bluetooth/btscanner/service.h b/examples/bluetooth/btscanner/service.h
index 293bc7a9..2089eb87 100644
--- a/examples/bluetooth/btscanner/service.h
+++ b/examples/bluetooth/btscanner/service.h
@@ -49,6 +49,8 @@
QT_FORWARD_DECLARE_CLASS(QBluetoothAddress)
QT_FORWARD_DECLARE_CLASS(QBluetoothServiceInfo)
QT_FORWARD_DECLARE_CLASS(QBluetoothServiceDiscoveryAgent)
+QT_FORWARD_DECLARE_CLASS (QLowEnergyServiceInfo)
+QT_FORWARD_DECLARE_CLASS (QLowEnergyCharacteristicInfo)
QT_USE_NAMESPACE
@@ -62,6 +64,7 @@ public:
public slots:
void addService(const QBluetoothServiceInfo&);
+ void addLowEnergyService(const QLowEnergyServiceInfo&);
private:
QBluetoothServiceDiscoveryAgent *discoveryAgent;
diff --git a/examples/bluetooth/heartlistener/assets/Button.qml b/examples/bluetooth/heartlistener/assets/Button.qml
new file mode 100644
index 00000000..40e98875
--- /dev/null
+++ b/examples/bluetooth/heartlistener/assets/Button.qml
@@ -0,0 +1,77 @@
+/***************************************************************************
+**
+** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id:button
+ //color: "#3870BA"
+
+ property real buttonWidth: 300
+ property real buttonHeight: 80
+ property string text: "Button"
+
+ signal buttonClick()
+ width: click.pressed ? (buttonWidth - 15) : buttonWidth
+ height: click.pressed ? (buttonHeight - 15) :buttonHeight
+
+ color: click.pressed ? "#3265A7" : "#3870BA"
+
+ border.color: "#F0EBED"
+ border.width: 5
+ radius: 10
+
+ Text {
+ id: label
+ font.pixelSize: 30; font.bold: true
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ anchors.fill: parent
+ elide: Text.ElideMiddle
+ color: "#F0EBED"
+ text: button.text
+ }
+
+ MouseArea {
+ id: click
+ anchors.fill: parent
+ onClicked: buttonClick()
+ }
+}
diff --git a/examples/bluetooth/heartlistener/assets/Point.qml b/examples/bluetooth/heartlistener/assets/Point.qml
new file mode 100644
index 00000000..2ed94a4d
--- /dev/null
+++ b/examples/bluetooth/heartlistener/assets/Point.qml
@@ -0,0 +1,51 @@
+/***************************************************************************
+**
+** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: point
+
+ Image {
+ width: 10; height: 7
+ smooth: true
+ source: "blue_heart_small.png"
+ }
+}
diff --git a/examples/bluetooth/heartlistener/assets/blue_heart.png b/examples/bluetooth/heartlistener/assets/blue_heart.png
new file mode 100644
index 00000000..997ee699
--- /dev/null
+++ b/examples/bluetooth/heartlistener/assets/blue_heart.png
Binary files differ
diff --git a/examples/bluetooth/heartlistener/assets/blue_heart_small.png b/examples/bluetooth/heartlistener/assets/blue_heart_small.png
new file mode 100644
index 00000000..7bd1f981
--- /dev/null
+++ b/examples/bluetooth/heartlistener/assets/blue_heart_small.png
Binary files differ
diff --git a/examples/bluetooth/heartlistener/assets/busy_dark.png b/examples/bluetooth/heartlistener/assets/busy_dark.png
new file mode 100644
index 00000000..3a105953
--- /dev/null
+++ b/examples/bluetooth/heartlistener/assets/busy_dark.png
Binary files differ
diff --git a/examples/bluetooth/heartlistener/assets/dialog.qml b/examples/bluetooth/heartlistener/assets/dialog.qml
new file mode 100644
index 00000000..45b64cf3
--- /dev/null
+++ b/examples/bluetooth/heartlistener/assets/dialog.qml
@@ -0,0 +1,61 @@
+/***************************************************************************
+**
+** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ opacity: 0.8
+ color: "#E0DEDF"
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ property int hr: heartRate.hr
+ Text {
+ text: heartRate.message
+ color: "#3870BA"
+
+ }
+
+ onHrChanged: {
+ if (heartRate.hr > 0) {
+ root.destroy()
+ }
+ }
+}
diff --git a/examples/bluetooth/heartlistener/assets/draw.js b/examples/bluetooth/heartlistener/assets/draw.js
new file mode 100644
index 00000000..a5de5474
--- /dev/null
+++ b/examples/bluetooth/heartlistener/assets/draw.js
@@ -0,0 +1,74 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+var component;
+var size = 0;
+var counter = 0;
+var difference = 0;
+
+function start() {
+ size = heartRate.measurementsSize();
+ difference = (plot.width-topbar.width)/size;
+ console.log(size +" "+ plot.width);
+ for (var i = 0; i< size; i++) {
+ var value = heartRate.measurements(i);
+
+ drawIt(value);
+ counter++;
+ }
+}
+
+function drawIt(value) {
+ if (component == null)
+ component = Qt.createComponent("Point.qml");
+ if (component.status == Component.Ready) {
+ var dynamicObject = component.createObject(plot);
+ if (dynamicObject == null) {
+ console.log("error creating block");
+ console.log(component.errorString());
+ return false;
+ }
+ dynamicObject.x = 10+(counter*difference);
+ console.log(plot.height)
+ dynamicObject.y = plot.height -value;
+
+ }
+}
+
diff --git a/examples/bluetooth/heartlistener/assets/home.qml b/examples/bluetooth/heartlistener/assets/home.qml
new file mode 100644
index 00000000..2c5e9485
--- /dev/null
+++ b/examples/bluetooth/heartlistener/assets/home.qml
@@ -0,0 +1,186 @@
+/***************************************************************************
+**
+** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: screen
+ color: "#F0EBED"
+ property string message: heartRate.message
+ onMessageChanged: {
+ if (heartRate.message != "Scanning for devices..." && heartRate.message != "Low Energy device found. Scanning for more...") {
+ background.visible = false;
+ demoMode.visible = true;
+ }
+ else {
+ demoMode.visible = false;
+ background.visible = true;
+ }
+ }
+
+ Rectangle {
+ id:select
+ width: parent.width
+ anchors.top: parent.top
+ height: 80
+ color: "#F0EBED"
+ border.color: "#3870BA"
+ border.width: 2
+ radius: 10
+
+ Text {
+ id: selectText
+ color: "#3870BA"
+ font.pixelSize: 34
+ anchors.centerIn: parent
+ text: "Select Device"
+ }
+ }
+
+ Rectangle {
+ id: spinner
+ width: parent.width
+ anchors.top: select.bottom
+ anchors.bottom: demoMode.top
+ visible: false
+ color: "#F0EBED"
+ z: 100
+
+ Rectangle {
+ id: inside
+ anchors.centerIn: parent
+ Image {
+ id: background
+
+ width:100
+ height:100
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ source: "busy_dark.png"
+ fillMode: Image.PreserveAspectFit
+ NumberAnimation on rotation { duration: 3000; from:0; to: 360; loops: Animation.Infinite}
+ }
+
+ Text {
+ id: infotext
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: background.bottom
+ text: heartRate.message
+ color: "#8F8F8F"
+ }
+ }
+ }
+
+ Component.onCompleted: {
+ heartRate.deviceSearch();
+ spinner.visible=true;
+ }
+
+ ListView {
+ id: theListView
+ width: parent.width
+ onModelChanged: spinner.visible=false
+ anchors.top: select.bottom
+ anchors.bottom: demoMode.top
+ model: heartRate.name
+
+ delegate: Rectangle {
+ id: box
+ height:140
+ width: parent.width
+ color: "#3870BA"
+ border.color: "#F0EBED"
+ border.width: 5
+ radius: 15
+
+ MouseArea {
+ anchors.fill: parent
+ onPressed: { box.color= "#3265A7"; box.height=110}
+ onClicked: {
+ heartRate.connectToService(modelData.deviceAddress);
+ pageLoader.source="monitor.qml";
+ }
+ }
+
+ Text {
+ id: device
+ font.pixelSize: 30
+ text: modelData.deviceName
+ anchors.top: parent.top
+ anchors.topMargin: 5
+ anchors.horizontalCenter: parent.horizontalCenter
+ color: "#F0EBED"
+ }
+
+ Text {
+ id: deviceAddress
+ font.pixelSize: 30
+ text: modelData.deviceAddress
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 5
+ anchors.horizontalCenter: parent.horizontalCenter
+ color: "#F0EBED"
+ }
+ }
+ }
+
+ Button {
+ id:demoMode
+ buttonWidth: parent.width
+ buttonHeight: 0.1*parent.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: scanAgain.top
+ text: "Run Demo"
+ onButtonClick: {
+ heartRate.startDemo();
+ pageLoader.source="monitor.qml";
+ }
+ }
+
+ Button {
+ id:scanAgain
+ buttonWidth: parent.width
+ buttonHeight: 0.1*parent.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ text: "Menu"
+ onButtonClick: pageLoader.source="main.qml"
+ }
+}
diff --git a/examples/bluetooth/heartlistener/assets/main.qml b/examples/bluetooth/heartlistener/assets/main.qml
new file mode 100644
index 00000000..e892eb47
--- /dev/null
+++ b/examples/bluetooth/heartlistener/assets/main.qml
@@ -0,0 +1,84 @@
+/***************************************************************************
+**
+** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ width: 400
+ height: 600
+ id: begin
+
+ Rectangle {
+ color: "#F0EBED"
+ anchors.fill: parent
+ Rectangle {
+ id: about
+ width: 0.75*parent.width
+ height: 0.1*parent.height
+ anchors.top: parent.top
+ anchors.topMargin: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+ color: "#F0EBED"
+ border.color: "#3870BA"
+ border.width: 2
+ radius: 10
+ Text {
+ id: aboutinfo
+ anchors.centerIn: parent
+ color: "#3870BA"
+ text: "Welcome to the Heart Listener Application"
+ }
+ }
+
+ Button {
+ id:call
+ buttonWidth: 0.75*parent.width
+ buttonHeight: 0.15*parent.height
+ anchors.centerIn: parent
+ text: "Scan for Devices"
+ onButtonClick: pageLoader.source="home.qml"
+ }
+ }
+
+ Loader {
+ id: pageLoader
+ anchors.fill: parent
+ }
+}
diff --git a/examples/bluetooth/heartlistener/assets/monitor.qml b/examples/bluetooth/heartlistener/assets/monitor.qml
new file mode 100644
index 00000000..2fcbef3d
--- /dev/null
+++ b/examples/bluetooth/heartlistener/assets/monitor.qml
@@ -0,0 +1,154 @@
+/***************************************************************************
+**
+** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ id: screenMonitor
+ color: "#F0EBED"
+
+ Button {
+ id:menu
+ buttonWidth: parent.width
+ buttonHeight: 0.1 * parent.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.top
+ text: "Menu"
+ onButtonClick: {
+ heartRate.disconnectService();
+ pageLoader.source="home.qml";
+ }
+ }
+
+ Text {
+ id: hrValue
+ font.pointSize: 24; font.bold: true
+ anchors.top:menu.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.topMargin: 25
+
+ color: "#3870BA"
+ text: heartRate.hr
+ onTextChanged: {
+ if (heartRate.hr > 0 && updatei != null && heartRate.numDevices() > 0) {
+ updatei.destroy()
+ }
+ }
+ }
+
+ Rectangle {
+ id: updatei
+ width: parent.width
+ height: 80
+ anchors.bottom: stop.top
+
+ color: "#F0EBED"
+ border.color: "#3870BA"
+ border.width: 2
+
+ Text {
+ id: logi
+ text: heartRate.message
+ anchors.centerIn: updatei
+ color: "#3870BA"
+ }
+ }
+
+ Image {
+ id: background
+ width: 300
+ height: width
+ anchors.centerIn: parent
+ source: "blue_heart.png"
+ fillMode: Image.PreserveAspectFit
+ NumberAnimation on width {
+ running: heartRate.hr > 0;
+ duration: heartRate.hr/60*250;
+ from:300; to: 350;
+ loops: Animation.Infinite;
+ }
+
+ ParticleSystem {
+ id: systwo
+ anchors.fill: parent
+
+ ImageParticle {
+ system: systwo
+ id: cptwo
+ source: "star.png"
+ colorVariation: 0.4
+ color: "#000000FF"
+ }
+
+ Emitter {
+ //burst on click
+ id: burstytwo
+ system: systwo
+ enabled: true
+ x: 160
+ y: 150
+ emitRate: heartRate.hr*100
+ maximumEmitted: 4000
+ acceleration: AngleDirection {angleVariation: 360; magnitude: 360; }
+ size: 4
+ endSize: 8
+ sizeVariation: 4
+ }
+
+
+ }
+
+ }
+
+ Button {
+ id:stop
+ buttonWidth: parent.width
+ buttonHeight: 0.1*parent.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ text: "Stop Monitoring"
+ onButtonClick: {
+ burstytwo.enabled = false;
+ heartRate.disconnectService();
+ pageLoader.source = "results.qml";
+ }
+ }
+}
diff --git a/examples/bluetooth/heartlistener/assets/results.qml b/examples/bluetooth/heartlistener/assets/results.qml
new file mode 100644
index 00000000..bdc7147d
--- /dev/null
+++ b/examples/bluetooth/heartlistener/assets/results.qml
@@ -0,0 +1,291 @@
+/***************************************************************************
+**
+** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "draw.js" as DrawGraph
+
+Rectangle {
+ id: results
+ color: "#F0EBED"
+
+ Component.onCompleted: heartRate.obtainResults()
+
+ function getTime() {
+ var t = heartRate.time;
+ var min = Math.floor(t/60);
+ var sec = t%60;
+ var r = min + " min " + sec + " sec ";
+ return r;
+ }
+
+ function drawGraph() {
+ var b = plot.height/200;
+ var ctx = canvas1.getContext('2d');
+ ctx.beginPath()
+ ctx.moveTo(10, plot.height- (b*60))
+ var size = heartRate.measurementsSize();
+ var difference = (plot.width-topbar.width)/size;
+
+ for (var i = 0; i< size; i++) {
+ var value = heartRate.measurements(i);
+ if (i == 0) {
+ ctx.moveTo(10+2, (plot.height- (value*b) + 2));
+ ctx.rect((10 + i*difference), (plot.height- (value*b)), 4, 4);
+
+ }
+ else {
+ ctx.lineTo((10+2 + i*difference), (plot.height- (value*b) + 2));
+ ctx.rect((10 + i*difference), (plot.height- (value*b)), 4, 4);
+ }
+
+ }
+ ctx.fillStyle = "#3870BA"
+ ctx.fill()
+ ctx.strokeStyle = "#3870BA"
+ ctx.stroke()
+ ctx.closePath()
+ }
+
+ Rectangle {
+ id: res
+ width: parent.width
+ anchors.top: parent.top
+ height: 80
+ color: "#F0EBED"
+ border.color: "#3870BA"
+ border.width: 2
+ radius: 10
+ Text {
+ id: restText
+ color: "#3870BA"
+ font.pixelSize: 34
+ anchors.centerIn: parent
+ text: "Results"
+ }
+ }
+
+ Text {
+ id: topbar
+ text: "200"
+ anchors.left: parent.left
+ anchors.top: res.bottom
+ anchors.rightMargin: 4
+ color: "#3870BA"
+ z: 50
+ }
+
+ Rectangle {
+ id: level
+ anchors.left: topbar.right
+
+ anchors.top: res.bottom
+ height: ((results.height -(res.height + menuLast.height + start.height ))/2)
+ width: 3
+ color: "#3870BA"
+ }
+
+ Text {
+ id: middlebar
+ anchors.verticalCenter: level.verticalCenter
+ anchors.left: parent.left
+ text: "100"
+ color: "#3870BA"
+ z: 50
+ }
+
+ Rectangle{
+ id: downlevel
+ anchors.bottom: cover.top
+ width: parent.width
+ anchors.left: level.right
+ height: 3
+ color: "#3870BA"
+ z: 50
+ }
+
+ Rectangle {
+ id: plot
+ anchors.left: level.right
+ anchors.leftMargin: 15
+ width: results.width
+ height: ((parent.height-(res.height+menuLast.height+start.height))/2)
+
+ anchors.top: res.bottom
+ color: "#F0EBED"
+ Canvas {
+ id: canvas1
+ anchors.fill: parent
+ z: 150
+ onPaint: drawGraph()
+ }
+ }
+
+ Rectangle {
+ id: cover
+ anchors.top: plot.bottom
+ anchors.bottom: menuLast.top
+ width: parent.width
+ height: ((parent.height-(res.height+menuLast.height+start.height))/2)
+ color: "#F0EBED"
+ radius: 10
+ border.color: "#3870BA"
+ border.width: 2
+
+ Flickable {
+ id: scroll
+ anchors.fill: parent
+ anchors.margins: 5
+ clip: true
+ contentWidth: parent.width
+ contentHeight: stresult.height
+
+ Rectangle {
+ id: stresult
+ width: parent.width
+ height: (results.height - (res.height + menuLast.height + start.height - 100))
+ color: "#F0EBED"
+ radius: 10
+
+ Text {
+ id: averageHR
+ font.pixelSize: 30;
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.top
+
+ color: "#3870BA"
+ text: "Average Heart Rate"
+ }
+
+ Text {
+ id: averageHRt
+ font.pixelSize: 40; font.bold: true
+ anchors.top: averageHR.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.topMargin: 10
+ color: "#3870BA"
+ text: heartRate.average
+ }
+
+ Text {
+ id: time
+ font.pixelSize: 30;
+ anchors.top: averageHRt.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.topMargin: 10
+ color: "#3870BA"
+ text: "Seconds measured:"
+ }
+
+ Text {
+ id: timet
+ font.pixelSize: 40; font.bold: true
+ anchors.top: time.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.topMargin: 10
+ color: "#3870BA"
+ text: getTime()
+ }
+ Text {
+ id: maxi
+ font.pixelSize: 30;
+ anchors.top: timet.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.topMargin: 20
+ color: "#3870BA"
+ text: " Max || Min "
+ }
+
+ Text {
+ id: mini
+ font.pixelSize: 40; font.bold: true
+ anchors.top:maxi.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.topMargin: 10
+ color: "#3870BA"
+ text: " " + heartRate.maxHR + " || " + heartRate.minHR
+ }
+
+ Text {
+ id: calories
+ font.pixelSize: 30;
+ anchors.top: mini.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.topMargin: 10
+ color: "#3870BA"
+ text: " Calories "
+ }
+
+ Text {
+ id: caloriestext
+ font.pixelSize: 40; font.bold: true
+ anchors.top:calories.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.topMargin: 10
+ color: "#3870BA"
+ text: heartRate.calories.toFixed(3)
+ }
+ }
+ }
+ }
+
+ Button {
+ id:menuLast
+ buttonWidth: parent.width
+ buttonHeight: 0.1*parent.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: start.top
+ text: "Menu"
+ onButtonClick: { pageLoader.source="main.qml"}
+ }
+
+ Button {
+ id:start
+ buttonWidth: parent.width
+ buttonHeight: 0.1*parent.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ text: "Start Monitoring"
+ onButtonClick: {
+ heartRate.connectToService(heartRate.deviceAddress());
+ pageLoader.source="monitor.qml";
+ }
+ }
+}
diff --git a/examples/bluetooth/heartlistener/assets/star.png b/examples/bluetooth/heartlistener/assets/star.png
new file mode 100644
index 00000000..defbde53
--- /dev/null
+++ b/examples/bluetooth/heartlistener/assets/star.png
Binary files differ
diff --git a/examples/bluetooth/heartlistener/deviceinfo.cpp b/examples/bluetooth/heartlistener/deviceinfo.cpp
new file mode 100644
index 00000000..5be9fcfe
--- /dev/null
+++ b/examples/bluetooth/heartlistener/deviceinfo.cpp
@@ -0,0 +1,58 @@
+/***************************************************************************
+**
+** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "deviceinfo.h"
+
+DeviceInfo::DeviceInfo(const QBluetoothDeviceInfo &info):
+ QObject(), m_device(info)
+{
+}
+
+QBluetoothDeviceInfo DeviceInfo::getDevice() const
+{
+ return m_device;
+}
+
+void DeviceInfo::setDevice(const QBluetoothDeviceInfo &device)
+{
+ m_device = device;
+ emit deviceChanged();
+}
diff --git a/examples/bluetooth/heartlistener/deviceinfo.h b/examples/bluetooth/heartlistener/deviceinfo.h
new file mode 100644
index 00000000..a80f723b
--- /dev/null
+++ b/examples/bluetooth/heartlistener/deviceinfo.h
@@ -0,0 +1,69 @@
+/***************************************************************************
+**
+** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DEVICEINFO_H
+#define DEVICEINFO_H
+
+#include <QString>
+#include <QObject>
+#include <qbluetoothdeviceinfo.h>
+#include <qbluetoothaddress.h>
+
+class DeviceInfo: public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString deviceName READ getName NOTIFY deviceChanged)
+ Q_PROPERTY(QString deviceAddress READ getAddress NOTIFY deviceChanged)
+public:
+ DeviceInfo(const QBluetoothDeviceInfo &device);
+ void setDevice(const QBluetoothDeviceInfo &device);
+ QString getName() const { return m_device.name(); }
+ QString getAddress() const { return m_device.address().toString(); }
+ QBluetoothDeviceInfo getDevice() const;
+
+signals:
+ void deviceChanged();
+
+private:
+ QBluetoothDeviceInfo m_device;
+};
+
+#endif // DEVICEINFO_H
diff --git a/examples/bluetooth/heartlistener/doc/images/heartratefound.png b/examples/bluetooth/heartlistener/doc/images/heartratefound.png
new file mode 100644
index 00000000..68ff993d
--- /dev/null
+++ b/examples/bluetooth/heartlistener/doc/images/heartratefound.png
Binary files differ
diff --git a/examples/bluetooth/heartlistener/doc/images/heartratemonitor.png b/examples/bluetooth/heartlistener/doc/images/heartratemonitor.png
new file mode 100644
index 00000000..ed51ba86
--- /dev/null
+++ b/examples/bluetooth/heartlistener/doc/images/heartratemonitor.png
Binary files differ
diff --git a/examples/bluetooth/heartlistener/doc/images/heartrateresults.png b/examples/bluetooth/heartlistener/doc/images/heartrateresults.png
new file mode 100644
index 00000000..6e2dfbca
--- /dev/null
+++ b/examples/bluetooth/heartlistener/doc/images/heartrateresults.png
Binary files differ
diff --git a/examples/bluetooth/heartlistener/doc/src/heartlistener.qdoc b/examples/bluetooth/heartlistener/doc/src/heartlistener.qdoc
new file mode 100644
index 00000000..c73c13f7
--- /dev/null
+++ b/examples/bluetooth/heartlistener/doc/src/heartlistener.qdoc
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example heartlistener
+ \title Bluetooth Low Energy Heart Listener Example
+ \brief An example demonstrating the interaction with a Bluetooth Low Energy Heart Rate
+ device/service. The example demonstrates the use of all Qt Bluetooth
+ Low Energy classes.
+
+ The Bluetooth Low Energy Heart Listener Example shows how to develop a Bluetooth
+ Low Energy application using the Qt Bluetooth API. The application covers
+ the scanning for Bluetooth Low Energy devices, connecting to a Heart Rate service
+ on the device, writing characteristics and descriptors and receiving updates from device
+ once the heart rate has changed.
+
+ \image heartratemonitor.png
+
+ The example introduces the following Qt classes:
+
+ \list
+ \li \l QLowEnergyController
+ \li \l QLowEnergyService
+ \li \l QLowEnergyCharacteristic
+ \li \l QLowEnergyDescriptor
+ \endlist
+
+ A Bluetooth Low Energy device with a Heart Rate
+ service is required for this application to work. An alternative might be a programmable
+ Bluetooth Low Energy device which might simulate the service. If no such device can be
+ found, the example uses a demo mode which creates and displays random values.
+
+ The \l {lowenergyscanner}{Bluetooth Low Energy Scanner} example might be more suitable
+ if a heart rate device is not available. The scanner example works with any type of Bluetooth
+ Low Energy peripheral device.
+
+ \include examples-run.qdocinc
+
+ \section1 Visual Tour
+
+ The application searches for all Bluetooth Low Energy peripheral devices in the vicinity.
+ It is assumed that the remote devices advertise their presence. The found devices are
+ presented in a list. Note that it shows all Bluetooth Low Energy devices even those which
+ do not offer a Heart Rate service.
+
+ \image heartratefound.png
+
+ After the user has selected a target device, the example connects to its Heart Rate service
+ if one is available. It automatically enables notification updates for the Heart Rate value
+ and presents the current value on the screen.
+
+ \image heartratemonitor.png
+
+ Once the monitoring process is canceled, a small graph presents a summary of the received
+ values.
+
+ \image heartrateresults.png
+*/
+
diff --git a/examples/bluetooth/heartlistener/heartlistener.pro b/examples/bluetooth/heartlistener/heartlistener.pro
new file mode 100644
index 00000000..7856b64e
--- /dev/null
+++ b/examples/bluetooth/heartlistener/heartlistener.pro
@@ -0,0 +1,20 @@
+TEMPLATE = app
+TARGET = heartlistener
+
+QT += quick bluetooth
+
+# Input
+HEADERS += deviceinfo.h \
+ heartrate.h
+SOURCES += deviceinfo.cpp \
+ heartrate.cpp \
+ main.cpp
+
+OTHER_FILES += assets/*.qml \
+ assets/*.js
+
+RESOURCES += \
+ resources.qrc
+
+target.path = $$[QT_INSTALL_EXAMPLES]/bluetooth/heartlistener
+INSTALLS += target
diff --git a/examples/bluetooth/heartlistener/heartrate.cpp b/examples/bluetooth/heartlistener/heartrate.cpp
new file mode 100644
index 00000000..6567fb90
--- /dev/null
+++ b/examples/bluetooth/heartlistener/heartrate.cpp
@@ -0,0 +1,441 @@
+/***************************************************************************
+**
+** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "heartrate.h"
+
+HeartRate::HeartRate():
+ m_currentDevice(QBluetoothDeviceInfo()), foundHeartRateService(false),
+ m_max(0), m_min(0), calories(0), m_control(0), timer(0),
+ m_service(0)
+{
+ //! [devicediscovery-1]
+ m_deviceDiscoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);
+
+ connect(m_deviceDiscoveryAgent, SIGNAL(deviceDiscovered(const QBluetoothDeviceInfo&)),
+ this, SLOT(addDevice(const QBluetoothDeviceInfo&)));
+ connect(m_deviceDiscoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)),
+ this, SLOT(deviceScanError(QBluetoothDeviceDiscoveryAgent::Error)));
+ connect(m_deviceDiscoveryAgent, SIGNAL(finished()), this, SLOT(scanFinished()));
+ //! [devicediscovery-1]
+
+ // initialize random seed for demo mode
+ qsrand(QTime::currentTime().msec());
+}
+
+HeartRate::~HeartRate()
+{
+ qDeleteAll(m_devices);
+ m_devices.clear();
+}
+
+void HeartRate::deviceSearch()
+{
+ qDeleteAll(m_devices);
+ m_devices.clear();
+ //! [devicediscovery-2]
+ m_deviceDiscoveryAgent->start();
+ //! [devicediscovery-2]
+ setMessage("Scanning for devices...");
+}
+
+//! [devicediscovery-3]
+void HeartRate::addDevice(const QBluetoothDeviceInfo &device)
+{
+ if (device.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration) {
+ qWarning() << "Discovered LE Device name: " << device.name() << " Address: "
+ << device.address().toString();
+//! [devicediscovery-3]
+ DeviceInfo *dev = new DeviceInfo(device);
+ m_devices.append(dev);
+ setMessage("Low Energy device found. Scanning for more...");
+//! [devicediscovery-4]
+ }
+ //...
+}
+//! [devicediscovery-4]
+
+void HeartRate::scanFinished()
+{
+ if (m_devices.size() == 0)
+ setMessage("No Low Energy devices found");
+ Q_EMIT nameChanged();
+}
+
+void HeartRate::deviceScanError(QBluetoothDeviceDiscoveryAgent::Error error)
+{
+ if (error == QBluetoothDeviceDiscoveryAgent::PoweredOffError)
+ setMessage("The Bluetooth adaptor is powered off, power it on before doing discovery.");
+ else if (error == QBluetoothDeviceDiscoveryAgent::InputOutputError)
+ setMessage("Writing or reading from the device resulted in an error.");
+ else
+ setMessage("An unknown error has occurred.");
+}
+
+
+void HeartRate::setMessage(QString message)
+{
+ m_info = message;
+ Q_EMIT messageChanged();
+}
+
+QString HeartRate::message() const
+{
+ return m_info;
+}
+
+QVariant HeartRate::name()
+{
+ return QVariant::fromValue(m_devices);
+}
+
+void HeartRate::connectToService(const QString &address)
+{
+ m_measurements.clear();
+
+ bool deviceFound = false;
+ for (int i = 0; i < m_devices.size(); i++) {
+ if (((DeviceInfo*)m_devices.at(i))->getAddress() == address ) {
+ m_currentDevice.setDevice(((DeviceInfo*)m_devices.at(i))->getDevice());
+ setMessage("Connecting to device...");
+ deviceFound = true;
+ break;
+ }
+ }
+ // we are running demo mode
+ if (!deviceFound) {
+ startDemo();
+ return;
+ }
+
+ if (m_control) {
+ m_control->disconnectFromDevice();
+ delete m_control;
+ m_control = 0;
+
+ }
+ //! [Connect signals]
+ m_control = new QLowEnergyController(m_currentDevice.getDevice().address(),
+ this);
+ connect(m_control, SIGNAL(serviceDiscovered(QBluetoothUuid)),
+ this, SLOT(serviceDiscovered(QBluetoothUuid)));
+ connect(m_control, SIGNAL(discoveryFinished()),
+ this, SLOT(serviceScanDone()));
+ connect(m_control, SIGNAL(error(QLowEnergyController::Error)),
+ this, SLOT(controllerError(QLowEnergyController::Error)));
+ connect(m_control, SIGNAL(connected()),
+ this, SLOT(deviceConnected()));
+ connect(m_control, SIGNAL(disconnected()),
+ this, SLOT(deviceDisconnected()));
+
+ m_control->connectToDevice();
+ //! [Connect signals]
+}
+
+//! [Connecting to service]
+
+void HeartRate::deviceConnected()
+{
+ m_control->discoverServices();
+}
+
+void HeartRate::deviceDisconnected()
+{
+ setMessage("Heart Rate service disconnected");
+ qWarning() << "Remote device disconnected";
+}
+
+//! [Connecting to service]
+
+//! [Filter HeartRate service 1]
+void HeartRate::serviceDiscovered(const QBluetoothUuid &gatt)
+{
+ if (gatt == QBluetoothUuid(QBluetoothUuid::HeartRate)) {
+ setMessage("Heart Rate service discovered. Waiting for service scan to be done...");
+ foundHeartRateService = true;
+ }
+}
+//! [Filter HeartRate service 1]
+
+void HeartRate::serviceScanDone()
+{
+ delete m_service;
+ m_service = 0;
+
+ //! [Filter HeartRate service 2]
+ if (foundHeartRateService) {
+ setMessage("Connecting to service...");
+ m_service = m_control->createServiceObject(
+ QBluetoothUuid(QBluetoothUuid::HeartRate), this);
+ }
+
+ if (!m_service) {
+ setMessage("Heart Rate Service not found.");
+ return;
+ }
+
+ connect(m_service, SIGNAL(stateChanged(QLowEnergyService::ServiceState)),
+ this, SLOT(serviceStateChanged(QLowEnergyService::ServiceState)));
+ connect(m_service, SIGNAL(characteristicChanged(QLowEnergyCharacteristic,QByteArray)),
+ this, SLOT(updateHeartRateValue(QLowEnergyCharacteristic,QByteArray)));
+ connect(m_service, SIGNAL(descriptorChanged(QLowEnergyDescriptor,QByteArray)),
+ this, SLOT(confirmedDescriptorWrite(QLowEnergyDescriptor,QByteArray)));
+
+ m_service->discoverDetails();
+ //! [Filter HeartRate service 2]
+}
+
+void HeartRate::disconnectService()
+{
+ foundHeartRateService = false;
+ m_stop = QDateTime::currentDateTime();
+
+ if (m_devices.isEmpty()) {
+ if (timer)
+ timer->stop();
+ return;
+ }
+
+ //disable notifications
+ if (m_notificationDesc.isValid() && m_service) {
+ m_service->writeDescriptor(m_notificationDesc, QByteArray::fromHex("0000"));
+ } else {
+ m_control->disconnectFromDevice();
+ delete m_service;
+ m_service = 0;
+ }
+}
+
+//! [Error handling]
+void HeartRate::controllerError(QLowEnergyController::Error error)
+{
+ setMessage("Cannot connect to remote device.");
+ qWarning() << "Controller Error:" << error;
+}
+//! [Error handling]
+
+
+//! [Find HRM characteristic]
+void HeartRate::serviceStateChanged(QLowEnergyService::ServiceState s)
+{
+ switch (s) {
+ case QLowEnergyService::ServiceDiscovered:
+ {
+ const QLowEnergyCharacteristic hrChar = m_service->characteristic(
+ QBluetoothUuid(QBluetoothUuid::HeartRateMeasurement));
+ if (!hrChar.isValid()) {
+ setMessage("HR Data not found.");
+ break;
+ }
+
+ const QLowEnergyDescriptor m_notificationDesc = hrChar.descriptor(
+ QBluetoothUuid::ClientCharacteristicConfiguration);
+ if (m_notificationDesc.isValid()) {
+ m_service->writeDescriptor(m_notificationDesc, QByteArray::fromHex("0100"));
+ setMessage("Measuring");
+ m_start = QDateTime::currentDateTime();
+ }
+
+ break;
+ }
+ default:
+ //nothing for now
+ break;
+ }
+}
+//! [Find HRM characteristic]
+
+void HeartRate::serviceError(QLowEnergyService::ServiceError e)
+{
+ switch (e) {
+ case QLowEnergyService::DescriptorWriteError:
+ setMessage("Cannot obtain HR notifications");
+ break;
+ default:
+ qWarning() << "HR service error:" << e;
+ }
+}
+
+//! [Reading value 1]
+void HeartRate::updateHeartRateValue(const QLowEnergyCharacteristic &c,
+ const QByteArray &value)
+{
+ // ignore any other characteristic change -> shouldn't really happen though
+ if (c.uuid() != QBluetoothUuid(QBluetoothUuid::HeartRateMeasurement))
+ return;
+
+
+ const char *data = value.constData();
+ quint8 flags = data[0];
+
+ //Heart Rate
+ if (flags & 0x1) { // HR 16 bit? otherwise 8 bit
+ quint16 *heartRate = (quint16 *) &data[1];
+ //qDebug() << "16 bit HR value:" << *heartRate;
+ m_measurements.append(*heartRate);
+ } else {
+ quint8 *heartRate = (quint8 *) &data[1];
+ m_measurements.append(*heartRate);
+ //qDebug() << "8 bit HR value:" << *heartRate;
+ }
+
+ //Energy Expended
+ if (flags & 0x8) {
+ int index = (flags & 0x1) ? 5 : 3;
+ quint16 *energy = (quint16 *) &data[index];
+ qDebug() << "Used Energy:" << *energy;
+ }
+ //! [Reading value 1]
+
+ Q_EMIT hrChanged();
+//! [Reading value 2]
+}
+//! [Reading value 2]
+
+void HeartRate::confirmedDescriptorWrite(const QLowEnergyDescriptor &d,
+ const QByteArray &value)
+{
+ if (d.isValid() && d == m_notificationDesc && value == QByteArray("0000")) {
+ //disabled notifications -> assume disconnect intent
+ m_control->disconnectFromDevice();
+ delete m_service;
+ m_service = 0;
+ }
+}
+
+int HeartRate::hR() const
+{
+ if (m_measurements.isEmpty())
+ return 0;
+ return m_measurements.last();
+}
+
+void HeartRate::obtainResults()
+{
+ Q_EMIT timeChanged();
+ Q_EMIT averageChanged();
+ Q_EMIT caloriesChanged();
+}
+
+int HeartRate::time()
+{
+ return m_start.secsTo(m_stop);
+}
+
+int HeartRate::maxHR() const
+{
+ return m_max;
+}
+
+int HeartRate::minHR() const
+{
+ return m_min;
+}
+
+float HeartRate::average()
+{
+ if (m_measurements.size() == 0) {
+ return 0;
+ } else {
+ m_max = 0;
+ m_min = 1000;
+ int sum = 0;
+ for (int i = 0; i < m_measurements.size(); i++) {
+ sum += (int) m_measurements.value(i);
+ if (((int)m_measurements.value(i)) > m_max)
+ m_max = (int)m_measurements.value(i);
+ if (((int)m_measurements.value(i)) < m_min)
+ m_min = (int)m_measurements.value(i);
+ }
+ return sum/m_measurements.size();
+ }
+}
+
+int HeartRate::measurements(int index) const
+{
+ if (index > m_measurements.size())
+ return 0;
+ else
+ return (int)m_measurements.value(index);
+}
+
+int HeartRate::measurementsSize() const
+{
+ return m_measurements.size();
+}
+
+QString HeartRate::deviceAddress() const
+{
+ return m_currentDevice.getAddress();
+}
+
+float HeartRate::caloriesCalculation()
+{
+ calories = ((-55.0969 + (0.6309 * average()) + (0.1988 * 94) + (0.2017 * 24)) / 4.184) * 60 * time()/3600 ;
+ return calories;
+}
+
+int HeartRate::numDevices() const
+{
+ return m_devices.size();
+}
+
+void HeartRate::startDemo()
+{
+ m_start = QDateTime::currentDateTime();
+ if (!timer) {
+ timer = new QTimer(this);
+ connect(timer, SIGNAL(timeout()), this, SLOT(receiveDemo()));
+ }
+ timer->start(1000);
+ setMessage("This is Demo mode");
+}
+
+void HeartRate::receiveDemo()
+{
+ m_measurements.append(randomPulse());
+ Q_EMIT hrChanged();
+}
+
+int HeartRate::randomPulse() const
+{
+ // random number between 50 and 70
+ return qrand() % (70 - 50) + 50;
+}
diff --git a/examples/bluetooth/heartlistener/heartrate.h b/examples/bluetooth/heartlistener/heartrate.h
new file mode 100644
index 00000000..8f5ee061
--- /dev/null
+++ b/examples/bluetooth/heartlistener/heartrate.h
@@ -0,0 +1,149 @@
+/***************************************************************************
+**
+** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef HEARTRATE_H
+#define HEARTRATE_H
+
+#include "deviceinfo.h"
+
+#include <QString>
+#include <QDebug>
+#include <QDateTime>
+#include <QVector>
+#include <QTimer>
+#include <QBluetoothDeviceDiscoveryAgent>
+#include <QBluetoothDeviceInfo>
+#include <QLowEnergyController>
+#include <QLowEnergyService>
+
+
+QT_USE_NAMESPACE
+class HeartRate: public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QVariant name READ name NOTIFY nameChanged)
+ Q_PROPERTY(QString message READ message NOTIFY messageChanged)
+ Q_PROPERTY(int hr READ hR NOTIFY hrChanged)
+ Q_PROPERTY(int maxHR READ maxHR NOTIFY averageChanged)
+ Q_PROPERTY(int minHR READ minHR NOTIFY averageChanged)
+ Q_PROPERTY(float average READ average NOTIFY averageChanged)
+ Q_PROPERTY(int time READ time NOTIFY timeChanged)
+ Q_PROPERTY(float calories READ caloriesCalculation NOTIFY caloriesChanged)
+
+public:
+ HeartRate();
+ ~HeartRate();
+ void setMessage(QString message);
+ QString message() const;
+ QVariant name();
+ int hR() const;
+ int time();
+ float average();
+ int maxHR() const;
+ int minHR() const;
+ float caloriesCalculation();
+
+public slots:
+ void deviceSearch();
+ void connectToService(const QString &address);
+ void disconnectService();
+ void startDemo();
+
+ void obtainResults();
+ int measurements(int index) const;
+ int measurementsSize() const;
+ QString deviceAddress() const;
+ int numDevices() const;
+
+private slots:
+ //QBluetothDeviceDiscoveryAgent
+ void addDevice(const QBluetoothDeviceInfo&);
+ void scanFinished();
+ void deviceScanError(QBluetoothDeviceDiscoveryAgent::Error);
+
+ //QLowEnergyController
+ void serviceDiscovered(const QBluetoothUuid &);
+ void serviceScanDone();
+ void controllerError(QLowEnergyController::Error);
+ void deviceConnected();
+ void deviceDisconnected();
+
+
+ //QLowEnergyService
+ void serviceStateChanged(QLowEnergyService::ServiceState s);
+ void updateHeartRateValue(const QLowEnergyCharacteristic &c,
+ const QByteArray &value);
+ void confirmedDescriptorWrite(const QLowEnergyDescriptor &d,
+ const QByteArray &value);
+ void serviceError(QLowEnergyService::ServiceError e);
+
+ //DemoMode
+ void receiveDemo();
+
+Q_SIGNALS:
+ void messageChanged();
+ void nameChanged();
+ void hrChanged();
+ void averageChanged();
+ void timeChanged();
+ void caloriesChanged();
+
+private:
+ int randomPulse() const;
+
+ DeviceInfo m_currentDevice;
+ QBluetoothDeviceDiscoveryAgent *m_deviceDiscoveryAgent;
+ QLowEnergyDescriptor m_notificationDesc;
+ QList<QObject*> m_devices;
+ QString m_info;
+ bool foundHeartRateService;
+ QVector<quint16> m_measurements;
+ QDateTime m_start;
+ QDateTime m_stop;
+ int m_max;
+ int m_min;
+ float calories;
+ QLowEnergyController *m_control;
+ QTimer *timer; // for demo application
+ QLowEnergyService *m_service;
+};
+
+#endif // HEARTRATE_H
diff --git a/examples/bluetooth/heartlistener/main.cpp b/examples/bluetooth/heartlistener/main.cpp
new file mode 100644
index 00000000..e50b87f1
--- /dev/null
+++ b/examples/bluetooth/heartlistener/main.cpp
@@ -0,0 +1,61 @@
+/***************************************************************************
+**
+** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QLoggingCategory>
+#include <QQmlContext>
+#include <QGuiApplication>
+#include <QQuickView>
+#include "heartrate.h"
+
+int main(int argc, char *argv[])
+{
+ //QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
+ QGuiApplication app(argc, argv);
+
+ HeartRate heartRate;
+ QQuickView *view = new QQuickView;
+ view->rootContext()->setContextProperty("heartRate", &heartRate);
+ view->setSource(QUrl("qrc:/assets/main.qml"));
+ view->setResizeMode(QQuickView::SizeRootObjectToView);
+ view->show();
+ return app.exec();
+
+}
diff --git a/examples/bluetooth/heartlistener/resources.qrc b/examples/bluetooth/heartlistener/resources.qrc
new file mode 100644
index 00000000..ac6f9c83
--- /dev/null
+++ b/examples/bluetooth/heartlistener/resources.qrc
@@ -0,0 +1,16 @@
+<RCC>
+ <qresource prefix="/">
+ <file>assets/blue_heart.png</file>
+ <file>assets/busy_dark.png</file>
+ <file>assets/Button.qml</file>
+ <file>assets/dialog.qml</file>
+ <file>assets/draw.js</file>
+ <file>assets/home.qml</file>
+ <file>assets/main.qml</file>
+ <file>assets/monitor.qml</file>
+ <file>assets/Point.qml</file>
+ <file>assets/results.qml</file>
+ <file>assets/star.png</file>
+ <file>assets/blue_heart_small.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/bluetooth/lowenergyscanner/assets/Characteristics.qml b/examples/bluetooth/lowenergyscanner/assets/Characteristics.qml
new file mode 100644
index 00000000..4a7db471
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/assets/Characteristics.qml
@@ -0,0 +1,147 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 300
+ height: 600
+
+ Header {
+ id: header
+ anchors.top: parent.top
+ headerText: "Characteristics list"
+ }
+
+ Dialog {
+ id: info
+ anchors.centerIn: parent
+ visible: true
+ dialogText: "Scanning for characteristics...";
+ }
+
+ Connections {
+ target: device
+ onCharacteristicsUpdated: {
+ menu.menuText = "Back"
+ if (characteristicview.count === 0)
+ info.dialogText = "No characteristic found"
+ else
+ info.visible = false;
+ }
+
+ onDisconnected: {
+ pageLoader.source = "main.qml"
+ }
+ }
+
+ ListView {
+ id: characteristicview
+ width: parent.width
+ clip: true
+
+ anchors.top: header.bottom
+ anchors.bottom: menu.top
+ model: device.characteristicList
+
+ delegate: Rectangle {
+ id: characteristicbox
+ height:300
+ width: parent.width
+ color: "lightsteelblue"
+ border.width: 2
+ border.color: "black"
+ radius: 5
+
+ Label {
+ id: characteristicName
+ textContent: modelData.characteristicName
+ anchors.top: parent.top
+ anchors.topMargin: 5
+ }
+
+ Label {
+ id: characteristicUuid
+ font.pointSize: characteristicName.font.pointSize*0.7
+ textContent: modelData.characteristicUuid
+ anchors.top: characteristicName.bottom
+ anchors.topMargin: 5
+ }
+
+ Label {
+ id: characteristicValue
+ font.pointSize: characteristicName.font.pointSize*0.7
+ textContent: ("Value: " + modelData.characteristicValue)
+ anchors.bottom: characteristicHandle.top
+ horizontalAlignment: Text.AlignHCenter
+ anchors.topMargin: 5
+ }
+
+ Label {
+ id: characteristicHandle
+ font.pointSize: characteristicName.font.pointSize*0.7
+ textContent: ("Handlers: " + modelData.characteristicHandle)
+ anchors.bottom: characteristicPermission.top
+ anchors.topMargin: 5
+ }
+
+ Label {
+ id: characteristicPermission
+ font.pointSize: characteristicName.font.pointSize*0.7
+ textContent: modelData.characteristicPermission
+ anchors.bottom: parent.bottom
+ anchors.topMargin: 5
+ anchors.bottomMargin: 5
+ }
+ }
+ }
+
+ Menu {
+ id: menu
+ anchors.bottom: parent.bottom
+ menuWidth: parent.width
+ menuText: "Scanning"
+ menuHeight: (parent.height/6)
+ onButtonClick: {
+ pageLoader.source = "Services.qml"
+ }
+ }
+}
diff --git a/examples/bluetooth/lowenergyscanner/assets/Dialog.qml b/examples/bluetooth/lowenergyscanner/assets/Dialog.qml
new file mode 100644
index 00000000..be5388b5
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/assets/Dialog.qml
@@ -0,0 +1,61 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: parent.width/2
+ height: 62
+ z: 50
+ property string dialogText: ""
+ border.width: 1
+ border.color: "#363636"
+ radius: 10
+
+ Text {
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ anchors.fill: parent
+ elide: Text.ElideMiddle
+ text: dialogText
+ color: "#363636"
+ wrapMode: Text.Wrap
+ }
+}
diff --git a/examples/bluetooth/lowenergyscanner/assets/Header.qml b/examples/bluetooth/lowenergyscanner/assets/Header.qml
new file mode 100644
index 00000000..654fda34
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/assets/Header.qml
@@ -0,0 +1,61 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: parent.width
+ height: 70
+ border.width: 1
+ border.color: "#363636"
+ radius: 5
+ property string headerText: ""
+
+ Text {
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ anchors.fill: parent
+ text: headerText
+ font.bold: true
+ font.pixelSize: 30
+ elide: Text.ElideMiddle
+ color: "#363636"
+ }
+}
diff --git a/examples/bluetooth/lowenergyscanner/assets/Label.qml b/examples/bluetooth/lowenergyscanner/assets/Label.qml
new file mode 100644
index 00000000..1dced831
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/assets/Label.qml
@@ -0,0 +1,53 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Text {
+ property string textContent: ""
+ font.pixelSize: 30
+ anchors.horizontalCenter: parent.horizontalCenter
+ color: "#363636"
+ horizontalAlignment: Text.AlignHCenter
+ elide: Text.ElideMiddle
+ width: parent.width
+ wrapMode: Text.Wrap
+ text: textContent
+}
diff --git a/examples/bluetooth/lowenergyscanner/assets/Menu.qml b/examples/bluetooth/lowenergyscanner/assets/Menu.qml
new file mode 100644
index 00000000..d1eaebb2
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/assets/Menu.qml
@@ -0,0 +1,90 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+
+ property real menuWidth: 100
+ property real menuHeight: 50
+ property string menuText: "Search"
+ signal buttonClick()
+
+ height: menuHeight
+ width: menuWidth
+
+ Rectangle {
+ id: search
+ width: parent.width
+ height: parent.height
+ anchors.centerIn: parent
+ color: "#363636"
+ border.width: 1
+ border.color: "#E3E3E3"
+ radius: 5
+ Text {
+ id: searchText
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ anchors.fill: parent
+ text: menuText
+ elide: Text.ElideMiddle
+ color: "#E3E3E3"
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onPressed: {
+ search.width = search.width - 7
+ search.height = search.height - 5
+ }
+
+ onReleased: {
+ search.width = search.width + 7
+ search.height = search.height + 5
+ }
+
+ onClicked: {
+ buttonClick()
+ }
+ }
+ }
+}
diff --git a/examples/bluetooth/lowenergyscanner/assets/Services.qml b/examples/bluetooth/lowenergyscanner/assets/Services.qml
new file mode 100644
index 00000000..e4e802d2
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/assets/Services.qml
@@ -0,0 +1,136 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 300
+ height: 600
+
+ Header {
+ id: header
+ anchors.top: parent.top
+ headerText: "Services list"
+ }
+
+ Dialog {
+ id: info
+ anchors.centerIn: parent
+ visible: true
+ dialogText: "Scanning for services...";
+ }
+
+ Connections {
+ target: device
+ onServicesUpdated: {
+ if (servicesview.count === 0)
+ info.dialogText = "No services found"
+ else
+ info.visible = false;
+ }
+
+ onDisconnected: {
+ pageLoader.source = "main.qml"
+ }
+ }
+
+ ListView {
+ id: servicesview
+ width: parent.width
+ anchors.top: header.bottom
+ anchors.bottom: menu.top
+ model: device.servicesList
+ clip: true
+
+ delegate: Rectangle {
+ id: servicebox
+ height:100
+ color: "lightsteelblue"
+ border.width: 2
+ border.color: "black"
+ radius: 5
+ width: parent.width
+ Component.onCompleted: {
+ info.visible = false
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ device.connectToService(modelData.serviceUuid);
+ pageLoader.source = "Characteristics.qml";
+ }
+ }
+
+ Label {
+ id: serviceName
+ textContent: modelData.serviceName
+ anchors.top: parent.top
+ anchors.topMargin: 5
+ }
+
+ Label {
+ textContent: modelData.serviceType
+ font.pointSize: serviceName.font.pointSize * 0.5
+ anchors.top: serviceName.bottom
+ }
+
+ Label {
+ id: serviceUuid
+ font.pointSize: serviceName.font.pointSize * 0.5
+ textContent: modelData.serviceUuid
+ anchors.bottom: servicebox.bottom
+ anchors.bottomMargin: 5
+ }
+ }
+ }
+
+ Menu {
+ id: menu
+ anchors.bottom: parent.bottom
+ menuWidth: parent.width
+ menuText: "Back"
+ menuHeight: (parent.height/6)
+ onButtonClick: {
+ device.disconnectFromDevice()
+ }
+ }
+}
diff --git a/examples/bluetooth/lowenergyscanner/assets/main.qml b/examples/bluetooth/lowenergyscanner/assets/main.qml
new file mode 100644
index 00000000..9f0395d5
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/assets/main.qml
@@ -0,0 +1,130 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: back
+ width: 300
+ height: 600
+ property bool deviceState: device.state
+ onDeviceStateChanged: {
+ if (!device.state)
+ info.visible = false;
+ }
+
+ Header {
+ id: header
+ anchors.top: parent.top
+ headerText: "Start Discovery"
+ }
+
+ Dialog {
+ id: info
+ anchors.centerIn: parent
+ visible: false
+ }
+
+ ListView {
+ id: theListView
+ width: parent.width
+ clip: true
+
+ anchors.top: header.bottom
+ anchors.bottom: menu.top
+ model: device.devicesList
+
+ delegate: Rectangle {
+ id: box
+ height:100
+ width: parent.width
+ color: "lightsteelblue"
+ border.width: 2
+ border.color: "black"
+ radius: 5
+
+ Component.onCompleted: {
+ info.visible = false;
+ header.headerText = "Select a device";
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ device.scanServices(modelData.deviceAddress);
+ pageLoader.source = "Services.qml"
+ }
+ }
+
+ Label {
+ id: deviceName
+ textContent: modelData.deviceName
+ anchors.top: parent.top
+ anchors.topMargin: 5
+ }
+
+ Label {
+ id: deviceAddress
+ textContent: modelData.deviceAddress
+ font.pointSize: deviceName.font.pointSize*0.7
+ anchors.bottom: box.bottom
+ anchors.bottomMargin: 5
+ }
+ }
+ }
+
+ Menu {
+ id: menu
+ anchors.bottom: parent.bottom
+ menuWidth: parent.width
+ menuHeight: (parent.height/6)
+ menuText: device.update
+ onButtonClick: {
+ device.startDeviceDiscovery();
+ info.dialogText = "Searching...";
+ info.visible = true;}
+ }
+
+ Loader {
+ id: pageLoader
+ anchors.fill: parent
+ }
+}
diff --git a/examples/bluetooth/lowenergyscanner/characteristicinfo.cpp b/examples/bluetooth/lowenergyscanner/characteristicinfo.cpp
new file mode 100644
index 00000000..f5290459
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/characteristicinfo.cpp
@@ -0,0 +1,147 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "characteristicinfo.h"
+#include "qbluetoothuuid.h"
+#include <QByteArray>
+
+CharacteristicInfo::CharacteristicInfo()
+{
+}
+
+CharacteristicInfo::CharacteristicInfo(const QLowEnergyCharacteristic &characteristic):
+ m_characteristic(characteristic)
+{
+}
+
+void CharacteristicInfo::setCharacteristic(const QLowEnergyCharacteristic &characteristic)
+{
+ m_characteristic = characteristic;
+ emit characteristicChanged();
+}
+
+QString CharacteristicInfo::getName() const
+{
+ //! [les-get-descriptors]
+ QString name = m_characteristic.name();
+ if (!name.isEmpty())
+ return name;
+
+ // find descriptor with CharacteristicUserDescription
+ foreach (const QLowEnergyDescriptor &descriptor, m_characteristic.descriptors()) {
+ if (descriptor.type() == QBluetoothUuid::CharacteristicUserDescription) {
+ name = descriptor.value();
+ break;
+ }
+ }
+ //! [les-get-descriptors]
+
+ if (name.isEmpty())
+ name = "Unknown";
+
+ return name;
+}
+
+QString CharacteristicInfo::getUuid() const
+{
+ const QBluetoothUuid uuid = m_characteristic.uuid();
+ bool success = false;
+ quint16 result16 = uuid.toUInt16(&success);
+ if (success)
+ return QStringLiteral("0x") + QString::number(result16, 16);
+
+ quint32 result32 = uuid.toUInt32(&success);
+ if (success)
+ return QStringLiteral("0x") + QString::number(result32, 16);
+
+ return uuid.toString().remove(QLatin1Char('{')).remove(QLatin1Char('}'));
+}
+
+QString CharacteristicInfo::getValue() const
+{
+ // Show raw string first and hex value below
+ QByteArray a = m_characteristic.value();
+ QString result;
+ if (a.isEmpty()) {
+ result = QStringLiteral("<none>");
+ return result;
+ }
+
+ result = a;
+ result += QLatin1Char('\n');
+ result += a.toHex();
+
+ return result;
+}
+
+QString CharacteristicInfo::getHandle() const
+{
+ return QStringLiteral("0x") + QString::number(m_characteristic.handle(), 16);
+}
+
+QString CharacteristicInfo::getPermission() const
+{
+ QString properties = "( ";
+ int permission = m_characteristic.properties();
+ if (permission & QLowEnergyCharacteristic::Read)
+ properties += QStringLiteral(" Read");
+ if (permission & QLowEnergyCharacteristic::Write)
+ properties += QStringLiteral(" Write");
+ if (permission & QLowEnergyCharacteristic::Notify)
+ properties += QStringLiteral(" Notify");
+ if (permission & QLowEnergyCharacteristic::Indicate)
+ properties += QStringLiteral(" Indicate");
+ if (permission & QLowEnergyCharacteristic::ExtendedProperty)
+ properties += QStringLiteral(" ExtendedProperty");
+ if (permission & QLowEnergyCharacteristic::Broadcasting)
+ properties += QStringLiteral(" Broadcast");
+ if (permission & QLowEnergyCharacteristic::WriteNoResponse)
+ properties += QStringLiteral(" WriteNoResp");
+ if (permission & QLowEnergyCharacteristic::WriteSigned)
+ properties += QStringLiteral(" WriteSigned");
+ properties += " )";
+ return properties;
+}
+
+QLowEnergyCharacteristic CharacteristicInfo::getCharacteristic() const
+{
+ return m_characteristic;
+}
diff --git a/examples/bluetooth/lowenergyscanner/characteristicinfo.h b/examples/bluetooth/lowenergyscanner/characteristicinfo.h
new file mode 100644
index 00000000..d06c962e
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/characteristicinfo.h
@@ -0,0 +1,75 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CHARACTERISTICINFO_H
+#define CHARACTERISTICINFO_H
+#include <QObject>
+#include <QString>
+#include <QtBluetooth/QLowEnergyCharacteristic>
+
+class CharacteristicInfo: public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString characteristicName READ getName NOTIFY characteristicChanged)
+ Q_PROPERTY(QString characteristicUuid READ getUuid NOTIFY characteristicChanged)
+ Q_PROPERTY(QString characteristicValue READ getValue NOTIFY characteristicChanged)
+ Q_PROPERTY(QString characteristicHandle READ getHandle NOTIFY characteristicChanged)
+ Q_PROPERTY(QString characteristicPermission READ getPermission NOTIFY characteristicChanged)
+
+public:
+ CharacteristicInfo();
+ CharacteristicInfo(const QLowEnergyCharacteristic &characteristic);
+ void setCharacteristic(const QLowEnergyCharacteristic &characteristic);
+ QString getName() const;
+ QString getUuid() const;
+ QString getValue() const;
+ QString getHandle() const;
+ QString getPermission() const;
+ QLowEnergyCharacteristic getCharacteristic() const;
+
+Q_SIGNALS:
+ void characteristicChanged();
+
+private:
+ QLowEnergyCharacteristic m_characteristic;
+};
+
+#endif // CHARACTERISTICINFO_H
diff --git a/examples/bluetooth/lowenergyscanner/device.cpp b/examples/bluetooth/lowenergyscanner/device.cpp
new file mode 100644
index 00000000..9ffb4d56
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/device.cpp
@@ -0,0 +1,307 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "device.h"
+#include <qbluetoothaddress.h>
+#include <qbluetoothdevicediscoveryagent.h>
+#include <qbluetoothlocaldevice.h>
+#include <qbluetoothdeviceinfo.h>
+#include <qbluetoothservicediscoveryagent.h>
+#include <QDebug>
+#include <QList>
+#include <QTimer>
+
+Device::Device():
+ connected(false), controller(0), m_deviceScanState(false)
+{
+ //! [les-devicediscovery-1]
+ discoveryAgent = new QBluetoothDeviceDiscoveryAgent();
+ connect(discoveryAgent, SIGNAL(deviceDiscovered(const QBluetoothDeviceInfo&)),
+ this, SLOT(addDevice(const QBluetoothDeviceInfo&)));
+ connect(discoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)),
+ this, SLOT(deviceScanError(QBluetoothDeviceDiscoveryAgent::Error)));
+ connect(discoveryAgent, SIGNAL(finished()), this, SLOT(deviceScanFinished()));
+ //! [les-devicediscovery-1]
+
+ setUpdate("Search");
+}
+
+Device::~Device()
+{
+ delete discoveryAgent;
+ delete controller;
+ qDeleteAll(devices);
+ qDeleteAll(m_services);
+ qDeleteAll(m_characteristics);
+ devices.clear();
+ m_services.clear();
+ m_characteristics.clear();
+}
+
+void Device::startDeviceDiscovery()
+{
+ qDeleteAll(devices);
+ devices.clear();
+ emit devicesUpdated();
+
+ setUpdate("Scanning for devices ...");
+ //! [les-devicediscovery-2]
+ discoveryAgent->start();
+ //! [les-devicediscovery-2]
+ m_deviceScanState = true;
+ Q_EMIT stateChanged();
+}
+
+//! [les-devicediscovery-3]
+void Device::addDevice(const QBluetoothDeviceInfo &info)
+{
+ if (info.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration) {
+ DeviceInfo *d = new DeviceInfo(info);
+ devices.append(d);
+ setUpdate("Last device added: " + d->getName());
+ }
+}
+//! [les-devicediscovery-3]
+
+void Device::deviceScanFinished()
+{
+ emit devicesUpdated();
+ m_deviceScanState = false;
+ emit stateChanged();
+ if (devices.isEmpty())
+ setUpdate("No Low Energy devices found...");
+ else
+ setUpdate("Done! Scan Again!");
+}
+
+QVariant Device::getDevices()
+{
+ return QVariant::fromValue(devices);
+}
+
+QVariant Device::getServices()
+{
+ return QVariant::fromValue(m_services);
+}
+
+QVariant Device::getCharacteristics()
+{
+ return QVariant::fromValue(m_characteristics);
+}
+
+QString Device::getUpdate()
+{
+ return m_message;
+}
+
+void Device::scanServices(const QString &address)
+{
+ // We need the current device for service discovery.
+ for (int i = 0; i < devices.size(); i++) {
+ if (((DeviceInfo*)devices.at(i))->getAddress() == address )
+ currentDevice.setDevice(((DeviceInfo*)devices.at(i))->getDevice());
+ }
+
+ if (!currentDevice.getDevice().isValid()) {
+ qWarning() << "Not a valid device";
+ return;
+ }
+
+ qDeleteAll(m_characteristics);
+ m_characteristics.clear();
+ emit characteristicsUpdated();
+ qDeleteAll(m_services);
+ m_services.clear();
+ emit servicesUpdated();
+
+ setUpdate("Connecting to device...");
+
+ if (controller && controller->remoteAddress() != currentDevice.getDevice().address()) {
+ controller->disconnectFromDevice();
+ delete controller;
+ controller = 0;
+ }
+
+ //! [les-controller-1]
+ if (!controller) {
+ // Connecting signals and slots for connecting to LE services.
+ controller = new QLowEnergyController(currentDevice.getDevice().address());
+ connect(controller, SIGNAL(connected()),
+ this, SLOT(deviceConnected()));
+ connect(controller, SIGNAL(error(QLowEnergyController::Error)),
+ this, SLOT(errorReceived(QLowEnergyController::Error)));
+ connect(controller, SIGNAL(disconnected()),
+ this, SLOT(deviceDisconnected()));
+ connect(controller, SIGNAL(serviceDiscovered(QBluetoothUuid)),
+ this, SLOT(addLowEnergyService(QBluetoothUuid)));
+ connect(controller, SIGNAL(discoveryFinished()),
+ this, SLOT(serviceScanDone()));
+ }
+
+ controller->connectToDevice();
+ //! [les-controller-1]
+}
+
+void Device::addLowEnergyService(const QBluetoothUuid &serviceUuid)
+{
+ //! [les-service-1]
+ QLowEnergyService *service = controller->createServiceObject(serviceUuid);
+ if (!service) {
+ qWarning() << "Cannot create service for uuid";
+ return;
+ }
+ //! [les-service-1]
+ ServiceInfo *serv = new ServiceInfo(service);
+ m_services.append(serv);
+
+ emit servicesUpdated();
+}
+//! [les-service-1]
+
+void Device::serviceScanDone()
+{
+ setUpdate("Service scan done!");
+}
+
+void Device::connectToService(const QString &uuid)
+{
+ QLowEnergyService *service = 0;
+ for (int i = 0; i < m_services.size(); i++) {
+ ServiceInfo *serviceInfo = (ServiceInfo*)m_services.at(i);
+ if (serviceInfo->getUuid() == uuid) {
+ service = serviceInfo->service();
+ break;
+ }
+ }
+
+ if (!service)
+ return;
+
+ qDeleteAll(m_characteristics);
+ m_characteristics.clear();
+ emit characteristicsUpdated();
+
+ if (service->state() == QLowEnergyService::DiscoveryRequired) {
+ //! [les-service-3]
+ connect(service, SIGNAL(stateChanged(QLowEnergyService::ServiceState)),
+ this, SLOT(serviceDetailsDiscovered(QLowEnergyService::ServiceState)));
+ service->discoverDetails();
+ //! [les-service-3]
+ return;
+ }
+
+ //discovery already done
+ const QList<QLowEnergyCharacteristic> chars = service->characteristics();
+ foreach (const QLowEnergyCharacteristic &ch, chars) {
+ CharacteristicInfo *cInfo = new CharacteristicInfo(ch);
+ m_characteristics.append(cInfo);
+ }
+
+ QTimer::singleShot(0, this, SIGNAL(characteristicsUpdated()));
+}
+
+void Device::deviceConnected()
+{
+ setUpdate("Discovering services!");
+ connected = true;
+ //! [les-service-2]
+ controller->discoverServices();
+ //! [les-service-2]
+}
+
+void Device::errorReceived(QLowEnergyController::Error /*error*/)
+{
+ qWarning() << "Error: " << controller->errorString();
+ setUpdate(controller->errorString());
+}
+
+void Device::setUpdate(QString message)
+{
+ m_message = message;
+ emit updateChanged();
+}
+
+void Device::disconnectFromDevice()
+{
+ if (connected)
+ controller->disconnectFromDevice();
+}
+
+void Device::deviceDisconnected()
+{
+ qWarning() << "Disconnect from device";
+ emit disconnected();
+}
+
+void Device::serviceDetailsDiscovered(QLowEnergyService::ServiceState newState)
+{
+ if (newState != QLowEnergyService::ServiceDiscovered)
+ return;
+
+ QLowEnergyService *service = qobject_cast<QLowEnergyService *>(sender());
+ if (!service)
+ return;
+
+ //! [les-chars]
+ const QList<QLowEnergyCharacteristic> chars = service->characteristics();
+ foreach (const QLowEnergyCharacteristic &ch, chars) {
+ CharacteristicInfo *cInfo = new CharacteristicInfo(ch);
+ m_characteristics.append(cInfo);
+ }
+ //! [les-chars]
+
+ emit characteristicsUpdated();
+}
+
+void Device::deviceScanError(QBluetoothDeviceDiscoveryAgent::Error error)
+{
+ if (error == QBluetoothDeviceDiscoveryAgent::PoweredOffError)
+ setUpdate("The Bluetooth adaptor is powered off, power it on before doing discovery.");
+ else if (error == QBluetoothDeviceDiscoveryAgent::InputOutputError)
+ setUpdate("Writing or reading from the device resulted in an error.");
+ else
+ setUpdate("An unknown error has occurred.");
+}
+
+bool Device::state()
+{
+ return m_deviceScanState;
+}
diff --git a/examples/bluetooth/lowenergyscanner/device.h b/examples/bluetooth/lowenergyscanner/device.h
new file mode 100644
index 00000000..f15c4c95
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/device.h
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the demonstration applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DEVICE_H
+#define DEVICE_H
+
+#include <qbluetoothglobal.h>
+#include <qbluetoothlocaldevice.h>
+#include <QObject>
+#include <QVariant>
+#include <QList>
+#include <QBluetoothServiceDiscoveryAgent>
+#include <QBluetoothDeviceDiscoveryAgent>
+#include <QLowEnergyController>
+#include <QBluetoothServiceInfo>
+#include "deviceinfo.h"
+#include "serviceinfo.h"
+#include "characteristicinfo.h"
+
+QT_FORWARD_DECLARE_CLASS (QBluetoothDeviceInfo)
+QT_FORWARD_DECLARE_CLASS (QLowEnergyServiceInfo)
+QT_FORWARD_DECLARE_CLASS (QBluetoothServiceInfo)
+
+class Device: public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QVariant devicesList READ getDevices NOTIFY devicesUpdated)
+ Q_PROPERTY(QVariant servicesList READ getServices NOTIFY servicesUpdated)
+ Q_PROPERTY(QVariant characteristicList READ getCharacteristics NOTIFY characteristicsUpdated)
+ Q_PROPERTY(QString update READ getUpdate NOTIFY updateChanged)
+ Q_PROPERTY(bool state READ state NOTIFY stateChanged)
+public:
+ Device();
+ ~Device();
+ QVariant getDevices();
+ QVariant getServices();
+ QVariant getCharacteristics();
+ QString getUpdate();
+ bool state();
+
+public slots:
+ void startDeviceDiscovery();
+ void scanServices(const QString &address);
+
+ void connectToService(const QString &uuid);
+ void disconnectFromDevice();
+
+private slots:
+ // QBluetoothDeviceDiscoveryAgent related
+ void addDevice(const QBluetoothDeviceInfo&);
+ void deviceScanFinished();
+ void deviceScanError(QBluetoothDeviceDiscoveryAgent::Error);
+
+ // QLowEnergyController realted
+ void addLowEnergyService(const QBluetoothUuid &uuid);
+ void deviceConnected();
+ void errorReceived(QLowEnergyController::Error);
+ void serviceScanDone();
+ void deviceDisconnected();
+
+ // QLowEnergyService related
+ void serviceDetailsDiscovered(QLowEnergyService::ServiceState newState);
+
+Q_SIGNALS:
+ void devicesUpdated();
+ void servicesUpdated();
+ void characteristicsUpdated();
+ void updateChanged();
+ void stateChanged();
+ void disconnected();
+
+private:
+ void setUpdate(QString message);
+ QBluetoothDeviceDiscoveryAgent *discoveryAgent;
+ DeviceInfo currentDevice;
+ QList<QObject*> devices;
+ QList<QObject*> m_services;
+ QList<QObject*> m_characteristics;
+ QString m_message;
+ bool connected;
+ QLowEnergyController *controller;
+ bool m_deviceScanState;
+};
+
+#endif // DEVICE_H
diff --git a/examples/bluetooth/lowenergyscanner/deviceinfo.cpp b/examples/bluetooth/lowenergyscanner/deviceinfo.cpp
new file mode 100644
index 00000000..d6b7a734
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/deviceinfo.cpp
@@ -0,0 +1,72 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "deviceinfo.h"
+
+DeviceInfo::DeviceInfo()
+{
+}
+
+DeviceInfo::DeviceInfo(const QBluetoothDeviceInfo &d)
+{
+ device = d;
+}
+
+QString DeviceInfo::getAddress() const
+{
+ return device.address().toString();
+}
+
+QString DeviceInfo::getName() const
+{
+ return device.name();
+}
+
+QBluetoothDeviceInfo DeviceInfo::getDevice()
+{
+ return device;
+}
+
+void DeviceInfo::setDevice(const QBluetoothDeviceInfo &dev)
+{
+ device = QBluetoothDeviceInfo(dev);
+ Q_EMIT deviceChanged();
+}
diff --git a/examples/bluetooth/lowenergyscanner/deviceinfo.h b/examples/bluetooth/lowenergyscanner/deviceinfo.h
new file mode 100644
index 00000000..48f11cfe
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/deviceinfo.h
@@ -0,0 +1,71 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DEVICEINFO_H
+#define DEVICEINFO_H
+
+#include <QObject>
+#include <qbluetoothdeviceinfo.h>
+#include <qbluetoothaddress.h>
+#include <QList>
+#include "deviceinfo.h"
+
+class DeviceInfo: public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString deviceName READ getName NOTIFY deviceChanged)
+ Q_PROPERTY(QString deviceAddress READ getAddress NOTIFY deviceChanged)
+public:
+ DeviceInfo();
+ DeviceInfo(const QBluetoothDeviceInfo &d);
+ QString getAddress() const;
+ QString getName() const;
+ QBluetoothDeviceInfo getDevice();
+ void setDevice(const QBluetoothDeviceInfo &dev);
+
+Q_SIGNALS:
+ void deviceChanged();
+
+private:
+ QBluetoothDeviceInfo device;
+};
+
+#endif // DEVICEINFO_H
diff --git a/examples/bluetooth/lowenergyscanner/doc/images/lowenergyscanner-chars.png b/examples/bluetooth/lowenergyscanner/doc/images/lowenergyscanner-chars.png
new file mode 100644
index 00000000..ff6d9e3e
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/doc/images/lowenergyscanner-chars.png
Binary files differ
diff --git a/examples/bluetooth/lowenergyscanner/doc/images/lowenergyscanner-devices.png b/examples/bluetooth/lowenergyscanner/doc/images/lowenergyscanner-devices.png
new file mode 100644
index 00000000..49a1c462
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/doc/images/lowenergyscanner-devices.png
Binary files differ
diff --git a/examples/bluetooth/lowenergyscanner/doc/images/lowenergyscanner-services.png b/examples/bluetooth/lowenergyscanner/doc/images/lowenergyscanner-services.png
new file mode 100644
index 00000000..5420c257
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/doc/images/lowenergyscanner-services.png
Binary files differ
diff --git a/examples/bluetooth/lowenergyscanner/doc/src/lowenergyscanner.qdoc b/examples/bluetooth/lowenergyscanner/doc/src/lowenergyscanner.qdoc
new file mode 100644
index 00000000..0dc38efa
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/doc/src/lowenergyscanner.qdoc
@@ -0,0 +1,139 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited all rights reserved
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example lowenergyscanner
+ \title Bluetooth Low Energy Scanner Example
+ \brief An application designed to browse the content of Bluetooth Low
+ Energy peripheral devices. The example demonstrates the use of all Qt Bluetooth
+ Low Energy classes.
+
+ The Bluetooth Low Energy Scanner Example shows how to develop Bluetooth
+ Low Energy applications using the Qt Bluetooth API. The application covers
+ scanning for Low Energy devices, scanning their services and reading
+ the service characteristics and descriptors.
+
+ \image lowenergyscanner-services.png
+
+ The example introduces the following Qt classes:
+
+ \list
+ \li \l QLowEnergyController
+ \li \l QLowEnergyService
+ \li \l QLowEnergyCharacteristic
+ \li \l QLowEnergyDescriptor
+ \endlist
+
+ The example can be used with any arbitrary Bluetooth Low Energy peripheral
+ device. It creates a snapshot of all services, characteristics and descriptors
+ and presents them to the user. Therefore the application provides an easy way of
+ browsing the content offered by a peripheral device.
+
+ \include examples-run.qdocinc
+
+ \section1 Scanning for Devices
+
+ The first step is to find all peripheral devices. The devices can be found using
+ the \l QBluetoothDeviceDiscoveryAgent class. The discovery process is started using
+ \l {QBluetoothDeviceDiscoveryAgent::start()}{start()}. Each new device is advertised via
+ the \l {QBluetoothDeviceDiscoveryAgent::deviceDiscovered()}{deviceDiscovered()} signal:
+
+ \snippet lowenergyscanner/device.cpp les-devicediscovery-1
+ \snippet lowenergyscanner/device.cpp les-devicediscovery-2
+
+ The below \c addDevice() slot is triggered as a reaction to the discovery of a new
+ device. It filters all found devices which
+ have the \l QBluetoothDeviceInfo::LowEnergyCoreConfiguration flag and adds them to a
+ list which is shown to the user.
+
+ \snippet lowenergyscanner/device.cpp les-devicediscovery-3
+
+ The list of devices may look like in the image below. \note It is a prerequisite
+ that the remote devices actively advertise their presence.
+
+ \image lowenergyscanner-devices.png
+
+ \section1 Connecting to Services
+
+ After the user has selected a device from the list the application connects to the
+ device and scans all services. The \l QLowEnergyController class is used to connect
+ to the device. The \l {QLowEnergyController::connectToDevice()} function triggers the
+ connection process which lasts until the \l {QLowEnergyController::connected()} signal
+ is received or an error has occurred:
+
+ \snippet lowenergyscanner/device.cpp les-controller-1
+
+ The slot triggered by the \l {QLowEnergyController::connected()}{connected()}
+ signal immediately calls \l {QLowEnergyController::discoverServices()} to start the service
+ discovery on the connected peripheral device.
+
+ \snippet lowenergyscanner/device.cpp les-service-2
+
+ The resulting list is presented to the user.The image below displays the results when the SensorTag
+ device is selected. The view lists the names of the services, whether they are
+ primary or secondary services and the UUID which determines the service type.
+
+ \image lowenergyscanner-services.png
+
+ As soon as the service is chosen the related \l QLowEnergyService instance is created to
+ permit interaction with it:
+
+ \snippet lowenergyscanner/device.cpp les-service-1
+
+ The service object provides the required signals and functions to discover the service details,
+ read and write characteristics and descriptors, as well as receive data change notifications.
+ Change notifications can be triggered as a result of writing a value or due to an on-device
+ update potentially triggered by the internal logic.
+ During the initial detail search the service's \l {QLowEnergyService::state()}{state()} transitions
+ from \l {QLowEnergyService::DiscoveryRequired}{DiscoveryRequired} to
+ \l {QLowEnergyService::DiscoveringServices}{DiscoveringServices} and eventually ends with
+ \l {QLowEnergyService::ServiceDiscovered}{ServiceDiscovered}:
+
+ \snippet lowenergyscanner/device.cpp les-service-3
+
+ \section1 Reading Service Data
+
+ Upon selection of a service the service details are shown. Each characteristic
+ is listed together with its name, UUID, value, handle and properties.
+
+ \image lowenergyscanner-chars.png
+
+ It is possible to retrieve the service's characteristics via
+ \l QLowEnergyService::characteristics() and in turn, each descriptor can be obtained
+ via \l QLowEnergyCharacteristic::descriptors().
+
+ \snippet lowenergyscanner/device.cpp les-chars
+
+ Although the example application does not display descriptors it uses descriptors to
+ get the name of an individual characteristic if its name cannot be discerned based on its
+ UUID. The second way to obtain the name is the existence of a descriptor of the type
+ \l {QBluetoothUuid::CharacteristicUserDescription}. The code below demonstrates how this
+ may be achieved:
+
+ \snippet lowenergyscanner/characteristicinfo.cpp les-get-descriptors
+*/
diff --git a/examples/bluetooth/lowenergyscanner/lowenergyscanner.pro b/examples/bluetooth/lowenergyscanner/lowenergyscanner.pro
new file mode 100644
index 00000000..f3378b4c
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/lowenergyscanner.pro
@@ -0,0 +1,25 @@
+TARGET = lowenergyscanner
+INCLUDEPATH += .
+
+QT += quick bluetooth
+
+# Input
+SOURCES += main.cpp \
+ device.cpp \
+ deviceinfo.cpp \
+ serviceinfo.cpp \
+ characteristicinfo.cpp
+
+OTHER_FILES += assets/*.qml
+
+HEADERS += \
+ device.h \
+ deviceinfo.h \
+ serviceinfo.h \
+ characteristicinfo.h
+
+RESOURCES += \
+ resources.qrc
+
+target.path = $$[QT_INSTALL_EXAMPLES]/bluetooth/lowenergyscanner
+INSTALLS += target
diff --git a/examples/bluetooth/lowenergyscanner/main.cpp b/examples/bluetooth/lowenergyscanner/main.cpp
new file mode 100644
index 00000000..ce359545
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/main.cpp
@@ -0,0 +1,62 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QLoggingCategory>
+#include <QQmlContext>
+#include <QGuiApplication>
+#include <QQuickView>
+#include "device.h"
+
+
+int main(int argc, char *argv[])
+{
+ //QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
+ QGuiApplication app(argc, argv);
+
+ Device d;
+ QQuickView *view = new QQuickView;
+ view->rootContext()->setContextProperty("device", &d);
+
+ view->setSource(QUrl("qrc:/assets/main.qml"));
+ view->setResizeMode(QQuickView::SizeRootObjectToView);
+ view->show();
+ return app.exec();
+}
diff --git a/examples/bluetooth/lowenergyscanner/resources.qrc b/examples/bluetooth/lowenergyscanner/resources.qrc
new file mode 100644
index 00000000..49a518e8
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/resources.qrc
@@ -0,0 +1,11 @@
+<RCC>
+ <qresource prefix="/">
+ <file>assets/Characteristics.qml</file>
+ <file>assets/main.qml</file>
+ <file>assets/Menu.qml</file>
+ <file>assets/Services.qml</file>
+ <file>assets/Header.qml</file>
+ <file>assets/Dialog.qml</file>
+ <file>assets/Label.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/bluetooth/lowenergyscanner/serviceinfo.cpp b/examples/bluetooth/lowenergyscanner/serviceinfo.cpp
new file mode 100644
index 00000000..c05422ca
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/serviceinfo.cpp
@@ -0,0 +1,102 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "serviceinfo.h"
+
+ServiceInfo::ServiceInfo()
+{
+}
+
+ServiceInfo::ServiceInfo(QLowEnergyService *service):
+ m_service(service)
+{
+ m_service->setParent(this);
+}
+
+QLowEnergyService *ServiceInfo::service() const
+{
+ return m_service;
+}
+
+QString ServiceInfo::getName() const
+{
+ if (!m_service)
+ return QString();
+
+ return m_service->serviceName();
+}
+
+QString ServiceInfo::getType() const
+{
+ if (!m_service)
+ return QString();
+
+ QString result;
+ if (m_service->type() & QLowEnergyService::PrimaryService)
+ result += QStringLiteral("primary");
+ else
+ result += QStringLiteral("secondary");
+
+ if (m_service->type() & QLowEnergyService::IncludedService)
+ result += QStringLiteral(" included");
+
+ result.prepend('<').append('>');
+
+ return result;
+}
+
+QString ServiceInfo::getUuid() const
+{
+ if (!m_service)
+ return QString();
+
+ const QBluetoothUuid uuid = m_service->serviceUuid();
+ bool success = false;
+ quint16 result16 = uuid.toUInt16(&success);
+ if (success)
+ return QStringLiteral("0x") + QString::number(result16, 16);
+
+ quint32 result32 = uuid.toUInt32(&success);
+ if (success)
+ return QStringLiteral("0x") + QString::number(result32, 16);
+
+ return uuid.toString().remove(QLatin1Char('{')).remove(QLatin1Char('}'));
+}
diff --git a/examples/bluetooth/lowenergyscanner/serviceinfo.h b/examples/bluetooth/lowenergyscanner/serviceinfo.h
new file mode 100644
index 00000000..1d35b1b7
--- /dev/null
+++ b/examples/bluetooth/lowenergyscanner/serviceinfo.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * 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.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** 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
+** OWNER 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."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SERVICEINFO_H
+#define SERVICEINFO_H
+#include <QtBluetooth/QLowEnergyService>
+
+class ServiceInfo: public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString serviceName READ getName NOTIFY serviceChanged)
+ Q_PROPERTY(QString serviceUuid READ getUuid NOTIFY serviceChanged)
+ Q_PROPERTY(QString serviceType READ getType NOTIFY serviceChanged)
+public:
+ ServiceInfo();
+ ServiceInfo(QLowEnergyService *service);
+ QLowEnergyService *service() const;
+ QString getUuid() const;
+ QString getName() const;
+ QString getType() const;
+
+Q_SIGNALS:
+ void serviceChanged();
+
+private:
+ QLowEnergyService *m_service;
+};
+
+#endif // SERVICEINFO_H
diff --git a/examples/bluetooth/picturetransfer/filetransfer.cpp b/examples/bluetooth/picturetransfer/filetransfer.cpp
index 7cfd041d..6f0a25b2 100644
--- a/examples/bluetooth/picturetransfer/filetransfer.cpp
+++ b/examples/bluetooth/picturetransfer/filetransfer.cpp
@@ -63,5 +63,5 @@ void FileTransfer::initTransfer(QString address, QString fileName)
void FileTransfer::updateProgress(qint64 transferred, qint64 total)
{
m_progress = ((float)transferred)/((float)total);
- Q_EMIT progressChanged();
+ emit progressChanged();
}
diff --git a/examples/bluetooth/picturetransfer/main.cpp b/examples/bluetooth/picturetransfer/main.cpp
index 7db3053e..cad9c66c 100644
--- a/examples/bluetooth/picturetransfer/main.cpp
+++ b/examples/bluetooth/picturetransfer/main.cpp
@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).first());
qDebug() << QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
- view.setSource(QUrl(QLatin1String("qrc:/bttransfer.qml")));
+ view.setSource(QUrl(QStringLiteral("qrc:/bttransfer.qml")));
view.setResizeMode(QQuickView::SizeRootObjectToView);
QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));
view.show();
diff --git a/examples/bluetooth/pingpong/pingpong.cpp b/examples/bluetooth/pingpong/pingpong.cpp
index d65a56a8..6d9466e9 100644
--- a/examples/bluetooth/pingpong/pingpong.cpp
+++ b/examples/bluetooth/pingpong/pingpong.cpp
@@ -60,7 +60,7 @@ PingPong::~PingPong()
void PingPong::startGame()
{
m_showDialog = false;
- Q_EMIT showDialogChanged();
+ emit showDialogChanged();
//! [Start the game]
if (m_role == 1)
updateDirection();
@@ -91,7 +91,7 @@ void PingPong::update()
size.append(size1);
size.append(" \n");
socket->write(size.constData());
- Q_EMIT ballChanged();
+ emit ballChanged();
}
else if (m_role == 2) {
size.setNum(m_rightBlockY);
@@ -111,7 +111,7 @@ void PingPong::setSize(const float &x, const float &y)
m_targetY = m_boardHeight/2;
m_ballPreviousX = m_ballX = m_boardWidth/2;
m_ballPreviousY = m_ballY = m_boardHeight - m_boardWidth/54;
- Q_EMIT ballChanged();
+ emit ballChanged();
}
void PingPong::updateBall(const float &bX, const float &bY)
@@ -176,7 +176,7 @@ void PingPong::checkBoundaries()
result.append(" \n");
socket->write(result);
qDebug() << result;
- Q_EMIT resultChanged();
+ emit resultChanged();
}
else if (m_ballX < 0) {
m_resultRight++;
@@ -196,7 +196,7 @@ void PingPong::checkBoundaries()
result.append(res);
result.append(" \n");
socket->write(result);
- Q_EMIT resultChanged();
+ emit resultChanged();
}
}
@@ -240,7 +240,7 @@ void PingPong::startServer()
setMessage(QStringLiteral("Server started, waiting for the client. You are the left player."));
// m_role is set to 1 if it is a server
m_role = 1;
- Q_EMIT roleChanged();
+ emit roleChanged();
}
void PingPong::startClient()
@@ -259,7 +259,7 @@ void PingPong::startClient()
setMessage(QStringLiteral("Starting server discovery. You are the right player"));
// m_role is set to 2 if it is a client
m_role = 2;
- Q_EMIT roleChanged();
+ emit roleChanged();
}
void PingPong::clientConnected()
@@ -380,7 +380,7 @@ void PingPong::readSocket()
QByteArray rightSide = result.at(2);
m_resultLeft = leftSide.toInt();
m_resultRight = rightSide.toInt();
- Q_EMIT resultChanged();
+ emit resultChanged();
checkResult();
}
}
@@ -401,7 +401,7 @@ void PingPong::readSocket()
if (boardSize.size() > 1) {
QByteArray rightBlockY = boardSize.at(0);
m_rightBlockY = m_proportionY * rightBlockY.toFloat();
- Q_EMIT rightBlockChanged();
+ emit rightBlockChanged();
}
}
else if (m_role == 2) {
@@ -413,8 +413,8 @@ void PingPong::readSocket()
m_ballX = m_proportionX * ballX.toFloat();
m_ballY = m_proportionY * ballY.toFloat();
m_leftBlockY = m_proportionY * leftBlockY.toFloat();
- Q_EMIT leftBlockChanged();
- Q_EMIT ballChanged();
+ emit leftBlockChanged();
+ emit ballChanged();
}
}
}
@@ -423,7 +423,7 @@ void PingPong::setMessage(const QString &message)
{
m_showDialog = true;
m_message = message;
- Q_EMIT showDialogChanged();
+ emit showDialogChanged();
}
int PingPong::role() const
diff --git a/examples/bluetooth/scanner/qmlscanner.cpp b/examples/bluetooth/scanner/qmlscanner.cpp
index 47d0bb26..5c09c8f3 100644
--- a/examples/bluetooth/scanner/qmlscanner.cpp
+++ b/examples/bluetooth/scanner/qmlscanner.cpp
@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
{
//QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
QGuiApplication application(argc, argv);
- const QString mainQmlApp = QLatin1String("qrc:/scanner.qml");
+ const QString mainQmlApp(QStringLiteral("qrc:/scanner.qml"));
QQuickView view;
view.setSource(QUrl(mainQmlApp));
view.setResizeMode(QQuickView::SizeRootObjectToView);
diff --git a/examples/nfc/ndefeditor/mainwindow.cpp b/examples/nfc/ndefeditor/mainwindow.cpp
index fedb0866..527ff6c7 100644
--- a/examples/nfc/ndefeditor/mainwindow.cpp
+++ b/examples/nfc/ndefeditor/mainwindow.cpp
@@ -105,13 +105,13 @@ void addRecord(Ui::MainWindow *ui, const QNdefRecord &record = QNdefRecord())
if (!vbox->isEmpty()) {
QFrame *hline = new QFrame;
hline->setFrameShape(QFrame::HLine);
- hline->setObjectName(QLatin1String("line-spacer"));
+ hline->setObjectName(QStringLiteral("line-spacer"));
vbox->addWidget(hline);
}
T *recordEditor = new T;
- recordEditor->setObjectName(QLatin1String("record-editor"));
+ recordEditor->setObjectName(QStringLiteral("record-editor"));
if (!record.isEmpty())
recordEditor->setRecord(record);
@@ -202,7 +202,7 @@ void MainWindow::saveMessage()
void MainWindow::touchReceive()
{
- ui->status->setStyleSheet(QLatin1String("background: blue"));
+ ui->status->setStyleSheet(QStringLiteral("background: blue"));
m_touchAction = ReadNdef;
@@ -214,7 +214,7 @@ void MainWindow::touchReceive()
void MainWindow::touchStore()
{
- ui->status->setStyleSheet(QLatin1String("background: yellow"));
+ ui->status->setStyleSheet(QStringLiteral("background: yellow"));
m_touchAction = WriteNdef;
@@ -337,8 +337,8 @@ void MainWindow::clearMessage()
{
QWidget *scrollArea = ui->scrollAreaWidgetContents;
- qDeleteAll(scrollArea->findChildren<QWidget *>(QLatin1String("line-spacer")));
- qDeleteAll(scrollArea->findChildren<QWidget *>(QLatin1String("record-editor")));
+ qDeleteAll(scrollArea->findChildren<QWidget *>(QStringLiteral("line-spacer")));
+ qDeleteAll(scrollArea->findChildren<QWidget *>(QStringLiteral("record-editor")));
}
QNdefMessage MainWindow::ndefMessage() const
diff --git a/examples/nfc/ndefeditor/mimeimagerecordeditor.cpp b/examples/nfc/ndefeditor/mimeimagerecordeditor.cpp
index adc33ef0..1b84ab4d 100644
--- a/examples/nfc/ndefeditor/mimeimagerecordeditor.cpp
+++ b/examples/nfc/ndefeditor/mimeimagerecordeditor.cpp
@@ -48,29 +48,29 @@
static QString imageFormatToMimeType(const QByteArray &format)
{
if (format == "bmp")
- return QLatin1String("image/bmp");
+ return QStringLiteral("image/bmp");
else if (format == "gif")
- return QLatin1String("image/gif");
+ return QStringLiteral("image/gif");
else if (format == "jpg" || format == "jpeg")
- return QLatin1String("image/jpeg");
+ return QStringLiteral("image/jpeg");
else if (format == "mng")
- return QLatin1String("video/x-mng");
+ return QStringLiteral("video/x-mng");
else if (format == "png")
- return QLatin1String("image/png");
+ return QStringLiteral("image/png");
else if (format == "pbm")
- return QLatin1String("image/x-portable-bitmap");
+ return QStringLiteral("image/x-portable-bitmap");
else if (format == "pgm")
- return QLatin1String("image/x-portable-graymap");
+ return QStringLiteral("image/x-portable-graymap");
else if (format == "ppm")
- return QLatin1String("image/x-portable-pixmap");
+ return QStringLiteral("image/x-portable-pixmap");
else if (format == "tiff")
- return QLatin1String("image/tiff");
+ return QStringLiteral("image/tiff");
else if (format == "xbm")
- return QLatin1String("image/x-xbitmap");
+ return QStringLiteral("image/x-xbitmap");
else if (format == "xpm")
- return QLatin1String("image/x-xpixmap");
+ return QStringLiteral("image/x-xpixmap");
else if (format == "svg")
- return QLatin1String("image/svg+xml");
+ return QStringLiteral("image/svg+xml");
else
return QString();
}
diff --git a/examples/nfc/poster/qmlposter.cpp b/examples/nfc/poster/qmlposter.cpp
index 2fc943d4..f6f3bbc8 100644
--- a/examples/nfc/poster/qmlposter.cpp
+++ b/examples/nfc/poster/qmlposter.cpp
@@ -45,7 +45,7 @@
int main(int argc, char *argv[])
{
QGuiApplication application(argc, argv);
- const QString mainQmlApp = QLatin1String("qrc:/poster.qml");
+ const QString mainQmlApp(QStringLiteral("qrc:/poster.qml"));
QQuickView view;
view.setSource(QUrl(mainQmlApp));
view.setResizeMode(QQuickView::SizeRootObjectToView);
diff --git a/qtconnectivity.pro b/qtconnectivity.pro
index e2a73944..365c4104 100644
--- a/qtconnectivity.pro
+++ b/qtconnectivity.pro
@@ -1,5 +1,6 @@
load(configure)
qtCompileTest(bluez)
+qtCompileTest(bluez_le)
qtCompileTest(btapi10_2_1)
qtCompileTest(libbb2)
load(qt_parts)
diff --git a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothBroadcastReceiver.java b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothBroadcastReceiver.java
index 20dbd78f..f12e68fa 100644
--- a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothBroadcastReceiver.java
+++ b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothBroadcastReceiver.java
@@ -6,36 +6,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothInputStreamThread.java b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothInputStreamThread.java
index 57636ad4..30ada8c9 100644
--- a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothInputStreamThread.java
+++ b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothInputStreamThread.java
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothSocketServer.java b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothSocketServer.java
index ee365a49..ae0a03a5 100644
--- a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothSocketServer.java
+++ b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothSocketServer.java
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/android/androidbroadcastreceiver.cpp b/src/bluetooth/android/androidbroadcastreceiver.cpp
index c17502ba..2ddf56c5 100644
--- a/src/bluetooth/android/androidbroadcastreceiver.cpp
+++ b/src/bluetooth/android/androidbroadcastreceiver.cpp
@@ -6,36 +6,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/android/androidbroadcastreceiver_p.h b/src/bluetooth/android/androidbroadcastreceiver_p.h
index 1ba24b62..347cd968 100644
--- a/src/bluetooth/android/androidbroadcastreceiver_p.h
+++ b/src/bluetooth/android/androidbroadcastreceiver_p.h
@@ -6,36 +6,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/android/devicediscoverybroadcastreceiver.cpp b/src/bluetooth/android/devicediscoverybroadcastreceiver.cpp
index ca62f013..ee594c5c 100644
--- a/src/bluetooth/android/devicediscoverybroadcastreceiver.cpp
+++ b/src/bluetooth/android/devicediscoverybroadcastreceiver.cpp
@@ -6,36 +6,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/android/devicediscoverybroadcastreceiver_p.h b/src/bluetooth/android/devicediscoverybroadcastreceiver_p.h
index fb24515b..4ed7027d 100644
--- a/src/bluetooth/android/devicediscoverybroadcastreceiver_p.h
+++ b/src/bluetooth/android/devicediscoverybroadcastreceiver_p.h
@@ -6,36 +6,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/android/inputstreamthread.cpp b/src/bluetooth/android/inputstreamthread.cpp
index 7f5029d9..98c245a7 100644
--- a/src/bluetooth/android/inputstreamthread.cpp
+++ b/src/bluetooth/android/inputstreamthread.cpp
@@ -6,36 +6,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/android/inputstreamthread_p.h b/src/bluetooth/android/inputstreamthread_p.h
index 464d381b..e7f7597e 100644
--- a/src/bluetooth/android/inputstreamthread_p.h
+++ b/src/bluetooth/android/inputstreamthread_p.h
@@ -6,36 +6,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/android/jni_android.cpp b/src/bluetooth/android/jni_android.cpp
index b7221867..faeb411a 100644
--- a/src/bluetooth/android/jni_android.cpp
+++ b/src/bluetooth/android/jni_android.cpp
@@ -6,36 +6,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/android/jni_android_p.h b/src/bluetooth/android/jni_android_p.h
index ce121080..0a90cfea 100644
--- a/src/bluetooth/android/jni_android_p.h
+++ b/src/bluetooth/android/jni_android_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/android/localdevicebroadcastreceiver.cpp b/src/bluetooth/android/localdevicebroadcastreceiver.cpp
index 5b7e4a38..c54c5e32 100644
--- a/src/bluetooth/android/localdevicebroadcastreceiver.cpp
+++ b/src/bluetooth/android/localdevicebroadcastreceiver.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/android/localdevicebroadcastreceiver_p.h b/src/bluetooth/android/localdevicebroadcastreceiver_p.h
index b1066a17..190ae631 100644
--- a/src/bluetooth/android/localdevicebroadcastreceiver_p.h
+++ b/src/bluetooth/android/localdevicebroadcastreceiver_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/android/serveracceptancethread.cpp b/src/bluetooth/android/serveracceptancethread.cpp
index d46fff7c..cc639135 100644
--- a/src/bluetooth/android/serveracceptancethread.cpp
+++ b/src/bluetooth/android/serveracceptancethread.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/android/serveracceptancethread_p.h b/src/bluetooth/android/serveracceptancethread_p.h
index d7d38072..1adda433 100644
--- a/src/bluetooth/android/serveracceptancethread_p.h
+++ b/src/bluetooth/android/serveracceptancethread_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/android/servicediscoverybroadcastreceiver.cpp b/src/bluetooth/android/servicediscoverybroadcastreceiver.cpp
index 87564ce6..5ca9d59b 100644
--- a/src/bluetooth/android/servicediscoverybroadcastreceiver.cpp
+++ b/src/bluetooth/android/servicediscoverybroadcastreceiver.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/android/servicediscoverybroadcastreceiver_p.h b/src/bluetooth/android/servicediscoverybroadcastreceiver_p.h
index e10fe3fd..273af121 100644
--- a/src/bluetooth/android/servicediscoverybroadcastreceiver_p.h
+++ b/src/bluetooth/android/servicediscoverybroadcastreceiver_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/bluetooth.pro b/src/bluetooth/bluetooth.pro
index 9caaf794..719d7ed5 100644
--- a/src/bluetooth/bluetooth.pro
+++ b/src/bluetooth/bluetooth.pro
@@ -2,6 +2,7 @@ TARGET = QtBluetooth
QT = core
QT_PRIVATE = concurrent
+
QMAKE_DOCS = $$PWD/doc/qtbluetooth.qdocconf
OTHER_FILES += doc/src/*.qdoc # show .qdoc files in Qt Creator
@@ -22,7 +23,12 @@ PUBLIC_HEADERS += \
qbluetoothlocaldevice.h \
qbluetoothtransfermanager.h \
qbluetoothtransferrequest.h \
- qbluetoothtransferreply.h
+ qlowenergyserviceinfo.h \
+ qlowenergyservice.h \
+ qlowenergycharacteristic.h \
+ qlowenergydescriptor.h \
+ qbluetoothtransferreply.h \
+ qlowenergycontroller.h
PRIVATE_HEADERS += \
qbluetoothaddress_p.h\
@@ -36,7 +42,10 @@ PRIVATE_HEADERS += \
qbluetoothtransferreply_p.h \
qbluetoothtransferrequest_p.h \
qprivatelinearbuffer_p.h \
- qbluetoothlocaldevice_p.h
+ qbluetoothlocaldevice_p.h \
+ qlowenergyserviceinfo_p.h \
+ qlowenergycontroller_p.h \
+ qlowenergyserviceprivate_p.h
SOURCES += \
qbluetoothaddress.cpp\
@@ -52,7 +61,13 @@ SOURCES += \
qbluetooth.cpp \
qbluetoothtransfermanager.cpp \
qbluetoothtransferrequest.cpp \
- qbluetoothtransferreply.cpp
+ qbluetoothtransferreply.cpp \
+ qlowenergyserviceinfo.cpp \
+ qlowenergyservice.cpp \
+ qlowenergycharacteristic.cpp \
+ qlowenergydescriptor.cpp \
+ qlowenergycontroller.cpp \
+ qlowenergyserviceprivate.cpp
config_bluez:qtHaveModule(dbus) {
QT *= dbus
@@ -70,16 +85,29 @@ config_bluez:qtHaveModule(dbus) {
qbluetoothsocket_bluez.cpp \
qbluetoothserver_bluez.cpp \
qbluetoothlocaldevice_bluez.cpp \
- qbluetoothtransferreply_bluez.cpp
+ qbluetoothtransferreply_bluez.cpp \
+
+
+ # old versions of Bluez do not have the required BTLE symbols
+ config_bluez_le {
+ SOURCES += \
+ qlowenergycontroller_bluez.cpp
+ } else {
+ message("Bluez version is too old to support Bluetooth Low Energy.")
+ message("Only classic Bluetooth will be available.")
+ DEFINES += QT_BLUEZ_NO_BTLE
+ SOURCES += \
+ qlowenergycontroller_p.cpp
+ }
} else:CONFIG(blackberry) {
DEFINES += QT_QNX_BLUETOOTH
include(qnx/qnx.pri)
+ LIBS += -lbtapi
config_btapi10_2_1 {
DEFINES += QT_QNX_BT_BLUETOOTH
- LIBS += -lbtapi
}
PRIVATE_HEADERS += \
@@ -92,7 +120,8 @@ config_bluez:qtHaveModule(dbus) {
qbluetoothservicediscoveryagent_qnx.cpp \
qbluetoothsocket_qnx.cpp \
qbluetoothserver_qnx.cpp \
- qbluetoothtransferreply_qnx.cpp
+ qbluetoothtransferreply_qnx.cpp \
+ qlowenergycontroller_p.cpp
} else:android:!android-no-sdk {
include(android/android.pri)
@@ -113,7 +142,8 @@ config_bluez:qtHaveModule(dbus) {
qbluetoothserviceinfo_android.cpp \
qbluetoothservicediscoveryagent_android.cpp \
qbluetoothsocket_android.cpp \
- qbluetoothserver_android.cpp
+ qbluetoothserver_android.cpp \
+ qlowenergycontroller_p.cpp
} else {
message("Unsupported Bluetooth platform, will not build a working QtBluetooth library.")
@@ -124,12 +154,11 @@ config_bluez:qtHaveModule(dbus) {
qbluetoothserviceinfo_p.cpp \
qbluetoothservicediscoveryagent_p.cpp \
qbluetoothsocket_p.cpp \
- qbluetoothserver_p.cpp
-
+ qbluetoothserver_p.cpp \
+ qlowenergycontroller_p.cpp
}
OTHER_FILES +=
HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS
-
diff --git a/src/bluetooth/bluez/adapter1_bluez5.cpp b/src/bluetooth/bluez/adapter1_bluez5.cpp
new file mode 100644
index 00000000..8de63d32
--- /dev/null
+++ b/src/bluetooth/bluez/adapter1_bluez5.cpp
@@ -0,0 +1,26 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.8
+ * Command line was: qdbusxml2cpp -p adapter1 -v org.bluez.Adapter1.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#include "adapter1_bluez5_p.h"
+
+/*
+ * Implementation of interface class OrgBluezAdapter1Interface
+ */
+
+OrgBluezAdapter1Interface::OrgBluezAdapter1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+OrgBluezAdapter1Interface::~OrgBluezAdapter1Interface()
+{
+}
+
diff --git a/src/bluetooth/bluez/adapter1_bluez5_p.h b/src/bluetooth/bluez/adapter1_bluez5_p.h
new file mode 100644
index 00000000..32a70b3d
--- /dev/null
+++ b/src/bluetooth/bluez/adapter1_bluez5_p.h
@@ -0,0 +1,126 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.8
+ * Command line was: qdbusxml2cpp -p adapter1 -v org.bluez.Adapter1.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#ifndef ADAPTER1_H_1396951555
+#define ADAPTER1_H_1396951555
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtDBus/QtDBus>
+
+/*
+ * Proxy class for interface org.bluez.Adapter1
+ */
+class OrgBluezAdapter1Interface: public QDBusAbstractInterface
+{
+ Q_OBJECT
+public:
+ static inline const char *staticInterfaceName()
+ { return "org.bluez.Adapter1"; }
+
+public:
+ OrgBluezAdapter1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+ ~OrgBluezAdapter1Interface();
+
+ Q_PROPERTY(QString Address READ address)
+ inline QString address() const
+ { return qvariant_cast< QString >(property("Address")); }
+
+ Q_PROPERTY(QString Alias READ alias WRITE setAlias)
+ inline QString alias() const
+ { return qvariant_cast< QString >(property("Alias")); }
+ inline void setAlias(const QString &value)
+ { setProperty("Alias", QVariant::fromValue(value)); }
+
+ Q_PROPERTY(uint Class READ classProperty)
+ inline uint classProperty() const
+ { return qvariant_cast< uint >(property("Class")); }
+
+ Q_PROPERTY(bool Discoverable READ discoverable WRITE setDiscoverable)
+ inline bool discoverable() const
+ { return qvariant_cast< bool >(property("Discoverable")); }
+ inline void setDiscoverable(bool value)
+ { setProperty("Discoverable", QVariant::fromValue(value)); }
+
+ Q_PROPERTY(uint DiscoverableTimeout READ discoverableTimeout WRITE setDiscoverableTimeout)
+ inline uint discoverableTimeout() const
+ { return qvariant_cast< uint >(property("DiscoverableTimeout")); }
+ inline void setDiscoverableTimeout(uint value)
+ { setProperty("DiscoverableTimeout", QVariant::fromValue(value)); }
+
+ Q_PROPERTY(bool Discovering READ discovering)
+ inline bool discovering() const
+ { return qvariant_cast< bool >(property("Discovering")); }
+
+ Q_PROPERTY(QString Modalias READ modalias)
+ inline QString modalias() const
+ { return qvariant_cast< QString >(property("Modalias")); }
+
+ Q_PROPERTY(QString Name READ name)
+ inline QString name() const
+ { return qvariant_cast< QString >(property("Name")); }
+
+ Q_PROPERTY(bool Pairable READ pairable WRITE setPairable)
+ inline bool pairable() const
+ { return qvariant_cast< bool >(property("Pairable")); }
+ inline void setPairable(bool value)
+ { setProperty("Pairable", QVariant::fromValue(value)); }
+
+ Q_PROPERTY(uint PairableTimeout READ pairableTimeout WRITE setPairableTimeout)
+ inline uint pairableTimeout() const
+ { return qvariant_cast< uint >(property("PairableTimeout")); }
+ inline void setPairableTimeout(uint value)
+ { setProperty("PairableTimeout", QVariant::fromValue(value)); }
+
+ Q_PROPERTY(bool Powered READ powered WRITE setPowered)
+ inline bool powered() const
+ { return qvariant_cast< bool >(property("Powered")); }
+ inline void setPowered(bool value)
+ { setProperty("Powered", QVariant::fromValue(value)); }
+
+ Q_PROPERTY(QStringList UUIDs READ uUIDs)
+ inline QStringList uUIDs() const
+ { return qvariant_cast< QStringList >(property("UUIDs")); }
+
+public Q_SLOTS: // METHODS
+ inline QDBusPendingReply<> RemoveDevice(const QDBusObjectPath &device)
+ {
+ QList<QVariant> argumentList;
+ argumentList << QVariant::fromValue(device);
+ return asyncCallWithArgumentList(QLatin1String("RemoveDevice"), argumentList);
+ }
+
+ inline QDBusPendingReply<> StartDiscovery()
+ {
+ QList<QVariant> argumentList;
+ return asyncCallWithArgumentList(QLatin1String("StartDiscovery"), argumentList);
+ }
+
+ inline QDBusPendingReply<> StopDiscovery()
+ {
+ QList<QVariant> argumentList;
+ return asyncCallWithArgumentList(QLatin1String("StopDiscovery"), argumentList);
+ }
+
+Q_SIGNALS: // SIGNALS
+};
+
+namespace org {
+ namespace bluez {
+ typedef ::OrgBluezAdapter1Interface Adapter1;
+ }
+}
+#endif
diff --git a/src/bluetooth/bluez/bluez.pri b/src/bluetooth/bluez/bluez.pri
index edc3eb09..be5a02a7 100644
--- a/src/bluetooth/bluez/bluez.pri
+++ b/src/bluetooth/bluez/bluez.pri
@@ -1,16 +1,3 @@
-linux-*: {
- # bluetooth.h is not standards compliant
- contains(QMAKE_CXXFLAGS, -std=c++0x) {
- QMAKE_CXXFLAGS -= -std=c++0x
- QMAKE_CXXFLAGS += -std=gnu++0x
- CONFIG -= c++11
- }
- c++11 {
- CONFIG -= c++11
- QMAKE_CXXFLAGS += -std=gnu++0x
- }
-}
-
HEADERS += bluez/manager_p.h \
bluez/adapter_p.h \
bluez/device_p.h \
@@ -21,8 +8,16 @@ HEADERS += bluez/manager_p.h \
bluez/obex_agent_p.h \
bluez/obex_transfer_p.h \
bluez/obex_manager_p.h \
- bluez_data_p.h
-
+ bluez/bluez5_helper_p.h \
+ bluez/objectmanager_p.h \
+ bluez/properties_p.h \
+ bluez/adapter1_bluez5_p.h \
+ bluez/device1_bluez5_p.h \
+ bluez/profile1_p.h \
+ bluez/obex_client1_bluez5_p.h \
+ bluez/obex_objectpush1_bluez5_p.h \
+ bluez/obex_transfer1_bluez5_p.h \
+ bluez/bluez_data_p.h
SOURCES += bluez/manager.cpp \
bluez/adapter.cpp \
@@ -33,4 +28,13 @@ SOURCES += bluez/manager.cpp \
bluez/obex_client.cpp \
bluez/obex_agent.cpp \
bluez/obex_transfer.cpp \
- bluez/obex_manager.cpp
+ bluez/obex_manager.cpp \
+ bluez/objectmanager.cpp \
+ bluez/properties.cpp \
+ bluez/adapter1_bluez5.cpp \
+ bluez/device1_bluez5.cpp \
+ bluez/bluez5_helper.cpp \
+ bluez/profile1.cpp \
+ bluez/obex_client1_bluez5.cpp \
+ bluez/obex_objectpush1_bluez5.cpp \
+ bluez/obex_transfer1_bluez5.cpp
diff --git a/src/bluetooth/bluez/bluez5_helper.cpp b/src/bluetooth/bluez/bluez5_helper.cpp
new file mode 100644
index 00000000..eebeae9d
--- /dev/null
+++ b/src/bluetooth/bluez/bluez5_helper.cpp
@@ -0,0 +1,323 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QGlobalStatic>
+#include <QtCore/QLoggingCategory>
+#include <QtCore/QMap>
+#include "bluez5_helper_p.h"
+#include "objectmanager_p.h"
+#include "properties_p.h"
+#include "adapter1_bluez5_p.h"
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(QT_BT_BLUEZ)
+
+typedef enum Bluez5TestResultType
+{
+ Unknown,
+ Bluez4,
+ Bluez5
+} Bluez5TestResult;
+
+Q_GLOBAL_STATIC_WITH_ARGS(Bluez5TestResult, bluezVersion, (Bluez5TestResult::Unknown));
+
+bool isBluez5()
+{
+ if (*bluezVersion() == Bluez5TestResultType::Unknown) {
+ OrgFreedesktopDBusObjectManagerInterface manager(QStringLiteral("org.bluez"),
+ QStringLiteral("/"),
+ QDBusConnection::systemBus());
+
+ qDBusRegisterMetaType<InterfaceList>();
+ qDBusRegisterMetaType<ManagedObjectList>();
+
+ QDBusPendingReply<ManagedObjectList> reply = manager.GetManagedObjects();
+ reply.waitForFinished();
+ if (reply.isError()) {
+ *bluezVersion() = Bluez5TestResultType::Bluez4;
+ qCDebug(QT_BT_BLUEZ) << "Bluez 4 detected.";
+ } else {
+ *bluezVersion() = Bluez5TestResultType::Bluez5;
+ qCDebug(QT_BT_BLUEZ) << "Bluez 5 detected.";
+ }
+ }
+
+ return (*bluezVersion() == Bluez5TestResultType::Bluez5);
+}
+
+struct AdapterData
+{
+public:
+ AdapterData() : reference(1), wasListeningAlready(false), propteryListener(0) {}
+
+ int reference;
+ bool wasListeningAlready;
+ OrgFreedesktopDBusPropertiesInterface *propteryListener;
+};
+
+class QtBluezDiscoveryManagerPrivate
+{
+public:
+ QMap<QString, AdapterData *> references;
+ OrgFreedesktopDBusObjectManagerInterface *manager;
+};
+
+Q_GLOBAL_STATIC(QtBluezDiscoveryManager, discoveryManager)
+
+/*!
+ \internal
+ \class QtBluezDiscoveryManager
+
+ This class manages the access to "org.bluez.Adapter1::Start/StopDiscovery.
+
+ The flag is a system flag. We want to ensure that the various Qt classes don't turn
+ the flag on and off and thereby get into their way. If some other system component
+ changes the flag (e.g. adapter removed) we notify all Qt classes about the change by emitting
+ \l discoveryInterrupted(QString). Classes should indicate this via an appropriate
+ error message to the user.
+
+ Once the signal was emitted, all existing requests for discovery mode on the same adapter
+ have to be renewed via \l registerDiscoveryInterest(QString).
+*/
+
+QtBluezDiscoveryManager::QtBluezDiscoveryManager(QObject *parent) :
+ QObject(parent)
+{
+ qCDebug(QT_BT_BLUEZ) << "Creating QtBluezDiscoveryManager";
+ d = new QtBluezDiscoveryManagerPrivate();
+
+ d->manager = new OrgFreedesktopDBusObjectManagerInterface(
+ QStringLiteral("org.bluez"), QStringLiteral("/"),
+ QDBusConnection::systemBus(), this);
+ connect(d->manager, SIGNAL(InterfacesRemoved(QDBusObjectPath,QStringList)),
+ SLOT(InterfacesRemoved(QDBusObjectPath,QStringList)));
+}
+
+QtBluezDiscoveryManager::~QtBluezDiscoveryManager()
+{
+ qCDebug(QT_BT_BLUEZ) << "Destroying QtBluezDiscoveryManager";
+
+ foreach (const QString &adapterPath, d->references.keys()) {
+ AdapterData *data = d->references.take(adapterPath);
+ delete data->propteryListener;
+
+ // turn discovery off if it wasn't on already
+ if (!data->wasListeningAlready) {
+ OrgBluezAdapter1Interface iface(QStringLiteral("org.bluez"), adapterPath,
+ QDBusConnection::systemBus());
+ iface.StopDiscovery();
+ }
+
+ delete data;
+ }
+
+ delete d;
+}
+
+QtBluezDiscoveryManager *QtBluezDiscoveryManager::instance()
+{
+ if (isBluez5())
+ return discoveryManager();
+
+ Q_ASSERT(false);
+ return 0;
+}
+
+bool QtBluezDiscoveryManager::registerDiscoveryInterest(const QString &adapterPath)
+{
+ if (adapterPath.isEmpty())
+ return false;
+
+ // already monitored adapter? -> increase ref count -> done
+ if (d->references.contains(adapterPath)) {
+ d->references[adapterPath]->reference++;
+ return true;
+ }
+
+ AdapterData *data = new AdapterData();
+
+ OrgFreedesktopDBusPropertiesInterface *propIface = new OrgFreedesktopDBusPropertiesInterface(
+ QStringLiteral("org.bluez"), adapterPath, QDBusConnection::systemBus());
+ connect(propIface, SIGNAL(PropertiesChanged(QString,QVariantMap,QStringList)),
+ SLOT(PropertiesChanged(QString,QVariantMap,QStringList)));
+ data->propteryListener = propIface;
+
+ OrgBluezAdapter1Interface iface(QStringLiteral("org.bluez"), adapterPath,
+ QDBusConnection::systemBus());
+ data->wasListeningAlready = iface.discovering();
+
+ d->references[adapterPath] = data;
+
+ if (!data->wasListeningAlready)
+ iface.StartDiscovery();
+
+ return true;
+}
+
+void QtBluezDiscoveryManager::unregisterDiscoveryInterest(const QString &adapterPath)
+{
+ if (!d->references.contains(adapterPath))
+ return;
+
+ AdapterData *data = d->references[adapterPath];
+ data->reference--;
+
+ if (data->reference > 0) // more than one client requested discovery mode
+ return;
+
+ d->references.remove(adapterPath);
+ if (!data->wasListeningAlready) { // Qt turned discovery mode on, Qt has to turn it off again
+ OrgBluezAdapter1Interface iface(QStringLiteral("org.bluez"), adapterPath,
+ QDBusConnection::systemBus());
+ iface.StopDiscovery();
+ }
+
+ delete data->propteryListener;
+ delete data;
+}
+
+//void QtBluezDiscoveryManager::dumpState() const
+//{
+// qCDebug(QT_BT_BLUEZ) << "-------------------------";
+// if (d->references.isEmpty()) {
+// qCDebug(QT_BT_BLUEZ) << "No running registration";
+// } else {
+// foreach (const QString &path, d->references.keys()) {
+// qCDebug(QT_BT_BLUEZ) << path << "->" << d->references[path]->reference;
+// }
+// }
+// qCDebug(QT_BT_BLUEZ) << "-------------------------";
+//}
+
+void QtBluezDiscoveryManager::InterfacesRemoved(const QDBusObjectPath &object_path,
+ const QStringList &interfaces)
+{
+ if (!d->references.contains(object_path.path())
+ || !interfaces.contains(QStringLiteral("org.bluez.Adapter1")))
+ return;
+
+ removeAdapterFromMonitoring(object_path.path());
+}
+
+void QtBluezDiscoveryManager::PropertiesChanged(const QString &interface,
+ const QVariantMap &changed_properties,
+ const QStringList &invalidated_properties)
+{
+ Q_UNUSED(invalidated_properties);
+
+ OrgFreedesktopDBusPropertiesInterface *propIface =
+ qobject_cast<OrgFreedesktopDBusPropertiesInterface *>(sender());
+
+ if (!propIface)
+ return;
+
+ if (interface == QStringLiteral("org.bluez.Adapter1")
+ && d->references.contains(propIface->path())
+ && changed_properties.contains(QStringLiteral("Discovering"))) {
+ bool isDiscovering = changed_properties.value(QStringLiteral("Discovering")).toBool();
+ if (!isDiscovering)
+ removeAdapterFromMonitoring(propIface->path());
+ }
+}
+
+void QtBluezDiscoveryManager::removeAdapterFromMonitoring(const QString &dbusPath)
+{
+ // remove adapter from monitoring
+ AdapterData *data = d->references.take(dbusPath);
+ delete data->propteryListener;
+ delete data;
+
+ emit discoveryInterrupted(dbusPath);
+}
+
+/*!
+ Finds the path for the local adapter with \a wantedAddress or an empty string
+ if no local adapter with the given address can be found.
+ If \a wantedAddress is \c null it returns the first/default adapter or an empty
+ string if none is available.
+
+ If \a ok is false the lookup was aborted due to a dbus error and this function
+ returns an empty string.
+ */
+QString findAdapterForAddress(const QBluetoothAddress &wantedAddress, bool *ok = 0)
+{
+ OrgFreedesktopDBusObjectManagerInterface manager(QStringLiteral("org.bluez"),
+ QStringLiteral("/"),
+ QDBusConnection::systemBus());
+
+ QDBusPendingReply<ManagedObjectList> reply = manager.GetManagedObjects();
+ reply.waitForFinished();
+ if (reply.isError()) {
+ if (ok)
+ *ok = false;
+
+ return QString();
+ }
+
+ typedef QPair<QString, QBluetoothAddress> AddressForPathType;
+ QList<AddressForPathType> localAdapters;
+
+ foreach (const QDBusObjectPath &path, reply.value().keys()) {
+ const InterfaceList ifaceList = reply.value().value(path);
+ foreach (const QString &iface, ifaceList.keys()) {
+ if (iface == QStringLiteral("org.bluez.Adapter1")) {
+ AddressForPathType pair;
+ pair.first = path.path();
+ pair.second = QBluetoothAddress(ifaceList.value(iface).value(
+ QStringLiteral("Address")).toString());
+ if (!pair.second.isNull())
+ localAdapters.append(pair);
+ break;
+ }
+ }
+ }
+
+ if (ok)
+ *ok = true;
+
+ if (localAdapters.isEmpty())
+ return QString(); // -> no local adapter found
+
+ if (wantedAddress.isNull())
+ return localAdapters.front().first; // -> return first found adapter
+
+ foreach (const AddressForPathType &pair, localAdapters) {
+ if (pair.second == wantedAddress)
+ return pair.first; // -> found local adapter with wanted address
+ }
+
+ return QString(); // nothing matching found
+}
+
+QT_END_NAMESPACE
diff --git a/src/bluetooth/bluez/bluez5_helper_p.h b/src/bluetooth/bluez/bluez5_helper_p.h
new file mode 100644
index 00000000..7935877c
--- /dev/null
+++ b/src/bluetooth/bluez/bluez5_helper_p.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef BLUEZ5_HELPER_H
+#define BLUEZ5_HELPER_H
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include <QtBluetooth/QBluetoothAddress>
+
+typedef QMap<QString, QVariantMap> InterfaceList;
+typedef QMap<QDBusObjectPath, InterfaceList> ManagedObjectList;
+
+Q_DECLARE_METATYPE(InterfaceList)
+Q_DECLARE_METATYPE(ManagedObjectList)
+
+QT_BEGIN_NAMESPACE
+
+bool isBluez5();
+
+QString findAdapterForAddress(const QBluetoothAddress &wantedAddress, bool *ok);
+
+class QtBluezDiscoveryManagerPrivate;
+class QtBluezDiscoveryManager : public QObject
+{
+ Q_OBJECT
+public:
+ QtBluezDiscoveryManager(QObject* parent = 0);
+ ~QtBluezDiscoveryManager();
+ static QtBluezDiscoveryManager *instance();
+
+ bool registerDiscoveryInterest(const QString &adapterPath);
+ void unregisterDiscoveryInterest(const QString &adapterPath);
+
+ //void dumpState() const;
+
+signals:
+ void discoveryInterrupted(const QString &adapterPath);
+
+private slots:
+ void InterfacesRemoved(const QDBusObjectPath &object_path,
+ const QStringList &interfaces);
+ void PropertiesChanged(const QString &interface,
+ const QVariantMap &changed_properties,
+ const QStringList &invalidated_properties);
+
+private:
+ void removeAdapterFromMonitoring(const QString &dbusPath);
+
+ QtBluezDiscoveryManagerPrivate *d;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/bluetooth/bluez/bluez_data_p.h b/src/bluetooth/bluez/bluez_data_p.h
index 6aa9b0a5..a220c32a 100644
--- a/src/bluetooth/bluez/bluez_data_p.h
+++ b/src/bluetooth/bluez/bluez_data_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -55,6 +47,7 @@
#include <QtCore/qglobal.h>
#include <sys/socket.h>
+#include <QtBluetooth/QBluetoothUuid>
#define BTPROTO_L2CAP 0
#define BTPROTO_RFCOMM 3
@@ -75,6 +68,27 @@
#define L2CAP_LM_TRUSTED 0x0008
#define L2CAP_LM_SECURE 0x0020
+#define BDADDR_LE_PUBLIC 0x01
+
+/* Byte order conversions */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define htobs(d) (d)
+#define htobl(d) (d)
+#define htobll(d) (d)
+#define btohs(d) (d)
+#define btohl(d) (d)
+#define btohll(d) (d)
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#define htobs(d) bswap_16(d)
+#define htobl(d) bswap_32(d)
+#define htobll(d) bswap_64(d)
+#define btohs(d) bswap_16(d)
+#define btohl(d) bswap_32(d)
+#define btohll(d) bswap_64(d)
+#else
+#error "Unknown byte order"
+#endif
+
// Bluetooth address
typedef struct {
quint8 b[6];
@@ -86,6 +100,9 @@ struct sockaddr_l2 {
unsigned short l2_psm;
bdaddr_t l2_bdaddr;
unsigned short l2_cid;
+#if !defined(QT_BLUEZ_NO_BTLE)
+ quint8 l2_bdaddr_type;
+#endif
};
// RFCOMM socket
@@ -95,4 +112,65 @@ struct sockaddr_rc {
quint8 rc_channel;
};
+// Bt Low Energy related
+
+#define bt_get_unaligned(ptr) \
+({ \
+ struct __attribute__((packed)) { \
+ __typeof__(*(ptr)) __v; \
+ } *__p = (__typeof__(__p)) (ptr); \
+ __p->__v; \
+})
+
+#define bt_put_unaligned(val, ptr) \
+do { \
+ struct __attribute__((packed)) { \
+ __typeof__(*(ptr)) __v; \
+ } *__p = (__typeof__(__p)) (ptr); \
+ __p->__v = (val); \
+} while (0)
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+static inline void btoh128(const quint128 *src, quint128 *dst)
+{
+ memcpy(dst, src, sizeof(quint128));
+}
+
+static inline void ntoh128(const quint128 *src, quint128 *dst)
+{
+ int i;
+
+ for (i = 0; i < 16; i++)
+ dst->data[15 - i] = src->data[i];
+}
+
+static inline uint16_t bt_get_le16(const void *ptr)
+{
+ return bt_get_unaligned((const uint16_t *) ptr);
+}
+#elif __BYTE_ORDER == __BIG_ENDIAN
+static inline uint16_t bt_get_le16(const void *ptr)
+{
+ return bswap_16(bt_get_unaligned((const uint16_t *) ptr));
+}
+
+static inline void btoh128(const quint128 *src, quint128 *dst)
+{
+ int i;
+
+ for (i = 0; i < 16; i++)
+ dst->data[15 - i] = src->data[i];
+}
+
+static inline void ntoh128(const quint128 *src, quint128 *dst)
+{
+ memcpy(dst, src, sizeof(quint128));
+}
+#else
+#error "Unknown byte order"
+#endif
+
+#define hton128(x, y) ntoh128(x, y)
+
#endif // BLUEZ_DATA_P_H
diff --git a/src/bluetooth/bluez/device1_bluez5.cpp b/src/bluetooth/bluez/device1_bluez5.cpp
new file mode 100644
index 00000000..50bef4cb
--- /dev/null
+++ b/src/bluetooth/bluez/device1_bluez5.cpp
@@ -0,0 +1,26 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.8
+ * Command line was: qdbusxml2cpp -p device1_bluez5 -v org.bluez.Device1.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#include "device1_bluez5_p.h"
+
+/*
+ * Implementation of interface class OrgBluezDevice1Interface
+ */
+
+OrgBluezDevice1Interface::OrgBluezDevice1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+OrgBluezDevice1Interface::~OrgBluezDevice1Interface()
+{
+}
+
diff --git a/src/bluetooth/bluez/device1_bluez5_p.h b/src/bluetooth/bluez/device1_bluez5_p.h
new file mode 100644
index 00000000..4caae28a
--- /dev/null
+++ b/src/bluetooth/bluez/device1_bluez5_p.h
@@ -0,0 +1,151 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.8
+ * Command line was: qdbusxml2cpp -p device1_bluez5 -v org.bluez.Device1.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#ifndef DEVICE1_BLUEZ5_H_1396951960
+#define DEVICE1_BLUEZ5_H_1396951960
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtDBus/QtDBus>
+
+/*
+ * Proxy class for interface org.bluez.Device1
+ */
+class OrgBluezDevice1Interface: public QDBusAbstractInterface
+{
+ Q_OBJECT
+public:
+ static inline const char *staticInterfaceName()
+ { return "org.bluez.Device1"; }
+
+public:
+ OrgBluezDevice1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+ ~OrgBluezDevice1Interface();
+
+ Q_PROPERTY(QDBusObjectPath Adapter READ adapter)
+ inline QDBusObjectPath adapter() const
+ { return qvariant_cast< QDBusObjectPath >(property("Adapter")); }
+
+ Q_PROPERTY(QString Address READ address)
+ inline QString address() const
+ { return qvariant_cast< QString >(property("Address")); }
+
+ Q_PROPERTY(QString Alias READ alias WRITE setAlias)
+ inline QString alias() const
+ { return qvariant_cast< QString >(property("Alias")); }
+ inline void setAlias(const QString &value)
+ { setProperty("Alias", QVariant::fromValue(value)); }
+
+ Q_PROPERTY(ushort Appearance READ appearance)
+ inline ushort appearance() const
+ { return qvariant_cast< ushort >(property("Appearance")); }
+
+ Q_PROPERTY(bool Blocked READ blocked WRITE setBlocked)
+ inline bool blocked() const
+ { return qvariant_cast< bool >(property("Blocked")); }
+ inline void setBlocked(bool value)
+ { setProperty("Blocked", QVariant::fromValue(value)); }
+
+ Q_PROPERTY(uint Class READ classProperty)
+ inline uint classProperty() const
+ { return qvariant_cast< uint >(property("Class")); }
+
+ Q_PROPERTY(bool Connected READ connected)
+ inline bool connected() const
+ { return qvariant_cast< bool >(property("Connected")); }
+
+ Q_PROPERTY(QString Icon READ icon)
+ inline QString icon() const
+ { return qvariant_cast< QString >(property("Icon")); }
+
+ Q_PROPERTY(bool LegacyPairing READ legacyPairing)
+ inline bool legacyPairing() const
+ { return qvariant_cast< bool >(property("LegacyPairing")); }
+
+ Q_PROPERTY(QString Modalias READ modalias)
+ inline QString modalias() const
+ { return qvariant_cast< QString >(property("Modalias")); }
+
+ Q_PROPERTY(QString Name READ name)
+ inline QString name() const
+ { return qvariant_cast< QString >(property("Name")); }
+
+ Q_PROPERTY(bool Paired READ paired)
+ inline bool paired() const
+ { return qvariant_cast< bool >(property("Paired")); }
+
+ Q_PROPERTY(short RSSI READ rSSI)
+ inline short rSSI() const
+ { return qvariant_cast< short >(property("RSSI")); }
+
+ Q_PROPERTY(bool Trusted READ trusted WRITE setTrusted)
+ inline bool trusted() const
+ { return qvariant_cast< bool >(property("Trusted")); }
+ inline void setTrusted(bool value)
+ { setProperty("Trusted", QVariant::fromValue(value)); }
+
+ Q_PROPERTY(QStringList UUIDs READ uUIDs)
+ inline QStringList uUIDs() const
+ { return qvariant_cast< QStringList >(property("UUIDs")); }
+
+public Q_SLOTS: // METHODS
+ inline QDBusPendingReply<> CancelPairing()
+ {
+ QList<QVariant> argumentList;
+ return asyncCallWithArgumentList(QLatin1String("CancelPairing"), argumentList);
+ }
+
+ inline QDBusPendingReply<> Connect()
+ {
+ QList<QVariant> argumentList;
+ return asyncCallWithArgumentList(QLatin1String("Connect"), argumentList);
+ }
+
+ inline QDBusPendingReply<> ConnectProfile(const QString &UUID)
+ {
+ QList<QVariant> argumentList;
+ argumentList << QVariant::fromValue(UUID);
+ return asyncCallWithArgumentList(QLatin1String("ConnectProfile"), argumentList);
+ }
+
+ inline QDBusPendingReply<> Disconnect()
+ {
+ QList<QVariant> argumentList;
+ return asyncCallWithArgumentList(QLatin1String("Disconnect"), argumentList);
+ }
+
+ inline QDBusPendingReply<> DisconnectProfile(const QString &UUID)
+ {
+ QList<QVariant> argumentList;
+ argumentList << QVariant::fromValue(UUID);
+ return asyncCallWithArgumentList(QLatin1String("DisconnectProfile"), argumentList);
+ }
+
+ inline QDBusPendingReply<> Pair()
+ {
+ QList<QVariant> argumentList;
+ return asyncCallWithArgumentList(QLatin1String("Pair"), argumentList);
+ }
+
+Q_SIGNALS: // SIGNALS
+};
+
+namespace org {
+ namespace bluez {
+ typedef ::OrgBluezDevice1Interface Device1;
+ }
+}
+#endif
diff --git a/src/bluetooth/bluez/obex_client1_bluez5.cpp b/src/bluetooth/bluez/obex_client1_bluez5.cpp
new file mode 100644
index 00000000..fe0fd1f3
--- /dev/null
+++ b/src/bluetooth/bluez/obex_client1_bluez5.cpp
@@ -0,0 +1,26 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.8
+ * Command line was: qdbusxml2cpp org.bluez.Client1.xml -p asd
+ *
+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#include "obex_client1_bluez5_p.h"
+
+/*
+ * Implementation of interface class OrgBluezObexClient1Interface
+ */
+
+OrgBluezObexClient1Interface::OrgBluezObexClient1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+OrgBluezObexClient1Interface::~OrgBluezObexClient1Interface()
+{
+}
+
diff --git a/src/bluetooth/bluez/obex_client1_bluez5_p.h b/src/bluetooth/bluez/obex_client1_bluez5_p.h
new file mode 100644
index 00000000..f8f0f89a
--- /dev/null
+++ b/src/bluetooth/bluez/obex_client1_bluez5_p.h
@@ -0,0 +1,63 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.8
+ * Command line was: qdbusxml2cpp org.bluez.Client1.xml -p asd
+ *
+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#ifndef ASD_H_1399976174
+#define ASD_H_1399976174
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtDBus/QtDBus>
+
+/*
+ * Proxy class for interface org.bluez.obex.Client1
+ */
+class OrgBluezObexClient1Interface: public QDBusAbstractInterface
+{
+ Q_OBJECT
+public:
+ static inline const char *staticInterfaceName()
+ { return "org.bluez.obex.Client1"; }
+
+public:
+ OrgBluezObexClient1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+ ~OrgBluezObexClient1Interface();
+
+public Q_SLOTS: // METHODS
+ inline QDBusPendingReply<QDBusObjectPath> CreateSession(const QString &destination, const QVariantMap &args)
+ {
+ QList<QVariant> argumentList;
+ argumentList << QVariant::fromValue(destination) << QVariant::fromValue(args);
+ return asyncCallWithArgumentList(QLatin1String("CreateSession"), argumentList);
+ }
+
+ inline QDBusPendingReply<> RemoveSession(const QDBusObjectPath &session)
+ {
+ QList<QVariant> argumentList;
+ argumentList << QVariant::fromValue(session);
+ return asyncCallWithArgumentList(QLatin1String("RemoveSession"), argumentList);
+ }
+
+Q_SIGNALS: // SIGNALS
+};
+
+namespace org {
+ namespace bluez {
+ namespace obex {
+ typedef ::OrgBluezObexClient1Interface Client1;
+ }
+ }
+}
+#endif
diff --git a/src/bluetooth/bluez/obex_objectpush1_bluez5.cpp b/src/bluetooth/bluez/obex_objectpush1_bluez5.cpp
new file mode 100644
index 00000000..637a3a62
--- /dev/null
+++ b/src/bluetooth/bluez/obex_objectpush1_bluez5.cpp
@@ -0,0 +1,26 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.8
+ * Command line was: qdbusxml2cpp org.bluez.obex.ObjectPush1.xml -p obex_objectpush1_bluez5
+ *
+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#include "obex_objectpush1_bluez5_p.h"
+
+/*
+ * Implementation of interface class OrgBluezObexObjectPush1Interface
+ */
+
+OrgBluezObexObjectPush1Interface::OrgBluezObexObjectPush1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+OrgBluezObexObjectPush1Interface::~OrgBluezObexObjectPush1Interface()
+{
+}
+
diff --git a/src/bluetooth/bluez/obex_objectpush1_bluez5_p.h b/src/bluetooth/bluez/obex_objectpush1_bluez5_p.h
new file mode 100644
index 00000000..f8adcab4
--- /dev/null
+++ b/src/bluetooth/bluez/obex_objectpush1_bluez5_p.h
@@ -0,0 +1,100 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.8
+ * Command line was: qdbusxml2cpp org.bluez.obex.ObjectPush1.xml -p obex_objectpush1_bluez5
+ *
+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#ifndef OBEX_OBJECTPUSH1_BLUEZ5_H_1399989318
+#define OBEX_OBJECTPUSH1_BLUEZ5_H_1399989318
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtDBus/QtDBus>
+
+/*
+ * Proxy class for interface org.bluez.obex.ObjectPush1
+ */
+class OrgBluezObexObjectPush1Interface: public QDBusAbstractInterface
+{
+ Q_OBJECT
+public:
+ static inline const char *staticInterfaceName()
+ { return "org.bluez.obex.ObjectPush1"; }
+
+public:
+ OrgBluezObexObjectPush1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+ ~OrgBluezObexObjectPush1Interface();
+
+public Q_SLOTS: // METHODS
+ inline QDBusPendingReply<QDBusObjectPath, QVariantMap> ExchangeBusinessCards(const QString &clientfile, const QString &targetfile)
+ {
+ QList<QVariant> argumentList;
+ argumentList << QVariant::fromValue(clientfile) << QVariant::fromValue(targetfile);
+ return asyncCallWithArgumentList(QLatin1String("ExchangeBusinessCards"), argumentList);
+ }
+ inline QDBusReply<QDBusObjectPath> ExchangeBusinessCards(const QString &clientfile, const QString &targetfile, QVariantMap &properties)
+ {
+ QList<QVariant> argumentList;
+ argumentList << QVariant::fromValue(clientfile) << QVariant::fromValue(targetfile);
+ QDBusMessage reply = callWithArgumentList(QDBus::Block, QLatin1String("ExchangeBusinessCards"), argumentList);
+ if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 2) {
+ properties = qdbus_cast<QVariantMap>(reply.arguments().at(1));
+ }
+ return reply;
+ }
+
+ inline QDBusPendingReply<QDBusObjectPath, QVariantMap> PullBusinessCard(const QString &targetfile)
+ {
+ QList<QVariant> argumentList;
+ argumentList << QVariant::fromValue(targetfile);
+ return asyncCallWithArgumentList(QLatin1String("PullBusinessCard"), argumentList);
+ }
+ inline QDBusReply<QDBusObjectPath> PullBusinessCard(const QString &targetfile, QVariantMap &properties)
+ {
+ QList<QVariant> argumentList;
+ argumentList << QVariant::fromValue(targetfile);
+ QDBusMessage reply = callWithArgumentList(QDBus::Block, QLatin1String("PullBusinessCard"), argumentList);
+ if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 2) {
+ properties = qdbus_cast<QVariantMap>(reply.arguments().at(1));
+ }
+ return reply;
+ }
+
+ inline QDBusPendingReply<QDBusObjectPath, QVariantMap> SendFile(const QString &sourcefile)
+ {
+ QList<QVariant> argumentList;
+ argumentList << QVariant::fromValue(sourcefile);
+ return asyncCallWithArgumentList(QLatin1String("SendFile"), argumentList);
+ }
+ inline QDBusReply<QDBusObjectPath> SendFile(const QString &sourcefile, QVariantMap &properties)
+ {
+ QList<QVariant> argumentList;
+ argumentList << QVariant::fromValue(sourcefile);
+ QDBusMessage reply = callWithArgumentList(QDBus::Block, QLatin1String("SendFile"), argumentList);
+ if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 2) {
+ properties = qdbus_cast<QVariantMap>(reply.arguments().at(1));
+ }
+ return reply;
+ }
+
+Q_SIGNALS: // SIGNALS
+};
+
+namespace org {
+ namespace bluez {
+ namespace obex {
+ typedef ::OrgBluezObexObjectPush1Interface ObjectPush1;
+ }
+ }
+}
+#endif
diff --git a/src/bluetooth/bluez/obex_transfer1_bluez5.cpp b/src/bluetooth/bluez/obex_transfer1_bluez5.cpp
new file mode 100644
index 00000000..51f2a013
--- /dev/null
+++ b/src/bluetooth/bluez/obex_transfer1_bluez5.cpp
@@ -0,0 +1,26 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.8
+ * Command line was: qdbusxml2cpp org.bluez.obex.Transfer1.xml -p obex_transfer1_bluez5
+ *
+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#include "obex_transfer1_bluez5_p.h"
+
+/*
+ * Implementation of interface class OrgBluezObexTransfer1Interface
+ */
+
+OrgBluezObexTransfer1Interface::OrgBluezObexTransfer1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+OrgBluezObexTransfer1Interface::~OrgBluezObexTransfer1Interface()
+{
+}
+
diff --git a/src/bluetooth/bluez/obex_transfer1_bluez5_p.h b/src/bluetooth/bluez/obex_transfer1_bluez5_p.h
new file mode 100644
index 00000000..46b86248
--- /dev/null
+++ b/src/bluetooth/bluez/obex_transfer1_bluez5_p.h
@@ -0,0 +1,91 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.8
+ * Command line was: qdbusxml2cpp org.bluez.obex.Transfer1.xml -p obex_transfer1_bluez5
+ *
+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#ifndef OBEX_TRANSFER1_BLUEZ5_H_1400058158
+#define OBEX_TRANSFER1_BLUEZ5_H_1400058158
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtDBus/QtDBus>
+
+/*
+ * Proxy class for interface org.bluez.obex.Transfer1
+ */
+class OrgBluezObexTransfer1Interface: public QDBusAbstractInterface
+{
+ Q_OBJECT
+public:
+ static inline const char *staticInterfaceName()
+ { return "org.bluez.obex.Transfer1"; }
+
+public:
+ OrgBluezObexTransfer1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+ ~OrgBluezObexTransfer1Interface();
+
+ Q_PROPERTY(QString Filename READ filename)
+ inline QString filename() const
+ { return qvariant_cast< QString >(property("Filename")); }
+
+ Q_PROPERTY(QString Name READ name)
+ inline QString name() const
+ { return qvariant_cast< QString >(property("Name")); }
+
+ Q_PROPERTY(QDBusObjectPath Session READ session)
+ inline QDBusObjectPath session() const
+ { return qvariant_cast< QDBusObjectPath >(property("Session")); }
+
+ Q_PROPERTY(qulonglong Size READ size)
+ inline qulonglong size() const
+ { return qvariant_cast< qulonglong >(property("Size")); }
+
+ Q_PROPERTY(QString Status READ status)
+ inline QString status() const
+ { return qvariant_cast< QString >(property("Status")); }
+
+ Q_PROPERTY(qulonglong Transferred READ transferred)
+ inline qulonglong transferred() const
+ { return qvariant_cast< qulonglong >(property("Transferred")); }
+
+public Q_SLOTS: // METHODS
+ inline QDBusPendingReply<> Cancel()
+ {
+ QList<QVariant> argumentList;
+ return asyncCallWithArgumentList(QLatin1String("Cancel"), argumentList);
+ }
+
+ inline QDBusPendingReply<> Resume()
+ {
+ QList<QVariant> argumentList;
+ return asyncCallWithArgumentList(QLatin1String("Resume"), argumentList);
+ }
+
+ inline QDBusPendingReply<> Suspend()
+ {
+ QList<QVariant> argumentList;
+ return asyncCallWithArgumentList(QLatin1String("Suspend"), argumentList);
+ }
+
+Q_SIGNALS: // SIGNALS
+};
+
+namespace org {
+ namespace bluez {
+ namespace obex {
+ typedef ::OrgBluezObexTransfer1Interface Transfer1;
+ }
+ }
+}
+#endif
diff --git a/src/bluetooth/bluez/objectmanager.cpp b/src/bluetooth/bluez/objectmanager.cpp
new file mode 100644
index 00000000..521012f6
--- /dev/null
+++ b/src/bluetooth/bluez/objectmanager.cpp
@@ -0,0 +1,26 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.8
+ * Command line was: qdbusxml2cpp -p objectmanager -v -i bluez5_helper.h org.freedesktop.dbus.objectmanager.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#include "objectmanager_p.h"
+
+/*
+ * Implementation of interface class OrgFreedesktopDBusObjectManagerInterface
+ */
+
+OrgFreedesktopDBusObjectManagerInterface::OrgFreedesktopDBusObjectManagerInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+OrgFreedesktopDBusObjectManagerInterface::~OrgFreedesktopDBusObjectManagerInterface()
+{
+}
+
diff --git a/src/bluetooth/bluez/objectmanager_p.h b/src/bluetooth/bluez/objectmanager_p.h
new file mode 100644
index 00000000..5ecde487
--- /dev/null
+++ b/src/bluetooth/bluez/objectmanager_p.h
@@ -0,0 +1,63 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.8
+ * Command line was: qdbusxml2cpp -p objectmanager -v -i bluez5_helper.h org.freedesktop.dbus.objectmanager.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#ifndef OBJECTMANAGER_H_1396883000
+#define OBJECTMANAGER_H_1396883000
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtDBus/QtDBus>
+
+/* Temporary hack to merge branches until Bluez headers are removed
+ * from bluez5_helpers_p.h.
+ */
+#define NO_BLUEZ_INCLUDES
+#include "bluez5_helper_p.h"
+
+/*
+ * Proxy class for interface org.freedesktop.DBus.ObjectManager
+ */
+class OrgFreedesktopDBusObjectManagerInterface: public QDBusAbstractInterface
+{
+ Q_OBJECT
+public:
+ static inline const char *staticInterfaceName()
+ { return "org.freedesktop.DBus.ObjectManager"; }
+
+public:
+ OrgFreedesktopDBusObjectManagerInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+ ~OrgFreedesktopDBusObjectManagerInterface();
+
+public Q_SLOTS: // METHODS
+ inline QDBusPendingReply<ManagedObjectList> GetManagedObjects()
+ {
+ QList<QVariant> argumentList;
+ return asyncCallWithArgumentList(QLatin1String("GetManagedObjects"), argumentList);
+ }
+
+Q_SIGNALS: // SIGNALS
+ void InterfacesAdded(const QDBusObjectPath &object_path, InterfaceList interfaces_and_properties);
+ void InterfacesRemoved(const QDBusObjectPath &object_path, const QStringList &interfaces);
+};
+
+namespace org {
+ namespace freedesktop {
+ namespace DBus {
+ typedef ::OrgFreedesktopDBusObjectManagerInterface ObjectManager;
+ }
+ }
+}
+#endif
diff --git a/src/bluetooth/bluez/org.bluez.Adapter1.xml b/src/bluetooth/bluez/org.bluez.Adapter1.xml
new file mode 100644
index 00000000..a1e6babe
--- /dev/null
+++ b/src/bluetooth/bluez/org.bluez.Adapter1.xml
@@ -0,0 +1,23 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.bluez.Adapter1">
+ <method name="StartDiscovery"></method>
+ <method name="StopDiscovery"></method>
+ <method name="RemoveDevice">
+ <arg name="device" type="o" direction="in"/>
+ </method>
+ <property name="Address" type="s" access="read"></property>
+ <property name="Name" type="s" access="read"></property>
+ <property name="Alias" type="s" access="readwrite"></property>
+ <property name="Class" type="u" access="read"></property>
+ <property name="Powered" type="b" access="readwrite"></property>
+ <property name="Discoverable" type="b" access="readwrite"></property>
+ <property name="DiscoverableTimeout" type="u" access="readwrite"></property>
+ <property name="Pairable" type="b" access="readwrite"></property>
+ <property name="PairableTimeout" type="u" access="readwrite"></property>
+ <property name="Discovering" type="b" access="read"></property>
+ <property name="UUIDs" type="as" access="read"></property>
+ <property name="Modalias" type="s" access="read"></property>
+ </interface>
+</node>
diff --git a/src/bluetooth/bluez/org.bluez.Client1.xml b/src/bluetooth/bluez/org.bluez.Client1.xml
new file mode 100644
index 00000000..8a5a25c1
--- /dev/null
+++ b/src/bluetooth/bluez/org.bluez.Client1.xml
@@ -0,0 +1,15 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.bluez.obex.Client1">
+ <method name="CreateSession">
+ <arg name="destination" type="s" direction="in"/>
+ <arg name="args" type="a{sv}" direction="in"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
+ <arg name="session" type="o" direction="out"/>
+ </method>
+ <method name="RemoveSession">
+ <arg name="session" type="o" direction="in"/>
+ </method>
+ </interface>
+</node>
diff --git a/src/bluetooth/bluez/org.bluez.Device1.xml b/src/bluetooth/bluez/org.bluez.Device1.xml
new file mode 100644
index 00000000..1f8fd2c1
--- /dev/null
+++ b/src/bluetooth/bluez/org.bluez.Device1.xml
@@ -0,0 +1,31 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.bluez.Device1">
+ <method name="Disconnect"></method>
+ <method name="Connect"></method>
+ <method name="ConnectProfile">
+ <arg name="UUID" type="s" direction="in"/>
+ </method>
+ <method name="DisconnectProfile">
+ <arg name="UUID" type="s" direction="in"/>
+ </method>
+ <method name="Pair"></method>
+ <method name="CancelPairing"></method>
+ <property name="Address" type="s" access="read"></property>
+ <property name="Name" type="s" access="read"></property>
+ <property name="Alias" type="s" access="readwrite"></property>
+ <property name="Class" type="u" access="read"></property>
+ <property name="Appearance" type="q" access="read"></property>
+ <property name="Icon" type="s" access="read"></property>
+ <property name="Paired" type="b" access="read"></property>
+ <property name="Trusted" type="b" access="readwrite"></property>
+ <property name="Blocked" type="b" access="readwrite"></property>
+ <property name="LegacyPairing" type="b" access="read"></property>
+ <property name="RSSI" type="n" access="read"></property>
+ <property name="Connected" type="b" access="read"></property>
+ <property name="UUIDs" type="as" access="read"></property>
+ <property name="Modalias" type="s" access="read"></property>
+ <property name="Adapter" type="o" access="read"></property>
+ </interface>
+</node>
diff --git a/src/bluetooth/bluez/org.bluez.ProfileManager1.xml b/src/bluetooth/bluez/org.bluez.ProfileManager1.xml
new file mode 100644
index 00000000..54c9fd0e
--- /dev/null
+++ b/src/bluetooth/bluez/org.bluez.ProfileManager1.xml
@@ -0,0 +1,16 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.bluez.ProfileManager1">
+ <method name="RegisterProfile">
+ <arg name="profile" type="o" direction="in"/>
+ <arg name="UUID" type="s" direction="in"/>
+ <arg name="options" type="a{sv}" direction="in"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QVariantMap"/>
+ </method>
+ <method name="UnregisterProfile">
+ <arg name="profile" type="o" direction="in"/>
+ </method>
+ </interface>
+</node>
+
diff --git a/src/bluetooth/bluez/org.bluez.obex.ObjectPush1.xml b/src/bluetooth/bluez/org.bluez.obex.ObjectPush1.xml
new file mode 100644
index 00000000..651f21a5
--- /dev/null
+++ b/src/bluetooth/bluez/org.bluez.obex.ObjectPush1.xml
@@ -0,0 +1,25 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.bluez.obex.ObjectPush1">
+ <method name="SendFile">
+ <arg name="sourcefile" type="s" direction="in"/>
+ <arg name="transfer" type="o" direction="out"/>
+ <arg name="properties" type="a{sv}" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/>
+ </method>
+ <method name="PullBusinessCard">
+ <arg name="targetfile" type="s" direction="in"/>
+ <arg name="transfer" type="o" direction="out"/>
+ <arg name="properties" type="a{sv}" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/>
+ </method>
+ <method name="ExchangeBusinessCards">
+ <arg name="clientfile" type="s" direction="in"/>
+ <arg name="targetfile" type="s" direction="in"/>
+ <arg name="transfer" type="o" direction="out"/>
+ <arg name="properties" type="a{sv}" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/>
+ </method>
+ </interface>
+</node>
diff --git a/src/bluetooth/bluez/org.bluez.obex.Transfer1.xml b/src/bluetooth/bluez/org.bluez.obex.Transfer1.xml
new file mode 100644
index 00000000..4ee76f7d
--- /dev/null
+++ b/src/bluetooth/bluez/org.bluez.obex.Transfer1.xml
@@ -0,0 +1,16 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.bluez.obex.Transfer1">
+ <method name="Suspend"/>
+ <method name="Resume"/>
+ <method name="Cancel"/>
+ <property name="Status" type="s" access="read"/>
+ <property name="Name" type="s" access="read"/>
+ <property name="Size" type="t" access="read"/>
+ <property name="Filename" type="s" access="read"/>
+ <property name="Transferred" type="t" access="read"/>
+ <property name="Session" type="o" access="read"/>
+ </interface>
+</node>
+
diff --git a/src/bluetooth/bluez/org.freedesktop.dbus.objectmanager.xml b/src/bluetooth/bluez/org.freedesktop.dbus.objectmanager.xml
new file mode 100644
index 00000000..8ab2a6e1
--- /dev/null
+++ b/src/bluetooth/bluez/org.freedesktop.dbus.objectmanager.xml
@@ -0,0 +1,19 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
+ <interface name="org.freedesktop.DBus.ObjectManager">
+ <method name="GetManagedObjects">
+ <arg type="a{oa{sa{sv}}}" name="object_paths_interfaces_and_properties" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="ManagedObjectList"/>
+ </method>
+ <signal name="InterfacesAdded">
+ <arg type="o" name="object_path"/>
+ <arg type="a{sa{sv}}" name="interfaces_and_properties"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="InterfaceList"/>
+ </signal>
+ <signal name="InterfacesRemoved">
+ <arg type="o" name="object_path"/>
+ <arg type="as" name="interfaces"/>
+ </signal>
+ </interface>
+</node>
diff --git a/src/bluetooth/bluez/org.freedesktop.dbus.properties.xml b/src/bluetooth/bluez/org.freedesktop.dbus.properties.xml
new file mode 100644
index 00000000..5dc94f5d
--- /dev/null
+++ b/src/bluetooth/bluez/org.freedesktop.dbus.properties.xml
@@ -0,0 +1,27 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.freedesktop.DBus.Properties">
+ <method name="Get">
+ <arg name="interface" type="s" direction="in"/>
+ <arg name="name" type="s" direction="in"/>
+ <arg name="value" type="v" direction="out"/>
+ </method>
+ <method name="Set">
+ <arg name="interface" type="s" direction="in"/>
+ <arg name="name" type="s" direction="in"/>
+ <arg name="value" type="v" direction="in"/>
+ </method>
+ <method name="GetAll">
+ <arg name="interface" type="s" direction="in"/>
+ <arg name="properties" type="a{sv}" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
+ </method>
+ <signal name="PropertiesChanged">
+ <arg name="interface" type="s"/>
+ <arg name="changed_properties" type="a{sv}"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
+ <arg name="invalidated_properties" type="as"/>
+ </signal>
+ </interface>
+</node>
diff --git a/src/bluetooth/bluez/profile1.cpp b/src/bluetooth/bluez/profile1.cpp
new file mode 100644
index 00000000..2cf15d7e
--- /dev/null
+++ b/src/bluetooth/bluez/profile1.cpp
@@ -0,0 +1,26 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.8
+ * Command line was: qdbusxml2cpp -p profile1 org.bluez.ProfileManager1.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#include "profile1_p.h"
+
+/*
+ * Implementation of interface class OrgBluezProfileManager1Interface
+ */
+
+OrgBluezProfileManager1Interface::OrgBluezProfileManager1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+OrgBluezProfileManager1Interface::~OrgBluezProfileManager1Interface()
+{
+}
+
diff --git a/src/bluetooth/bluez/profile1_p.h b/src/bluetooth/bluez/profile1_p.h
new file mode 100644
index 00000000..d94f1916
--- /dev/null
+++ b/src/bluetooth/bluez/profile1_p.h
@@ -0,0 +1,61 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.8
+ * Command line was: qdbusxml2cpp -p profile1 org.bluez.ProfileManager1.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#ifndef PROFILE1_H_1400142085
+#define PROFILE1_H_1400142085
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtDBus/QtDBus>
+
+/*
+ * Proxy class for interface org.bluez.ProfileManager1
+ */
+class OrgBluezProfileManager1Interface: public QDBusAbstractInterface
+{
+ Q_OBJECT
+public:
+ static inline const char *staticInterfaceName()
+ { return "org.bluez.ProfileManager1"; }
+
+public:
+ OrgBluezProfileManager1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+ ~OrgBluezProfileManager1Interface();
+
+public Q_SLOTS: // METHODS
+ inline QDBusPendingReply<> RegisterProfile(const QDBusObjectPath &profile, const QString &UUID, const QVariantMap &options)
+ {
+ QList<QVariant> argumentList;
+ argumentList << QVariant::fromValue(profile) << QVariant::fromValue(UUID) << QVariant::fromValue(options);
+ return asyncCallWithArgumentList(QLatin1String("RegisterProfile"), argumentList);
+ }
+
+ inline QDBusPendingReply<> UnregisterProfile(const QDBusObjectPath &profile)
+ {
+ QList<QVariant> argumentList;
+ argumentList << QVariant::fromValue(profile);
+ return asyncCallWithArgumentList(QLatin1String("UnregisterProfile"), argumentList);
+ }
+
+Q_SIGNALS: // SIGNALS
+};
+
+namespace org {
+ namespace bluez {
+ typedef ::OrgBluezProfileManager1Interface ProfileManager1;
+ }
+}
+#endif
diff --git a/src/bluetooth/bluez/properties.cpp b/src/bluetooth/bluez/properties.cpp
new file mode 100644
index 00000000..53c9021c
--- /dev/null
+++ b/src/bluetooth/bluez/properties.cpp
@@ -0,0 +1,26 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.8
+ * Command line was: qdbusxml2cpp -p properties -v org.freedesktop.dbus.properties.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#include "properties_p.h"
+
+/*
+ * Implementation of interface class OrgFreedesktopDBusPropertiesInterface
+ */
+
+OrgFreedesktopDBusPropertiesInterface::OrgFreedesktopDBusPropertiesInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+OrgFreedesktopDBusPropertiesInterface::~OrgFreedesktopDBusPropertiesInterface()
+{
+}
+
diff --git a/src/bluetooth/bluez/properties_p.h b/src/bluetooth/bluez/properties_p.h
new file mode 100644
index 00000000..44a79664
--- /dev/null
+++ b/src/bluetooth/bluez/properties_p.h
@@ -0,0 +1,71 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.8
+ * Command line was: qdbusxml2cpp -p properties -v org.freedesktop.dbus.properties.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#ifndef PROPERTIES_H_1396952220
+#define PROPERTIES_H_1396952220
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtDBus/QtDBus>
+
+/*
+ * Proxy class for interface org.freedesktop.DBus.Properties
+ */
+class OrgFreedesktopDBusPropertiesInterface: public QDBusAbstractInterface
+{
+ Q_OBJECT
+public:
+ static inline const char *staticInterfaceName()
+ { return "org.freedesktop.DBus.Properties"; }
+
+public:
+ OrgFreedesktopDBusPropertiesInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+ ~OrgFreedesktopDBusPropertiesInterface();
+
+public Q_SLOTS: // METHODS
+ inline QDBusPendingReply<QDBusVariant> Get(const QString &interface, const QString &name)
+ {
+ QList<QVariant> argumentList;
+ argumentList << QVariant::fromValue(interface) << QVariant::fromValue(name);
+ return asyncCallWithArgumentList(QLatin1String("Get"), argumentList);
+ }
+
+ inline QDBusPendingReply<QVariantMap> GetAll(const QString &interface)
+ {
+ QList<QVariant> argumentList;
+ argumentList << QVariant::fromValue(interface);
+ return asyncCallWithArgumentList(QLatin1String("GetAll"), argumentList);
+ }
+
+ inline QDBusPendingReply<> Set(const QString &interface, const QString &name, const QDBusVariant &value)
+ {
+ QList<QVariant> argumentList;
+ argumentList << QVariant::fromValue(interface) << QVariant::fromValue(name) << QVariant::fromValue(value);
+ return asyncCallWithArgumentList(QLatin1String("Set"), argumentList);
+ }
+
+Q_SIGNALS: // SIGNALS
+ void PropertiesChanged(const QString &interface, const QVariantMap &changed_properties, const QStringList &invalidated_properties);
+};
+
+namespace org {
+ namespace freedesktop {
+ namespace DBus {
+ typedef ::OrgFreedesktopDBusPropertiesInterface Properties;
+ }
+ }
+}
+#endif
diff --git a/src/bluetooth/bluez/servicemap.cpp b/src/bluetooth/bluez/servicemap.cpp
index bb2c9978..411eb6d8 100644
--- a/src/bluetooth/bluez/servicemap.cpp
+++ b/src/bluetooth/bluez/servicemap.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/bluez/servicemap_p.h b/src/bluetooth/bluez/servicemap_p.h
index ed94c8a6..6ae3afb3 100644
--- a/src/bluetooth/bluez/servicemap_p.h
+++ b/src/bluetooth/bluez/servicemap_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/doc/images/peripheral-structure.png b/src/bluetooth/doc/images/peripheral-structure.png
new file mode 100644
index 00000000..a42c74da
--- /dev/null
+++ b/src/bluetooth/doc/images/peripheral-structure.png
Binary files differ
diff --git a/src/bluetooth/doc/qtbluetooth.qdocconf b/src/bluetooth/doc/qtbluetooth.qdocconf
index 171310cb..52061d7e 100644
--- a/src/bluetooth/doc/qtbluetooth.qdocconf
+++ b/src/bluetooth/doc/qtbluetooth.qdocconf
@@ -2,7 +2,6 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtBluetooth
description = Qt Bluetooth Reference Documentation
-url = http://qt-project.org/doc/qt-$QT_VER
version = $QT_VERSION
examplesinstallpath = bluetooth
diff --git a/src/bluetooth/doc/snippets/doc_src_qtbluetooth.cpp b/src/bluetooth/doc/snippets/doc_src_qtbluetooth.cpp
index c0c0f61a..abcf9dbb 100644
--- a/src/bluetooth/doc/snippets/doc_src_qtbluetooth.cpp
+++ b/src/bluetooth/doc/snippets/doc_src_qtbluetooth.cpp
@@ -51,6 +51,10 @@
#include <QtBluetooth/QBluetoothTransferRequest>
#include <QtBluetooth/QBluetoothTransferReply>
+#include <QtBluetooth/QLowEnergyController>
+#include <QtBluetooth/QLowEnergyService>
+#include <QtBluetooth/QLowEnergyCharacteristic>
+
//! [namespace]
QT_USE_NAMESPACE
//! [namespace]
@@ -64,6 +68,7 @@ public:
void startDeviceDiscovery();
void startServiceDiscovery();
void objectPush();
+ void btleSharedData();
public slots:
void deviceDiscovered(const QBluetoothDeviceInfo &device);
@@ -166,6 +171,29 @@ void MyClass::transferFinished(QBluetoothTransferReply* /*reply*/)
{
}
+void MyClass::btleSharedData()
+{
+ QBluetoothAddress remoteDevice;
+
+//! [data_share_qlowenergyservice]
+ QLowEnergyService *first, *second;
+ QLowEnergyController control(remoteDevice);
+ control.connectToDevice();
+
+ // waiting for connection
+
+ first = control.createServiceObject(QBluetoothUuid::BatteryService);
+ second = control.createServiceObject(QBluetoothUuid::BatteryService);
+ Q_ASSERT(first->state() == QLowEnergyService::DiscoveryRequired);
+ Q_ASSERT(first->state() == second->state());
+
+ first->discoverDetails();
+
+ Q_ASSERT(first->state() == QLowEnergyService::DiscoveringServices);
+ Q_ASSERT(first->state() == second->state());
+//! [data_share_qlowenergyservice]
+}
+
int main(int argc, char** argv)
{
QCoreApplication app(argc, argv);
diff --git a/src/bluetooth/doc/src/bluetooth-index.qdoc b/src/bluetooth/doc/src/bluetooth-index.qdoc
index fe9322e9..9e691613 100644
--- a/src/bluetooth/doc/src/bluetooth-index.qdoc
+++ b/src/bluetooth/doc/src/bluetooth-index.qdoc
@@ -35,7 +35,9 @@ The Bluetooth API provides connectivity between Bluetooth enabled devices.
Currently the API is supported on \l{Qt for Android}{Android},
\l{Qt for BlackBerry}{BlackBerry 10} and
-\l{Qt for Linux/X11}{Linux} (\l{http://www.bluez.org}{Bluez 4.x}).
+\l{Qt for Linux/X11}{Linux} (\l{http://www.bluez.org}{BlueZ 4.x/5.x}).
+
+
\section1 Overview
@@ -45,6 +47,12 @@ for transferring data between devices. Bluetooth connectivity is based on
basic device management, such as scanning for devices, gathering information
about them, and exchanging data between them.
+This Qt release contains a Technology Preview of the new Qt Bluetooth
+Low Energy API. Further details can be found in the
+\l {Bluetooth Low Energy Overview}{Bluetooth Low Energy Overview} section.
+The Tech Preview supports BlueZ 4 & 5 based Linux systems. Support for
+further platforms is being planned.
+
\section1 Getting started
To use the C++ library in your application, add the following configuration
@@ -61,7 +69,8 @@ import statement in your \c .qml file:
\section2 Guides
\list
- \li \l {Qt Bluetooth Overview}
+ \li \l {Qt Bluetooth Overview}{Classic Bluetooth Overview}
+ \li \l {Bluetooth Low Energy Overview} (Tech Preview)
\endlist
\section2 Reference
@@ -77,6 +86,8 @@ import statement in your \c .qml file:
\li \l {scanner}{QML Bluetooth Scanner}
\li \l {picturetransfer}{QML Bluetooth Picture Push}
\li \l {pingpong}{QML Bluetooth PingPong}
+ \li \l {heartlistener}{Bluetooth Low Energy Heart Listener}
+ \li \l {lowenergyscanner}{Bluetooth Low Energy Scanner}
\endlist
\li C++
\list
diff --git a/src/bluetooth/doc/src/bluetooth-le-overview.qdoc b/src/bluetooth/doc/src/bluetooth-le-overview.qdoc
new file mode 100644
index 00000000..958e623d
--- /dev/null
+++ b/src/bluetooth/doc/src/bluetooth-le-overview.qdoc
@@ -0,0 +1,254 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt local connectivty modules.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\ingroup technology-apis
+\title Bluetooth Low Energy Overview
+\page qtbluetooth-le-overview.html
+\brief The Qt Bluetooth Low Energy API enables communication between Bluetooth
+Low Energy devices.
+
+\tableofcontents
+
+ \section1 Technology Preview
+
+ The Qt Bluetooth Low Energy API has been introduced in Qt 5.4.
+ The API is considered to be a preview of the technology and currently only works
+ on BlueZ 4 & 5 based Linux systems. Support for further platforms, for example Android,
+ is currently being worked on and will be added by later Qt releases. In addition,
+ Qt only supports the central role. For more details on this limitation see below.
+
+ While the API is not yet frozen it is close to its final stage.
+ We would like to encourage you to send us feedback and bug reports related to
+ this new feature.
+
+ \section1 What Is Bluetooth Low Energy
+
+ Bluetooth Low Energy, also known as Bluetooth Smart, is a wireless computer
+ network technology, which was officially introduced in 2011. It works on the same
+ 2.4 GHz frequency as ”classic” Bluetooth. The main difference is, as stated by its technology name,
+ low energy consumption. It provides an opportunity for Bluetooth Low Energy devices to
+ operate for months, even years, on coin-cell batteries. The technology was introduced by
+ \l {https://www.bluetooth.org/en-us/specification/adopted-specifications}{Bluetooth v4.0}.
+ Devices which support this technology are called Bluetooth Smart Ready Devices.
+ The key features of the technology are:
+
+ \list
+ \li Ultra-low peak, average and idle mode power consumption
+ \li Ability to run for years on standard, coin-cell batteries
+ \li Low cost
+ \li Multi-vendor interoperability
+ \li Enhanced range
+ \endlist
+
+ Bluetooth Low Energy uses a client-server architecture. The server (also
+ known as peripheral) offers services such as temperature or heart rate
+ and advertises them. The client (known as central
+ device) connects to the server and reads the values advertised by the server.
+ An example might be an apartment with Bluetooth Smart Ready sensors such
+ as a thermostat, humidity or pressure sensor. Those sensors are peripheral
+ devices advertising the environment values of the apartment. At the same time
+ a mobile phone or computer might connect to those sensors, retrieve their
+ values and present them as part of a larger environment control application
+ to the user.
+
+ \section1 Basic Service Structure
+
+ Bluetooth Low Energy is based on two protocols: ATT (Attribute Protocol)
+ and GATT (Generic Attribute Profile). They specify the communication layers
+ used by every Bluetooth Smart Ready device.
+
+ \section2 ATT Protocol
+
+ The basic building block of ATT is an \e attribute. Each attribute consists of
+ three elements:
+
+ \list
+ \li a value - the payload or desirable piece of information
+ \li a UUID - the type of attribute (used by GATT)
+ \li a 16-bit handle - a unique identifier for the attribute
+ \endlist
+
+ The server stores the attributes and the client uses the ATT protocol to
+ read and write values on the server.
+
+ \section2 GATT Profile
+
+ GATT defines grouping for a set of attributes by applying a meaning to predefined
+ UUIDs. The table below shows an example service exposing a heart rate
+ on a particular day. The actual values are stored inside the two characteristics:
+
+ \table
+ \header
+ \li Handle
+ \li UUID
+ \li Value
+ \li Description
+ \row
+ \li 0x0001
+ \li 0x2800
+ \li UUID 0x180D
+ \li Begin Heart Rate service
+ \row
+ \li 0x0002
+ \li 0x2803
+ \li UUID 0x2A37, Value handle: 0x0003
+ \li Characteristic of type \e {Heart Rate Measurement (HRM)}
+ \row
+ \li 0x0003
+ \li 0x2A37
+ \li 65 bpm
+ \li Heart rate value
+ \row
+ \li 0x0004
+ \li 0x2803
+ \li UUID 0x2A08, Value handle: 0x0006
+ \li Characteristic of type Date Time
+ \row
+ \li 0x0005
+ \li 0x2A08
+ \li 18/08/2014 11:00
+ \li Date and Time of the measurement
+ \row
+ \li 0x0006
+ \li 0x2800
+ \li UUID xxxxxx
+ \li Begin next service
+ \row
+ \li ...
+ \li ...
+ \li ...
+ \li ...
+ \endtable
+
+ GATT specifies that the above used UUID \c 0x2800 marks the begin of a service definition.
+ Every attribute following \c 0x2800 is part of the service until the next \c 0x2800 or the
+ end is encountered. In similar ways the well known UUID \c 0x2803 states that a characteristic
+ is to be found and each of the characteristics has a type defining the nature of the value.
+ The example above uses the UUIDs \c 0x2A08 (Date Time) and \c 0x2A37 (Heart Rate Measurement).
+ Each of the above UUIDs is defined by the \l {https://bluetooth.org}{Bluetooth Special Interest Group}.
+ and can be found in the
+ \l{https://developer.bluetooth.org/gatt/Pages/default.aspx}{GATT specification}. While it
+ is advisable to use pre-defined UUIDs where available it is entirely possible to use new and not
+ yet used UUIDs for characteristic and service types.
+
+ In general, each service may consist of one or more characteristics. A characteristic
+ contains data and can be further described by descriptors, which provide additional
+ information or means of manipulating the characteristic. All services, characteristics and
+ descriptors are recognized by their 128-bit UUID. Finally, it is possible to include
+ services inside of services (see picture below).
+
+ \image peripheral-structure.png
+
+ \section1 Using Qt Bluetooth Low Energy API
+
+ This section describes how to use the Bluetooth Low Energy API provided by Qt. Currently the API
+ permits creating connections to peripheral devices, discovering their services, as well as reading
+ and writing data stored on the device. The example code below is taken from the
+ \l {heartlistener}{Heart Listener} example.
+
+ \note As of Qt 5.4 the Qt Bluetooth Low Energy API is in tech preview mode and supports Linux
+ with BlueZ 4 & 5. Only the last versions of Bluez 4.x (v 4.101 confirmed to work) and Linux kernels
+ from version 3.5 onwards support this feature.
+
+ \section2 Establishing a Connection
+
+ To be able to read and write the characteristics of the Bluetooth Low Energy peripheral device,
+ it is necessary to find and connect the device. This requires the peripheral device to advertise
+ its presence and services. We start the device discovery with the help of the
+ \l QBluetoothDeviceDiscoveryAgent class. We connect to its \l {QBluetoothDeviceDiscoveryAgent::deviceDiscovered()}
+ signal and start the search with \l {QBluetoothDeviceDiscoveryAgent::start()}{start()}:
+
+ \snippet heartlistener/heartrate.cpp devicediscovery-1
+ \snippet heartlistener/heartrate.cpp devicediscovery-2
+
+ Since we are only interested in Low Energy devices we filter the device type within the
+ receiving slot. The device type can be ascertained using the \l QBluetoothDeviceInfo::coreConfigurations()
+ flag:
+
+ \snippet heartlistener/heartrate.cpp devicediscovery-3
+ \snippet heartlistener/heartrate.cpp devicediscovery-4
+
+ Once the address of the peripheral device is known we use the \l QLowEnergyController class.
+ This class is the entry point for all Bluetooth Low Energy development. The constructor of the class
+ accepts the remote device's \l QBluetoothAddress. Finally we set up the customary slots and
+ directly connect to the device using
+ \l {QLowEnergyController::connectToDevice()}{connectToDevice()}:
+
+ \snippet heartlistener/heartrate.cpp Connect signals
+
+ \section2 Service Search
+
+ As soon as the connection is established we initiate the service discovery:
+
+ \snippet heartlistener/heartrate.cpp Connecting to service
+
+ The \c serviceDiscovered() slot below is triggered as a result of the
+ \l {QLowEnergyController::serviceDiscovered()} signal and provides an intermittent progress report.
+ Since we are talking about the heart listener app which monitors HeartRate devices in the vicinity
+ we ignore any service that is not of type \l QBluetoothUuid::HeartRate.
+
+ \snippet heartlistener/heartrate.cpp Filter HeartRate service 1
+
+ Eventually the \l {QLowEnergyController::discoveryFinished()} signal is emitted to indicate
+ the successful completion of the service discovery. Provided a HeartRate service was found,
+ a \l QLowEnergyService instance is created to represent the service. The returned service object
+ provides the required signals for update notifications and the discovery of service details
+ is triggered using \l QLowEnergyService::discoverDetails():
+
+ \snippet heartlistener/heartrate.cpp Filter HeartRate service 2
+
+ During the detail search the service's \l {QLowEnergyService::state()}{state()} transitions
+ from \l {QLowEnergyService::DiscoveryRequired}{DiscoveryRequired} to
+ \l {QLowEnergyService::DiscoveringServices}{DiscoveringServices} and eventually ends with
+ \l {QLowEnergyService::ServiceDiscovered}{ServiceDiscovered}:
+
+ \snippet heartlistener/heartrate.cpp Find HRM characteristic
+
+ \section2 Interaction with the Peripheral Device
+
+ In the code example above, the desired characteristic is of type
+ \l {QBluetoothUuid::HeartRateMeasurement}{HeartRateMeasurement}. Since the application measures
+ the heart rate changes, it must enable change notifications for the characteristic.
+ Note that not all characteristics provide change notifications. Since the HeartRate characteristic
+ has been standardized it is possible to assume that notifications can be received. Ultimately
+ \l QLowEnergyCharacteristic::properties() must have the \l {QLowEnergyCharacteristic::Notify} flag
+ set and a descriptor of type \l {QBluetoothUuid::ClientCharacteristicConfiguration} must exist to confirm
+ the availability of an appropriate notification.
+
+ Finally, we process the value of the HeartRate characteristic, as per Bluetooth Low Energy standard:
+
+ \snippet heartlistener/heartrate.cpp Reading value 1
+ \snippet heartlistener/heartrate.cpp Reading value 2
+
+ In general a characteristic value is a series of bytes. The precise interpretation of
+ those bytes depends on the characteristic type and value structure.
+ A significant number has been standardized by the
+ \l {https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx}{Bluetooth SIG} whereas others
+ may follow a custom protocol. The above code snippet demonstrates how to the read the standardized
+ HeartRate value.
+*/
diff --git a/src/bluetooth/doc/src/bluetooth-overview.qdoc b/src/bluetooth/doc/src/bluetooth-overview.qdoc
index f8040fb8..81d6270a 100644
--- a/src/bluetooth/doc/src/bluetooth-overview.qdoc
+++ b/src/bluetooth/doc/src/bluetooth-overview.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt local connectivty modules.
@@ -29,7 +29,8 @@
\ingroup technology-apis
\title Qt Bluetooth Overview
\page qtbluetooth-overview.html
-\brief The Qt Bluetooth API enables connectivity with other Bluetooth enabled devices.
+\brief The Qt Bluetooth API enables connectivity with other regular Bluetooth
+ and Bluetooth Low Energy enabled devices.
\tableofcontents
@@ -41,6 +42,9 @@
\li Push files to remote devices using the OBEX Object Push Profile (OPP)
\li Connect to remote devices through a RFCOMM channel using the Serial Port Profile (SPP).
\li Create a RFCOMM server that allows incoming connections using SPP.
+ \li Retrieve specification about Bluetooth Low Energy device.
+ \li Connect to Bluetooth Low Energy device.
+ \li Receive advertisement from Bluetooth Low Energy device.
\endlist
Note that the Object Push Profile is not supported on Android.
@@ -103,4 +107,9 @@
\l QBluetoothSocket classes. A good example to start with SPP is the \l{btchat}{Bluetooth Chat}
example.
+ \section1 Bluetooth Low Energy
+
+ Bluetooth Low Energy, also known as Bluetooth Smart, is a new technology enabling
+ devices with low energy consumption to communicate with each other. More details about
+ this technology and the related Qt APIs can be found in the \l {Bluetooth Low Energy Overview}.
*/
diff --git a/src/bluetooth/doc/src/examples.qdoc b/src/bluetooth/doc/src/examples.qdoc
index f9965075..f53d7127 100644
--- a/src/bluetooth/doc/src/examples.qdoc
+++ b/src/bluetooth/doc/src/examples.qdoc
@@ -69,6 +69,13 @@
\row
\li \l{picturetransfer}{QML Picture Push Example}
\li A QML application that transfers pictures between Bluetooth devices.
+ \row
+ \li \l{lowenergyscanner}{QML Bluetooth Low Energy Scanner}
+ \li Scan for Bluetooth Low Energy devices, services and characteristics.
+ \row
+ \li \l{heartlistener}{QML Bluetooth Low Energy Heart Listener}
+ \li Connect to the Bluetooth Low Energy heart belt and receive
+ measurements.
\endtable
*/
diff --git a/src/bluetooth/qbluetooth.cpp b/src/bluetooth/qbluetooth.cpp
index 4ba14dba..855d6f02 100644
--- a/src/bluetooth/qbluetooth.cpp
+++ b/src/bluetooth/qbluetooth.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -45,7 +37,6 @@
QT_BEGIN_NAMESPACE
namespace QBluetooth {
-
/*!
\namespace QBluetooth
\inmodule QtBluetooth
@@ -77,6 +68,13 @@ namespace QBluetooth {
*/
}
+/*!
+ \typedef QLowEnergyHandle
+ \relates QBluetooth
+
+ Typedef for Bluetooth Low Energy ATT attribute handles.
+*/
+
Q_LOGGING_CATEGORY(QT_BT, "qt.bluetooth")
Q_LOGGING_CATEGORY(QT_BT_ANDROID, "qt.bluetooth.android")
Q_LOGGING_CATEGORY(QT_BT_BLUEZ, "qt.bluetooth.bluez")
diff --git a/src/bluetooth/qbluetooth.h b/src/bluetooth/qbluetooth.h
index b13c0043..ebe546f8 100644
--- a/src/bluetooth/qbluetooth.h
+++ b/src/bluetooth/qbluetooth.h
@@ -1,45 +1,36 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
-
#ifndef QBLUETOOTH_H
#define QBLUETOOTH_H
@@ -48,18 +39,20 @@
QT_BEGIN_NAMESPACE
namespace QBluetooth {
- enum Security {
- NoSecurity = 0x00,
- Authorization = 0x01,
- Authentication = 0x02,
- Encryption = 0x04,
- Secure = 0x08
- };
-
- Q_DECLARE_FLAGS(SecurityFlags, Security)
- Q_DECLARE_OPERATORS_FOR_FLAGS(SecurityFlags)
+enum Security {
+ NoSecurity = 0x00,
+ Authorization = 0x01,
+ Authentication = 0x02,
+ Encryption = 0x04,
+ Secure = 0x08
+};
+
+Q_DECLARE_FLAGS(SecurityFlags, Security)
+Q_DECLARE_OPERATORS_FOR_FLAGS(SecurityFlags)
}
+typedef quint16 QLowEnergyHandle;
+
QT_END_NAMESPACE
#endif // QBLUETOOTH_H
diff --git a/src/bluetooth/qbluetoothaddress.cpp b/src/bluetooth/qbluetoothaddress.cpp
index 9213a431..00a057fc 100644
--- a/src/bluetooth/qbluetoothaddress.cpp
+++ b/src/bluetooth/qbluetoothaddress.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -42,6 +34,10 @@
#include "qbluetoothaddress.h"
#include "qbluetoothaddress_p.h"
+#ifndef QT_NO_DEBUG_STREAM
+#include <QDebug>
+#endif
+
QT_BEGIN_NAMESPACE
/*!
@@ -62,8 +58,7 @@ QT_BEGIN_NAMESPACE
Returns true if the Bluetooth addresses are not equal, otherwise returns false.
*/
-namespace
-{
+namespace {
class BluetoothAddressRegisterMetaTypes
{
public:
@@ -77,16 +72,16 @@ public:
/*!
Constructs an null Bluetooth address.
*/
-QBluetoothAddress::QBluetoothAddress()
- : d_ptr(new QBluetoothAddressPrivate)
+QBluetoothAddress::QBluetoothAddress() :
+ d_ptr(new QBluetoothAddressPrivate)
{
}
/*!
Constructs a new Bluetooth address and assigns \a address to it.
*/
-QBluetoothAddress::QBluetoothAddress(quint64 address)
- : d_ptr(new QBluetoothAddressPrivate)
+QBluetoothAddress::QBluetoothAddress(quint64 address) :
+ d_ptr(new QBluetoothAddressPrivate)
{
Q_D(QBluetoothAddress);
d->m_address = address;
@@ -98,8 +93,8 @@ QBluetoothAddress::QBluetoothAddress(quint64 address)
The format of \a address can be either XX:XX:XX:XX:XX:XX or XXXXXXXXXXXX,
where X is a hexadecimal digit. Case is not important.
*/
-QBluetoothAddress::QBluetoothAddress(const QString &address)
- : d_ptr(new QBluetoothAddressPrivate)
+QBluetoothAddress::QBluetoothAddress(const QString &address) :
+ d_ptr(new QBluetoothAddressPrivate)
{
Q_D(QBluetoothAddress);
@@ -121,8 +116,8 @@ QBluetoothAddress::QBluetoothAddress(const QString &address)
/*!
Constructs a new Bluetooth address which is a copy of \a other.
*/
-QBluetoothAddress::QBluetoothAddress(const QBluetoothAddress &other)
- : d_ptr(new QBluetoothAddressPrivate)
+QBluetoothAddress::QBluetoothAddress(const QBluetoothAddress &other) :
+ d_ptr(new QBluetoothAddressPrivate)
{
*this = other;
}
@@ -200,7 +195,7 @@ quint64 QBluetoothAddress::toUInt64() const
*/
QString QBluetoothAddress::toString() const
{
- QString s(QLatin1String("%1:%2:%3:%4:%5:%6"));
+ QString s(QStringLiteral("%1:%2:%3:%4:%5:%6"));
Q_D(const QBluetoothAddress);
for (int i = 5; i >= 0; --i) {
@@ -216,4 +211,12 @@ QBluetoothAddressPrivate::QBluetoothAddressPrivate()
m_address = 0;
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug debug, const QBluetoothAddress &address)
+{
+ debug << address.toString();
+ return debug;
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/bluetooth/qbluetoothaddress.h b/src/bluetooth/qbluetoothaddress.h
index db9e0a1a..3fa491a2 100644
--- a/src/bluetooth/qbluetoothaddress.h
+++ b/src/bluetooth/qbluetoothaddress.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -69,7 +61,10 @@ public:
bool operator<(const QBluetoothAddress &other) const;
bool operator==(const QBluetoothAddress &other) const;
- inline bool operator!=(const QBluetoothAddress &other) const { return !operator==(other); }
+ inline bool operator!=(const QBluetoothAddress &other) const
+ {
+ return !operator==(other);
+ }
quint64 toUInt64() const;
QString toString() const;
@@ -79,6 +74,10 @@ private:
QBluetoothAddressPrivate *d_ptr;
};
+#ifndef QT_NO_DEBUG_STREAM
+Q_BLUETOOTH_EXPORT QDebug operator<<(QDebug, const QBluetoothAddress &address);
+#endif
+
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QBluetoothAddress)
diff --git a/src/bluetooth/qbluetoothaddress_p.h b/src/bluetooth/qbluetoothaddress_p.h
index 37e13d9a..be641dca 100644
--- a/src/bluetooth/qbluetoothaddress_p.h
+++ b/src/bluetooth/qbluetoothaddress_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -62,9 +54,7 @@ class QBluetoothAddressPrivate
public:
QBluetoothAddressPrivate();
-
quint64 m_address;
-
};
QT_END_NAMESPACE
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent.cpp
index 6b959c5f..16d74aff 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -99,6 +91,16 @@ QT_BEGIN_NAMESPACE
\fn void QBluetoothDeviceDiscoveryAgent::deviceDiscovered(const QBluetoothDeviceInfo &info)
This signal is emitted when the Bluetooth device described by \a info is discovered.
+
+ The signal is emitted as soon as the most important device information
+ has been collected. However, as long as the \l finished() signal has not
+ been emitted the information collection continues even for already discovered
+ devices. This is particularly true for signal strength information (RSSI). If
+ signal strength information is required it is advisable to retrieve the device
+ information via \l discoveredDevices() once the discovery has finished. This
+ will yield the most recent RSSI information.
+
+ \sa QBluetoothDeviceInfo::rssi()
*/
/*!
@@ -132,10 +134,10 @@ QT_BEGIN_NAMESPACE
/*!
Constructs a new Bluetooth device discovery agent with parent \a parent.
*/
-QBluetoothDeviceDiscoveryAgent::QBluetoothDeviceDiscoveryAgent(QObject *parent)
- : QObject(parent), d_ptr(new QBluetoothDeviceDiscoveryAgentPrivate(QBluetoothAddress()))
+QBluetoothDeviceDiscoveryAgent::QBluetoothDeviceDiscoveryAgent(QObject *parent) :
+ QObject(parent),
+ d_ptr(new QBluetoothDeviceDiscoveryAgentPrivate(QBluetoothAddress(), this))
{
- d_ptr->q_ptr = this;
}
/*!
@@ -150,10 +152,11 @@ QBluetoothDeviceDiscoveryAgent::QBluetoothDeviceDiscoveryAgent(QObject *parent)
\sa error()
*/
-QBluetoothDeviceDiscoveryAgent::QBluetoothDeviceDiscoveryAgent(const QBluetoothAddress &deviceAdapter, QObject *parent)
- : QObject(parent), d_ptr(new QBluetoothDeviceDiscoveryAgentPrivate(deviceAdapter))
+QBluetoothDeviceDiscoveryAgent::QBluetoothDeviceDiscoveryAgent(
+ const QBluetoothAddress &deviceAdapter, QObject *parent) :
+ QObject(parent),
+ d_ptr(new QBluetoothDeviceDiscoveryAgentPrivate(deviceAdapter, this))
{
- d_ptr->q_ptr = this;
if (!deviceAdapter.isNull()) {
const QList<QBluetoothHostInfo> localDevices = QBluetoothLocalDevice::allDevices();
foreach (const QBluetoothHostInfo &hostInfo, localDevices) {
@@ -238,7 +241,6 @@ bool QBluetoothDeviceDiscoveryAgent::isActive() const
return d->isActive();
}
-
/*!
Returns the last error.
*/
@@ -261,4 +263,3 @@ QString QBluetoothDeviceDiscoveryAgent::errorString() const
#include "moc_qbluetoothdevicediscoveryagent.cpp"
QT_END_NAMESPACE
-
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent.h b/src/bluetooth/qbluetoothdevicediscoveryagent.h
index f52f32fb..4638a4f2 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent.h
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -45,9 +37,7 @@
#include <QtBluetooth/qbluetoothglobal.h>
#include <QObject>
-
#include <QtBluetooth/QBluetoothDeviceInfo>
-
#include <QtBluetooth/QBluetoothAddress>
QT_BEGIN_NAMESPACE
@@ -57,7 +47,8 @@ class QBluetoothDeviceDiscoveryAgentPrivate;
class Q_BLUETOOTH_EXPORT QBluetoothDeviceDiscoveryAgent : public QObject
{
Q_OBJECT
- Q_PROPERTY(QBluetoothDeviceDiscoveryAgent::InquiryType inquiryType READ inquiryType WRITE setInquiryType)
+ Q_PROPERTY(QBluetoothDeviceDiscoveryAgent::InquiryType inquiryType
+ READ inquiryType WRITE setInquiryType)
public:
// FIXME: add more errors
@@ -67,7 +58,7 @@ public:
InputOutputError,
PoweredOffError,
InvalidBluetoothAdapterError,
- UnknownError = 100 //New errors must be added before Unknown error
+ UnknownError = 100 // New errors must be added before Unknown error
};
enum InquiryType {
@@ -76,7 +67,8 @@ public:
};
QBluetoothDeviceDiscoveryAgent(QObject *parent = 0);
- explicit QBluetoothDeviceDiscoveryAgent(const QBluetoothAddress &deviceAdapter, QObject *parent = 0);
+ explicit QBluetoothDeviceDiscoveryAgent(const QBluetoothAddress &deviceAdapter,
+ QObject *parent = 0);
~QBluetoothDeviceDiscoveryAgent();
// TODO Remove inquiry type in Qt 6 -> not really used anywhere
@@ -107,6 +99,11 @@ private:
#ifdef QT_BLUEZ_BLUETOOTH
Q_PRIVATE_SLOT(d_func(), void _q_deviceFound(const QString &address, const QVariantMap &dict))
Q_PRIVATE_SLOT(d_func(), void _q_propertyChanged(const QString &name, const QDBusVariant &value))
+ Q_PRIVATE_SLOT(d_func(), void _q_InterfacesAdded(const QDBusObjectPath &path, InterfaceList interfaceList))
+ Q_PRIVATE_SLOT(d_func(), void _q_discoveryFinished())
+ Q_PRIVATE_SLOT(d_func(), void _q_discoveryInterrupted(const QString &path))
+ Q_PRIVATE_SLOT(d_func(), void _q_PropertiesChanged(const QString &interface, const QVariantMap &changed_properties, const QStringList &invalidated_properties))
+ Q_PRIVATE_SLOT(d_func(), void _q_extendedDeviceDiscoveryTimeout())
#endif
};
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp
index 4f8ecdff..1bd3dac5 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp
@@ -6,36 +6,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,14 +43,16 @@ QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(QT_BT_ANDROID)
QBluetoothDeviceDiscoveryAgentPrivate::QBluetoothDeviceDiscoveryAgentPrivate(
- const QBluetoothAddress &deviceAdapter)
- : inquiryType(QBluetoothDeviceDiscoveryAgent::GeneralUnlimitedInquiry),
- lastError(QBluetoothDeviceDiscoveryAgent::NoError), errorString(QStringLiteral()),
- receiver(0),
- m_adapterAddress(deviceAdapter),
- m_active(false),
- pendingCancel(false),
- pendingStart(false)
+ const QBluetoothAddress &deviceAdapter, QBluetoothDeviceDiscoveryAgent *parent) :
+ inquiryType(QBluetoothDeviceDiscoveryAgent::GeneralUnlimitedInquiry),
+ lastError(QBluetoothDeviceDiscoveryAgent::NoError),
+ errorString(QStringLiteral()),
+ receiver(0),
+ m_adapterAddress(deviceAdapter),
+ m_active(false),
+ pendingCancel(false),
+ pendingStart(false),
+ q_ptr(parent)
{
adapter = QAndroidJniObject::callStaticObjectMethod("android/bluetooth/BluetoothAdapter",
"getDefaultAdapter",
@@ -102,8 +96,9 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start()
return;
}
- if (!m_adapterAddress.isNull() &&
- adapter.callObjectMethod<jstring>("getAddress").toString() != m_adapterAddress.toString()) {
+ if (!m_adapterAddress.isNull()
+ && adapter.callObjectMethod<jstring>("getAddress").toString()
+ != m_adapterAddress.toString()) {
qCWarning(QT_BT_ANDROID) << "Incorrect local adapter passed.";
lastError = QBluetoothDeviceDiscoveryAgent::InvalidBluetoothAdapterError;
errorString = QBluetoothDeviceDiscoveryAgent::tr("Passed address is not a local device.");
@@ -112,14 +107,14 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start()
}
const int state = adapter.callMethod<jint>("getState");
- if (state != 12 ) { //BluetoothAdapter.STATE_ON
+ if (state != 12) { // BluetoothAdapter.STATE_ON
lastError = QBluetoothDeviceDiscoveryAgent::PoweredOffError;
errorString = QBluetoothDeviceDiscoveryAgent::tr("Device is powered off");
emit q->error(lastError);
return;
}
- //install Java BroadcastReceiver
+ // install Java BroadcastReceiver
if (!receiver) {
receiver = new DeviceDiscoveryBroadcastReceiver();
qRegisterMetaType<QBluetoothDeviceInfo>("QBluetoothDeviceInfo");
@@ -140,7 +135,8 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start()
m_active = true;
- qCDebug(QT_BT_ANDROID) << "QBluetoothDeviceDiscoveryAgentPrivate::start() - successfully executed.";
+ qCDebug(QT_BT_ANDROID)
+ << "QBluetoothDeviceDiscoveryAgentPrivate::start() - successfully executed.";
}
void QBluetoothDeviceDiscoveryAgentPrivate::stop()
@@ -163,9 +159,9 @@ void QBluetoothDeviceDiscoveryAgentPrivate::stop()
void QBluetoothDeviceDiscoveryAgentPrivate::processDiscoveryFinished()
{
- //We need to guard because Android sends two DISCOVERY_FINISHED when cancelling
- //Also if we have two active agents both receive the same signal.
- //If this one is not active ignore the device information
+ // We need to guard because Android sends two DISCOVERY_FINISHED when cancelling
+ // Also if we have two active agents both receive the same signal.
+ // If this one is not active ignore the device information
if (!m_active)
return;
@@ -180,9 +176,9 @@ void QBluetoothDeviceDiscoveryAgentPrivate::processDiscoveryFinished()
pendingStart = pendingCancel = false;
start();
} else {
- //check that it didn't finish due to turned off Bluetooth Device
+ // check that it didn't finish due to turned off Bluetooth Device
const int state = adapter.callMethod<jint>("getState");
- if (state != 12 ) { //BluetoothAdapter.STATE_ON
+ if (state != 12) { // BluetoothAdapter.STATE_ON
lastError = QBluetoothDeviceDiscoveryAgent::PoweredOffError;
errorString = QBluetoothDeviceDiscoveryAgent::tr("Device is powered off");
emit q->error(lastError);
@@ -192,9 +188,10 @@ void QBluetoothDeviceDiscoveryAgentPrivate::processDiscoveryFinished()
}
}
-void QBluetoothDeviceDiscoveryAgentPrivate::processDiscoveredDevices(const QBluetoothDeviceInfo &info)
+void QBluetoothDeviceDiscoveryAgentPrivate::processDiscoveredDevices(
+ const QBluetoothDeviceInfo &info)
{
- //If we have two active agents both receive the same signal.
+ // If we have two active agents both receive the same signal.
// If this one is not active ignore the device information
if (!m_active)
return;
@@ -205,4 +202,5 @@ void QBluetoothDeviceDiscoveryAgentPrivate::processDiscoveredDevices(const QBlue
qCDebug(QT_BT_ANDROID) << "Device found: " << info.name() << info.address().toString();
emit q->deviceDiscovered(info);
}
+
QT_END_NAMESPACE
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp
index 83b83fbd..2f90fd30 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,44 +40,82 @@
#include "bluez/manager_p.h"
#include "bluez/adapter_p.h"
#include "bluez/device_p.h"
+#include "bluez/bluez5_helper_p.h"
+#include "bluez/objectmanager_p.h"
+#include "bluez/adapter1_bluez5_p.h"
+#include "bluez/device1_bluez5_p.h"
+#include "bluez/properties_p.h"
QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(QT_BT_BLUEZ)
-QBluetoothDeviceDiscoveryAgentPrivate::QBluetoothDeviceDiscoveryAgentPrivate(const QBluetoothAddress &deviceAdapter)
- : lastError(QBluetoothDeviceDiscoveryAgent::NoError), m_adapterAddress(deviceAdapter), pendingCancel(false), pendingStart(false),
- adapter(0)
+QBluetoothDeviceDiscoveryAgentPrivate::QBluetoothDeviceDiscoveryAgentPrivate(
+ const QBluetoothAddress &deviceAdapter, QBluetoothDeviceDiscoveryAgent *parent) :
+ lastError(QBluetoothDeviceDiscoveryAgent::NoError),
+ m_adapterAddress(deviceAdapter),
+ pendingCancel(false),
+ pendingStart(false),
+ manager(0),
+ adapter(0),
+ managerBluez5(0),
+ adapterBluez5(0),
+ discoveryTimer(0),
+ useExtendedDiscovery(false),
+ q_ptr(parent)
{
- manager = new OrgBluezManagerInterface(QLatin1String("org.bluez"), QLatin1String("/"),
- QDBusConnection::systemBus());
+ Q_Q(QBluetoothDeviceDiscoveryAgent);
+ if (isBluez5()) {
+ managerBluez5 = new OrgFreedesktopDBusObjectManagerInterface(
+ QStringLiteral("org.bluez"),
+ QStringLiteral("/"),
+ QDBusConnection::systemBus(), parent);
+ QObject::connect(managerBluez5,
+ SIGNAL(InterfacesAdded(QDBusObjectPath,InterfaceList)),
+ q, SLOT(_q_InterfacesAdded(QDBusObjectPath,InterfaceList)));
+
+ } else {
+ manager = new OrgBluezManagerInterface(QStringLiteral("org.bluez"), QStringLiteral("/"),
+ QDBusConnection::systemBus(), parent);
+ QObject::connect(&extendedDiscoveryTimer,
+ SIGNAL(timeout()),
+ q, SLOT(_q_extendedDeviceDiscoveryTimeout()));
+ extendedDiscoveryTimer.setInterval(10000);
+ extendedDiscoveryTimer.setSingleShot(true);
+ }
inquiryType = QBluetoothDeviceDiscoveryAgent::GeneralUnlimitedInquiry;
}
QBluetoothDeviceDiscoveryAgentPrivate::~QBluetoothDeviceDiscoveryAgentPrivate()
{
- delete manager;
delete adapter;
+ delete adapterBluez5;
}
bool QBluetoothDeviceDiscoveryAgentPrivate::isActive() const
{
- if(pendingStart)
+ if (pendingStart)
return true;
- if(pendingCancel)
+ if (pendingCancel)
return false;
- return adapter != 0;
+
+ return (adapter || adapterBluez5);
}
void QBluetoothDeviceDiscoveryAgentPrivate::start()
{
-
- if(pendingCancel == true) {
+ if (pendingCancel == true) {
pendingStart = true;
return;
}
discoveredDevices.clear();
+
+ if (managerBluez5) {
+ startBluez5();
+ return;
+ }
+
QDBusPendingReply<QDBusObjectPath> reply;
if (m_adapterAddress.isNull())
@@ -103,18 +133,18 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start()
return;
}
- adapter = new OrgBluezAdapterInterface(QLatin1String("org.bluez"), reply.value().path(),
+ adapter = new OrgBluezAdapterInterface(QStringLiteral("org.bluez"), reply.value().path(),
QDBusConnection::systemBus());
Q_Q(QBluetoothDeviceDiscoveryAgent);
- QObject::connect(adapter, SIGNAL(DeviceFound(QString,QVariantMap)),
- q, SLOT(_q_deviceFound(QString,QVariantMap)));
- QObject::connect(adapter, SIGNAL(PropertyChanged(QString,QDBusVariant)),
- q, SLOT(_q_propertyChanged(QString,QDBusVariant)));
+ QObject::connect(adapter, SIGNAL(DeviceFound(QString, QVariantMap)),
+ q, SLOT(_q_deviceFound(QString, QVariantMap)));
+ QObject::connect(adapter, SIGNAL(PropertyChanged(QString, QDBusVariant)),
+ q, SLOT(_q_propertyChanged(QString, QDBusVariant)));
QDBusPendingReply<QVariantMap> propertiesReply = adapter->GetProperties();
propertiesReply.waitForFinished();
- if(propertiesReply.isError()) {
+ if (propertiesReply.isError()) {
errorString = propertiesReply.error().message();
delete adapter;
adapter = 0;
@@ -137,6 +167,26 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start()
return;
}
+ if (propertiesReply.value().value(QStringLiteral("Discovering")).toBool()) {
+ /* The discovery session is already ongoing. BTLE devices are advertised
+ immediately after the start of the device discovery session. Hence if the
+ session is already ongoing, we have just missed the BTLE device
+ advertisement.
+
+ This always happens during the second device discovery run in
+ the current process. The first discovery doesn't have this issue.
+ As to why the discovery session remains active despite the previous one
+ being terminated is not known. This may be a bug in Bluez4.
+
+ To workaround this issue we have to wait for two discovery
+ sessions cycles.
+ */
+ qCDebug(QT_BT_BLUEZ) << "Using BTLE device discovery workaround.";
+ useExtendedDiscovery = true;
+ } else {
+ useExtendedDiscovery = false;
+ }
+
QDBusPendingReply<> discoveryReply = adapter->StartDiscovery();
if (discoveryReply.isError()) {
delete adapter;
@@ -150,14 +200,83 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start()
}
}
+void QBluetoothDeviceDiscoveryAgentPrivate::startBluez5()
+{
+ Q_Q(QBluetoothDeviceDiscoveryAgent);
+
+
+ bool ok = false;
+ const QString adapterPath = findAdapterForAddress(m_adapterAddress, &ok);
+ if (!ok || adapterPath.isEmpty()) {
+ qCWarning(QT_BT_BLUEZ) << "Cannot find Bluez 5 adapter for device search" << ok;
+ lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError;
+ errorString = QBluetoothDeviceDiscoveryAgent::tr("Cannot find valid Bluetooth adapter.");
+ q->error(lastError);
+ return;
+ }
+
+ adapterBluez5 = new OrgBluezAdapter1Interface(QStringLiteral("org.bluez"),
+ adapterPath,
+ QDBusConnection::systemBus());
+
+ if (!adapterBluez5->powered()) {
+ qCDebug(QT_BT_BLUEZ) << "Aborting device discovery due to offline Bluetooth Adapter";
+ lastError = QBluetoothDeviceDiscoveryAgent::PoweredOffError;
+ errorString = QBluetoothDeviceDiscoveryAgent::tr("Device is powered off");
+ delete adapterBluez5;
+ adapterBluez5 = 0;
+ emit q->error(lastError);
+ return;
+ }
+
+
+ QtBluezDiscoveryManager::instance()->registerDiscoveryInterest(adapterBluez5->path());
+ QObject::connect(QtBluezDiscoveryManager::instance(), SIGNAL(discoveryInterrupted(QString)),
+ q, SLOT(_q_discoveryInterrupted(QString)));
+
+ // collect initial set of information
+ QDBusPendingReply<ManagedObjectList> reply = managerBluez5->GetManagedObjects();
+ reply.waitForFinished();
+ if (!reply.isError()) {
+ foreach (const QDBusObjectPath &path, reply.value().keys()) {
+ const InterfaceList ifaceList = reply.value().value(path);
+ foreach (const QString &iface, ifaceList.keys()) {
+ if (iface == QStringLiteral("org.bluez.Device1")) {
+
+ if (path.path().indexOf(adapterBluez5->path()) != 0)
+ continue; //devices whose path doesn't start with same path we skip
+
+ deviceFoundBluez5(path.path());
+ }
+ }
+ }
+ }
+
+ // wait 20s and sum up what was found
+ if (!discoveryTimer) {
+ discoveryTimer = new QTimer(q);
+ discoveryTimer->setSingleShot(true);
+ discoveryTimer->setInterval(20000); // 20s
+ QObject::connect(discoveryTimer, SIGNAL(timeout()),
+ q, SLOT(_q_discoveryFinished()));
+ }
+
+ discoveryTimer->start();
+}
+
void QBluetoothDeviceDiscoveryAgentPrivate::stop()
{
+ if (!adapter && !adapterBluez5)
+ return;
+
+ qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO;
+ pendingCancel = true;
+ pendingStart = false;
if (adapter) {
- qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO;
- pendingCancel = true;
- pendingStart = false;
QDBusPendingReply<> reply = adapter->StopDiscovery();
reply.waitForFinished();
+ } else {
+ _q_discoveryFinished();
}
}
@@ -165,27 +284,37 @@ void QBluetoothDeviceDiscoveryAgentPrivate::_q_deviceFound(const QString &addres
const QVariantMap &dict)
{
const QBluetoothAddress btAddress(address);
- const QString btName = dict.value(QLatin1String("Name")).toString();
- quint32 btClass = dict.value(QLatin1String("Class")).toUInt();
+ const QString btName = dict.value(QStringLiteral("Name")).toString();
+ quint32 btClass = dict.value(QStringLiteral("Class")).toUInt();
qCDebug(QT_BT_BLUEZ) << "Discovered: " << address << btName
- << "Num UUIDs" << dict.value(QLatin1String("UUIDs")).toStringList().count()
- << "total device" << discoveredDevices.count() << "cached"
- << dict.value(QLatin1String("Cached")).toBool()
- << "RSSI" << dict.value(QLatin1String("RSSI")).toInt();
+ << "Num UUIDs" << dict.value(QStringLiteral("UUIDs")).toStringList().count()
+ << "total device" << discoveredDevices.count() << "cached"
+ << dict.value(QStringLiteral("Cached")).toBool()
+ << "RSSI" << dict.value(QStringLiteral("RSSI")).toInt();
QBluetoothDeviceInfo device(btAddress, btName, btClass);
- if(dict.value(QLatin1String("RSSI")).isValid())
- device.setRssi(dict.value(QLatin1String("RSSI")).toInt());
+ if (dict.value(QStringLiteral("RSSI")).isValid())
+ device.setRssi(dict.value(QStringLiteral("RSSI")).toInt());
QList<QBluetoothUuid> uuids;
- foreach (const QString &u, dict.value(QLatin1String("UUIDs")).toStringList()) {
+ foreach (const QString &u, dict.value(QLatin1String("UUIDs")).toStringList())
uuids.append(QBluetoothUuid(u));
- }
device.setServiceUuids(uuids, QBluetoothDeviceInfo::DataIncomplete);
- device.setCached(dict.value(QLatin1String("Cached")).toBool());
- for(int i = 0; i < discoveredDevices.size(); i++){
- if(discoveredDevices[i].address() == device.address()) {
- if(discoveredDevices[i] == device) {
+ device.setCached(dict.value(QStringLiteral("Cached")).toBool());
+
+
+ /*
+ * Bluez v4.1 does not have extra bit which gives information if device is Bluetooth
+ * Low Energy device and the way to discover it is with Class property of the Bluetooth device.
+ * Low Energy devices do not have property Class.
+ */
+ if (btClass == 0)
+ device.setCoreConfigurations(QBluetoothDeviceInfo::LowEnergyCoreConfiguration);
+ else
+ device.setCoreConfigurations(QBluetoothDeviceInfo::BaseRateCoreConfiguration);
+ for (int i = 0; i < discoveredDevices.size(); i++) {
+ if (discoveredDevices[i].address() == device.address()) {
+ if (discoveredDevices[i] == device) {
qCDebug(QT_BT_BLUEZ) << "Duplicate: " << address;
return;
}
@@ -203,26 +332,215 @@ void QBluetoothDeviceDiscoveryAgentPrivate::_q_deviceFound(const QString &addres
emit q->deviceDiscovered(device);
}
+void QBluetoothDeviceDiscoveryAgentPrivate::deviceFoundBluez5(const QString& devicePath)
+{
+ Q_Q(QBluetoothDeviceDiscoveryAgent);
+
+ if (!q->isActive())
+ return;
+
+ OrgBluezDevice1Interface device(QStringLiteral("org.bluez"), devicePath,
+ QDBusConnection::systemBus());
+
+ if (device.adapter().path() != adapterBluez5->path())
+ return;
+
+ const QBluetoothAddress btAddress(device.address());
+ if (btAddress.isNull()) // no point reporting an empty address
+ return;
+
+ const QString btName = device.alias();
+ quint32 btClass = device.classProperty();
+
+ qCDebug(QT_BT_BLUEZ) << "Discovered: " << btAddress.toString() << btName
+ << "Num UUIDs" << device.uUIDs().count()
+ << "total device" << discoveredDevices.count() << "cached"
+ << "RSSI" << device.rSSI() << "Class" << btClass;
+
+ OrgFreedesktopDBusPropertiesInterface *prop = new OrgFreedesktopDBusPropertiesInterface(
+ QStringLiteral("org.bluez"), devicePath, QDBusConnection::systemBus(), q);
+ QObject::connect(prop, SIGNAL(PropertiesChanged(QString,QVariantMap,QStringList)),
+ q, SLOT(_q_PropertiesChanged(QString,QVariantMap,QStringList)));
+ // remember what we have to cleanup
+ propertyMonitors.append(prop);
+
+ // read information
+ QBluetoothDeviceInfo deviceInfo(btAddress, btName, btClass);
+
+ if (!btClass)
+ deviceInfo.setCoreConfigurations(QBluetoothDeviceInfo::LowEnergyCoreConfiguration);
+ else
+ deviceInfo.setCoreConfigurations(QBluetoothDeviceInfo::BaseRateCoreConfiguration);
+
+ deviceInfo.setRssi(device.rSSI());
+ QList<QBluetoothUuid> uuids;
+ foreach (const QString &u, device.uUIDs())
+ uuids.append(QBluetoothUuid(u));
+ deviceInfo.setServiceUuids(uuids, QBluetoothDeviceInfo::DataIncomplete);
+
+ for (int i = 0; i < discoveredDevices.size(); i++) {
+ if (discoveredDevices[i].address() == deviceInfo.address()) {
+ if (discoveredDevices[i] == deviceInfo) {
+ qCDebug(QT_BT_BLUEZ) << "Duplicate: " << btAddress.toString();
+ return;
+ }
+ discoveredDevices.replace(i, deviceInfo);
+
+ emit q->deviceDiscovered(deviceInfo);
+ return; // this works if the list doesn't contain duplicates. Don't let it.
+ }
+ }
+
+ discoveredDevices.append(deviceInfo);
+ emit q->deviceDiscovered(deviceInfo);
+}
+
void QBluetoothDeviceDiscoveryAgentPrivate::_q_propertyChanged(const QString &name,
const QDBusVariant &value)
{
qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO << name << value.variant();
- if (name == QLatin1String("Discovering") && !value.variant().toBool()) {
- Q_Q(QBluetoothDeviceDiscoveryAgent);
+ if (name == QLatin1String("Discovering")) {
+ if (!value.variant().toBool()) {
+ Q_Q(QBluetoothDeviceDiscoveryAgent);
+ if (pendingCancel && !pendingStart) {
+ adapter->deleteLater();
+ adapter = 0;
+
+ emit q->canceled();
+ pendingCancel = false;
+ } else if (pendingStart) {
+ adapter->deleteLater();
+ adapter = 0;
+
+ pendingStart = false;
+ pendingCancel = false;
+ start();
+ } else {
+ if (useExtendedDiscovery) {
+ useExtendedDiscovery = false;
+ /* We don't use the Start/StopDiscovery combo here
+ Using this combo surppresses the BTLE device.
+ */
+ extendedDiscoveryTimer.start();
+ return;
+ }
+
+ adapter->deleteLater();
+ adapter = 0;
+ emit q->finished();
+ }
+ } else {
+ if (extendedDiscoveryTimer.isActive())
+ extendedDiscoveryTimer.stop();
+ }
+ }
+}
+
+void QBluetoothDeviceDiscoveryAgentPrivate::_q_extendedDeviceDiscoveryTimeout()
+{
+
+ if (adapter) {
adapter->deleteLater();
adapter = 0;
- if(pendingCancel && !pendingStart){
- emit q->canceled();
- pendingCancel = false;
- }
- else if(pendingStart){
- pendingStart = false;
- pendingCancel = false;
- start();
- }
- else {
- emit q->finished();
+ }
+ if (isActive()) {
+ Q_Q(QBluetoothDeviceDiscoveryAgent);
+ emit q->finished();
+ }
+}
+
+void QBluetoothDeviceDiscoveryAgentPrivate::_q_InterfacesAdded(const QDBusObjectPath &object_path,
+ InterfaceList interfaces_and_properties)
+{
+ Q_Q(QBluetoothDeviceDiscoveryAgent);
+
+ if (!q->isActive())
+ return;
+
+ if (interfaces_and_properties.contains(QStringLiteral("org.bluez.Device1"))) {
+ // device interfaces belonging to different adapter
+ // will be filtered out by deviceFoundBluez5();
+ deviceFoundBluez5(object_path.path());
+ }
+}
+
+void QBluetoothDeviceDiscoveryAgentPrivate::_q_discoveryFinished()
+{
+ Q_Q(QBluetoothDeviceDiscoveryAgent);
+
+ if (discoveryTimer)
+ discoveryTimer->stop();
+
+ QtBluezDiscoveryManager::instance()->disconnect(q);
+ QtBluezDiscoveryManager::instance()->unregisterDiscoveryInterest(adapterBluez5->path());
+
+ qDeleteAll(propertyMonitors);
+ propertyMonitors.clear();
+
+ delete adapterBluez5;
+ adapterBluez5 = 0;
+
+ if (pendingCancel && !pendingStart) {
+ emit q->canceled();
+ pendingCancel = false;
+ } else if (pendingStart) {
+ pendingStart = false;
+ pendingCancel = false;
+ start();
+ } else {
+ emit q->finished();
+ }
+}
+
+void QBluetoothDeviceDiscoveryAgentPrivate::_q_discoveryInterrupted(const QString &path)
+{
+ Q_Q(QBluetoothDeviceDiscoveryAgent);
+
+ if (!q->isActive())
+ return;
+
+ if (path == adapterBluez5->path()) {
+ qCWarning(QT_BT_BLUEZ) << "Device discovery aborted due to unexpected adapter changes";
+
+ if (discoveryTimer)
+ discoveryTimer->stop();
+
+ QtBluezDiscoveryManager::instance()->disconnect(q);
+ // no need to call unregisterDiscoveryInterest since QtBluezDiscoveryManager
+ // does this automatically when emitting discoveryInterrupted(QString) signal
+
+ delete adapterBluez5;
+ adapterBluez5 = 0;
+
+ errorString = QBluetoothDeviceDiscoveryAgent::tr("Bluetooth adapter error");
+ lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError;
+ emit q->error(lastError);
+ }
+}
+
+void QBluetoothDeviceDiscoveryAgentPrivate::_q_PropertiesChanged(const QString &interface,
+ const QVariantMap &changed_properties,
+ const QStringList &)
+{
+ Q_Q(QBluetoothDeviceDiscoveryAgent);
+ if (interface == QStringLiteral("org.bluez.Device1")
+ && changed_properties.contains(QStringLiteral("RSSI"))) {
+ OrgFreedesktopDBusPropertiesInterface *props =
+ qobject_cast<OrgFreedesktopDBusPropertiesInterface *>(q->sender());
+ if (!props)
+ return;
+
+ OrgBluezDevice1Interface device(QStringLiteral("org.bluez"), props->path(),
+ QDBusConnection::systemBus());
+ for (int i = 0; i < discoveredDevices.size(); i++) {
+ if (discoveredDevices[i].address().toString() == device.address()) {
+ qCDebug(QT_BT_BLUEZ) << "Updating RSSI for" << device.address()
+ << changed_properties.value(QStringLiteral("RSSI"));
+ discoveredDevices[i].setRssi(
+ changed_properties.value(QStringLiteral("RSSI")).toInt());
+ return;
+ }
}
}
}
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp
index ee5c70f9..c89c2d37 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +40,10 @@
QT_BEGIN_NAMESPACE
-QBluetoothDeviceDiscoveryAgentPrivate::QBluetoothDeviceDiscoveryAgentPrivate(const QBluetoothAddress &deviceAdapter)
+QBluetoothDeviceDiscoveryAgentPrivate::QBluetoothDeviceDiscoveryAgentPrivate(
+ const QBluetoothAddress &deviceAdapter,
+ QBluetoothDeviceDiscoveryAgent *parent)
+ : q_ptr(parent)
{
Q_UNUSED(deviceAdapter);
inquiryType = QBluetoothDeviceDiscoveryAgent::GeneralUnlimitedInquiry;
@@ -76,4 +71,6 @@ void QBluetoothDeviceDiscoveryAgentPrivate::stop()
{
}
+
+
QT_END_NAMESPACE
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_p.h b/src/bluetooth/qbluetoothdevicediscoveryagent_p.h
index 3819f389..f25496dc 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_p.h
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -65,8 +57,14 @@
#include <QtBluetooth/QBluetoothLocalDevice>
#ifdef QT_BLUEZ_BLUETOOTH
+#include "bluez/bluez5_helper_p.h"
+
class OrgBluezManagerInterface;
class OrgBluezAdapterInterface;
+class OrgFreedesktopDBusObjectManagerInterface;
+class OrgFreedesktopDBusPropertiesInterface;
+class OrgBluezAdapter1Interface;
+class OrgBluezDevice1Interface;
QT_BEGIN_NAMESPACE
class QDBusVariant;
@@ -80,14 +78,17 @@ QT_BEGIN_NAMESPACE
class QBluetoothDeviceDiscoveryAgentPrivate
#if defined(QT_QNX_BLUETOOTH) || defined(QT_ANDROID_BLUETOOTH)
-: public QObject {
+ : public QObject
+{
Q_OBJECT
#else
{
#endif
Q_DECLARE_PUBLIC(QBluetoothDeviceDiscoveryAgent)
public:
- QBluetoothDeviceDiscoveryAgentPrivate(const QBluetoothAddress &deviceAdapter);
+ QBluetoothDeviceDiscoveryAgentPrivate(
+ const QBluetoothAddress &deviceAdapter,
+ QBluetoothDeviceDiscoveryAgent *parent);
~QBluetoothDeviceDiscoveryAgentPrivate();
void start();
@@ -97,6 +98,14 @@ public:
#ifdef QT_BLUEZ_BLUETOOTH
void _q_deviceFound(const QString &address, const QVariantMap &dict);
void _q_propertyChanged(const QString &name, const QDBusVariant &value);
+ void _q_InterfacesAdded(const QDBusObjectPath &object_path,
+ InterfaceList interfaces_and_properties);
+ void _q_discoveryFinished();
+ void _q_discoveryInterrupted(const QString &path);
+ void _q_PropertiesChanged(const QString &interface,
+ const QVariantMap &changed_properties,
+ const QStringList &invalidated_properties);
+ void _q_extendedDeviceDiscoveryTimeout();
#endif
private:
@@ -107,12 +116,12 @@ private:
QString errorString;
#ifdef QT_ANDROID_BLUETOOTH
-private Q_SLOTS:
+private slots:
void processDiscoveryFinished();
- void processDiscoveredDevices(const QBluetoothDeviceInfo& info);
+ void processDiscoveredDevices(const QBluetoothDeviceInfo &info);
private:
- DeviceDiscoveryBroadcastReceiver* receiver;
+ DeviceDiscoveryBroadcastReceiver *receiver;
QBluetoothAddress m_adapterAddress;
bool m_active;
QAndroidJniObject adapter;
@@ -124,8 +133,19 @@ private:
bool pendingStart;
OrgBluezManagerInterface *manager;
OrgBluezAdapterInterface *adapter;
+ OrgFreedesktopDBusObjectManagerInterface *managerBluez5;
+ OrgBluezAdapter1Interface *adapterBluez5;
+ QTimer *discoveryTimer;
+ QList<OrgFreedesktopDBusPropertiesInterface *> propertyMonitors;
+
+ void deviceFoundBluez5(const QString& devicePath);
+ void startBluez5();
+
+ bool useExtendedDiscovery;
+ QTimer extendedDiscoveryTimer;
+
#elif defined(QT_QNX_BLUETOOTH)
- private Q_SLOTS:
+private slots:
void finished();
void remoteDevicesChanged(int);
void controlReply(ppsResult result);
@@ -138,7 +158,7 @@ private:
int m_rdfd;
bool m_active;
- enum Ops{
+ enum Ops {
None,
Cancel,
Start
@@ -150,7 +170,6 @@ private:
#endif
QBluetoothDeviceDiscoveryAgent *q_ptr;
-
};
QT_END_NAMESPACE
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_qnx.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_qnx.cpp
index 390faf50..2e4ad274 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_qnx.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_qnx.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -46,12 +38,17 @@
#include <QtCore/private/qcore_unix_p.h>
-
QT_BEGIN_NAMESPACE
-QBluetoothDeviceDiscoveryAgentPrivate::QBluetoothDeviceDiscoveryAgentPrivate(const QBluetoothAddress &deviceAdapter):
- QObject(0), lastError(QBluetoothDeviceDiscoveryAgent::NoError),
- m_rdfd(-1), m_active(false), m_nextOp(None), m_currentOp(None)
+QBluetoothDeviceDiscoveryAgentPrivate::QBluetoothDeviceDiscoveryAgentPrivate(
+ const QBluetoothAddress &deviceAdapter, QBluetoothDeviceDiscoveryAgent *parent) :
+ QObject(parent),
+ lastError(QBluetoothDeviceDiscoveryAgent::NoError),
+ m_rdfd(-1),
+ m_active(false),
+ m_nextOp(None),
+ m_currentOp(None),
+ q_ptr(parent)
{
Q_UNUSED(deviceAdapter);
inquiryType = QBluetoothDeviceDiscoveryAgent::GeneralUnlimitedInquiry;
@@ -86,16 +83,18 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start()
m_nextOp = Start;
return;
}
- if (m_nextOp == Cancel) {
+ if (m_nextOp == Cancel)
m_nextOp = None;
- }
m_currentOp = Start;
if (m_rdfd != -1) {
qCDebug(QT_BT_QNX) << "RDev FD still open";
- } else if ((m_rdfd = qt_safe_open("/pps/services/bluetooth/remote_devices/.all", O_RDONLY)) == -1) {
- qCWarning(QT_BT_QNX) << Q_FUNC_INFO << "rdfd - failed to open /pps/services/bluetooth/remote_devices/.all"
- << m_rdfd;
+ } else if ((m_rdfd
+ = qt_safe_open("/pps/services/bluetooth/remote_devices/.all",
+ O_RDONLY)) == -1) {
+ qCWarning(QT_BT_QNX) << Q_FUNC_INFO
+ << "rdfd - failed to open /pps/services/bluetooth/remote_devices/.all"
+ << m_rdfd;
lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError;
errorString = QBluetoothDeviceDiscoveryAgent::tr("Cannot open remote device socket");
emit q->error(lastError);
@@ -106,7 +105,8 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start()
if (!m_rdNotifier) {
qCWarning(QT_BT_QNX) << Q_FUNC_INFO << "failed to connect to m_rdNotifier";
lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError;
- errorString = QBluetoothDeviceDiscoveryAgent::tr("Cannot connect to Bluetooth socket notifier");
+ errorString = QBluetoothDeviceDiscoveryAgent::tr(
+ "Cannot connect to Bluetooth socket notifier");
emit q->error(lastError);
stop();
return;
@@ -114,7 +114,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start()
}
if (ppsSendControlMessage("device_search", this)) {
- //If there is no new results after 7 seconds, the device inquire will be stopped
+ // If there is no new results after 7 seconds, the device inquire will be stopped
m_finishedTimer.start(10000);
connect(m_rdNotifier, SIGNAL(activated(int)), this, SLOT(remoteDevicesChanged(int)));
} else {
@@ -138,7 +138,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::stop()
m_currentOp = Cancel;
qCDebug(QT_BT_QNX) << "Stopping device search";
- ppsSendControlMessage("cancel_device_search",this);
+ ppsSendControlMessage("cancel_device_search", this);
if (m_rdNotifier) {
delete m_rdNotifier;
@@ -160,27 +160,33 @@ void QBluetoothDeviceDiscoveryAgentPrivate::remoteDevicesChanged(int fd)
QBluetoothAddress deviceAddr;
QString deviceName;
- if (!ppsReadRemoteDevice(fd, &ppsDecoder, &deviceAddr, &deviceName)) {
+ if (!ppsReadRemoteDevice(fd, &ppsDecoder, &deviceAddr, &deviceName))
return;
- }
bool paired = false;
int cod = 0;
int dev_type = 0;
int rssi = 0;
-
+ bool hasGatt = false;
pps_decoder_get_bool(&ppsDecoder, "paired", &paired);
pps_decoder_get_int(&ppsDecoder, "cod", &cod);
pps_decoder_get_int(&ppsDecoder, "dev_type", &dev_type);
pps_decoder_get_int(&ppsDecoder, "rssi", &rssi);
+ pps_decoder_push(&ppsDecoder, "gatt_available_services");
+ const char *next_service = 0;
+
+ for (int service_count=0; pps_decoder_get_string(&ppsDecoder, 0, &next_service ) == PPS_DECODER_OK; service_count++) {
+ hasGatt = true;
+ //qBluetoothDebug() << next_service;
+ }
pps_decoder_cleanup(&ppsDecoder);
QBluetoothDeviceInfo deviceInfo(deviceAddr, deviceName, cod);
deviceInfo.setRssi(rssi);
bool updated = false;
- //Prevent a device from being listed twice
- for (int i=0; i < discoveredDevices.size(); i++) {
+ // Prevent a device from being listed twice
+ for (int i = 0; i < discoveredDevices.size(); i++) {
if (discoveredDevices.at(i).address() == deviceInfo.address()) {
updated = true;
if (discoveredDevices.at(i) == deviceInfo) {
@@ -191,12 +197,26 @@ void QBluetoothDeviceDiscoveryAgentPrivate::remoteDevicesChanged(int fd)
}
}
}
- //Starts the timer again
+ // Starts the timer again
m_finishedTimer.start(7000);
if (!deviceAddr.isNull()) {
qCDebug(QT_BT_QNX) << "Device discovered: " << deviceName << deviceAddr.toString();
+ /* Looking for device type. Only Low energy devices will be added
+ * BT_DEVICE_TYPE_LE_PUBLIC is 0 --->LE device
+ * BT_DEVICE_TYPE_LE_PRIVATE is 1 ---> LE device
+ * BT_DEVICE_TYPE_REGULAR is 32
+ * BT_DEVICE_TYPE_UNKNOWN is 255
+ */
+ if (dev_type == 0 || dev_type == 1)
+ deviceInfo.setCoreConfigurations(QBluetoothDeviceInfo::LowEnergyCoreConfiguration);
+ else{
+ if (hasGatt)
+ deviceInfo.setCoreConfigurations(QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration);
+ else
+ deviceInfo.setCoreConfigurations(QBluetoothDeviceInfo::BaseRateCoreConfiguration);
+ }
discoveredDevices.append(deviceInfo);
- if (!updated)//We are not allowed to emit a signal with the updated version
+ if (!updated) // We are not allowed to emit a signal with the updated version
emit q_ptr->deviceDiscovered(discoveredDevices.last());
}
}
@@ -206,11 +226,11 @@ void QBluetoothDeviceDiscoveryAgentPrivate::controlReply(ppsResult result)
Q_Q(QBluetoothDeviceDiscoveryAgent);
if (result.msg == QStringLiteral("device_search") && m_currentOp == Start) {
if (result.dat.size() > 0 && result.dat.first() == QStringLiteral("EOK")) {
- //Do nothing. We can not be certain, that the device search is over yet
+ // Do nothing. We can not be certain, that the device search is over yet
} else if (result.error == 16) {
qCDebug(QT_BT_QNX) << "Could not start device inquire bc resource is busy";
- if (m_nextOp == None) { //We try again
- ppsSendControlMessage("cancel_device_search",this);
+ if (m_nextOp == None) { // We try again
+ ppsSendControlMessage("cancel_device_search", this);
QTimer::singleShot(5000, this, SLOT(startDeviceSearch()));
m_finishedTimer.start(20000);
}
@@ -219,17 +239,18 @@ void QBluetoothDeviceDiscoveryAgentPrivate::controlReply(ppsResult result)
qCWarning(QT_BT_QNX) << "A PPS Bluetooth error occurred:";
lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError;
errorString = result.errorMsg;
- Q_EMIT q_ptr->error(QBluetoothDeviceDiscoveryAgent::InputOutputError);
+ emit q_ptr->error(QBluetoothDeviceDiscoveryAgent::InputOutputError);
stop();
}
processNextOp();
- } else if (result.msg == QStringLiteral("cancel_device_search") && m_currentOp == Cancel && !isFinished) {
+ } else if (result.msg == QStringLiteral("cancel_device_search") && m_currentOp == Cancel
+ && !isFinished) {
qCDebug(QT_BT_QNX) << "Cancel device search";
-// if (!result.errorMsg.isEmpty()) {
-// lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError;
-// errorString = result.errorMsg;
-// q_ptr->error(QBluetoothDeviceDiscoveryAgent::InputOutputError);
-// }
+// if (!result.errorMsg.isEmpty()) {
+// lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError;
+// errorString = result.errorMsg;
+// q_ptr->error(QBluetoothDeviceDiscoveryAgent::InputOutputError);
+// }
emit q->canceled();
processNextOp();
}
@@ -237,9 +258,8 @@ void QBluetoothDeviceDiscoveryAgentPrivate::controlReply(ppsResult result)
void QBluetoothDeviceDiscoveryAgentPrivate::controlEvent(ppsResult result)
{
- if (result.msg == QStringLiteral("device_added")) {
+ if (result.msg == QStringLiteral("device_added"))
qCDebug(QT_BT_QNX) << "Device was added" << result.dat.first();
- }
}
void QBluetoothDeviceDiscoveryAgentPrivate::finished()
@@ -254,9 +274,8 @@ void QBluetoothDeviceDiscoveryAgentPrivate::finished()
void QBluetoothDeviceDiscoveryAgentPrivate::startDeviceSearch()
{
- if (m_currentOp == Start) {
- ppsSendControlMessage("device_search", this); //Try again
- }
+ if (m_currentOp == Start)
+ ppsSendControlMessage("device_search", this); // Try again
}
void QBluetoothDeviceDiscoveryAgentPrivate::processNextOp()
@@ -268,12 +287,10 @@ void QBluetoothDeviceDiscoveryAgentPrivate::processNextOp()
m_currentOp = m_nextOp;
m_nextOp = None;
- if (m_currentOp == Start) {
+ if (m_currentOp == Start)
start();
- } else if (m_currentOp == Cancel) {
+ else if (m_currentOp == Cancel)
stop();
- }
}
QT_END_NAMESPACE
-
diff --git a/src/bluetooth/qbluetoothdeviceinfo.cpp b/src/bluetooth/qbluetoothdeviceinfo.cpp
index f10ec133..6aa58a07 100644
--- a/src/bluetooth/qbluetoothdeviceinfo.cpp
+++ b/src/bluetooth/qbluetoothdeviceinfo.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -216,7 +208,6 @@ QT_BEGIN_NAMESPACE
\value HealthStepCounter A pedometer.
*/
-
/*!
\enum QBluetoothDeviceInfo::ServiceClass
@@ -247,20 +238,33 @@ QT_BEGIN_NAMESPACE
\value DataUnavailable No data is available.
*/
-QBluetoothDeviceInfoPrivate::QBluetoothDeviceInfoPrivate()
- : valid(false), cached(false), rssi(1),
- serviceClasses(QBluetoothDeviceInfo::NoService),
- majorDeviceClass(QBluetoothDeviceInfo::MiscellaneousDevice),
- minorDeviceClass(0),
- serviceUuidsCompleteness(QBluetoothDeviceInfo::DataUnavailable)
+/*!
+ \enum QBluetoothDeviceInfo::CoreConfiguration
+
+ This enum describes the configuration of the device.
+
+ \value BaseRateCoreConfiguration The device is a standard Bluetooth device.
+ \value BaseRateAndLowEnergyCoreConfiguration The device is a Bluetooth Smart device with support
+ for standard and Low Energy device.
+ \value LowEnergyCoreConfiguration The device is a Bluetooth Low Energy device.
+*/
+QBluetoothDeviceInfoPrivate::QBluetoothDeviceInfoPrivate() :
+ valid(false),
+ cached(false),
+ rssi(1),
+ serviceClasses(QBluetoothDeviceInfo::NoService),
+ majorDeviceClass(QBluetoothDeviceInfo::MiscellaneousDevice),
+ minorDeviceClass(0),
+ serviceUuidsCompleteness(QBluetoothDeviceInfo::DataUnavailable),
+ deviceCoreConfiguration(QBluetoothDeviceInfo::BaseRateCoreConfiguration)
{
}
/*!
Constructs an invalid QBluetoothDeviceInfo object.
*/
-QBluetoothDeviceInfo::QBluetoothDeviceInfo()
-: d_ptr(new QBluetoothDeviceInfoPrivate)
+QBluetoothDeviceInfo::QBluetoothDeviceInfo() :
+ d_ptr(new QBluetoothDeviceInfoPrivate)
{
}
@@ -278,8 +282,9 @@ QBluetoothDeviceInfo::QBluetoothDeviceInfo()
\row \li 13 - 23 \li 11 \li Service class.
\endtable
*/
-QBluetoothDeviceInfo::QBluetoothDeviceInfo(const QBluetoothAddress &address, const QString &name, quint32 classOfDevice)
-: d_ptr(new QBluetoothDeviceInfoPrivate)
+QBluetoothDeviceInfo::QBluetoothDeviceInfo(const QBluetoothAddress &address, const QString &name,
+ quint32 classOfDevice) :
+ d_ptr(new QBluetoothDeviceInfoPrivate)
{
Q_D(QBluetoothDeviceInfo);
@@ -300,8 +305,8 @@ QBluetoothDeviceInfo::QBluetoothDeviceInfo(const QBluetoothAddress &address, con
/*!
Constructs a QBluetoothDeviceInfo that is a copy of \a other.
*/
-QBluetoothDeviceInfo::QBluetoothDeviceInfo(const QBluetoothDeviceInfo &other)
-: d_ptr(new QBluetoothDeviceInfoPrivate)
+QBluetoothDeviceInfo::QBluetoothDeviceInfo(const QBluetoothDeviceInfo &other) :
+ d_ptr(new QBluetoothDeviceInfoPrivate)
{
*this = other;
}
@@ -323,6 +328,7 @@ bool QBluetoothDeviceInfo::isValid() const
return d->valid;
}
+
/*!
Returns the signal strength when the device was last scanned
*/
@@ -359,6 +365,7 @@ QBluetoothDeviceInfo &QBluetoothDeviceInfo::operator=(const QBluetoothDeviceInfo
d->serviceUuidsCompleteness = other.d_func()->serviceUuidsCompleteness;
d->serviceUuids = other.d_func()->serviceUuids;
d->rssi = other.d_func()->rssi;
+ d->deviceCoreConfiguration = other.d_func()->deviceCoreConfiguration;
return *this;
}
@@ -370,29 +377,30 @@ bool QBluetoothDeviceInfo::operator==(const QBluetoothDeviceInfo &other) const
{
Q_D(const QBluetoothDeviceInfo);
- if(d->cached != other.d_func()->cached)
+ if (d->cached != other.d_func()->cached)
+ return false;
+ if (d->valid != other.d_func()->valid)
return false;
- if(d->valid != other.d_func()->valid)
+ if (d->majorDeviceClass != other.d_func()->majorDeviceClass)
return false;
- if(d->majorDeviceClass != other.d_func()->majorDeviceClass)
+ if (d->minorDeviceClass != other.d_func()->minorDeviceClass)
return false;
- if(d->minorDeviceClass != other.d_func()->minorDeviceClass)
+ if (d->serviceClasses != other.d_func()->serviceClasses)
return false;
- if(d->serviceClasses != other.d_func()->serviceClasses)
+ if (d->name != other.d_func()->name)
return false;
- if(d->name != other.d_func()->name)
+ if (d->address != other.d_func()->address)
return false;
- if(d->address != other.d_func()->address)
+ if (d->serviceUuidsCompleteness != other.d_func()->serviceUuidsCompleteness)
return false;
- if(d->serviceUuidsCompleteness != other.d_func()->serviceUuidsCompleteness)
+ if (d->serviceUuids.count() != other.d_func()->serviceUuids.count())
return false;
- if(d->serviceUuids.count() != other.d_func()->serviceUuids.count())
+ if (d->serviceUuids != other.d_func()->serviceUuids)
return false;
- if(d->serviceUuids != other.d_func()->serviceUuids)
+ if (d->deviceCoreConfiguration != other.d_func()->deviceCoreConfiguration)
return false;
return true;
-
}
/*!
@@ -458,7 +466,8 @@ quint8 QBluetoothDeviceInfo::minorDeviceClass() const
/*!
Sets the list of service UUIDs to \a uuids and the completeness of the data to \a completeness.
*/
-void QBluetoothDeviceInfo::setServiceUuids(const QList<QBluetoothUuid> &uuids, DataCompleteness completeness)
+void QBluetoothDeviceInfo::setServiceUuids(const QList<QBluetoothUuid> &uuids,
+ DataCompleteness completeness)
{
Q_D(QBluetoothDeviceInfo);
@@ -498,6 +507,32 @@ QBluetoothDeviceInfo::DataCompleteness QBluetoothDeviceInfo::serviceUuidsComplet
}
/*!
+ Sets the CoreConfigurations of the device to \a coreConfigs. This will help to make a difference
+ between regular and Low Energy devices.
+
+ \sa coreConfigurations()
+*/
+void QBluetoothDeviceInfo::setCoreConfigurations(QBluetoothDeviceInfo::CoreConfigurations coreConfigs)
+{
+ Q_D(QBluetoothDeviceInfo);
+
+ d->deviceCoreConfiguration = coreConfigs;
+}
+
+/*!
+ Returns the configuration of the device. If device configuration is not set,
+ basic rate device configuration will be returned.
+
+ \sa setCoreConfigurations()
+*/
+QBluetoothDeviceInfo::CoreConfigurations QBluetoothDeviceInfo::coreConfigurations() const
+{
+ Q_D(const QBluetoothDeviceInfo);
+
+ return d->deviceCoreConfiguration;
+}
+
+/*!
Returns true if the QBluetoothDeviceInfo object is created from cached data.
*/
bool QBluetoothDeviceInfo::isCached() const
diff --git a/src/bluetooth/qbluetoothdeviceinfo.h b/src/bluetooth/qbluetoothdeviceinfo.h
index be605f8d..d97e54de 100644
--- a/src/bluetooth/qbluetoothdeviceinfo.h
+++ b/src/bluetooth/qbluetoothdeviceinfo.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -196,8 +188,16 @@ public:
DataUnavailable
};
+ enum CoreConfiguration {
+ LowEnergyCoreConfiguration = 0x01,
+ BaseRateCoreConfiguration = 0x02,
+ BaseRateAndLowEnergyCoreConfiguration = 0x03
+ };
+ Q_DECLARE_FLAGS(CoreConfigurations, CoreConfiguration)
+
QBluetoothDeviceInfo();
- QBluetoothDeviceInfo(const QBluetoothAddress &address, const QString &name, quint32 classOfDevice);
+ QBluetoothDeviceInfo(const QBluetoothAddress &address, const QString &name,
+ quint32 classOfDevice);
QBluetoothDeviceInfo(const QBluetoothDeviceInfo &other);
~QBluetoothDeviceInfo();
@@ -224,6 +224,9 @@ public:
QList<QBluetoothUuid> serviceUuids(DataCompleteness *completeness = 0) const;
DataCompleteness serviceUuidsCompleteness() const;
+ void setCoreConfigurations(QBluetoothDeviceInfo::CoreConfigurations coreConfigs);
+ QBluetoothDeviceInfo::CoreConfigurations coreConfigurations() const;
+
protected:
QBluetoothDeviceInfoPrivate *d_ptr;
diff --git a/src/bluetooth/qbluetoothdeviceinfo_p.h b/src/bluetooth/qbluetoothdeviceinfo_p.h
index f5d9f9d4..5b110993 100644
--- a/src/bluetooth/qbluetoothdeviceinfo_p.h
+++ b/src/bluetooth/qbluetoothdeviceinfo_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -80,6 +72,7 @@ public:
QBluetoothDeviceInfo::DataCompleteness serviceUuidsCompleteness;
QList<QBluetoothUuid> serviceUuids;
+ QBluetoothDeviceInfo::CoreConfigurations deviceCoreConfiguration;
};
QT_END_NAMESPACE
diff --git a/src/bluetooth/qbluetoothglobal.h b/src/bluetooth/qbluetoothglobal.h
index c2184eb4..9c64e24e 100644
--- a/src/bluetooth/qbluetoothglobal.h
+++ b/src/bluetooth/qbluetoothglobal.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothhostinfo.cpp b/src/bluetooth/qbluetoothhostinfo.cpp
index 00ce0680..cf720021 100644
--- a/src/bluetooth/qbluetoothhostinfo.cpp
+++ b/src/bluetooth/qbluetoothhostinfo.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -56,16 +48,16 @@ QT_BEGIN_NAMESPACE
/*!
Constrcuts a null QBluetoothHostInfo object.
*/
-QBluetoothHostInfo::QBluetoothHostInfo()
- : d_ptr(new QBluetoothHostInfoPrivate)
+QBluetoothHostInfo::QBluetoothHostInfo() :
+ d_ptr(new QBluetoothHostInfoPrivate)
{
}
/*!
Constrcuts a new QBluetoothHostInfo which is a copy of \a other.
*/
-QBluetoothHostInfo::QBluetoothHostInfo(const QBluetoothHostInfo &other)
- : d_ptr(new QBluetoothHostInfoPrivate)
+QBluetoothHostInfo::QBluetoothHostInfo(const QBluetoothHostInfo &other) :
+ d_ptr(new QBluetoothHostInfoPrivate)
{
Q_D(QBluetoothHostInfo);
diff --git a/src/bluetooth/qbluetoothhostinfo.h b/src/bluetooth/qbluetoothhostinfo.h
index b4428a82..abc70e7e 100644
--- a/src/bluetooth/qbluetoothhostinfo.h
+++ b/src/bluetooth/qbluetoothhostinfo.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -68,7 +60,6 @@ private:
QBluetoothHostInfoPrivate *d_ptr;
};
-
QT_END_NAMESPACE
#endif
diff --git a/src/bluetooth/qbluetoothhostinfo_p.h b/src/bluetooth/qbluetoothhostinfo_p.h
index 29943241..7eb46bd6 100644
--- a/src/bluetooth/qbluetoothhostinfo_p.h
+++ b/src/bluetooth/qbluetoothhostinfo_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -60,7 +52,9 @@ QT_BEGIN_NAMESPACE
class QBluetoothHostInfoPrivate
{
public:
- QBluetoothHostInfoPrivate() {}
+ QBluetoothHostInfoPrivate()
+ {
+ }
QBluetoothAddress m_address;
QString m_name;
diff --git a/src/bluetooth/qbluetoothlocaldevice.cpp b/src/bluetooth/qbluetoothlocaldevice.cpp
index 6560e135..fa700c6a 100644
--- a/src/bluetooth/qbluetoothlocaldevice.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -102,18 +94,17 @@ QT_BEGIN_NAMESPACE
*/
-namespace
+namespace {
+class LocalDeviceRegisterMetaTypes
{
- class LocalDeviceRegisterMetaTypes
+public:
+ LocalDeviceRegisterMetaTypes()
{
- public:
- LocalDeviceRegisterMetaTypes()
- {
- qRegisterMetaType<QBluetoothLocalDevice::HostMode>("QBluetoothLocalDevice::HostMode");
- qRegisterMetaType<QBluetoothLocalDevice::Pairing>("QBluetoothLocalDevice::Pairing");
- qRegisterMetaType<QBluetoothLocalDevice::Error>("QBluetoothLocalDevice::Error");
- }
- } _registerLocalDeviceMetaTypes;
+ qRegisterMetaType<QBluetoothLocalDevice::HostMode>("QBluetoothLocalDevice::HostMode");
+ qRegisterMetaType<QBluetoothLocalDevice::Pairing>("QBluetoothLocalDevice::Pairing");
+ qRegisterMetaType<QBluetoothLocalDevice::Error>("QBluetoothLocalDevice::Error");
+ }
+} _registerLocalDeviceMetaTypes;
}
/*!
@@ -241,7 +232,6 @@ bool QBluetoothLocalDevice::isValid() const
Returns the current bluetooth pairing status of \a address, if it's unpaired, paired, or paired and authorized.
*/
-
/*!
\fn QBluetoothLocalDevice::pairingDisplayConfirmation(const QBluetoothAddress &address, QString pin)
@@ -294,7 +284,6 @@ bool QBluetoothLocalDevice::isValid() const
Signal emitted if there's an exceptional \a error while pairing.
*/
-
/*!
\fn QBluetoothLocalDevice::QBluetoothLocalDevice(const QBluetoothAddress &address, QObject *parent = 0)
diff --git a/src/bluetooth/qbluetoothlocaldevice.h b/src/bluetooth/qbluetoothlocaldevice.h
index 597496b7..4c1e9016 100644
--- a/src/bluetooth/qbluetoothlocaldevice.h
+++ b/src/bluetooth/qbluetoothlocaldevice.h
@@ -1,45 +1,36 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
-
#ifndef QBLUETOOTHLOCALDEVICE_H
#define QBLUETOOTHLOCALDEVICE_H
@@ -76,9 +67,9 @@ public:
};
enum Error {
- NoError,
- PairingError,
- UnknownError = 100
+ NoError,
+ PairingError,
+ UnknownError = 100
};
QBluetoothLocalDevice(QObject *parent = 0);
explicit QBluetoothLocalDevice(const QBluetoothAddress &address, QObject *parent = 0);
diff --git a/src/bluetooth/qbluetoothlocaldevice_android.cpp b/src/bluetooth/qbluetoothlocaldevice_android.cpp
index a6d2b5d6..4c1b1d4e 100644
--- a/src/bluetooth/qbluetoothlocaldevice_android.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice_android.cpp
@@ -6,36 +6,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -55,23 +47,26 @@ QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(QT_BT_ANDROID)
QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate(
- QBluetoothLocalDevice *q, const QBluetoothAddress &address)
- : q_ptr(q), obj(0), pendingHostModeTransition(false)
+ QBluetoothLocalDevice *q, const QBluetoothAddress &address) :
+ q_ptr(q),
+ obj(0),
+ pendingHostModeTransition(false)
{
initialize(address);
receiver = new LocalDeviceBroadcastReceiver(q_ptr);
- QObject::connect(receiver, SIGNAL(hostModeStateChanged(QBluetoothLocalDevice::HostMode)),
- this, SLOT(processHostModeChange(QBluetoothLocalDevice::HostMode)));
- QObject::connect(receiver, SIGNAL(pairingStateChanged(QBluetoothAddress,QBluetoothLocalDevice::Pairing)),
- this, SLOT(processPairingStateChanged(QBluetoothAddress,QBluetoothLocalDevice::Pairing)));
- QObject::connect(receiver, SIGNAL(connectDeviceChanges(QBluetoothAddress,bool)),
- this, SLOT(processConnectDeviceChanges(QBluetoothAddress,bool)));
- QObject::connect(receiver, SIGNAL(pairingDisplayConfirmation(QBluetoothAddress,QString)),
- this, SLOT(processDisplayConfirmation(QBluetoothAddress,QString)));
+ connect(receiver, SIGNAL(hostModeStateChanged(QBluetoothLocalDevice::HostMode)),
+ this, SLOT(processHostModeChange(QBluetoothLocalDevice::HostMode)));
+ connect(receiver, SIGNAL(pairingStateChanged(QBluetoothAddress,
+ QBluetoothLocalDevice::Pairing)),
+ this, SLOT(processPairingStateChanged(QBluetoothAddress,
+ QBluetoothLocalDevice::Pairing)));
+ connect(receiver, SIGNAL(connectDeviceChanges(QBluetoothAddress, bool)),
+ this, SLOT(processConnectDeviceChanges(QBluetoothAddress, bool)));
+ connect(receiver, SIGNAL(pairingDisplayConfirmation(QBluetoothAddress, QString)),
+ this, SLOT(processDisplayConfirmation(QBluetoothAddress, QString)));
}
-
QBluetoothLocalDevicePrivate::~QBluetoothLocalDevicePrivate()
{
receiver->unregisterReceiver();
@@ -90,17 +85,21 @@ void QBluetoothLocalDevicePrivate::initialize(const QBluetoothAddress &address)
jclass btAdapterClass = env->FindClass("android/bluetooth/BluetoothAdapter");
if (btAdapterClass == NULL) {
- qCWarning(QT_BT_ANDROID) << "Native registration unable to find class android/bluetooth/BluetoothAdapter";
+ qCWarning(QT_BT_ANDROID)
+ << "Native registration unable to find class android/bluetooth/BluetoothAdapter";
return;
}
- jmethodID getDefaultAdapterID = env->GetStaticMethodID(btAdapterClass, "getDefaultAdapter", "()Landroid/bluetooth/BluetoothAdapter;");
+ jmethodID getDefaultAdapterID
+ = env->GetStaticMethodID(btAdapterClass, "getDefaultAdapter",
+ "()Landroid/bluetooth/BluetoothAdapter;");
if (getDefaultAdapterID == NULL) {
- qCWarning(QT_BT_ANDROID) << "Native registration unable to get method ID: getDefaultAdapter of android/bluetooth/BluetoothAdapter";
+ qCWarning(QT_BT_ANDROID)
+ << "Native registration unable to get method ID: " \
+ "getDefaultAdapter of android/bluetooth/BluetoothAdapter";
return;
}
-
jobject btAdapterObject = env->CallStaticObjectMethod(btAdapterClass, getDefaultAdapterID);
if (btAdapterObject == NULL) {
qCWarning(QT_BT_ANDROID) << "Device does not support Bluetooth";
@@ -112,14 +111,13 @@ void QBluetoothLocalDevicePrivate::initialize(const QBluetoothAddress &address)
if (!obj->isValid()) {
delete obj;
obj = 0;
- } else {
- if (!address.isNull()) {
- const QString localAddress = obj->callObjectMethod("getAddress", "()Ljava/lang/String;").toString();
- if (localAddress != address.toString()) {
- //passed address not local one -> invalid
- delete obj;
- obj = 0;
- }
+ } else if (!address.isNull()) {
+ const QString localAddress
+ = obj->callObjectMethod("getAddress", "()Ljava/lang/String;").toString();
+ if (localAddress != address.toString()) {
+ // passed address not local one -> invalid
+ delete obj;
+ obj = 0;
}
}
@@ -132,17 +130,16 @@ bool QBluetoothLocalDevicePrivate::isValid() const
return obj ? true : false;
}
-
void QBluetoothLocalDevicePrivate::processHostModeChange(QBluetoothLocalDevice::HostMode newMode)
{
if (!pendingHostModeTransition) {
- //if not in transition -> pass data on
+ // if not in transition -> pass data on
emit q_ptr->hostModeStateChanged(newMode);
return;
}
if (isValid() && newMode == QBluetoothLocalDevice::HostPoweredOff) {
- bool success = (bool) obj->callMethod<jboolean>("enable", "()Z");
+ bool success = (bool)obj->callMethod<jboolean>("enable", "()Z");
if (!success)
emit q_ptr->error(QBluetoothLocalDevice::UnknownError);
}
@@ -162,26 +159,25 @@ int QBluetoothLocalDevicePrivate::pendingPairing(const QBluetoothAddress &addres
return -1;
}
-
void QBluetoothLocalDevicePrivate::processPairingStateChanged(
- const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing)
+ const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing)
{
int index = pendingPairing(address);
if (index < 0)
- return; //ignore unrelated pairing signals
+ return; // ignore unrelated pairing signals
QPair<QBluetoothAddress, bool> entry = pendingPairings.takeAt(index);
- if ((entry.second && pairing == QBluetoothLocalDevice::Paired) ||
- (!entry.second && pairing == QBluetoothLocalDevice::Unpaired)) {
+ if ((entry.second && pairing == QBluetoothLocalDevice::Paired)
+ || (!entry.second && pairing == QBluetoothLocalDevice::Unpaired)) {
emit q_ptr->pairingFinished(address, pairing);
} else {
emit q_ptr->error(QBluetoothLocalDevice::PairingError);
}
-
}
-void QBluetoothLocalDevicePrivate::processConnectDeviceChanges(const QBluetoothAddress& address, bool isConnectEvent)
+void QBluetoothLocalDevicePrivate::processConnectDeviceChanges(const QBluetoothAddress &address,
+ bool isConnectEvent)
{
int index = -1;
for (int i = 0; i < connectedDevices.count(); i++) {
@@ -191,21 +187,22 @@ void QBluetoothLocalDevicePrivate::processConnectDeviceChanges(const QBluetoothA
}
}
- if (isConnectEvent) { //connect event
+ if (isConnectEvent) { // connect event
if (index >= 0)
return;
connectedDevices.append(address);
emit q_ptr->deviceConnected(address);
- } else { //disconnect event
+ } else { // disconnect event
connectedDevices.removeAll(address);
emit q_ptr->deviceDisconnected(address);
}
}
-void QBluetoothLocalDevicePrivate::processDisplayConfirmation(const QBluetoothAddress &address, const QString &pin)
+void QBluetoothLocalDevicePrivate::processDisplayConfirmation(const QBluetoothAddress &address,
+ const QString &pin)
{
- //only send pairing notification for pairing requests issued by
- //this QBluetoothLocalDevice instance
+ // only send pairing notification for pairing requests issued by
+ // this QBluetoothLocalDevice instance
if (pendingPairing(address) == -1)
return;
@@ -213,14 +210,14 @@ void QBluetoothLocalDevicePrivate::processDisplayConfirmation(const QBluetoothAd
emit q_ptr->pairingDisplayPinCode(address, pin);
}
-QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent)
-: QObject(parent),
+QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent) :
+ QObject(parent),
d_ptr(new QBluetoothLocalDevicePrivate(this, QBluetoothAddress()))
{
}
-QBluetoothLocalDevice::QBluetoothLocalDevice(const QBluetoothAddress &address, QObject *parent)
-: QObject(parent),
+QBluetoothLocalDevice::QBluetoothLocalDevice(const QBluetoothAddress &address, QObject *parent) :
+ QObject(parent),
d_ptr(new QBluetoothLocalDevicePrivate(this, address))
{
}
@@ -236,8 +233,10 @@ QString QBluetoothLocalDevice::name() const
QBluetoothAddress QBluetoothLocalDevice::address() const
{
QString result;
- if (d_ptr->adapter())
- result = d_ptr->adapter()->callObjectMethod("getAddress", "()Ljava/lang/String;").toString();
+ if (d_ptr->adapter()) {
+ result
+ = d_ptr->adapter()->callObjectMethod("getAddress", "()Ljava/lang/String;").toString();
+ }
QBluetoothAddress address(result);
return address;
@@ -249,7 +248,7 @@ void QBluetoothLocalDevice::powerOn()
return;
if (d_ptr->adapter()) {
- bool ret = (bool) d_ptr->adapter()->callMethod<jboolean>("enable", "()Z");
+ bool ret = (bool)d_ptr->adapter()->callMethod<jboolean>("enable", "()Z");
if (!ret)
emit error(QBluetoothLocalDevice::UnknownError);
}
@@ -267,23 +266,26 @@ void QBluetoothLocalDevice::setHostMode(QBluetoothLocalDevice::HostMode requeste
if (mode == QBluetoothLocalDevice::HostPoweredOff) {
bool success = false;
if (d_ptr->adapter())
- success = (bool) d_ptr->adapter()->callMethod<jboolean>("disable", "()Z");
+ success = (bool)d_ptr->adapter()->callMethod<jboolean>("disable", "()Z");
if (!success)
emit error(QBluetoothLocalDevice::UnknownError);
} else if (mode == QBluetoothLocalDevice::HostConnectable) {
if (hostMode() == QBluetoothLocalDevice::HostDiscoverable) {
- //cannot directly go from Discoverable to Connectable
- //we need to go to disabled mode and enable once disabling came through
+ // cannot directly go from Discoverable to Connectable
+ // we need to go to disabled mode and enable once disabling came through
setHostMode(QBluetoothLocalDevice::HostPoweredOff);
d_ptr->pendingHostModeTransition = true;
} else {
- QAndroidJniObject::callStaticMethod<void>("org/qtproject/qt5/android/bluetooth/QtBluetoothBroadcastReceiver", "setConnectable");
+ QAndroidJniObject::callStaticMethod<void>(
+ "org/qtproject/qt5/android/bluetooth/QtBluetoothBroadcastReceiver",
+ "setConnectable");
}
- } else if (mode == QBluetoothLocalDevice::HostDiscoverable ||
- mode == QBluetoothLocalDevice::HostDiscoverableLimitedInquiry) {
- QAndroidJniObject::callStaticMethod<void>("org/qtproject/qt5/android/bluetooth/QtBluetoothBroadcastReceiver", "setDiscoverable");
+ } else if (mode == QBluetoothLocalDevice::HostDiscoverable
+ || mode == QBluetoothLocalDevice::HostDiscoverableLimitedInquiry) {
+ QAndroidJniObject::callStaticMethod<void>(
+ "org/qtproject/qt5/android/bluetooth/QtBluetoothBroadcastReceiver", "setDiscoverable");
}
}
@@ -293,14 +295,14 @@ QBluetoothLocalDevice::HostMode QBluetoothLocalDevice::hostMode() const
jint scanMode = d_ptr->adapter()->callMethod<jint>("getScanMode");
switch (scanMode) {
- case 20: //BluetoothAdapter.SCAN_MODE_NONE
- return HostPoweredOff;
- case 21: //BluetoothAdapter.SCAN_MODE_CONNECTABLE
- return HostConnectable;
- case 23: //BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE
- return HostDiscoverable;
- default:
- break;
+ case 20: // BluetoothAdapter.SCAN_MODE_NONE
+ return HostPoweredOff;
+ case 21: // BluetoothAdapter.SCAN_MODE_CONNECTABLE
+ return HostConnectable;
+ case 23: // BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE
+ return HostDiscoverable;
+ default:
+ break;
}
}
@@ -309,24 +311,28 @@ QBluetoothLocalDevice::HostMode QBluetoothLocalDevice::hostMode() const
QList<QBluetoothHostInfo> QBluetoothLocalDevice::allDevices()
{
- //Android only supports max of one device (so far)
+ // Android only supports max of one device (so far)
QList<QBluetoothHostInfo> localDevices;
QAndroidJniEnvironment env;
jclass btAdapterClass = env->FindClass("android/bluetooth/BluetoothAdapter");
if (btAdapterClass == NULL) {
- qCWarning(QT_BT_ANDROID) << "Native registration unable to find class android/bluetooth/BluetoothAdapter";
+ qCWarning(QT_BT_ANDROID)
+ << "Native registration unable to find class android/bluetooth/BluetoothAdapter";
return localDevices;
}
- jmethodID getDefaultAdapterID = env->GetStaticMethodID(btAdapterClass, "getDefaultAdapter", "()Landroid/bluetooth/BluetoothAdapter;");
+ jmethodID getDefaultAdapterID
+ = env->GetStaticMethodID(btAdapterClass, "getDefaultAdapter",
+ "()Landroid/bluetooth/BluetoothAdapter;");
if (getDefaultAdapterID == NULL) {
- qCWarning(QT_BT_ANDROID) << "Native registration unable to get method ID: getDefaultAdapter of android/bluetooth/BluetoothAdapter";
+ qCWarning(QT_BT_ANDROID)
+ << "Native registration unable to get method ID: " \
+ "getDefaultAdapter of android/bluetooth/BluetoothAdapter";
env->DeleteLocalRef(btAdapterClass);
return localDevices;
}
-
jobject btAdapterObject = env->CallStaticObjectMethod(btAdapterClass, getDefaultAdapterID);
if (btAdapterObject == NULL) {
qCWarning(QT_BT_ANDROID) << "Device does not support Bluetooth";
@@ -338,7 +344,8 @@ QList<QBluetoothHostInfo> QBluetoothLocalDevice::allDevices()
if (o.isValid()) {
QBluetoothHostInfo info;
info.setName(o.callObjectMethod("getName", "()Ljava/lang/String;").toString());
- info.setAddress(QBluetoothAddress(o.callObjectMethod("getAddress", "()Ljava/lang/String;").toString()));
+ info.setAddress(QBluetoothAddress(o.callObjectMethod("getAddress",
+ "()Ljava/lang/String;").toString()));
localDevices.append(info);
}
@@ -352,61 +359,60 @@ void QBluetoothLocalDevice::requestPairing(const QBluetoothAddress &address, Pai
{
if (address.isNull()) {
QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
- Q_ARG(QBluetoothLocalDevice::Error,
- QBluetoothLocalDevice::PairingError));
+ Q_ARG(QBluetoothLocalDevice::Error,
+ QBluetoothLocalDevice::PairingError));
return;
}
const Pairing previousPairing = pairingStatus(address);
Pairing newPairing = pairing;
- if (pairing == AuthorizedPaired) //AuthorizedPaired same as Paired on Android
+ if (pairing == AuthorizedPaired) // AuthorizedPaired same as Paired on Android
newPairing = Paired;
if (previousPairing == newPairing) {
QMetaObject::invokeMethod(this, "pairingFinished", Qt::QueuedConnection,
- Q_ARG(QBluetoothAddress, address),
- Q_ARG(QBluetoothLocalDevice::Pairing, pairing));
+ Q_ARG(QBluetoothAddress, address),
+ Q_ARG(QBluetoothLocalDevice::Pairing, pairing));
return;
}
- //BluetoothDevice::createBond() requires Android API 19
+ // BluetoothDevice::createBond() requires Android API 19
if (QtAndroidPrivate::androidSdkVersion() < 19 || !d_ptr->adapter()) {
qCWarning(QT_BT_ANDROID) << "Unable to pair: requires Android API 19+";
QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
- Q_ARG(QBluetoothLocalDevice::Error,
- QBluetoothLocalDevice::PairingError));
+ Q_ARG(QBluetoothLocalDevice::Error,
+ QBluetoothLocalDevice::PairingError));
return;
}
QAndroidJniObject inputString = QAndroidJniObject::fromString(address.toString());
jboolean success = QAndroidJniObject::callStaticMethod<jboolean>(
- "org/qtproject/qt5/android/bluetooth/QtBluetoothBroadcastReceiver",
- "setPairingMode",
- "(Ljava/lang/String;Z)Z",
- inputString.object<jstring>(),
- newPairing == Paired ? JNI_TRUE : JNI_FALSE);
+ "org/qtproject/qt5/android/bluetooth/QtBluetoothBroadcastReceiver",
+ "setPairingMode",
+ "(Ljava/lang/String;Z)Z",
+ inputString.object<jstring>(),
+ newPairing == Paired ? JNI_TRUE : JNI_FALSE);
if (!success) {
QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
- Q_ARG(QBluetoothLocalDevice::Error,
- QBluetoothLocalDevice::PairingError));
+ Q_ARG(QBluetoothLocalDevice::Error,
+ QBluetoothLocalDevice::PairingError));
} else {
- d_ptr->pendingPairings.append(qMakePair(address,
- newPairing == Paired ? true : false));
+ d_ptr->pendingPairings.append(qMakePair(address, newPairing == Paired ? true : false));
}
-
}
-QBluetoothLocalDevice::Pairing QBluetoothLocalDevice::pairingStatus(const QBluetoothAddress &address) const
+QBluetoothLocalDevice::Pairing QBluetoothLocalDevice::pairingStatus(
+ const QBluetoothAddress &address) const
{
if (address.isNull() || !d_ptr->adapter())
return Unpaired;
QAndroidJniObject inputString = QAndroidJniObject::fromString(address.toString());
- QAndroidJniObject remoteDevice =
- d_ptr->adapter()->callObjectMethod("getRemoteDevice",
- "(Ljava/lang/String;)Landroid/bluetooth/BluetoothDevice;",
- inputString.object<jstring>());
+ QAndroidJniObject remoteDevice
+ = d_ptr->adapter()->callObjectMethod("getRemoteDevice",
+ "(Ljava/lang/String;)Landroid/bluetooth/BluetoothDevice;",
+ inputString.object<jstring>());
QAndroidJniEnvironment env;
if (env->ExceptionCheck()) {
env->ExceptionClear();
@@ -415,7 +421,7 @@ QBluetoothLocalDevice::Pairing QBluetoothLocalDevice::pairingStatus(const QBluet
jint bondState = remoteDevice.callMethod<jint>("getBondState");
switch (bondState) {
- case 12: //BluetoothDevice.BOND_BONDED
+ case 12: // BluetoothDevice.BOND_BONDED
return Paired;
default:
break;
@@ -432,7 +438,6 @@ void QBluetoothLocalDevice::pairingConfirmation(bool confirmation)
bool success = d_ptr->receiver->pairingConfirmation(confirmation);
if (!success)
emit error(PairingError);
-
}
QList<QBluetoothAddress> QBluetoothLocalDevice::connectedDevices() const
@@ -449,9 +454,9 @@ QList<QBluetoothAddress> QBluetoothLocalDevice::connectedDevices() const
* but at least it can complement our already detected connections.
*/
QAndroidJniObject connectedDevices = QAndroidJniObject::callStaticObjectMethod(
- "org/qtproject/qt5/android/bluetooth/QtBluetoothBroadcastReceiver",
- "getConnectedDevices",
- "()[Ljava/lang/String;");
+ "org/qtproject/qt5/android/bluetooth/QtBluetoothBroadcastReceiver",
+ "getConnectedDevices",
+ "()[Ljava/lang/String;");
if (!connectedDevices.isValid())
return d_ptr->connectedDevices;
diff --git a/src/bluetooth/qbluetoothlocaldevice_bluez.cpp b/src/bluetooth/qbluetoothlocaldevice_bluez.cpp
index d2c8ac1d..c7ee556d 100644
--- a/src/bluetooth/qbluetoothlocaldevice_bluez.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice_bluez.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,6 +42,11 @@
#include "bluez/adapter_p.h"
#include "bluez/agent_p.h"
#include "bluez/device_p.h"
+#include "bluez/bluez5_helper_p.h"
+#include "bluez/objectmanager_p.h"
+#include "bluez/properties_p.h"
+#include "bluez/adapter1_bluez5_p.h"
+#include "bluez/device1_bluez5_p.h"
QT_BEGIN_NAMESPACE
@@ -63,101 +60,137 @@ inline uint qHash(const QBluetoothAddress &address)
}
QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent) :
- QObject(parent), d_ptr(new QBluetoothLocalDevicePrivate(this))
+ QObject(parent),
+ d_ptr(new QBluetoothLocalDevicePrivate(this))
{
}
QBluetoothLocalDevice::QBluetoothLocalDevice(const QBluetoothAddress &address, QObject *parent) :
- QObject(parent), d_ptr(new QBluetoothLocalDevicePrivate(this, address))
+ QObject(parent),
+ d_ptr(new QBluetoothLocalDevicePrivate(this, address))
{
}
QString QBluetoothLocalDevice::name() const
{
- if (!d_ptr || !d_ptr->adapter)
- return QString();
+ if (d_ptr->adapter) {
+ QDBusPendingReply<QVariantMap> reply = d_ptr->adapter->GetProperties();
+ reply.waitForFinished();
+ if (reply.isError())
+ return QString();
- QDBusPendingReply<QVariantMap> reply = d_ptr->adapter->GetProperties();
- reply.waitForFinished();
- if (reply.isError())
- return QString();
+ return reply.value().value(QStringLiteral("Name")).toString();
+ } else if (d_ptr->adapterBluez5) {
+ return d_ptr->adapterBluez5->alias();
+ }
- return reply.value().value(QLatin1String("Name")).toString();
+ return QString();
}
QBluetoothAddress QBluetoothLocalDevice::address() const
{
- if (!d_ptr || !d_ptr->adapter)
- return QBluetoothAddress();
+ if (d_ptr->adapter) {
+ QDBusPendingReply<QVariantMap> reply = d_ptr->adapter->GetProperties();
+ reply.waitForFinished();
+ if (reply.isError())
+ return QBluetoothAddress();
- QDBusPendingReply<QVariantMap> reply = d_ptr->adapter->GetProperties();
- reply.waitForFinished();
- if (reply.isError())
- return QBluetoothAddress();
+ return QBluetoothAddress(reply.value().value(QStringLiteral("Address")).toString());
+ } else if (d_ptr->adapterBluez5) {
+ return QBluetoothAddress(d_ptr->adapterBluez5->address());
+ }
- return QBluetoothAddress(reply.value().value(QLatin1String("Address")).toString());
+ return QBluetoothAddress();
}
void QBluetoothLocalDevice::powerOn()
{
- if (!d_ptr || !d_ptr->adapter)
- return;
-
- d_ptr->adapter->SetProperty(QLatin1String("Powered"), QDBusVariant(QVariant::fromValue(true)));
+ if (d_ptr->adapter)
+ d_ptr->adapter->SetProperty(QStringLiteral("Powered"), QDBusVariant(QVariant::fromValue(true)));
+ else if (d_ptr->adapterBluez5)
+ d_ptr->adapterBluez5->setPowered(true);
}
void QBluetoothLocalDevice::setHostMode(QBluetoothLocalDevice::HostMode mode)
{
- if (!d_ptr || !d_ptr->adapter)
+ if (!isValid())
return;
+ Q_D(QBluetoothLocalDevice);
+
switch (mode) {
case HostDiscoverableLimitedInquiry:
case HostDiscoverable:
if (hostMode() == HostPoweredOff) {
- //We first have to wait for BT to be powered on,
- //then we can set the host mode correctly
- d_ptr->pendingHostModeChange = (int) HostDiscoverable;
- d_ptr->adapter->SetProperty(QStringLiteral("Powered"),
+ // We first have to wait for BT to be powered on,
+ // then we can set the host mode correctly
+ d->pendingHostModeChange = static_cast<int>(HostDiscoverable);
+ if (d->adapter) {
+ d->adapter->SetProperty(QStringLiteral("Powered"),
QDBusVariant(QVariant::fromValue(true)));
+ } else {
+ d->adapterBluez5->setPowered(true);
+ }
} else {
- d_ptr->adapter->SetProperty(QStringLiteral("Discoverable"),
- QDBusVariant(QVariant::fromValue(true)));
+ if (d->adapter) {
+ d->adapter->SetProperty(QStringLiteral("Discoverable"),
+ QDBusVariant(QVariant::fromValue(true)));
+ } else {
+ d->adapterBluez5->setDiscoverable(true);
+ }
}
break;
case HostConnectable:
if (hostMode() == HostPoweredOff) {
- d_ptr->pendingHostModeChange = (int) HostConnectable;
- d_ptr->adapter->SetProperty(QStringLiteral("Powered"),
+ d->pendingHostModeChange = static_cast<int>(HostConnectable);
+ if (d->adapter) {
+ d->adapter->SetProperty(QStringLiteral("Powered"),
QDBusVariant(QVariant::fromValue(true)));
+ } else {
+ d->adapterBluez5->setPowered(true);
+ }
} else {
- d_ptr->adapter->SetProperty(QStringLiteral("Discoverable"),
- QDBusVariant(QVariant::fromValue(false)));
+ if (d->adapter) {
+ d->adapter->SetProperty(QStringLiteral("Discoverable"),
+ QDBusVariant(QVariant::fromValue(false)));
+ } else {
+ d->adapterBluez5->setDiscoverable(false);
+ }
}
break;
case HostPoweredOff:
- d_ptr->adapter->SetProperty(QLatin1String("Powered"),
- QDBusVariant(QVariant::fromValue(false)));
+ if (d->adapter) {
+ d->adapter->SetProperty(QStringLiteral("Powered"),
+ QDBusVariant(QVariant::fromValue(false)));
+ } else {
+ d->adapterBluez5->setPowered(false);
+ }
break;
}
}
QBluetoothLocalDevice::HostMode QBluetoothLocalDevice::hostMode() const
{
- if (!d_ptr || !d_ptr->adapter)
- return HostPoweredOff;
-
- QDBusPendingReply<QVariantMap> reply = d_ptr->adapter->GetProperties();
- reply.waitForFinished();
- if (reply.isError())
- return HostPoweredOff;
-
- if (!reply.value().value(QLatin1String("Powered")).toBool())
- return HostPoweredOff;
- else if (reply.value().value(QLatin1String("Discoverable")).toBool())
- return HostDiscoverable;
- else if (reply.value().value(QLatin1String("Powered")).toBool())
- return HostConnectable;
+ if (d_ptr->adapter) {
+ QDBusPendingReply<QVariantMap> reply = d_ptr->adapter->GetProperties();
+ reply.waitForFinished();
+ if (reply.isError())
+ return HostPoweredOff;
+
+ if (!reply.value().value(QStringLiteral("Powered")).toBool())
+ return HostPoweredOff;
+ else if (reply.value().value(QStringLiteral("Discoverable")).toBool())
+ return HostDiscoverable;
+ else if (reply.value().value(QStringLiteral("Powered")).toBool())
+ return HostConnectable;
+ } else if (d_ptr->adapterBluez5) {
+ if (!d_ptr->adapterBluez5->powered())
+ return HostPoweredOff;
+ else if (d_ptr->adapterBluez5->discoverable())
+ return HostDiscoverable;
+ else if (d_ptr->adapterBluez5->powered())
+ return HostConnectable;
+ }
return HostPoweredOff;
}
@@ -171,196 +204,483 @@ QList<QBluetoothHostInfo> QBluetoothLocalDevice::allDevices()
{
QList<QBluetoothHostInfo> localDevices;
- OrgBluezManagerInterface manager(QLatin1String("org.bluez"), QLatin1String("/"),
- QDBusConnection::systemBus());
-
- QDBusPendingReply<QList<QDBusObjectPath> > reply = manager.ListAdapters();
- reply.waitForFinished();
- if (reply.isError())
- return localDevices;
-
-
- foreach (const QDBusObjectPath &path, reply.value()) {
- QBluetoothHostInfo hostinfo;
- OrgBluezAdapterInterface adapter(QLatin1String("org.bluez"), path.path(),
+ if (isBluez5()) {
+ OrgFreedesktopDBusObjectManagerInterface manager(QStringLiteral("org.bluez"),
+ QStringLiteral("/"),
+ QDBusConnection::systemBus());
+ QDBusPendingReply<ManagedObjectList> reply = manager.GetManagedObjects();
+ reply.waitForFinished();
+ if (reply.isError())
+ return localDevices;
+
+ foreach (const QDBusObjectPath &path, reply.value().keys()) {
+ const InterfaceList ifaceList = reply.value().value(path);
+ foreach (const QString &iface, ifaceList.keys()) {
+ if (iface == QStringLiteral("org.bluez.Adapter1")) {
+ QBluetoothHostInfo hostInfo;
+ const QString temp = ifaceList.value(iface).value(QStringLiteral("Address")).toString();
+
+ hostInfo.setAddress(QBluetoothAddress(temp));
+ if (hostInfo.address().isNull())
+ continue;
+ hostInfo.setName(ifaceList.value(iface).value(QStringLiteral("Name")).toString());
+ localDevices.append(hostInfo);
+ }
+ }
+ }
+ } else {
+ OrgBluezManagerInterface manager(QStringLiteral("org.bluez"), QStringLiteral("/"),
QDBusConnection::systemBus());
- QDBusPendingReply<QVariantMap> reply = adapter.GetProperties();
+ QDBusPendingReply<QList<QDBusObjectPath> > reply = manager.ListAdapters();
reply.waitForFinished();
if (reply.isError())
- continue;
+ return localDevices;
- hostinfo.setAddress(QBluetoothAddress(reply.value().value(QLatin1String("Address")).toString()));
- hostinfo.setName(reply.value().value(QLatin1String("Name")).toString());
+ foreach (const QDBusObjectPath &path, reply.value()) {
+ QBluetoothHostInfo hostinfo;
+ OrgBluezAdapterInterface adapter(QStringLiteral("org.bluez"), path.path(),
+ QDBusConnection::systemBus());
+
+ QDBusPendingReply<QVariantMap> reply = adapter.GetProperties();
+ reply.waitForFinished();
+ if (reply.isError())
+ continue;
- localDevices.append(hostinfo);
+ hostinfo.setAddress(QBluetoothAddress(
+ reply.value().value(QStringLiteral("Address")).toString()));
+ hostinfo.setName(reply.value().value(QStringLiteral("Name")).toString());
+
+ localDevices.append(hostinfo);
+ }
}
return localDevices;
}
-static inline OrgBluezDeviceInterface *getDevice(const QBluetoothAddress &address, QBluetoothLocalDevicePrivate *d_ptr)
+static inline OrgBluezDeviceInterface *getDevice(const QBluetoothAddress &address,
+ QBluetoothLocalDevicePrivate *d_ptr)
{
if (!d_ptr || !d_ptr->adapter)
return 0;
QDBusPendingReply<QDBusObjectPath> reply = d_ptr->adapter->FindDevice(address.toString());
reply.waitForFinished();
- if(reply.isError()){
+ if (reply.isError()) {
qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << "reply failed" << reply.error();
return 0;
}
QDBusObjectPath path = reply.value();
- return new OrgBluezDeviceInterface(QLatin1String("org.bluez"), path.path(),
- QDBusConnection::systemBus());
+ return new OrgBluezDeviceInterface(QStringLiteral("org.bluez"), path.path(),
+ QDBusConnection::systemBus());
}
void QBluetoothLocalDevice::requestPairing(const QBluetoothAddress &address, Pairing pairing)
{
if (!isValid() || address.isNull()) {
QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
- Q_ARG(QBluetoothLocalDevice::Error, QBluetoothLocalDevice::PairingError));
+ Q_ARG(QBluetoothLocalDevice::Error,
+ QBluetoothLocalDevice::PairingError));
return;
}
const Pairing current_pairing = pairingStatus(address);
if (current_pairing == pairing) {
- QMetaObject::invokeMethod(this, "pairingFinished", Qt::QueuedConnection, Q_ARG(QBluetoothAddress, address),
+ if (d_ptr->adapterBluez5) {
+ // A possibly running discovery or pending pairing request should be canceled
+ if (d_ptr->pairingDiscoveryTimer && d_ptr->pairingDiscoveryTimer->isActive()) {
+ d_ptr->pairingDiscoveryTimer->stop();
+ }
+
+ if (d_ptr->pairingTarget) {
+ qCDebug(QT_BT_BLUEZ) << "Cancelling pending pairing request to" << d_ptr->pairingTarget->address();
+ QDBusPendingReply<> cancelReply = d_ptr->pairingTarget->CancelPairing();
+ cancelReply.waitForFinished();
+ delete d_ptr->pairingTarget;
+ d_ptr->pairingTarget = 0;
+ }
+
+ }
+ QMetaObject::invokeMethod(this, "pairingFinished", Qt::QueuedConnection,
+ Q_ARG(QBluetoothAddress, address),
Q_ARG(QBluetoothLocalDevice::Pairing, pairing));
return;
}
- if(pairing == Paired || pairing == AuthorizedPaired) {
+ if (d_ptr->adapterBluez5) {
+ d_ptr->requestPairingBluez5(address, pairing);
+ return;
+ }
+ if (pairing == Paired || pairing == AuthorizedPaired) {
d_ptr->address = address;
d_ptr->pairing = pairing;
- if(!d_ptr->agent){
+ if (!d_ptr->agent) {
d_ptr->agent = new OrgBluezAgentAdaptor(d_ptr);
bool res = QDBusConnection::systemBus().registerObject(d_ptr->agent_path, d_ptr);
- if(!res){
+ if (!res) {
QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
- Q_ARG(QBluetoothLocalDevice::Error, QBluetoothLocalDevice::PairingError));
+ Q_ARG(QBluetoothLocalDevice::Error,
+ QBluetoothLocalDevice::PairingError));
qCWarning(QT_BT_BLUEZ) << "Failed to register agent";
return;
}
}
- if(current_pairing == Paired && pairing == AuthorizedPaired){
+ if (current_pairing == Paired && pairing == AuthorizedPaired) {
OrgBluezDeviceInterface *device = getDevice(address, d_ptr);
if (!device) {
QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
- Q_ARG(QBluetoothLocalDevice::Error, QBluetoothLocalDevice::PairingError));
+ Q_ARG(QBluetoothLocalDevice::Error,
+ QBluetoothLocalDevice::PairingError));
return;
}
- QDBusPendingReply<> deviceReply = device->SetProperty(QLatin1String("Trusted"), QDBusVariant(true));
+ QDBusPendingReply<> deviceReply
+ = device->SetProperty(QStringLiteral("Trusted"), QDBusVariant(true));
deviceReply.waitForFinished();
- if(deviceReply.isError()){
+ if (deviceReply.isError()) {
qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << "reply failed" << deviceReply.error();
QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
- Q_ARG(QBluetoothLocalDevice::Error, QBluetoothLocalDevice::PairingError));
+ Q_ARG(QBluetoothLocalDevice::Error,
+ QBluetoothLocalDevice::PairingError));
return;
}
delete device;
- QMetaObject::invokeMethod(this, "pairingFinished", Qt::QueuedConnection, Q_ARG(QBluetoothAddress, address),
- Q_ARG(QBluetoothLocalDevice::Pairing, QBluetoothLocalDevice::AuthorizedPaired));
- }
- else if(current_pairing == AuthorizedPaired && pairing == Paired){
+ QMetaObject::invokeMethod(this, "pairingFinished", Qt::QueuedConnection,
+ Q_ARG(QBluetoothAddress, address),
+ Q_ARG(QBluetoothLocalDevice::Pairing,
+ QBluetoothLocalDevice::AuthorizedPaired));
+ } else if (current_pairing == AuthorizedPaired && pairing == Paired) {
OrgBluezDeviceInterface *device = getDevice(address, d_ptr);
if (!device) {
QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
- Q_ARG(QBluetoothLocalDevice::Error, QBluetoothLocalDevice::PairingError));
+ Q_ARG(QBluetoothLocalDevice::Error,
+ QBluetoothLocalDevice::PairingError));
return;
}
- QDBusPendingReply<> deviceReply = device->SetProperty(QLatin1String("Trusted"), QDBusVariant(false));
+ QDBusPendingReply<> deviceReply
+ = device->SetProperty(QStringLiteral("Trusted"), QDBusVariant(false));
deviceReply.waitForFinished();
- if(deviceReply.isError()){
+ if (deviceReply.isError()) {
qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << "reply failed" << deviceReply.error();
QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
- Q_ARG(QBluetoothLocalDevice::Error, QBluetoothLocalDevice::PairingError));
+ Q_ARG(QBluetoothLocalDevice::Error,
+ QBluetoothLocalDevice::PairingError));
return;
}
delete device;
- QMetaObject::invokeMethod(this, "pairingFinished", Qt::QueuedConnection, Q_ARG(QBluetoothAddress, address),
- Q_ARG(QBluetoothLocalDevice::Pairing, QBluetoothLocalDevice::Paired));
- }
- else {
- QDBusPendingReply<QDBusObjectPath> reply =
- d_ptr->adapter->CreatePairedDevice(address.toString(),
- QDBusObjectPath(d_ptr->agent_path),
- QLatin1String("NoInputNoOutput"));
+ QMetaObject::invokeMethod(this, "pairingFinished", Qt::QueuedConnection,
+ Q_ARG(QBluetoothAddress, address),
+ Q_ARG(QBluetoothLocalDevice::Pairing,
+ QBluetoothLocalDevice::Paired));
+ } else {
+ QDBusPendingReply<QDBusObjectPath> reply
+ = d_ptr->adapter->CreatePairedDevice(address.toString(),
+ QDBusObjectPath(d_ptr->agent_path),
+ QStringLiteral("NoInputNoOutput"));
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
- connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), d_ptr, SLOT(pairingCompleted(QDBusPendingCallWatcher*)));
+ connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher *)), d_ptr,
+ SLOT(pairingCompleted(QDBusPendingCallWatcher *)));
- if(reply.isError())
+ if (reply.isError())
qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << reply.error() << d_ptr->agent_path;
}
- }
- else if(pairing == Unpaired) {
- QDBusPendingReply<QDBusObjectPath> reply = this->d_ptr->adapter->FindDevice(address.toString());
+ } else if (pairing == Unpaired) {
+ QDBusPendingReply<QDBusObjectPath> reply = this->d_ptr->adapter->FindDevice(
+ address.toString());
reply.waitForFinished();
- if(reply.isError()) {
+ if (reply.isError()) {
qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << "failed to find device" << reply.error();
QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
- Q_ARG(QBluetoothLocalDevice::Error, QBluetoothLocalDevice::PairingError));
+ Q_ARG(QBluetoothLocalDevice::Error,
+ QBluetoothLocalDevice::PairingError));
return;
}
QDBusPendingReply<> removeReply = this->d_ptr->adapter->RemoveDevice(reply.value());
removeReply.waitForFinished();
- if(removeReply.isError()){
- qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << "failed to remove device" << removeReply.error();
+ if (removeReply.isError()) {
+ qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << "failed to remove device"
+ << removeReply.error();
QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
- Q_ARG(QBluetoothLocalDevice::Error, QBluetoothLocalDevice::PairingError));
+ Q_ARG(QBluetoothLocalDevice::Error,
+ QBluetoothLocalDevice::PairingError));
} else {
- QMetaObject::invokeMethod(this, "pairingFinished", Qt::QueuedConnection, Q_ARG(QBluetoothAddress, address),
- Q_ARG(QBluetoothLocalDevice::Pairing, QBluetoothLocalDevice::Unpaired));
+ QMetaObject::invokeMethod(this, "pairingFinished", Qt::QueuedConnection,
+ Q_ARG(QBluetoothAddress, address),
+ Q_ARG(QBluetoothLocalDevice::Pairing,
+ QBluetoothLocalDevice::Unpaired));
}
}
- return;
}
-QBluetoothLocalDevice::Pairing QBluetoothLocalDevice::pairingStatus(const QBluetoothAddress &address) const
+void QBluetoothLocalDevicePrivate::requestPairingBluez5(const QBluetoothAddress &targetAddress,
+ QBluetoothLocalDevice::Pairing targetPairing)
+{
+ if (!managerBluez5)
+ return;
+
+ //are we already discovering something? -> abort those attempts
+ if (pairingDiscoveryTimer && pairingDiscoveryTimer->isActive()) {
+ pairingDiscoveryTimer->stop();
+ QtBluezDiscoveryManager::instance()->unregisterDiscoveryInterest(
+ adapterBluez5->path());
+ }
+
+ if (pairingTarget) {
+ delete pairingTarget;
+ pairingTarget = 0;
+ }
+
+ // pairing implies that the device was found
+ // if we cannot find it we may have to turn on Discovery mode for a limited amount of time
+
+ // check device doesn't already exist
+ QDBusPendingReply<ManagedObjectList> reply = managerBluez5->GetManagedObjects();
+ reply.waitForFinished();
+ if (reply.isError()) {
+ emit q_ptr->error(QBluetoothLocalDevice::PairingError);
+ return;
+ }
+
+
+ foreach (const QDBusObjectPath &path, reply.value().keys()) {
+ const InterfaceList ifaceList = reply.value().value(path);
+ foreach (const QString &iface, ifaceList.keys()) {
+
+ if (iface == QStringLiteral("org.bluez.Device1")) {
+
+ OrgBluezDevice1Interface device(QStringLiteral("org.bluez"),
+ path.path(),
+ QDBusConnection::systemBus());
+ if (targetAddress == QBluetoothAddress(device.address())) {
+ qCDebug(QT_BT_BLUEZ) << "Initiating direct pair to" << targetAddress.toString();
+ //device exist -> directly work with it
+ processPairingBluez5(path.path(), targetPairing);
+ return;
+ }
+ }
+ }
+ }
+
+ //no device matching -> turn on discovery
+ QtBluezDiscoveryManager::instance()->registerDiscoveryInterest(adapterBluez5->path());
+
+ address = targetAddress;
+ pairing = targetPairing;
+ if (!pairingDiscoveryTimer) {
+ pairingDiscoveryTimer = new QTimer(this);
+ pairingDiscoveryTimer->setSingleShot(true);
+ pairingDiscoveryTimer->setInterval(20000); //20s
+ connect(pairingDiscoveryTimer, SIGNAL(timeout()),
+ SLOT(pairingDiscoveryTimedOut()));
+ }
+
+ qCDebug(QT_BT_BLUEZ) << "Initiating discovery for pairing on" << targetAddress.toString();
+ pairingDiscoveryTimer->start();
+}
+
+/*!
+ * \internal
+ *
+ * Found a matching device. Now we must ensure its pairing/trusted state is as desired.
+ * If it has to be paired then we need another roundtrip through the event loop
+ * while we wait for the user to accept the pairing dialogs.
+ */
+void QBluetoothLocalDevicePrivate::processPairingBluez5(const QString &objectPath,
+ QBluetoothLocalDevice::Pairing target)
+{
+ if (pairingTarget)
+ delete pairingTarget;
+
+ //stop possibly running discovery
+ if (pairingDiscoveryTimer && pairingDiscoveryTimer->isActive()) {
+ pairingDiscoveryTimer->stop();
+
+ QtBluezDiscoveryManager::instance()->unregisterDiscoveryInterest(
+ adapterBluez5->path());
+ }
+
+ pairingTarget = new OrgBluezDevice1Interface(QStringLiteral("org.bluez"), objectPath,
+ QDBusConnection::systemBus(), this);
+ const QBluetoothAddress targetAddress(pairingTarget->address());
+
+ Q_Q(QBluetoothLocalDevice);
+
+ switch (target) {
+ case QBluetoothLocalDevice::Unpaired: {
+ delete pairingTarget;
+ pairingTarget = 0;
+
+ QDBusPendingReply<> removeReply = adapterBluez5->RemoveDevice(QDBusObjectPath(objectPath));
+ removeReply.waitForFinished();
+
+ if (removeReply.isError())
+ emit q->error(QBluetoothLocalDevice::PairingError);
+ else
+ emit q->pairingFinished(targetAddress, QBluetoothLocalDevice::Unpaired);
+
+ break;
+ }
+ case QBluetoothLocalDevice::Paired:
+ case QBluetoothLocalDevice::AuthorizedPaired:
+ pairing = target;
+
+ if (!pairingTarget->paired()) {
+ qCDebug(QT_BT_BLUEZ) << "Sending pairing request to" << pairingTarget->address();
+ //initiate the pairing
+ QDBusPendingReply<> pairReply = pairingTarget->Pair();
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pairReply, this);
+ connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ SLOT(pairingCompleted(QDBusPendingCallWatcher*)));
+ return;
+ }
+
+ //already paired but Trust level must be adjusted
+ if (target == QBluetoothLocalDevice::AuthorizedPaired && !pairingTarget->trusted())
+ pairingTarget->setTrusted(true);
+ else if (target == QBluetoothLocalDevice::Paired && pairingTarget->trusted())
+ pairingTarget->setTrusted(false);
+
+ delete pairingTarget;
+ pairingTarget = 0;
+
+ emit q->pairingFinished(targetAddress, target);
+
+ break;
+ default:
+ break;
+ }
+}
+
+void QBluetoothLocalDevicePrivate::pairingDiscoveryTimedOut()
+{
+ qCWarning(QT_BT_BLUEZ) << "Discovery for pairing purposes failed. Cannot find parable device.";
+
+ QtBluezDiscoveryManager::instance()->unregisterDiscoveryInterest(
+ adapterBluez5->path());
+
+ emit q_ptr->error(QBluetoothLocalDevice::PairingError);
+}
+
+QBluetoothLocalDevice::Pairing QBluetoothLocalDevice::pairingStatus(
+ const QBluetoothAddress &address) const
{
if (address.isNull())
return Unpaired;
- OrgBluezDeviceInterface *device = getDevice(address, d_ptr);
+ if (d_ptr->adapter) {
+ OrgBluezDeviceInterface *device = getDevice(address, d_ptr);
- if(!device)
- return Unpaired;
+ if (!device)
+ return Unpaired;
- QDBusPendingReply<QVariantMap> deviceReply = device->GetProperties();
- deviceReply.waitForFinished();
- if (deviceReply.isError())
- return Unpaired;
+ QDBusPendingReply<QVariantMap> deviceReply = device->GetProperties();
+ deviceReply.waitForFinished();
+ if (deviceReply.isError())
+ return Unpaired;
- QVariantMap map = deviceReply.value();
+ QVariantMap map = deviceReply.value();
- if (map.value(QLatin1String("Trusted")).toBool() && map.value(QLatin1String("Paired")).toBool())
- return AuthorizedPaired;
- else if (map.value(QLatin1String("Paired")).toBool())
+ if (map.value(QStringLiteral("Trusted")).toBool() && map.value(QStringLiteral("Paired")).toBool())
+ return AuthorizedPaired;
+ else if (map.value(QStringLiteral("Paired")).toBool())
return Paired;
- else
+ } else if (d_ptr->adapterBluez5) {
+
+ QDBusPendingReply<ManagedObjectList> reply = d_ptr->managerBluez5->GetManagedObjects();
+ reply.waitForFinished();
+ if (reply.isError())
return Unpaired;
+
+ foreach (const QDBusObjectPath &path, reply.value().keys()) {
+ const InterfaceList ifaceList = reply.value().value(path);
+ foreach (const QString &iface, ifaceList.keys()) {
+
+ if (iface == QStringLiteral("org.bluez.Device1")) {
+
+ OrgBluezDevice1Interface device(QStringLiteral("org.bluez"),
+ path.path(),
+ QDBusConnection::systemBus());
+
+ if (address == QBluetoothAddress(device.address())) {
+ if (device.trusted() && device.paired())
+ return AuthorizedPaired;
+ else if (device.paired())
+ return Paired;
+ else
+ return Unpaired;
+ }
+ }
+ }
+ }
+ }
+
+ return Unpaired;
}
-QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate(QBluetoothLocalDevice *q, QBluetoothAddress address)
- : adapter(0), agent(0), manager(0),
- localAddress(address), pendingHostModeChange(-1), msgConnection(0), q_ptr(q)
+QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate(QBluetoothLocalDevice *q,
+ QBluetoothAddress address) :
+ adapter(0),
+ adapterBluez5(0),
+ adapterProperties(0),
+ managerBluez5(0),
+ agent(0),
+ manager(0),
+ localAddress(address),
+ pairingTarget(0),
+ pairingDiscoveryTimer(0),
+ pendingHostModeChange(-1),
+ msgConnection(0),
+ q_ptr(q)
{
- initializeAdapter();
+ if (isBluez5())
+ initializeAdapterBluez5();
+ else
+ initializeAdapter();
+
connectDeviceChanges();
}
void QBluetoothLocalDevicePrivate::connectDeviceChanges()
{
- if (adapter) { //invalid QBluetoothLocalDevice due to wrong local adapter address
+ if (adapter) { // invalid QBluetoothLocalDevice due to wrong local adapter address
createCache();
- connect(adapter, SIGNAL(PropertyChanged(QString,QDBusVariant)), SLOT(PropertyChanged(QString,QDBusVariant)));
- connect(adapter, SIGNAL(DeviceCreated(QDBusObjectPath)), SLOT(_q_deviceCreated(QDBusObjectPath)));
- connect(adapter, SIGNAL(DeviceRemoved(QDBusObjectPath)), SLOT(_q_deviceRemoved(QDBusObjectPath)));
+ connect(adapter, SIGNAL(PropertyChanged(QString, QDBusVariant)),
+ SLOT(PropertyChanged(QString, QDBusVariant)));
+ connect(adapter, SIGNAL(DeviceCreated(QDBusObjectPath)),
+ SLOT(_q_deviceCreated(QDBusObjectPath)));
+ connect(adapter, SIGNAL(DeviceRemoved(QDBusObjectPath)),
+ SLOT(_q_deviceRemoved(QDBusObjectPath)));
+ } else if (adapterBluez5 && managerBluez5) {
+ //setup property change notifications for all existing devices
+ QDBusPendingReply<ManagedObjectList> reply = managerBluez5->GetManagedObjects();
+ reply.waitForFinished();
+ if (reply.isError())
+ return;
+
+ OrgFreedesktopDBusPropertiesInterface *monitor = 0;
+ foreach (const QDBusObjectPath &path, reply.value().keys()) {
+ const InterfaceList ifaceList = reply.value().value(path);
+ foreach (const QString &iface, ifaceList.keys()) {
+ if (iface == QStringLiteral("org.bluez.Device1")) {
+ monitor = new OrgFreedesktopDBusPropertiesInterface(QStringLiteral("org.bluez"),
+ path.path(),
+ QDBusConnection::systemBus(), this);
+ connect(monitor, SIGNAL(PropertiesChanged(QString,QVariantMap,QStringList)),
+ SLOT(PropertiesChanged(QString,QVariantMap,QStringList)));
+ deviceChangeMonitors.insert(path.path(), monitor);
+
+ const QVariantMap ifaceValues = ifaceList.value(QStringLiteral("org.bluez.Device1"));
+ if (ifaceValues.value(QStringLiteral("Connected"), false).toBool()) {
+ QBluetoothAddress address(ifaceValues.value(QStringLiteral("Address")).toString());
+ connectedDevicesSet.insert(address);
+ }
+ }
+ }
+ }
}
}
@@ -368,9 +688,15 @@ QBluetoothLocalDevicePrivate::~QBluetoothLocalDevicePrivate()
{
delete msgConnection;
delete adapter;
+ delete adapterBluez5;
+ delete adapterProperties;
+ delete managerBluez5;
delete agent;
+ delete pairingTarget;
delete manager;
+
qDeleteAll(devices);
+ qDeleteAll(deviceChangeMonitors);
}
void QBluetoothLocalDevicePrivate::initializeAdapter()
@@ -388,7 +714,8 @@ void QBluetoothLocalDevicePrivate::initializeAdapter()
if (reply.isError())
return;
- adapter = new OrgBluezAdapterInterface(QLatin1String("org.bluez"), reply.value().path(), QDBusConnection::systemBus());
+ adapter = new OrgBluezAdapterInterface(QStringLiteral("org.bluez"),
+ reply.value().path(), QDBusConnection::systemBus());
} else {
QDBusPendingReply<QList<QDBusObjectPath> > reply = man->ListAdapters();
reply.waitForFinished();
@@ -396,7 +723,9 @@ void QBluetoothLocalDevicePrivate::initializeAdapter()
return;
foreach (const QDBusObjectPath &path, reply.value()) {
- OrgBluezAdapterInterface *tmpAdapter = new OrgBluezAdapterInterface(QLatin1String("org.bluez"), path.path(), QDBusConnection::systemBus());
+ OrgBluezAdapterInterface *tmpAdapter
+ = new OrgBluezAdapterInterface(QStringLiteral("org.bluez"),
+ path.path(), QDBusConnection::systemBus());
QDBusPendingReply<QVariantMap> reply = tmpAdapter->GetProperties();
reply.waitForFinished();
@@ -405,7 +734,7 @@ void QBluetoothLocalDevicePrivate::initializeAdapter()
continue;
}
- QBluetoothAddress path_address(reply.value().value(QLatin1String("Address")).toString());
+ QBluetoothAddress path_address(reply.value().value(QStringLiteral("Address")).toString());
if (path_address == localAddress) {
adapter = tmpAdapter;
@@ -423,7 +752,8 @@ void QBluetoothLocalDevicePrivate::initializeAdapter()
currentMode = static_cast<QBluetoothLocalDevice::HostMode>(-1);
if (adapter) {
- connect(adapter, SIGNAL(PropertyChanged(QString,QDBusVariant)), SLOT(PropertyChanged(QString,QDBusVariant)));
+ connect(adapter, SIGNAL(PropertyChanged(QString, QDBusVariant)),
+ SLOT(PropertyChanged(QString, QDBusVariant)));
qsrand(QTime::currentTime().msec());
agent_path = agentPath;
@@ -431,9 +761,182 @@ void QBluetoothLocalDevicePrivate::initializeAdapter()
}
}
+void QBluetoothLocalDevicePrivate::initializeAdapterBluez5()
+{
+ if (adapterBluez5)
+ return;
+
+ //get all local adapters
+ if (!managerBluez5)
+ managerBluez5 = new OrgFreedesktopDBusObjectManagerInterface(
+ QStringLiteral("org.bluez"),
+ QStringLiteral("/"),
+ QDBusConnection::systemBus(), this);
+
+ connect(managerBluez5, SIGNAL(InterfacesAdded(QDBusObjectPath,InterfaceList)),
+ SLOT(InterfacesAdded(QDBusObjectPath,InterfaceList)));
+ connect(managerBluez5, SIGNAL(InterfacesRemoved(QDBusObjectPath,QStringList)),
+ SLOT(InterfacesRemoved(QDBusObjectPath,QStringList)));
+
+ bool ok = true;
+ const QString adapterPath = findAdapterForAddress(localAddress, &ok);
+ if (!ok || adapterPath.isEmpty())
+ return;
+
+ adapterBluez5 = new OrgBluezAdapter1Interface(QStringLiteral("org.bluez"),
+ adapterPath,
+ QDBusConnection::systemBus(), this);
+
+ if (adapterBluez5) {
+ //hook up propertiesChanged for current adapter
+ adapterProperties = new OrgFreedesktopDBusPropertiesInterface(
+ QStringLiteral("org.bluez"), adapterBluez5->path(),
+ QDBusConnection::systemBus(), this);
+ connect(adapterProperties, SIGNAL(PropertiesChanged(QString,QVariantMap,QStringList)),
+ SLOT(PropertiesChanged(QString,QVariantMap,QStringList)));
+ }
+
+ currentMode = static_cast<QBluetoothLocalDevice::HostMode>(-1);
+}
+
+// Bluez 5
+void QBluetoothLocalDevicePrivate::PropertiesChanged(const QString &interface,
+ const QVariantMap &changed_properties,
+ const QStringList &/*invalidated_properties*/)
+{
+ //qDebug() << "Change" << interface << changed_properties;
+ if (interface == QStringLiteral("org.bluez.Adapter1")) {
+ //update host mode
+ if (changed_properties.contains(QStringLiteral("Discoverable"))
+ || changed_properties.contains(QStringLiteral("Powered"))) {
+
+ QBluetoothLocalDevice::HostMode mode;
+
+ if (!adapterBluez5->powered()) {
+ mode = QBluetoothLocalDevice::HostPoweredOff;
+ } else {
+ if (adapterBluez5->discoverable())
+ mode = QBluetoothLocalDevice::HostDiscoverable;
+ else
+ mode = QBluetoothLocalDevice::HostConnectable;
+
+ if (pendingHostModeChange != -1) {
+
+ if (static_cast<int>(mode) != pendingHostModeChange) {
+ adapterBluez5->setDiscoverable(
+ pendingHostModeChange
+ == static_cast<int>(QBluetoothLocalDevice::HostDiscoverable));
+ pendingHostModeChange = -1;
+ return;
+ }
+ pendingHostModeChange = -1;
+ }
+ }
+
+ if (mode != currentMode)
+ emit q_ptr->hostModeStateChanged(mode);
+
+ currentMode = mode;
+ }
+ } else if (interface == QStringLiteral("org.bluez.Device1")
+ && changed_properties.contains(QStringLiteral("Connected"))) {
+ // update list of connected devices
+ OrgFreedesktopDBusPropertiesInterface *senderIface =
+ qobject_cast<OrgFreedesktopDBusPropertiesInterface*>(sender());
+ if (!senderIface)
+ return;
+
+ const QString currentPath = senderIface->path();
+ bool isConnected = changed_properties.value(QStringLiteral("Connected"), false).toBool();
+ OrgBluezDevice1Interface device(QStringLiteral("org.bluez"), currentPath,
+ QDBusConnection::systemBus());
+ const QBluetoothAddress changedAddress(device.address());
+ bool isInSet = connectedDevicesSet.contains(changedAddress);
+ if (isConnected && !isInSet) {
+ connectedDevicesSet.insert(changedAddress);
+ emit q_ptr->deviceConnected(changedAddress);
+ } else if (!isConnected && isInSet) {
+ connectedDevicesSet.remove(changedAddress);
+ emit q_ptr->deviceDisconnected(changedAddress);
+ }
+ }
+}
+
+void QBluetoothLocalDevicePrivate::InterfacesAdded(const QDBusObjectPath &object_path, InterfaceList interfaces_and_properties)
+{
+ if (interfaces_and_properties.contains(QStringLiteral("org.bluez.Device1"))
+ && !deviceChangeMonitors.contains(object_path.path())) {
+ // a new device was added which we need to add to list of known devices
+ OrgFreedesktopDBusPropertiesInterface *monitor = new OrgFreedesktopDBusPropertiesInterface(
+ QStringLiteral("org.bluez"),
+ object_path.path(),
+ QDBusConnection::systemBus());
+ connect(monitor, SIGNAL(PropertiesChanged(QString,QVariantMap,QStringList)),
+ SLOT(PropertiesChanged(QString,QVariantMap,QStringList)));
+ deviceChangeMonitors.insert(object_path.path(), monitor);
+
+ const QVariantMap ifaceValues = interfaces_and_properties.value(QStringLiteral("org.bluez.Device1"));
+ if (ifaceValues.value(QStringLiteral("Connected"), false).toBool()) {
+ QBluetoothAddress address(ifaceValues.value(QStringLiteral("Address")).toString());
+ connectedDevicesSet.insert(address);
+ emit q_ptr->deviceConnected(address);
+ }
+ }
+
+ if (pairingDiscoveryTimer && pairingDiscoveryTimer->isActive()
+ && interfaces_and_properties.contains(QStringLiteral("org.bluez.Device1"))) {
+ //device discovery for pairing found new remote device
+ OrgBluezDevice1Interface device(QStringLiteral("org.bluez"),
+ object_path.path(), QDBusConnection::systemBus());
+ if (!address.isNull() && address == QBluetoothAddress(device.address()))
+ processPairingBluez5(object_path.path(), pairing);
+ }
+}
+
+void QBluetoothLocalDevicePrivate::InterfacesRemoved(const QDBusObjectPath &object_path,
+ const QStringList &interfaces)
+{
+ if (deviceChangeMonitors.contains(object_path.path())
+ && interfaces.contains(QLatin1String("org.bluez.Device1"))) {
+
+ //a device was removed
+ delete deviceChangeMonitors.take(object_path.path());
+
+ //the path contains the address (e.g.: /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX)
+ //-> use it to update current list of connected devices
+ QString addressString = object_path.path().right(17);
+ addressString.replace(QStringLiteral("_"), QStringLiteral(":"));
+ const QBluetoothAddress address(addressString);
+ bool found = connectedDevicesSet.remove(address);
+ if (found)
+ emit q_ptr->deviceDisconnected(address);
+ }
+
+ if (adapterBluez5
+ && object_path.path() == adapterBluez5->path()
+ && interfaces.contains(QLatin1String("org.bluez.Adapter1"))) {
+ qCDebug(QT_BT_BLUEZ) << "Adapter" << adapterBluez5->path() << "was removed";
+ // current adapter was removed -> invalidate the instance
+ delete adapterBluez5;
+ adapterBluez5 = 0;
+ managerBluez5->deleteLater();
+ managerBluez5 = 0;
+ delete adapterProperties;
+ adapterProperties = 0;
+
+ delete pairingTarget;
+ pairingTarget = 0;
+
+ // turn off connectivity monitoring
+ qDeleteAll(deviceChangeMonitors);
+ deviceChangeMonitors.clear();
+ connectedDevicesSet.clear();
+ }
+}
+
bool QBluetoothLocalDevicePrivate::isValid() const
{
- return adapter;
+ return adapter || adapterBluez5;
}
// Bluez 4
@@ -477,24 +980,28 @@ void QBluetoothLocalDevicePrivate::RequestConfirmation(const QDBusObjectPath &in
msgConfirmation = message();
msgConnection = new QDBusConnection(connection());
emit q->pairingDisplayConfirmation(address, QString::fromLatin1("%1").arg(in1));
- return;
}
void QBluetoothLocalDevicePrivate::_q_deviceCreated(const QDBusObjectPath &device)
{
- OrgBluezDeviceInterface *deviceInterface =
- new OrgBluezDeviceInterface(QLatin1String("org.bluez"), device.path(), QDBusConnection::systemBus(), this);
- connect(deviceInterface, SIGNAL(PropertyChanged(QString,QDBusVariant)), SLOT(_q_devicePropertyChanged(QString,QDBusVariant)));
+ OrgBluezDeviceInterface *deviceInterface
+ = new OrgBluezDeviceInterface(QStringLiteral("org.bluez"),
+ device.path(),
+ QDBusConnection::systemBus(), this);
+ connect(deviceInterface, SIGNAL(PropertyChanged(QString, QDBusVariant)),
+ SLOT(_q_devicePropertyChanged(QString, QDBusVariant)));
devices << deviceInterface;
- QDBusPendingReply<QVariantMap> properties = deviceInterface->asyncCall(QLatin1String("GetProperties"));
+ QDBusPendingReply<QVariantMap> properties
+ = deviceInterface->asyncCall(QStringLiteral("GetProperties"));
properties.waitForFinished();
if (!properties.isValid()) {
qCritical() << "Unable to get device properties from: " << device.path();
return;
}
- const QBluetoothAddress address = QBluetoothAddress(properties.value().value(QLatin1String("Address")).toString());
- const bool connected = properties.value().value(QLatin1String("Connected")).toBool();
+ const QBluetoothAddress address
+ = QBluetoothAddress(properties.value().value(QStringLiteral("Address")).toString());
+ const bool connected = properties.value().value(QStringLiteral("Connected")).toBool();
if (connected) {
connectedDevicesSet.insert(address);
@@ -510,15 +1017,16 @@ void QBluetoothLocalDevicePrivate::_q_deviceRemoved(const QDBusObjectPath &devic
foreach (OrgBluezDeviceInterface *deviceInterface, devices) {
if (deviceInterface->path() == device.path()) {
devices.remove(deviceInterface);
- delete deviceInterface; //deviceDisconnected is already emitted by _q_devicePropertyChanged
+ delete deviceInterface; // deviceDisconnected is already emitted by _q_devicePropertyChanged
break;
}
}
}
-void QBluetoothLocalDevicePrivate::_q_devicePropertyChanged(const QString &property, const QDBusVariant &value)
+void QBluetoothLocalDevicePrivate::_q_devicePropertyChanged(const QString &property,
+ const QDBusVariant &value)
{
- OrgBluezDeviceInterface *deviceInterface = qobject_cast<OrgBluezDeviceInterface*>(sender());
+ OrgBluezDeviceInterface *deviceInterface = qobject_cast<OrgBluezDeviceInterface *>(sender());
if (deviceInterface && property == QLatin1String("Connected")) {
QDBusPendingReply<QVariantMap> propertiesReply = deviceInterface->GetProperties();
propertiesReply.waitForFinished();
@@ -527,7 +1035,8 @@ void QBluetoothLocalDevicePrivate::_q_devicePropertyChanged(const QString &prope
return;
}
const QVariantMap properties = propertiesReply.value();
- const QBluetoothAddress address = QBluetoothAddress(properties.value(QLatin1String("Address")).toString());
+ const QBluetoothAddress address
+ = QBluetoothAddress(properties.value(QStringLiteral("Address")).toString());
const bool connected = value.variant().toBool();
if (connected) {
@@ -553,19 +1062,25 @@ void QBluetoothLocalDevicePrivate::createCache()
}
foreach (const QDBusObjectPath &device, reply.value()) {
OrgBluezDeviceInterface *deviceInterface =
- new OrgBluezDeviceInterface(QLatin1String("org.bluez"), device.path(), QDBusConnection::systemBus(), this);
- connect(deviceInterface, SIGNAL(PropertyChanged(QString,QDBusVariant)), SLOT(_q_devicePropertyChanged(QString,QDBusVariant)));
+ new OrgBluezDeviceInterface(QStringLiteral("org.bluez"),
+ device.path(),
+ QDBusConnection::systemBus(), this);
+ connect(deviceInterface, SIGNAL(PropertyChanged(QString,QDBusVariant)),
+ SLOT(_q_devicePropertyChanged(QString,QDBusVariant)));
devices << deviceInterface;
- QDBusPendingReply<QVariantMap> properties = deviceInterface->asyncCall(QLatin1String("GetProperties"));
+ QDBusPendingReply<QVariantMap> properties
+ = deviceInterface->asyncCall(QStringLiteral("GetProperties"));
properties.waitForFinished();
if (!properties.isValid()) {
qCWarning(QT_BT_BLUEZ) << "Unable to get properties for device " << device.path();
return;
}
- if (properties.value().value(QLatin1String("Connected")).toBool())
- connectedDevicesSet.insert(QBluetoothAddress(properties.value().value(QLatin1String("Address")).toString()));
+ if (properties.value().value(QStringLiteral("Connected")).toBool()) {
+ connectedDevicesSet.insert(
+ QBluetoothAddress(properties.value().value(QStringLiteral("Address")).toString()));
+ }
}
}
@@ -576,19 +1091,18 @@ QList<QBluetoothAddress> QBluetoothLocalDevicePrivate::connectedDevices() const
void QBluetoothLocalDevice::pairingConfirmation(bool confirmation)
{
- if(!d_ptr ||
- !d_ptr->msgConfirmation.isReplyRequired() ||
- !d_ptr->msgConnection)
+ if (!d_ptr
+ || !d_ptr->msgConfirmation.isReplyRequired()
+ || !d_ptr->msgConnection)
return;
- if(confirmation){
+ if (confirmation) {
QDBusMessage msg = d_ptr->msgConfirmation.createReply(QVariant(true));
d_ptr->msgConnection->send(msg);
- }
- else {
- QDBusMessage error =
- d_ptr->msgConfirmation.createErrorReply(QDBusError::AccessDenied,
- QLatin1String("Pairing rejected"));
+ } else {
+ QDBusMessage error
+ = d_ptr->msgConfirmation.createErrorReply(QDBusError::AccessDenied,
+ QStringLiteral("Pairing rejected"));
d_ptr->msgConnection->send(error);
}
delete d_ptr->msgConnection;
@@ -613,62 +1127,90 @@ void QBluetoothLocalDevicePrivate::pairingCompleted(QDBusPendingCallWatcher *wat
Q_Q(QBluetoothLocalDevice);
QDBusPendingReply<> reply = *watcher;
- if(reply.isError()) {
- qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << "failed to create pairing" << reply.error();
- emit q->error(QBluetoothLocalDevice::PairingError);
- delete watcher;
+ if (reply.isError()) {
+ qCWarning(QT_BT_BLUEZ) << "Failed to create pairing" << reply.error().name();
+ if (reply.error().name() != QStringLiteral("org.bluez.Error.AuthenticationCanceled"))
+ emit q->error(QBluetoothLocalDevice::PairingError);
+ watcher->deleteLater();
return;
}
- QDBusPendingReply<QDBusObjectPath> findReply = adapter->FindDevice(address.toString());
- findReply.waitForFinished();
- if(findReply.isError()) {
- qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << "failed to find device" << findReply.error();
- emit q->error(QBluetoothLocalDevice::PairingError);
- delete watcher;
- return;
- }
+ if (adapter) {
+ QDBusPendingReply<QDBusObjectPath> findReply = adapter->FindDevice(address.toString());
+ findReply.waitForFinished();
+ if (findReply.isError()) {
+ qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << "failed to find device" << findReply.error();
+ emit q->error(QBluetoothLocalDevice::PairingError);
+ watcher->deleteLater();
+ return;
+ }
- OrgBluezDeviceInterface device(QLatin1String("org.bluez"), findReply.value().path(),
- QDBusConnection::systemBus());
+ OrgBluezDeviceInterface device(QStringLiteral("org.bluez"), findReply.value().path(),
+ QDBusConnection::systemBus());
- if(pairing == QBluetoothLocalDevice::AuthorizedPaired) {
- device.SetProperty(QLatin1String("Trusted"), QDBusVariant(QVariant(true)));
- emit q->pairingFinished(address, QBluetoothLocalDevice::AuthorizedPaired);
- }
- else {
- device.SetProperty(QLatin1String("Trusted"), QDBusVariant(QVariant(false)));
- emit q->pairingFinished(address, QBluetoothLocalDevice::Paired);
+ if (pairing == QBluetoothLocalDevice::AuthorizedPaired) {
+ device.SetProperty(QStringLiteral("Trusted"), QDBusVariant(QVariant(true)));
+ emit q->pairingFinished(address, QBluetoothLocalDevice::AuthorizedPaired);
+ }
+ else {
+ device.SetProperty(QStringLiteral("Trusted"), QDBusVariant(QVariant(false)));
+ emit q->pairingFinished(address, QBluetoothLocalDevice::Paired);
+ }
+ } else if (adapterBluez5) {
+ if (!pairingTarget) {
+ qCWarning(QT_BT_BLUEZ) << "Pairing target expected but found null pointer.";
+ emit q->error(QBluetoothLocalDevice::PairingError);
+ watcher->deleteLater();
+ return;
+ }
+
+ if (!pairingTarget->paired()) {
+ qCWarning(QT_BT_BLUEZ) << "Device was not paired as requested";
+ emit q->error(QBluetoothLocalDevice::PairingError);
+ watcher->deleteLater();
+ return;
+ }
+
+ const QBluetoothAddress targetAddress(pairingTarget->address());
+
+ if (pairing == QBluetoothLocalDevice::AuthorizedPaired && !pairingTarget->trusted())
+ pairingTarget->setTrusted(true);
+ else if (pairing == QBluetoothLocalDevice::Paired && pairingTarget->trusted())
+ pairingTarget->setTrusted(false);
+
+ delete pairingTarget;
+ pairingTarget = 0;
+
+ emit q->pairingFinished(targetAddress, pairing);
}
- delete watcher;
+ watcher->deleteLater();
}
void QBluetoothLocalDevicePrivate::Authorize(const QDBusObjectPath &in0, const QString &in1)
{
Q_UNUSED(in0)
Q_UNUSED(in1)
- //TODO implement this
+ // TODO implement this
qCDebug(QT_BT_BLUEZ) << "Got authorize for" << in0.path() << in1;
}
void QBluetoothLocalDevicePrivate::Cancel()
{
- //TODO implement this
+ // TODO implement this
qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO;
}
void QBluetoothLocalDevicePrivate::Release()
{
- //TODO implement this
+ // TODO implement this
qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO;
}
-
void QBluetoothLocalDevicePrivate::ConfirmModeChange(const QString &in0)
{
Q_UNUSED(in0)
- //TODO implement this
+ // TODO implement this
qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO << in0;
}
@@ -677,7 +1219,7 @@ void QBluetoothLocalDevicePrivate::DisplayPasskey(const QDBusObjectPath &in0, ui
Q_UNUSED(in0)
Q_UNUSED(in1)
Q_UNUSED(in2)
- //TODO implement this
+ // TODO implement this
qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO << in0.path() << in1 << in2;
}
@@ -688,13 +1230,13 @@ uint QBluetoothLocalDevicePrivate::RequestPasskey(const QDBusObjectPath &in0)
return qrand()&0x1000000;
}
-
+// Bluez 4
void QBluetoothLocalDevicePrivate::PropertyChanged(QString property, QDBusVariant value)
{
Q_UNUSED(value);
- if (property != QLatin1String("Powered") &&
- property != QLatin1String("Discoverable"))
+ if (property != QLatin1String("Powered")
+ && property != QLatin1String("Discoverable"))
return;
Q_Q(QBluetoothLocalDevice);
@@ -702,18 +1244,17 @@ void QBluetoothLocalDevicePrivate::PropertyChanged(QString property, QDBusVarian
QDBusPendingReply<QVariantMap> reply = adapter->GetProperties();
reply.waitForFinished();
- if (reply.isError()){
+ if (reply.isError()) {
qCWarning(QT_BT_BLUEZ) << "Failed to get bluetooth properties for mode change";
return;
}
QVariantMap map = reply.value();
- if(!map.value(QLatin1String("Powered")).toBool()){
+ if (!map.value(QStringLiteral("Powered")).toBool()) {
mode = QBluetoothLocalDevice::HostPoweredOff;
- }
- else {
- if (map.value(QLatin1String("Discoverable")).toBool())
+ } else {
+ if (map.value(QStringLiteral("Discoverable")).toBool())
mode = QBluetoothLocalDevice::HostDiscoverable;
else
mode = QBluetoothLocalDevice::HostConnectable;
@@ -724,10 +1265,10 @@ void QBluetoothLocalDevicePrivate::PropertyChanged(QString property, QDBusVarian
return;
if (pendingHostModeChange == (int)QBluetoothLocalDevice::HostDiscoverable) {
adapter->SetProperty(QStringLiteral("Discoverable"),
- QDBusVariant(QVariant::fromValue(true)));
+ QDBusVariant(QVariant::fromValue(true)));
} else {
adapter->SetProperty(QStringLiteral("Discoverable"),
- QDBusVariant(QVariant::fromValue(false)));
+ QDBusVariant(QVariant::fromValue(false)));
}
pendingHostModeChange = -1;
return;
@@ -735,7 +1276,7 @@ void QBluetoothLocalDevicePrivate::PropertyChanged(QString property, QDBusVarian
}
}
- if(mode != currentMode)
+ if (mode != currentMode)
emit q->hostModeStateChanged(mode);
currentMode = mode;
diff --git a/src/bluetooth/qbluetoothlocaldevice_p.cpp b/src/bluetooth/qbluetoothlocaldevice_p.cpp
index d40e6473..dbfb8724 100644
--- a/src/bluetooth/qbluetoothlocaldevice_p.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice_p.cpp
@@ -1,57 +1,50 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
-
#include "qbluetoothlocaldevice.h"
#include "qbluetoothaddress.h"
QT_BEGIN_NAMESPACE
QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent) :
- QObject(parent), d_ptr(0)
+ QObject(parent),
+ d_ptr(0)
{
}
QBluetoothLocalDevice::QBluetoothLocalDevice(const QBluetoothAddress &, QObject *parent) :
- QObject(parent), d_ptr(0)
+ QObject(parent),
+ d_ptr(0)
{
}
@@ -96,7 +89,8 @@ void QBluetoothLocalDevice::requestPairing(const QBluetoothAddress &address, Pai
Q_UNUSED(pairing);
}
-QBluetoothLocalDevice::Pairing QBluetoothLocalDevice::pairingStatus(const QBluetoothAddress &address) const
+QBluetoothLocalDevice::Pairing QBluetoothLocalDevice::pairingStatus(
+ const QBluetoothAddress &address) const
{
Q_UNUSED(address);
return Unpaired;
diff --git a/src/bluetooth/qbluetoothlocaldevice_p.h b/src/bluetooth/qbluetoothlocaldevice_p.h
index a4503468..5d84af7e 100644
--- a/src/bluetooth/qbluetoothlocaldevice_p.h
+++ b/src/bluetooth/qbluetoothlocaldevice_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -63,10 +55,15 @@
#include <QDBusObjectPath>
#include <QDBusMessage>
#include <QSet>
+#include "bluez/bluez5_helper_p.h"
class OrgBluezAdapterInterface;
+class OrgBluezAdapter1Interface;
+class OrgFreedesktopDBusPropertiesInterface;
+class OrgFreedesktopDBusObjectManagerInterface;
class OrgBluezAgentAdaptor;
class OrgBluezDeviceInterface;
+class OrgBluezDevice1Interface;
class OrgBluezManagerInterface;
QT_BEGIN_NAMESPACE
@@ -95,22 +92,20 @@ class QBluetoothLocalDevicePrivate : public QObject
Q_OBJECT
public:
QBluetoothLocalDevicePrivate(
- QBluetoothLocalDevice *q,
- const QBluetoothAddress &address = QBluetoothAddress());
+ QBluetoothLocalDevice *q, const QBluetoothAddress &address = QBluetoothAddress());
~QBluetoothLocalDevicePrivate();
QAndroidJniObject *adapter();
- void initialize(const QBluetoothAddress& address);
+ void initialize(const QBluetoothAddress &address);
static bool startDiscovery();
static bool cancelDiscovery();
static bool isDiscovering();
bool isValid() const;
-
private slots:
void processHostModeChange(QBluetoothLocalDevice::HostMode newMode);
void processPairingStateChanged(const QBluetoothAddress &address,
- QBluetoothLocalDevice::Pairing pairing);
+ QBluetoothLocalDevice::Pairing pairing);
void processConnectDeviceChanges(const QBluetoothAddress &address, bool isConnectEvent);
void processDisplayConfirmation(const QBluetoothAddress &address, const QString &pin);
@@ -129,18 +124,22 @@ public:
};
#elif defined(QT_BLUEZ_BLUETOOTH)
-class QBluetoothLocalDevicePrivate : public QObject,
- protected QDBusContext
+class QBluetoothLocalDevicePrivate : public QObject, protected QDBusContext
{
Q_OBJECT
Q_DECLARE_PUBLIC(QBluetoothLocalDevice)
public:
- QBluetoothLocalDevicePrivate(QBluetoothLocalDevice *q, QBluetoothAddress localAddress = QBluetoothAddress());
+ QBluetoothLocalDevicePrivate(QBluetoothLocalDevice *q,
+ QBluetoothAddress localAddress = QBluetoothAddress());
~QBluetoothLocalDevicePrivate();
QSet<OrgBluezDeviceInterface *> devices;
QSet<QBluetoothAddress> connectedDevicesSet;
- OrgBluezAdapterInterface *adapter;
+ OrgBluezAdapterInterface *adapter; //Bluez 4
+ OrgBluezAdapter1Interface *adapterBluez5; //Bluez 5
+ OrgFreedesktopDBusPropertiesInterface *adapterProperties; //Bluez 5
+ OrgFreedesktopDBusObjectManagerInterface *managerBluez5; //Bluez 5
+ QMap<QString, OrgFreedesktopDBusPropertiesInterface *> deviceChangeMonitors; //Bluez 5
OrgBluezAgentAdaptor *agent;
OrgBluezManagerInterface *manager;
@@ -150,10 +149,12 @@ public:
QBluetoothAddress localAddress;
QBluetoothAddress address;
QBluetoothLocalDevice::Pairing pairing;
+ OrgBluezDevice1Interface *pairingTarget;
+ QTimer *pairingDiscoveryTimer;
QBluetoothLocalDevice::HostMode currentMode;
int pendingHostModeChange;
-public Q_SLOTS: // METHODS
+public slots:
void Authorize(const QDBusObjectPath &in0, const QString &in1);
void Cancel();
void ConfirmModeChange(const QString &in0);
@@ -164,15 +165,30 @@ public Q_SLOTS: // METHODS
void RequestConfirmation(const QDBusObjectPath &in0, uint in1);
QString RequestPinCode(const QDBusObjectPath &in0);
- void pairingCompleted(QDBusPendingCallWatcher*);
+ void pairingCompleted(QDBusPendingCallWatcher *);
- void PropertyChanged(QString,QDBusVariant);
+ void PropertyChanged(QString, QDBusVariant);
void _q_deviceCreated(const QDBusObjectPath &device);
void _q_deviceRemoved(const QDBusObjectPath &device);
void _q_devicePropertyChanged(const QString &property, const QDBusVariant &value);
bool isValid() const;
void adapterRemoved(const QDBusObjectPath &device);
+ void requestPairingBluez5(const QBluetoothAddress &address,
+ QBluetoothLocalDevice::Pairing targetPairing);
+
+private Q_SLOTS:
+ void PropertiesChanged(const QString &interface,
+ const QVariantMap &changed_properties,
+ const QStringList &invalidated_properties);
+ void InterfacesAdded(const QDBusObjectPath &object_path,
+ InterfaceList interfaces_and_properties);
+ void InterfacesRemoved(const QDBusObjectPath &object_path,
+ const QStringList &interfaces);
+ void processPairingBluez5(const QString &objectPath,
+ QBluetoothLocalDevice::Pairing target);
+ void pairingDiscoveryTimedOut();
+
private:
void createCache();
void connectDeviceChanges();
@@ -183,6 +199,7 @@ private:
QBluetoothLocalDevice *q_ptr;
void initializeAdapter();
+ void initializeAdapterBluez5();
};
#elif defined(QT_QNX_BLUETOOTH)
diff --git a/src/bluetooth/qbluetoothlocaldevice_qnx.cpp b/src/bluetooth/qbluetoothlocaldevice_qnx.cpp
index 8ed29437..c2a099f4 100644
--- a/src/bluetooth/qbluetoothlocaldevice_qnx.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice_qnx.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,21 +41,21 @@
QT_BEGIN_NAMESPACE
-QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent)
-: QObject(parent)
+QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent) :
+ QObject(parent)
{
this->d_ptr = new QBluetoothLocalDevicePrivate(this);
- this->d_ptr->isValidDevice = true; //assume single local device on QNX
+ this->d_ptr->isValidDevice = true; // assume single local device on QNX
}
-QBluetoothLocalDevice::QBluetoothLocalDevice(const QBluetoothAddress &address, QObject *parent)
-: QObject(parent)
+QBluetoothLocalDevice::QBluetoothLocalDevice(const QBluetoothAddress &address, QObject *parent) :
+ QObject(parent)
{
this->d_ptr = new QBluetoothLocalDevicePrivate(this);
- //works since we assume a single local device on QNX
- this->d_ptr->isValidDevice = (QBluetoothLocalDevicePrivate::address() == address ||
- address == QBluetoothAddress());
+ // works since we assume a single local device on QNX
+ this->d_ptr->isValidDevice = (QBluetoothLocalDevicePrivate::address() == address
+ || address == QBluetoothAddress());
}
QString QBluetoothLocalDevice::name() const
@@ -104,10 +96,12 @@ QList<QBluetoothAddress> QBluetoothLocalDevice::connectedDevices() const
for (int i = 0; i < allFiles.size(); i++) {
qCDebug(QT_BT_QNX) << allFiles.at(i);
int fileId;
- const char *filePath = QByteArray("/pps/services/bluetooth/remote_devices/").append(allFiles.at(i).toUtf8().constData()).constData();
- if ((fileId = qt_safe_open(filePath, O_RDONLY)) == -1)
+ const char *filePath = QByteArray("/pps/services/bluetooth/remote_devices/").append(allFiles.at(
+ i).toUtf8().constData())
+ .constData();
+ if ((fileId = qt_safe_open(filePath, O_RDONLY)) == -1) {
qCWarning(QT_BT_QNX) << "Failed to open remote device file";
- else {
+ } else {
pps_decoder_t ppsDecoder;
pps_decoder_initialize(&ppsDecoder, 0);
@@ -124,11 +118,11 @@ QList<QBluetoothAddress> QBluetoothLocalDevice::connectedDevices() const
if (a == PPS_DECODER_OK) {
if (connectedDevice)
devices.append(deviceAddr);
- }
- else if ( a == PPS_DECODER_BAD_TYPE)
+ } else if (a == PPS_DECODER_BAD_TYPE) {
qCDebug(QT_BT_QNX) << "Type missmatch";
- else
+ } else {
qCDebug(QT_BT_QNX) << "An unknown error occurred while checking connected status.";
+ }
pps_decoder_cleanup(&ppsDecoder);
}
}
@@ -138,7 +132,7 @@ QList<QBluetoothAddress> QBluetoothLocalDevice::connectedDevices() const
QList<QBluetoothHostInfo> QBluetoothLocalDevice::allDevices()
{
- //We only have one device
+ // We only have one device
QList<QBluetoothHostInfo> localDevices;
QBluetoothHostInfo hostInfo;
hostInfo.setName(QBluetoothLocalDevicePrivate::name());
@@ -151,20 +145,23 @@ void QBluetoothLocalDevice::requestPairing(const QBluetoothAddress &address, Pai
{
if (address.isNull()) {
QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
- Q_ARG(QBluetoothLocalDevice::Error, QBluetoothLocalDevice::PairingError));
+ Q_ARG(QBluetoothLocalDevice::Error,
+ QBluetoothLocalDevice::PairingError));
return;
}
const Pairing current_pairing = pairingStatus(address);
if (current_pairing == pairing) {
- QMetaObject::invokeMethod(this, "pairingFinished", Qt::QueuedConnection, Q_ARG(QBluetoothAddress, address),
+ QMetaObject::invokeMethod(this, "pairingFinished", Qt::QueuedConnection,
+ Q_ARG(QBluetoothAddress, address),
Q_ARG(QBluetoothLocalDevice::Pairing, pairing));
return;
}
d_ptr->requestPairing(address, pairing);
}
-QBluetoothLocalDevice::Pairing QBluetoothLocalDevice::pairingStatus(const QBluetoothAddress &address) const
+QBluetoothLocalDevice::Pairing QBluetoothLocalDevice::pairingStatus(
+ const QBluetoothAddress &address) const
{
if (!isValid())
return Unpaired;
@@ -173,7 +170,7 @@ QBluetoothLocalDevice::Pairing QBluetoothLocalDevice::pairingStatus(const QBluet
QByteArray qnxPath("/pps/services/bluetooth/remote_devices/");
qnxPath.append(address.toString().toUtf8());
int m_rdfd;
- if ((m_rdfd = qt_safe_open(qnxPath.constData(), O_RDONLY)) == -1){
+ if ((m_rdfd = qt_safe_open(qnxPath.constData(), O_RDONLY)) == -1) {
btle = true;
qnxPath.append("-00");
if ((m_rdfd = qt_safe_open(qnxPath.constData(), O_RDONLY)) == -1) {
@@ -211,8 +208,8 @@ void QBluetoothLocalDevice::pairingConfirmation(bool confirmation)
Q_UNUSED(confirmation);
}
-QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate(QBluetoothLocalDevice *q)
- : q_ptr(q)
+QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate(QBluetoothLocalDevice *q) :
+ q_ptr(q)
{
ppsRegisterControl();
ppsRegisterForEvent(QStringLiteral("access_changed"), this);
@@ -263,38 +260,36 @@ void QBluetoothLocalDevicePrivate::setHostMode(QBluetoothLocalDevice::HostMode m
return;
QBluetoothLocalDevice::HostMode currentHostMode = hostMode();
- if (currentHostMode == mode){
+ if (currentHostMode == mode)
return;
- }
- //If the device is in PowerOff state and the profile is changed then the power has to be turned on
+ // If the device is in PowerOff state and the profile is changed then the power has to be turned on
if (currentHostMode == QBluetoothLocalDevice::HostPoweredOff) {
qCDebug(QT_BT_QNX) << "Powering on";
powerOn();
}
- if (mode == QBluetoothLocalDevice::HostPoweredOff) {
+ if (mode == QBluetoothLocalDevice::HostPoweredOff)
powerOff();
- }
- else if (mode == QBluetoothLocalDevice::HostDiscoverable) { //General discoverable and connectable.
+ else if (mode == QBluetoothLocalDevice::HostDiscoverable) // General discoverable and connectable.
setAccess(1);
- }
- else if (mode == QBluetoothLocalDevice::HostConnectable) { //Connectable but not discoverable.
+ else if (mode == QBluetoothLocalDevice::HostConnectable) // Connectable but not discoverable.
setAccess(3);
- }
- else if (mode == QBluetoothLocalDevice::HostDiscoverableLimitedInquiry) { //Limited discoverable and connectable.
+ else if (mode == QBluetoothLocalDevice::HostDiscoverableLimitedInquiry) // Limited discoverable and connectable.
setAccess(2);
- }
}
void QBluetoothLocalDevicePrivate::requestPairing(const QBluetoothAddress &address,
QBluetoothLocalDevice::Pairing pairing)
{
- if (pairing == QBluetoothLocalDevice::Paired || pairing == QBluetoothLocalDevice::AuthorizedPaired) {
- ppsSendControlMessage("initiate_pairing", QStringLiteral("{\"addr\":\"%1\"}").arg(address.toString()),
- this);
+ if (pairing == QBluetoothLocalDevice::Paired
+ || pairing == QBluetoothLocalDevice::AuthorizedPaired) {
+ ppsSendControlMessage("initiate_pairing",
+ QStringLiteral("{\"addr\":\"%1\"}").arg(address.toString()),
+ this);
} else {
- ppsSendControlMessage("remove_device", QStringLiteral("{\"addr\":\"%1\"}").arg(address.toString()),
- this);
+ ppsSendControlMessage("remove_device",
+ QStringLiteral("{\"addr\":\"%1\"}").arg(address.toString()),
+ this);
}
}
@@ -308,11 +303,11 @@ QBluetoothLocalDevice::HostMode QBluetoothLocalDevicePrivate::hostMode() const
int hostMode = ppsReadSetting("accessibility").toInt();
- if (hostMode == 1) //General discoverable and connectable.
+ if (hostMode == 1) // General discoverable and connectable.
return QBluetoothLocalDevice::HostDiscoverable;
- else if (hostMode == 3) //Connectable but not discoverable.
+ else if (hostMode == 3) // Connectable but not discoverable.
return QBluetoothLocalDevice::HostConnectable;
- else if (hostMode == 2) //Limited discoverable and connectable.
+ else if (hostMode == 2) // Limited discoverable and connectable.
return QBluetoothLocalDevice::HostDiscoverableLimitedInquiry;
else
return QBluetoothLocalDevice::HostPoweredOff;
@@ -322,25 +317,24 @@ extern int __newHostMode;
void QBluetoothLocalDevicePrivate::setAccess(int access)
{
- if (!ppsReadSetting("enabled").toBool()) { //We cannot set the host mode until BT is fully powered up
+ if (!ppsReadSetting("enabled").toBool()) // We cannot set the host mode until BT is fully powered up
__newHostMode = access;
- } else {
+ else
ppsSendControlMessage("set_access", QStringLiteral("{\"access\":%1}").arg(access), 0);
-
- }
}
void QBluetoothLocalDevicePrivate::connectedDevices()
{
QList<QBluetoothAddress> devices = q_ptr->connectedDevices();
- for (int i = 0; i < devices.size(); i ++) {
+ for (int i = 0; i < devices.size(); i++) {
if (!connectedDevicesSet.contains(devices.at(i))) {
QBluetoothAddress addr = devices.at(i);
connectedDevicesSet.append(addr);
emit q_ptr->deviceConnected(devices.at(i));
}
}
- for (int i = 0; i < connectedDevicesSet.size(); i ++) {
+
+ for (int i = 0; i < connectedDevicesSet.size(); i++) {
if (!devices.contains(connectedDevicesSet.at(i))) {
QBluetoothAddress addr = connectedDevicesSet.at(i);
emit q_ptr->deviceDisconnected(addr);
@@ -365,38 +359,39 @@ void QBluetoothLocalDevicePrivate::controlEvent(ppsResult result)
{
qCDebug(QT_BT_QNX) << Q_FUNC_INFO << "Control Event" << result.msg;
if (result.msg == QStringLiteral("access_changed")) {
- if (__newHostMode == -1 && result.dat.size() > 1 &&
- result.dat.first() == QStringLiteral("level")) {
+ if (__newHostMode == -1 && result.dat.size() > 1
+ && result.dat.first() == QStringLiteral("level")) {
QBluetoothLocalDevice::HostMode newHostMode = hostMode();
qCDebug(QT_BT_QNX) << "New Host mode" << newHostMode;
connectedDevices();
- Q_EMIT q_ptr->hostModeStateChanged(newHostMode);
+ emit q_ptr->hostModeStateChanged(newHostMode);
}
} else if (result.msg == QStringLiteral("pairing_complete")) {
qCDebug(QT_BT_QNX) << "pairing completed";
if (result.dat.contains(QStringLiteral("addr"))) {
const QBluetoothAddress address = QBluetoothAddress(
- result.dat.at(result.dat.indexOf(QStringLiteral("addr")) + 1));
+ result.dat.at(result.dat.indexOf(QStringLiteral("addr")) + 1));
QBluetoothLocalDevice::Pairing pairingStatus = QBluetoothLocalDevice::Paired;
- if (result.dat.contains(QStringLiteral("trusted")) &&
- result.dat.at(result.dat.indexOf(QStringLiteral("trusted")) + 1) == QStringLiteral("true")) {
+ if (result.dat.contains(QStringLiteral("trusted"))
+ && result.dat.at(result.dat.indexOf(QStringLiteral("trusted")) + 1)
+ == QStringLiteral("true")) {
pairingStatus = QBluetoothLocalDevice::AuthorizedPaired;
}
qCDebug(QT_BT_QNX) << "pairing completed" << address.toString();
- Q_EMIT q_ptr->pairingFinished(address, pairingStatus);
+ emit q_ptr->pairingFinished(address, pairingStatus);
}
} else if (result.msg == QStringLiteral("device_deleted")) {
qCDebug(QT_BT_QNX) << "device deleted";
if (result.dat.contains(QStringLiteral("addr"))) {
const QBluetoothAddress address = QBluetoothAddress(
- result.dat.at(result.dat.indexOf(QStringLiteral("addr")) + 1));
- Q_EMIT q_ptr->pairingFinished(address, QBluetoothLocalDevice::Unpaired);
+ result.dat.at(result.dat.indexOf(QStringLiteral("addr")) + 1));
+ emit q_ptr->pairingFinished(address, QBluetoothLocalDevice::Unpaired);
}
} else if (result.msg == QStringLiteral("radio_shutdown")) {
qCDebug(QT_BT_QNX) << "radio shutdown";
- Q_EMIT q_ptr->hostModeStateChanged(QBluetoothLocalDevice::HostPoweredOff);
+ emit q_ptr->hostModeStateChanged(QBluetoothLocalDevice::HostPoweredOff);
}
}
diff --git a/src/bluetooth/qbluetoothserver.cpp b/src/bluetooth/qbluetoothserver.cpp
index 667c3306..34108a91 100644
--- a/src/bluetooth/qbluetoothserver.cpp
+++ b/src/bluetooth/qbluetoothserver.cpp
@@ -6,36 +6,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothserver.h b/src/bluetooth/qbluetoothserver.h
index 61573843..2eadd1d4 100644
--- a/src/bluetooth/qbluetoothserver.h
+++ b/src/bluetooth/qbluetoothserver.h
@@ -1,41 +1,33 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothserver_android.cpp b/src/bluetooth/qbluetoothserver_android.cpp
index f90c540e..e1a50703 100644
--- a/src/bluetooth/qbluetoothserver_android.cpp
+++ b/src/bluetooth/qbluetoothserver_android.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothserver_bluez.cpp b/src/bluetooth/qbluetoothserver_bluez.cpp
index 4532e570..88eab65c 100644
--- a/src/bluetooth/qbluetoothserver_bluez.cpp
+++ b/src/bluetooth/qbluetoothserver_bluez.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothserver_p.cpp b/src/bluetooth/qbluetoothserver_p.cpp
index d9efcf2f..310b6f68 100644
--- a/src/bluetooth/qbluetoothserver_p.cpp
+++ b/src/bluetooth/qbluetoothserver_p.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothserver_p.h b/src/bluetooth/qbluetoothserver_p.h
index e8fc2f06..75f1bde6 100644
--- a/src/bluetooth/qbluetoothserver_p.h
+++ b/src/bluetooth/qbluetoothserver_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -126,7 +118,7 @@ private:
bool serverRegistered;
QString nextClientAddress;
-private Q_SLOTS:
+private slots:
#ifndef QT_QNX_BT_BLUETOOTH
void controlReply(ppsResult result);
void controlEvent(ppsResult result);
diff --git a/src/bluetooth/qbluetoothserver_qnx.cpp b/src/bluetooth/qbluetoothserver_qnx.cpp
index 2aefa041..bb2346cd 100644
--- a/src/bluetooth/qbluetoothserver_qnx.cpp
+++ b/src/bluetooth/qbluetoothserver_qnx.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent.cpp b/src/bluetooth/qbluetoothservicediscoveryagent.cpp
index 36849eed..4c752356 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -105,6 +97,12 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \fn QBluetoothServiceDiscoveryAgent::serviceDiscovered(const QLowEnergyServiceInfo &info)
+
+ This signal is emitted when the Bluetooth Low Energy service described by \a info is discovered.
+*/
+
+/*!
\fn QBluetoothServiceDiscoveryAgent::finished()
This signal is emitted when the Bluetooth service discovery completes.
@@ -178,6 +176,8 @@ QBluetoothServiceDiscoveryAgent::~QBluetoothServiceDiscoveryAgent()
that if a remote Bluetooth device moves out of range in between two subsequent calls
to \l start() the list may contain stale entries.
+ \note The list of services should always be cleared before the discovery mode is changed.
+
\sa clear()
*/
QList<QBluetoothServiceInfo> QBluetoothServiceDiscoveryAgent::discoveredServices() const
@@ -246,7 +246,6 @@ bool QBluetoothServiceDiscoveryAgent::setRemoteAddress(const QBluetoothAddress &
if (!address.isNull())
d_ptr->singleDevice = true;
d_ptr->deviceAddress = address;
-
return true;
}
@@ -277,6 +276,11 @@ void QBluetoothServiceDiscoveryAgent::start(DiscoveryMode mode)
if (d->discoveryState() == QBluetoothServiceDiscoveryAgentPrivate::Inactive
&& d->error != InvalidBluetoothAdapterError) {
+#ifdef QT_BLUEZ_BLUETOOTH
+ // done to avoid repeated parsing for adapter address
+ // on Bluez5
+ d->foundHostAdapterPath.clear();
+#endif
d->setDiscoveryMode(mode);
if (d->deviceAddress.isNull()) {
d->startDeviceDiscovery();
@@ -502,6 +506,21 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_serviceDiscoveryFinished()
startServiceDiscovery();
}
+bool QBluetoothServiceDiscoveryAgentPrivate::isDuplicatedService(
+ const QBluetoothServiceInfo &serviceInfo) const
+{
+ //check the service is not already part of our known list
+ for (int j = 0; j < discoveredServices.count(); j++) {
+ const QBluetoothServiceInfo &info = discoveredServices.at(j);
+ if (info.device() == serviceInfo.device()
+ && info.serviceClassUuids() == serviceInfo.serviceClassUuids()
+ && info.serviceUuid() == serviceInfo.serviceUuid()) {
+ return true;
+ }
+ }
+ return false;
+}
+
#include "moc_qbluetoothservicediscoveryagent.cpp"
QT_END_NAMESPACE
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent.h b/src/bluetooth/qbluetoothservicediscoveryagent.h
index 59c7b74b..947dfde8 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent.h
+++ b/src/bluetooth/qbluetoothservicediscoveryagent.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,6 +41,7 @@
#include <QtBluetooth/QBluetoothServiceInfo>
#include <QtBluetooth/QBluetoothUuid>
#include <QtBluetooth/QBluetoothDeviceDiscoveryAgent>
+#include <QtBluetooth/QLowEnergyServiceInfo>
QT_BEGIN_NAMESPACE
@@ -100,6 +93,7 @@ public Q_SLOTS:
Q_SIGNALS:
void serviceDiscovered(const QBluetoothServiceInfo &info);
+ void serviceDiscovered(const QLowEnergyServiceInfo &info);
void finished();
void canceled();
void error(QBluetoothServiceDiscoveryAgent::Error error);
@@ -114,6 +108,7 @@ private:
#ifdef QT_BLUEZ_BLUETOOTH
Q_PRIVATE_SLOT(d_func(), void _q_discoveredServices(QDBusPendingCallWatcher*))
Q_PRIVATE_SLOT(d_func(), void _q_createdDevice(QDBusPendingCallWatcher*))
+ Q_PRIVATE_SLOT(d_func(), void _q_finishSdpScan(QBluetoothServiceDiscoveryAgent::Error, const QString &, const QStringList &))
#endif
#ifdef QT_ANDROID_BLUETOOTH
Q_PRIVATE_SLOT(d_func(), void _q_processFetchedUuids(const QBluetoothAddress &address,
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp
index 2643d7a9..d97c0e92 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -55,8 +47,6 @@ QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(QT_BT_ANDROID)
-Q_GLOBAL_STATIC_WITH_ARGS(QUuid, btBaseUuid, ("{00000000-0000-1000-8000-00805F9B34FB}"))
-
QBluetoothServiceDiscoveryAgentPrivate::QBluetoothServiceDiscoveryAgentPrivate(
const QBluetoothAddress &deviceAdapter)
: error(QBluetoothServiceDiscoveryAgent::NoError),
@@ -304,80 +294,6 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_processFetchedUuids(
}
}
-
-static QString serviceNameForClassUuid(const uint value)
-{
- switch (value & 0xffff) {
- case QBluetoothUuid::ServiceDiscoveryServer: return QBluetoothServiceDiscoveryAgent::tr("Service Discovery");
- //case QBluetoothUuid::BrowseGroupDescriptor: return QString();
- //case QBluetoothUuid::PublicBrowseGroup: return QString();
- case QBluetoothUuid::SerialPort: return QBluetoothServiceDiscoveryAgent::tr("Serial Port Profile");
- case QBluetoothUuid::LANAccessUsingPPP: return QBluetoothServiceDiscoveryAgent::tr("LAN Access Profile");
- case QBluetoothUuid::DialupNetworking: return QBluetoothServiceDiscoveryAgent::tr("Dial-up Networking");
- case QBluetoothUuid::IrMCSync: return QBluetoothServiceDiscoveryAgent::tr("Synchronization");
- case QBluetoothUuid::ObexObjectPush: return QBluetoothServiceDiscoveryAgent::tr("Object Push");
- case QBluetoothUuid::OBEXFileTransfer: return QBluetoothServiceDiscoveryAgent::tr("File Transfer");
- case QBluetoothUuid::IrMCSyncCommand: return QBluetoothServiceDiscoveryAgent::tr("Synchronization Command");
- case QBluetoothUuid::Headset: return QBluetoothServiceDiscoveryAgent::tr("Headset");
- case QBluetoothUuid::AudioSource: return QBluetoothServiceDiscoveryAgent::tr("Advanced Audio Distribution Source");
- case QBluetoothUuid::AudioSink: return QBluetoothServiceDiscoveryAgent::tr("Advanced Audio Distribution Sink");
- case QBluetoothUuid::AV_RemoteControlTarget: return QBluetoothServiceDiscoveryAgent::tr("Audio/Video Remote Control Target");
- case QBluetoothUuid::AdvancedAudioDistribution: return QBluetoothServiceDiscoveryAgent::tr("Advanced Audio Distribution");
- case QBluetoothUuid::AV_RemoteControl: return QBluetoothServiceDiscoveryAgent::tr("Audio/Video Remote Control");
- case QBluetoothUuid::AV_RemoteControlController: return QBluetoothServiceDiscoveryAgent::tr("Audio/Video Remote Control Controller");
- case QBluetoothUuid::HeadsetAG: return QBluetoothServiceDiscoveryAgent::tr("Headset AG");
- case QBluetoothUuid::PANU: return QBluetoothServiceDiscoveryAgent::tr("Personal Area Networking (PANU)");
- case QBluetoothUuid::NAP: return QBluetoothServiceDiscoveryAgent::tr("Personal Area Networking (NAP)");
- case QBluetoothUuid::GN: return QBluetoothServiceDiscoveryAgent::tr("Personal Area Networking (GN)");
- case QBluetoothUuid::DirectPrinting: return QBluetoothServiceDiscoveryAgent::tr("Basic Direct Printing (BPP)");
- case QBluetoothUuid::ReferencePrinting: return QBluetoothServiceDiscoveryAgent::tr("Basic Reference Printing (BPP)");
- case QBluetoothUuid::BasicImage: return QBluetoothServiceDiscoveryAgent::tr("Basic Imaging Profile");
- case QBluetoothUuid::ImagingResponder: return QBluetoothServiceDiscoveryAgent::tr("Basic Imaging Responder");
- case QBluetoothUuid::ImagingAutomaticArchive: return QBluetoothServiceDiscoveryAgent::tr("Basic Imaging Archive");
- case QBluetoothUuid::ImagingReferenceObjects: return QBluetoothServiceDiscoveryAgent::tr("Basic Imaging Ref Objects");
- case QBluetoothUuid::Handsfree: return QBluetoothServiceDiscoveryAgent::tr("Hands-Free");
- case QBluetoothUuid::HandsfreeAudioGateway: return QBluetoothServiceDiscoveryAgent::tr("Hands-Free AG");
- case QBluetoothUuid::DirectPrintingReferenceObjectsService: return QBluetoothServiceDiscoveryAgent::tr("Basic Printing RefObject Service");
- case QBluetoothUuid::ReflectedUI: return QBluetoothServiceDiscoveryAgent::tr("Basic Printing Reflected UI");
- case QBluetoothUuid::BasicPrinting: return QBluetoothServiceDiscoveryAgent::tr("Basic Printing");
- case QBluetoothUuid::PrintingStatus: return QBluetoothServiceDiscoveryAgent::tr("Basic Printing Status");
- case QBluetoothUuid::HumanInterfaceDeviceService: return QBluetoothServiceDiscoveryAgent::tr("Human Interface Device");
- case QBluetoothUuid::HardcopyCableReplacement: return QBluetoothServiceDiscoveryAgent::tr("Hardcopy Cable Replacement");
- case QBluetoothUuid::HCRPrint: return QBluetoothServiceDiscoveryAgent::tr("Hardcopy Cable Replacement Print");
- case QBluetoothUuid::HCRScan: return QBluetoothServiceDiscoveryAgent::tr("Hardcopy Cable Replacement Scan");
- case QBluetoothUuid::SIMAccess: return QBluetoothServiceDiscoveryAgent::tr("SIM Access");
- case QBluetoothUuid::PhonebookAccessPCE: return QBluetoothServiceDiscoveryAgent::tr("Phonebook Access PCE");
- case QBluetoothUuid::PhonebookAccessPSE: return QBluetoothServiceDiscoveryAgent::tr("Phonebook Access PSE");
- case QBluetoothUuid::PhonebookAccess: return QBluetoothServiceDiscoveryAgent::tr("Phonebook Access");
- case QBluetoothUuid::HeadsetHS: return QBluetoothServiceDiscoveryAgent::tr("Headset HS");
- case QBluetoothUuid::MessageAccessServer: return QBluetoothServiceDiscoveryAgent::tr("Message Access Server");
- case QBluetoothUuid::MessageNotificationServer: return QBluetoothServiceDiscoveryAgent::tr("Message Notification Server");
- case QBluetoothUuid::MessageAccessProfile: return QBluetoothServiceDiscoveryAgent::tr("Message Access");
- case QBluetoothUuid::GNSS: return QBluetoothServiceDiscoveryAgent::tr("Global Navigation Satellite System");
- case QBluetoothUuid::GNSSServer: return QBluetoothServiceDiscoveryAgent::tr("Global Navigation Satellite System Server");
- case QBluetoothUuid::Display3D: return QBluetoothServiceDiscoveryAgent::tr("3D Synchronization Display");
- case QBluetoothUuid::Glasses3D: return QBluetoothServiceDiscoveryAgent::tr("3D Synchronization Glasses");
- case QBluetoothUuid::Synchronization3D: return QBluetoothServiceDiscoveryAgent::tr("3D Synchronization");
- case QBluetoothUuid::MPSProfile: return QBluetoothServiceDiscoveryAgent::tr("Multi-Profile Specification (Profile)");
- case QBluetoothUuid::MPSService: return QBluetoothServiceDiscoveryAgent::tr("Multi-Profile Specification");
- case QBluetoothUuid::PnPInformation: return QBluetoothServiceDiscoveryAgent::tr("Device Identification");
- //case QBluetoothUuid::GenericNetworking: return QBluetoothServiceDiscoveryAgent::tr("");
- //case QBluetoothUuid::GenericFileTransfer: return QBluetoothServiceDiscoveryAgent::tr("");
- //case QBluetoothUuid::GenericAudio: return QBluetoothServiceDiscoveryAgent::tr("");
- //case QBluetoothUuid::GenericTelephony: return QBluetoothServiceDiscoveryAgent::tr("");
- case QBluetoothUuid::VideoSource: return QBluetoothServiceDiscoveryAgent::tr("Video Source");
- case QBluetoothUuid::VideoSink: return QBluetoothServiceDiscoveryAgent::tr("Video Sink");
- case QBluetoothUuid::VideoDistribution: return QBluetoothServiceDiscoveryAgent::tr("Video Distribution");
- case QBluetoothUuid::HDP: return QBluetoothServiceDiscoveryAgent::tr("Health Device");
- case QBluetoothUuid::HDPSource: return QBluetoothServiceDiscoveryAgent::tr("Health Device Source");
- case QBluetoothUuid::HDPSink: return QBluetoothServiceDiscoveryAgent::tr("Health Device Sink");
- default:
- break;
- }
-
- return QString();
-}
-
void QBluetoothServiceDiscoveryAgentPrivate::populateDiscoveredServices(const QBluetoothDeviceInfo &remoteDevice, const QList<QBluetoothUuid> &uuids)
{
/* Android doesn't provide decent SDP data. A list of uuids is close to meaning-less
@@ -403,21 +319,14 @@ void QBluetoothServiceDiscoveryAgentPrivate::populateDiscoveredServices(const QB
if (uuid.isNull())
continue;
- bool isBaseUuuidSuffix = false;
- if (btBaseUuid()->data2 == uuid.data2 && btBaseUuid()->data3 == uuid.data3
- && btBaseUuid()->data4[0] == uuid.data4[0] && btBaseUuid()->data4[1] == uuid.data4[1]
- && btBaseUuid()->data4[2] == uuid.data4[2] && btBaseUuid()->data4[3] == uuid.data4[3]
- && btBaseUuid()->data4[4] == uuid.data4[4] && btBaseUuid()->data4[5] == uuid.data4[5]
- && btBaseUuid()->data4[6] == uuid.data4[6] && btBaseUuid()->data4[7] == uuid.data4[7])
- {
- isBaseUuuidSuffix = true;
- }
-
//check for SPP protocol
- if (isBaseUuuidSuffix && ((uuid.data1 & 0xffff) == QBluetoothUuid::SerialPort))
+ bool ok = false;
+ quint16 uuid16 = uuid.toUInt16(&ok);
+ if (ok && uuid16 == QBluetoothUuid::SerialPort)
sppIndex = i;
- if (!isBaseUuuidSuffix)
+ //check for custom uuid
+ if (uuid.minimumSize() == 16)
customUuids.append(i);
}
@@ -483,22 +392,13 @@ void QBluetoothServiceDiscoveryAgentPrivate::populateDiscoveredServices(const QB
QBluetoothServiceInfo::Sequence classId;
classId << QVariant::fromValue(uuids.at(i));
serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId);
- serviceInfo.setServiceName(serviceNameForClassUuid(uuids.at(i).data1));
+ QBluetoothUuid::ServiceClassUuid clsId
+ = static_cast<QBluetoothUuid::ServiceClassUuid>(uuids.at(i).toUInt16());
+ serviceInfo.setServiceName(QBluetoothUuid::serviceClassToString(clsId));
}
//don't include the service if we already discovered it before
- bool alreadyDiscovered = false;
- for (int j = 0; j < discoveredServices.count(); j++) {
- const QBluetoothServiceInfo &info = discoveredServices.at(j);
- if (info.device() == serviceInfo.device()
- && info.serviceClassUuids() == serviceInfo.serviceClassUuids()
- && info.serviceUuid() == serviceInfo.serviceUuid()) {
- alreadyDiscovered = true;
- break;
- }
- }
-
- if (!alreadyDiscovered) {
+ if (!isDuplicatedService(serviceInfo)) {
discoveredServices << serviceInfo;
//qCDebug(QT_BT_ANDROID) << serviceInfo;
emit q->serviceDiscovered(serviceInfo);
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp
index 08343a7d..f3b14d4d 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp
@@ -5,70 +5,88 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qbluetoothservicediscoveryagent.h"
#include "qbluetoothservicediscoveryagent_p.h"
+#include "qlowenergyserviceinfo_p.h"
#include "bluez/manager_p.h"
#include "bluez/adapter_p.h"
#include "bluez/device_p.h"
+#include "bluez/bluez5_helper_p.h"
+#include "bluez/objectmanager_p.h"
+#include "bluez/adapter1_bluez5_p.h"
+#include <QtCore/QFile>
+#include <QtCore/QLibraryInfo>
#include <QtCore/QLoggingCategory>
+#include <QtCore/QProcess>
#include <QtDBus/QDBusPendingCallWatcher>
+#include <QtConcurrent/QtConcurrentRun>
QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(QT_BT_BLUEZ)
+static inline void convertAddress(quint64 from, quint8 (&to)[6])
+{
+ to[0] = (from >> 0) & 0xff;
+ to[1] = (from >> 8) & 0xff;
+ to[2] = (from >> 16) & 0xff;
+ to[3] = (from >> 24) & 0xff;
+ to[4] = (from >> 32) & 0xff;
+ to[5] = (from >> 40) & 0xff;
+}
+
QBluetoothServiceDiscoveryAgentPrivate::QBluetoothServiceDiscoveryAgentPrivate(const QBluetoothAddress &deviceAdapter)
: error(QBluetoothServiceDiscoveryAgent::NoError), m_deviceAdapterAddress(deviceAdapter), state(Inactive), deviceDiscoveryAgent(0),
mode(QBluetoothServiceDiscoveryAgent::MinimalDiscovery), singleDevice(false),
- manager(0), adapter(0), device(0)
+ manager(0), managerBluez5(0), adapter(0), device(0)
{
- qRegisterMetaType<ServiceMap>("ServiceMap");
- qDBusRegisterMetaType<ServiceMap>();
+ if (isBluez5()) {
+ managerBluez5 = new OrgFreedesktopDBusObjectManagerInterface(
+ QStringLiteral("org.bluez"), QStringLiteral("/"),
+ QDBusConnection::systemBus());
+ qRegisterMetaType<QBluetoothServiceDiscoveryAgent::Error>("QBluetoothServiceDiscoveryAgent::Error");
+ } else {
+ qRegisterMetaType<ServiceMap>("ServiceMap");
+ qDBusRegisterMetaType<ServiceMap>();
- manager = new OrgBluezManagerInterface(QLatin1String("org.bluez"), QLatin1String("/"),
- QDBusConnection::systemBus());
+ manager = new OrgBluezManagerInterface(QStringLiteral("org.bluez"), QStringLiteral("/"),
+ QDBusConnection::systemBus());
+ }
}
QBluetoothServiceDiscoveryAgentPrivate::~QBluetoothServiceDiscoveryAgentPrivate()
{
delete device;
delete manager;
+ delete managerBluez5;
delete adapter;
}
@@ -76,7 +94,12 @@ void QBluetoothServiceDiscoveryAgentPrivate::start(const QBluetoothAddress &addr
{
Q_Q(QBluetoothServiceDiscoveryAgent);
- qCDebug(QT_BT_BLUEZ) << "Full discovery on: " << address.toString();
+ qCDebug(QT_BT_BLUEZ) << "Discovery on: " << address.toString() << "Mode:" << DiscoveryMode();
+
+ if (managerBluez5) {
+ startBluez5(address);
+ return;
+ }
QDBusPendingReply<QDBusObjectPath> reply;
if (m_deviceAdapterAddress.isNull())
@@ -93,9 +116,18 @@ void QBluetoothServiceDiscoveryAgentPrivate::start(const QBluetoothAddress &addr
return;
}
- adapter = new OrgBluezAdapterInterface(QLatin1String("org.bluez"), reply.value().path(),
+ adapter = new OrgBluezAdapterInterface(QStringLiteral("org.bluez"), reply.value().path(),
QDBusConnection::systemBus());
+ if (m_deviceAdapterAddress.isNull()) {
+ QDBusPendingReply<QVariantMap> reply = adapter->GetProperties();
+ reply.waitForFinished();
+ if (!reply.isError()) {
+ const QBluetoothAddress path_address(reply.value().value(QStringLiteral("Address")).toString());
+ m_deviceAdapterAddress = path_address;
+ }
+ }
+
QDBusPendingReply<QDBusObjectPath> deviceObjectPath = adapter->CreateDevice(address.toString());
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(deviceObjectPath, q);
@@ -105,6 +137,204 @@ void QBluetoothServiceDiscoveryAgentPrivate::start(const QBluetoothAddress &addr
}
+void QBluetoothServiceDiscoveryAgentPrivate::startBluez5(const QBluetoothAddress &address)
+{
+ Q_Q(QBluetoothServiceDiscoveryAgent);
+
+ if (foundHostAdapterPath.isEmpty()) {
+ // check that we match adapter addresses or use first if it wasn't specified
+
+ bool ok = false;
+ foundHostAdapterPath = findAdapterForAddress(m_deviceAdapterAddress, &ok);
+ if (!ok) {
+ discoveredDevices.clear();
+ error = QBluetoothServiceDiscoveryAgent::InputOutputError;
+ errorString = QBluetoothDeviceDiscoveryAgent::tr("Cannot access adapter during service discovery");
+ emit q->error(error);
+ _q_serviceDiscoveryFinished();
+ return;
+ }
+
+ if (foundHostAdapterPath.isEmpty()) {
+ // Cannot find a local adapter
+ // Abort any outstanding discoveries
+ discoveredDevices.clear();
+
+ error = QBluetoothServiceDiscoveryAgent::InvalidBluetoothAdapterError;
+ errorString = QBluetoothServiceDiscoveryAgent::tr("Cannot find local Bluetooth adapter");
+ emit q->error(error);
+ _q_serviceDiscoveryFinished();
+
+ return;
+ }
+ }
+
+ // ensure we didn't go offline yet
+ OrgBluezAdapter1Interface adapter(QStringLiteral("org.bluez"),
+ foundHostAdapterPath, QDBusConnection::systemBus());
+ if (!adapter.powered()) {
+ discoveredDevices.clear();
+
+ error = QBluetoothServiceDiscoveryAgent::PoweredOffError;
+ errorString = QBluetoothServiceDiscoveryAgent::tr("Local device is powered off");
+ emit q->error(error);
+
+ _q_serviceDiscoveryFinished();
+ return;
+ }
+
+ if (DiscoveryMode() == QBluetoothServiceDiscoveryAgent::MinimalDiscovery) {
+ performMinimalServiceDiscovery(address);
+ } else {
+ // we need to run the discovery in a different thread
+ // as it involves blocking calls
+ QtConcurrent::run(this, &QBluetoothServiceDiscoveryAgentPrivate::runSdpScan,
+ address, QBluetoothAddress(adapter.address()));
+ }
+}
+
+/*
+ * This function runs in a different thread. We need to be very careful what we
+ * access from here. That's why invokeMethod is used below.
+ *
+ * src/tools/sdpscanner performs an SDP scan. This is
+ * done out-of-process to avoid license issues. At this stage Bluez uses GPLv2.
+ */
+void QBluetoothServiceDiscoveryAgentPrivate::runSdpScan(
+ const QBluetoothAddress &remoteAddress, const QBluetoothAddress localAddress)
+{
+ Q_Q(QBluetoothServiceDiscoveryAgent);
+
+ const QString binPath = QLibraryInfo::location(QLibraryInfo::BinariesPath);
+
+ QFileInfo fileInfo(binPath, QStringLiteral("sdpscanner"));
+ if (!fileInfo.exists() || !fileInfo.isExecutable()) {
+ QMetaObject::invokeMethod(q, "_q_finishSdpScan", Qt::QueuedConnection,
+ Q_ARG(QBluetoothServiceDiscoveryAgent::Error,
+ QBluetoothServiceDiscoveryAgent::InputOutputError),
+ Q_ARG(QString,
+ QBluetoothServiceDiscoveryAgent::tr("Unable to find sdpscanner")),
+ Q_ARG(QStringList, QStringList()));
+ qCWarning(QT_BT_BLUEZ) << "Cannot find sdpscanner:"
+ << fileInfo.canonicalFilePath();
+ return;
+ }
+
+ QStringList arguments;
+ arguments << remoteAddress.toString() << localAddress.toString();
+
+ QByteArray output;
+
+ QProcess process;
+ process.setProcessChannelMode(QProcess::ForwardedErrorChannel);
+ process.setReadChannel(QProcess::StandardOutput);
+ process.start(fileInfo.canonicalFilePath(), arguments);
+
+ if (process.waitForStarted(-1)) {
+ while (process.waitForReadyRead(-1))
+ output += process.readAllStandardOutput();
+ }
+
+ process.waitForFinished();
+
+ if (process.exitStatus() != QProcess::NormalExit
+ || process.exitCode() != 0) {
+ qCWarning(QT_BT_BLUEZ) << "SDP scan failure"
+ << process.exitStatus() << process.exitCode()
+ << remoteAddress;
+ if (singleDevice) {
+ QMetaObject::invokeMethod(q, "_q_finishSdpScan", Qt::QueuedConnection,
+ Q_ARG(QBluetoothServiceDiscoveryAgent::Error,
+ QBluetoothServiceDiscoveryAgent::InputOutputError),
+ Q_ARG(QString,
+ QBluetoothServiceDiscoveryAgent::tr("Unable to perform SDP scan")),
+ Q_ARG(QStringList, QStringList()));
+ } else {
+ // go to next device
+ QMetaObject::invokeMethod(q, "_q_finishSdpScan", Qt::QueuedConnection,
+ Q_ARG(QBluetoothServiceDiscoveryAgent::Error,
+ QBluetoothServiceDiscoveryAgent::NoError),
+ Q_ARG(QString, QString()),
+ Q_ARG(QStringList, QStringList()));
+ }
+ return;
+ }
+
+ QStringList xmlRecords;
+ const QString decodedData = QString::fromUtf8(QByteArray::fromBase64(output));
+
+ // split the various xml docs up
+ int next;
+ int start = decodedData.indexOf(QStringLiteral("<?xml"), 0);
+ if (start != -1) {
+ do {
+ next = decodedData.indexOf(QStringLiteral("<?xml"), start + 1);
+ if (next != -1)
+ xmlRecords.append(decodedData.mid(start, next-start));
+ else
+ xmlRecords.append(decodedData.mid(start, decodedData.size() - start));
+ start = next;
+ } while ( start != -1);
+ }
+
+ QMetaObject::invokeMethod(q, "_q_finishSdpScan", Qt::QueuedConnection,
+ Q_ARG(QBluetoothServiceDiscoveryAgent::Error,
+ QBluetoothServiceDiscoveryAgent::NoError),
+ Q_ARG(QString, QString()),
+ Q_ARG(QStringList, xmlRecords));
+}
+
+void QBluetoothServiceDiscoveryAgentPrivate::_q_finishSdpScan(QBluetoothServiceDiscoveryAgent::Error errorCode,
+ const QString &errorDescription,
+ const QStringList &xmlRecords)
+{
+ Q_Q(QBluetoothServiceDiscoveryAgent);
+
+ if (errorCode != QBluetoothServiceDiscoveryAgent::NoError) {
+ qCWarning(QT_BT_BLUEZ) << "SDP search failed for"
+ << discoveredDevices.at(0).address().toString();
+ // We have an error which we need to indicate and stop further processing
+ discoveredDevices.clear();
+ error = errorCode;
+ errorString = errorDescription;
+ emit q->error(error);
+ } else if (!xmlRecords.isEmpty() && discoveryState() != Inactive) {
+ foreach (const QString &record, xmlRecords) {
+ bool isBtleService = false;
+ const QBluetoothServiceInfo serviceInfo = parseServiceXml(record, &isBtleService);
+
+ //apply uuidFilter
+ if (!uuidFilter.isEmpty()) {
+ bool serviceNameMatched = uuidFilter.contains(serviceInfo.serviceUuid());
+ bool serviceClassMatched = false;
+ foreach (const QBluetoothUuid &id, serviceInfo.serviceClassUuids()) {
+ if (uuidFilter.contains(id)) {
+ serviceClassMatched = true;
+ break;
+ }
+ }
+
+ if (!serviceNameMatched && !serviceClassMatched)
+ continue;
+ }
+
+ if (!serviceInfo.isValid())
+ continue;
+
+ if (!isDuplicatedService(serviceInfo)) {
+ discoveredServices.append(serviceInfo);
+ qCDebug(QT_BT_BLUEZ) << "Discovered services" << discoveredDevices.at(0).address().toString()
+ << serviceInfo.serviceName() << serviceInfo.serviceUuid()
+ << ">>>" << serviceInfo.serviceClassUuids();
+
+ emit q->serviceDiscovered(serviceInfo);
+ }
+ }
+ }
+
+ _q_serviceDiscoveryFinished();
+}
+
void QBluetoothServiceDiscoveryAgentPrivate::stop()
{
qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO << "Stop called";
@@ -143,7 +373,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_createdDevice(QDBusPendingCallWa
QDBusPendingReply<QDBusObjectPath> deviceObjectPath = *watcher;
if (deviceObjectPath.isError()) {
- if (deviceObjectPath.error().name() != QLatin1String("org.bluez.Error.AlreadyExists")) {
+ if (deviceObjectPath.error().name() != QStringLiteral("org.bluez.Error.AlreadyExists")) {
delete adapter;
adapter = 0;
_q_serviceDiscoveryFinished();
@@ -167,38 +397,95 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_createdDevice(QDBusPendingCallWa
}
}
- device = new OrgBluezDeviceInterface(QLatin1String("org.bluez"),
+ device = new OrgBluezDeviceInterface(QStringLiteral("org.bluez"),
deviceObjectPath.value().path(),
QDBusConnection::systemBus());
delete adapter;
adapter = 0;
- QString pattern;
- foreach (const QBluetoothUuid &uuid, uuidFilter)
- pattern += uuid.toString().remove(QLatin1Char('{')).remove(QLatin1Char('}')) + QLatin1Char(' ');
+ QVariantMap deviceProperties;
+ QString classType;
+ QDBusPendingReply<QVariantMap> deviceReply = device->GetProperties();
+ deviceReply.waitForFinished();
+ if (!deviceReply.isError()) {
+ deviceProperties = deviceReply.value();
+ classType = deviceProperties.value(QStringLiteral("Class")).toString();
+ }
+
+ /*
+ * Low Energy services in bluez are represented as the list of the paths that can be
+ * accessed with org.bluez.Characteristic
+ */
+ //QDBusArgument services = v.value(QLatin1String("Services")).value<QDBusArgument>();
+
+
+ /*
+ * Bluez v4.1 does not have extra bit which gives information if device is Bluetooth
+ * Low Energy device and the way to discover it is with Class property of the Bluetooth device.
+ * Low Energy devices do not have property Class.
+ * In case we have LE device finish service discovery; otherwise search for regular services.
+ */
+ if (classType.isEmpty()) { //is BLE device or device properties above not retrievable
+ qCDebug(QT_BT_BLUEZ) << "Discovered BLE-only device. Normal service discovery skipped.";
+ delete device;
+ device = 0;
+
+ const QStringList deviceUuids = deviceProperties.value(QStringLiteral("UUIDs")).toStringList();
+ for (int i = 0; i < deviceUuids.size(); i++) {
+ QString b = deviceUuids.at(i);
+ b = b.remove(QLatin1Char('{')).remove(QLatin1Char('}'));
+ const QBluetoothUuid uuid(b);
+
+ qCDebug(QT_BT_BLUEZ) << "Discovered BLE service" << uuid << uuidFilter.size();
+ QLowEnergyServiceInfo lowEnergyService(uuid);
+ lowEnergyService.setDevice(discoveredDevices.at(0));
+ if (uuidFilter.isEmpty())
+ emit q->serviceDiscovered(lowEnergyService);
+ else {
+ for (int j = 0; j < uuidFilter.size(); j++) {
+ if (uuidFilter.at(j) == uuid)
+ emit q->serviceDiscovered(lowEnergyService);
- pattern = pattern.trimmed();
- qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO << "Discover restrictions:" << pattern;
+ }
+ }
- QDBusPendingReply<ServiceMap> discoverReply = device->DiscoverServices(pattern);
- watcher = new QDBusPendingCallWatcher(discoverReply, q);
- QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- q, SLOT(_q_discoveredServices(QDBusPendingCallWatcher*)));
+ }
+
+ if (singleDevice && deviceReply.isError()) {
+ error = QBluetoothServiceDiscoveryAgent::InputOutputError;
+ errorString = QBluetoothServiceDiscoveryAgent::tr("Unable to access device");
+ emit q->error(error);
+ }
+ _q_serviceDiscoveryFinished();
+ } else {
+ QString pattern;
+ foreach (const QBluetoothUuid &uuid, uuidFilter)
+ pattern += uuid.toString().remove(QLatin1Char('{')).remove(QLatin1Char('}')) + QLatin1Char(' ');
+
+ pattern = pattern.trimmed();
+ qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO << "Discover restrictions:" << pattern;
+
+ QDBusPendingReply<ServiceMap> discoverReply = device->DiscoverServices(pattern);
+ watcher = new QDBusPendingCallWatcher(discoverReply, q);
+ QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ q, SLOT(_q_discoveredServices(QDBusPendingCallWatcher*)));
+ }
}
+// Bluez 4
void QBluetoothServiceDiscoveryAgentPrivate::_q_discoveredServices(QDBusPendingCallWatcher *watcher)
{
if (!device)
return;
qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO;
+ Q_Q(QBluetoothServiceDiscoveryAgent);
QDBusPendingReply<ServiceMap> reply = *watcher;
if (reply.isError()) {
qCDebug(QT_BT_BLUEZ) << "discoveredServices error: " << error << reply.error().message();
watcher->deleteLater();
if (singleDevice) {
- Q_Q(QBluetoothServiceDiscoveryAgent);
error = QBluetoothServiceDiscoveryAgent::UnknownError;
errorString = reply.error().message();
emit q->error(error);
@@ -213,56 +500,50 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_discoveredServices(QDBusPendingC
qCDebug(QT_BT_BLUEZ) << "Parsing xml" << discoveredDevices.at(0).address().toString() << discoveredDevices.count() << map.count();
- foreach (const QString &record, reply.value()) {
- QXmlStreamReader xml(record);
- QBluetoothServiceInfo serviceInfo;
- serviceInfo.setDevice(discoveredDevices.at(0));
-
- while (!xml.atEnd()) {
- xml.readNext();
-
- if (xml.tokenType() == QXmlStreamReader::StartElement &&
- xml.name() == QLatin1String("attribute")) {
- quint16 attributeId =
- xml.attributes().value(QLatin1String("id")).toString().toUShort(0, 0);
- if (xml.readNextStartElement()) {
- QVariant value = readAttributeValue(xml);
+ foreach (const QString &record, reply.value()) {
+ bool isBtleService = false;
+ QBluetoothServiceInfo serviceInfo = parseServiceXml(record, &isBtleService);
- serviceInfo.setAttribute(attributeId, value);
- }
- }
+ if (isBtleService) {
+ qCDebug(QT_BT_BLUEZ) << "Discovered BLE services" << discoveredDevices.at(0).address().toString()
+ << serviceInfo.serviceName() << serviceInfo.serviceUuid() << serviceInfo.serviceClassUuids();
+ continue;
}
if (!serviceInfo.isValid())
continue;
- Q_Q(QBluetoothServiceDiscoveryAgent);
+ // Don't need to apply uuidFilter because Bluez 4 applies
+ // search pattern during DiscoverServices() call
- //don't include the service if we already discovered it before
- bool alreadyDiscovered = false;
- for (int j = 0; j < discoveredServices.count(); j++) {
- const QBluetoothServiceInfo &info = discoveredServices.at(j);
- if (info.device() == serviceInfo.device()
- && info.serviceClassUuids() == serviceInfo.serviceClassUuids()
- && info.serviceUuid() == serviceInfo.serviceUuid()) {
- alreadyDiscovered = true;
- break;
+ Q_Q(QBluetoothServiceDiscoveryAgent);
+ // Some service uuids are unknown to Bluez. In such cases we fall back
+ // to our own naming resolution.
+ if (serviceInfo.serviceName().isEmpty()
+ && !serviceInfo.serviceClassUuids().isEmpty()) {
+ foreach (const QBluetoothUuid &classUuid, serviceInfo.serviceClassUuids()) {
+ bool ok = false;
+ QBluetoothUuid::ServiceClassUuid clsId
+ = static_cast<QBluetoothUuid::ServiceClassUuid>(classUuid.toUInt16(&ok));
+ if (ok) {
+ serviceInfo.setServiceName(QBluetoothUuid::serviceClassToString(clsId));
+ break;
+ }
}
}
- if (!alreadyDiscovered) {
+ if (!isDuplicatedService(serviceInfo)) {
discoveredServices.append(serviceInfo);
- qCDebug(QT_BT_BLUEZ) << "Discovered services" << discoveredDevices.at(0).address().toString();
+ qCDebug(QT_BT_BLUEZ) << "Discovered services" << discoveredDevices.at(0).address().toString()
+ << serviceInfo.serviceName();
emit q->serviceDiscovered(serviceInfo);
}
// could stop discovery, check for state
- if(discoveryState() == Inactive){
+ if (discoveryState() == Inactive)
qCDebug(QT_BT_BLUEZ) << "Exit discovery after stop";
- break;
- }
}
watcher->deleteLater();
@@ -272,32 +553,163 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_discoveredServices(QDBusPendingC
_q_serviceDiscoveryFinished();
}
+QBluetoothServiceInfo QBluetoothServiceDiscoveryAgentPrivate::parseServiceXml(
+ const QString& xmlRecord, bool *isBtleService)
+{
+ QXmlStreamReader xml(xmlRecord);
+
+ QBluetoothServiceInfo serviceInfo;
+ serviceInfo.setDevice(discoveredDevices.at(0));
+
+ while (!xml.atEnd()) {
+ xml.readNext();
+
+ if (xml.tokenType() == QXmlStreamReader::StartElement &&
+ xml.name() == QLatin1String("attribute")) {
+ quint16 attributeId =
+ xml.attributes().value(QLatin1String("id")).toString().toUShort(0, 0);
+
+ if (xml.readNextStartElement()) {
+ QVariant value = readAttributeValue(xml);
+ if (isBtleService) {
+ if (attributeId == 1) {// Attribute with id 1 contains UUID of the service
+ const QBluetoothServiceInfo::Sequence seq =
+ value.value<QBluetoothServiceInfo::Sequence>();
+ for (int i = 0; i < seq.count(); i++) {
+ const QBluetoothUuid uuid = seq.at(i).value<QBluetoothUuid>();
+ if ((uuid.data1 & 0x1800) == 0x1800) {// We are taking into consideration that LE services starts at 0x1800
+ //TODO don't emit in the middle of nowhere
+ Q_Q(QBluetoothServiceDiscoveryAgent);
+ QLowEnergyServiceInfo leService(uuid);
+ leService.setDevice(discoveredDevices.at(0));
+ *isBtleService = true;
+ emit q->serviceDiscovered(leService);
+ break;
+ }
+ }
+ }
+ }
+ serviceInfo.setAttribute(attributeId, value);
+ }
+ }
+ }
+
+ return serviceInfo;
+}
+
+void QBluetoothServiceDiscoveryAgentPrivate::performMinimalServiceDiscovery(const QBluetoothAddress &deviceAddress)
+{
+ if (foundHostAdapterPath.isEmpty()) {
+ _q_serviceDiscoveryFinished();
+ return;
+ }
+
+ Q_Q(QBluetoothServiceDiscoveryAgent);
+
+ QDBusPendingReply<ManagedObjectList> reply = managerBluez5->GetManagedObjects();
+ reply.waitForFinished();
+ if (reply.isError()) {
+ if (singleDevice) {
+ error = QBluetoothServiceDiscoveryAgent::InputOutputError;
+ errorString = reply.error().message();
+ emit q->error(error);
+
+ }
+ _q_serviceDiscoveryFinished();
+ return;
+ }
+
+ QStringList uuidStrings;
+ foreach (const QDBusObjectPath &path, reply.value().keys()) {
+ const InterfaceList ifaceList = reply.value().value(path);
+ foreach (const QString &iface, ifaceList.keys()) {
+ if (iface == QStringLiteral("org.bluez.Device1")) {
+ const QVariantMap details = ifaceList.value(iface);
+ if (deviceAddress.toString()
+ == details.value(QStringLiteral("Address")).toString()) {
+ uuidStrings = details.value(QStringLiteral("UUIDs")).toStringList();
+ break;
+ }
+ }
+ }
+ if (!uuidStrings.isEmpty())
+ break;
+ }
+
+ if (uuidStrings.isEmpty() || discoveredDevices.isEmpty()) {
+ qCWarning(QT_BT_BLUEZ) << "No uuids found for" << deviceAddress.toString();
+ // nothing found -> go to next uuid
+ _q_serviceDiscoveryFinished();
+ return;
+ }
+
+ qCDebug(QT_BT_BLUEZ) << "Minimal uuid list for" << deviceAddress.toString() << uuidStrings;
+
+ QBluetoothUuid uuid;
+ for (int i = 0; i < uuidStrings.count(); i++) {
+ uuid = QBluetoothUuid(uuidStrings.at(i));
+ if (uuid.isNull())
+ continue;
+
+ //apply uuidFilter
+ if (!uuidFilter.isEmpty() && !uuidFilter.contains(uuid))
+ continue;
+
+ // TODO deal with BTLE services under Bluez 5 -> right now they are normal services
+ QBluetoothServiceInfo serviceInfo;
+ serviceInfo.setDevice(discoveredDevices.at(0));
+
+ if (uuid.minimumSize() == 16) { // not derived from Bluetooth Base UUID
+ serviceInfo.setServiceUuid(uuid);
+ serviceInfo.setServiceName(QBluetoothServiceDiscoveryAgent::tr("Custom Service"));
+ } else {
+ // set uuid as service class id
+ QBluetoothServiceInfo::Sequence classId;
+ classId << QVariant::fromValue(uuid);
+ serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId);
+ QBluetoothUuid::ServiceClassUuid clsId
+ = static_cast<QBluetoothUuid::ServiceClassUuid>(uuid.data1 & 0xffff);
+ serviceInfo.setServiceName(QBluetoothUuid::serviceClassToString(clsId));
+ }
+
+ //don't include the service if we already discovered it before
+ if (!isDuplicatedService(serviceInfo)) {
+ discoveredServices << serviceInfo;
+ qCDebug(QT_BT_BLUEZ) << "Discovered services" << discoveredDevices.at(0).address().toString()
+ << serviceInfo.serviceName();
+ emit q->serviceDiscovered(serviceInfo);
+ }
+ }
+
+ _q_serviceDiscoveryFinished();
+}
+
QVariant QBluetoothServiceDiscoveryAgentPrivate::readAttributeValue(QXmlStreamReader &xml)
{
if (xml.name() == QLatin1String("boolean")) {
- const QString value = xml.attributes().value(QLatin1String("value")).toString();
+ const QString value = xml.attributes().value(QStringLiteral("value")).toString();
xml.skipCurrentElement();
return value == QLatin1String("true");
} else if (xml.name() == QLatin1String("uint8")) {
- quint8 value = xml.attributes().value(QLatin1String("value")).toString().toUShort(0, 0);
+ quint8 value = xml.attributes().value(QStringLiteral("value")).toString().toUShort(0, 0);
xml.skipCurrentElement();
return value;
} else if (xml.name() == QLatin1String("uint16")) {
- quint16 value = xml.attributes().value(QLatin1String("value")).toString().toUShort(0, 0);
+ quint16 value = xml.attributes().value(QStringLiteral("value")).toString().toUShort(0, 0);
xml.skipCurrentElement();
return value;
} else if (xml.name() == QLatin1String("uint32")) {
- quint32 value = xml.attributes().value(QLatin1String("value")).toString().toUInt(0, 0);
+ quint32 value = xml.attributes().value(QStringLiteral("value")).toString().toUInt(0, 0);
xml.skipCurrentElement();
return value;
} else if (xml.name() == QLatin1String("uint64")) {
- quint64 value = xml.attributes().value(QLatin1String("value")).toString().toULongLong(0, 0);
+ quint64 value = xml.attributes().value(QStringLiteral("value")).toString().toULongLong(0, 0);
xml.skipCurrentElement();
return value;
} else if (xml.name() == QLatin1String("uuid")) {
QBluetoothUuid uuid;
- const QString value = xml.attributes().value(QLatin1String("value")).toString();
- if (value.startsWith(QLatin1String("0x"))) {
+ const QString value = xml.attributes().value(QStringLiteral("value")).toString();
+ if (value.startsWith(QStringLiteral("0x"))) {
if (value.length() == 6) {
quint16 v = value.toUShort(0, 0);
uuid = QBluetoothUuid(v);
@@ -310,9 +722,9 @@ QVariant QBluetoothServiceDiscoveryAgentPrivate::readAttributeValue(QXmlStreamRe
}
xml.skipCurrentElement();
return QVariant::fromValue(uuid);
- } else if (xml.name() == QLatin1String("text") || xml.name() == QStringLiteral("url")) {
- QString value = xml.attributes().value(QLatin1String("value")).toString();
- if (xml.attributes().value(QLatin1String("encoding")) == QLatin1String("hex"))
+ } else if (xml.name() == QLatin1String("text") || xml.name() == QLatin1String("url")) {
+ QString value = xml.attributes().value(QStringLiteral("value")).toString();
+ if (xml.attributes().value(QStringLiteral("encoding")) == QLatin1String("hex"))
value = QString::fromUtf8(QByteArray::fromHex(value.toLatin1()));
xml.skipCurrentElement();
return value;
@@ -328,7 +740,7 @@ QVariant QBluetoothServiceDiscoveryAgentPrivate::readAttributeValue(QXmlStreamRe
} else {
qCWarning(QT_BT_BLUEZ) << "unknown attribute type"
<< xml.name().toString()
- << xml.attributes().value(QLatin1String("value")).toString();
+ << xml.attributes().value(QStringLiteral("value")).toString();
xml.skipCurrentElement();
return QVariant();
}
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_p.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_p.cpp
index 86874a6c..695912f1 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_p.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_p.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_p.h b/src/bluetooth/qbluetoothservicediscoveryagent_p.h
index 377e186b..b027033e 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_p.h
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -57,13 +49,17 @@
#include "qbluetoothdeviceinfo.h"
#include "qbluetoothserviceinfo.h"
#include "qbluetoothservicediscoveryagent.h"
+#include "qlowenergyserviceinfo.h"
#include <QStack>
+#include <QStringList>
#ifdef QT_BLUEZ_BLUETOOTH
class OrgBluezManagerInterface;
class OrgBluezAdapterInterface;
class OrgBluezDeviceInterface;
+class OrgFreedesktopDBusObjectManagerInterface;
+
QT_BEGIN_NAMESPACE
class QDBusPendingCallWatcher;
class QXmlStreamReader;
@@ -119,7 +115,6 @@ public:
void setDiscoveryMode(QBluetoothServiceDiscoveryAgent::DiscoveryMode m) { mode = m; }
QBluetoothServiceDiscoveryAgent::DiscoveryMode DiscoveryMode() { return mode; }
- // private slots
void _q_deviceDiscoveryFinished();
void _q_deviceDiscovered(const QBluetoothDeviceInfo &info);
void _q_serviceDiscoveryFinished();
@@ -127,6 +122,15 @@ public:
#ifdef QT_BLUEZ_BLUETOOTH
void _q_discoveredServices(QDBusPendingCallWatcher *watcher);
void _q_createdDevice(QDBusPendingCallWatcher *watcher);
+ //Slots below are used for discovering Bluetooth Low Energy devices. It will be used with Bluez 5.x version.
+ /*
+ void _g_discoveredGattService();
+ void _q_discoverGattCharacteristics(QDBusPendingCallWatcher *watcher);
+ void _q_discoveredGattCharacteristic(QDBusPendingCallWatcher *watcher);
+ */
+ void _q_finishSdpScan(QBluetoothServiceDiscoveryAgent::Error errorCode,
+ const QString &errorDescription,
+ const QStringList &xmlRecords);
#endif
#ifdef QT_ANDROID_BLUETOOTH
void _q_processFetchedUuids(const QBluetoothAddress &address, const QList<QBluetoothUuid> &uuids);
@@ -140,13 +144,19 @@ public:
private:
void start(const QBluetoothAddress &address);
void stop();
+ bool isDuplicatedService(const QBluetoothServiceInfo &serviceInfo) const;
#ifdef QT_BLUEZ_BLUETOOTH
+ void startBluez5(const QBluetoothAddress &address);
+ void runSdpScan(const QBluetoothAddress &remoteAddress,
+ const QBluetoothAddress localAddress);
QVariant readAttributeValue(QXmlStreamReader &xml);
+ QBluetoothServiceInfo parseServiceXml(const QString& xml, bool *isBtleService);
+ void performMinimalServiceDiscovery(const QBluetoothAddress &deviceAddress);
#endif
#ifdef QT_QNX_BLUETOOTH
-private Q_SLOTS:
+private slots:
void remoteDevicesChanged(int fd);
void controlReply(ppsResult result);
void controlEvent(ppsResult result);
@@ -160,6 +170,7 @@ private:
QSocketNotifier *rdNotifier;
QTimer m_queryTimer;
bool m_btInitialized;
+ bool m_serviceScanDone;
#endif
public:
@@ -179,9 +190,10 @@ private:
QBluetoothServiceDiscoveryAgent::DiscoveryMode mode;
bool singleDevice;
-
#ifdef QT_BLUEZ_BLUETOOTH
+ QString foundHostAdapterPath;
OrgBluezManagerInterface *manager;
+ OrgFreedesktopDBusObjectManagerInterface *managerBluez5;
OrgBluezAdapterInterface *adapter;
OrgBluezDeviceInterface *device;
#endif
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp
index 59551451..04c25fdc 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -45,16 +37,21 @@
#include "qbluetoothdeviceinfo.h"
#include "qbluetoothdevicediscoveryagent.h"
+#include "qlowenergyserviceinfo_p.h"
+
#include <QStringList>
#include "qbluetoothuuid.h"
-
+#include <stdio.h>
+#include <unistd.h>
#include <sys/pps.h>
#ifdef QT_QNX_BT_BLUETOOTH
#include <errno.h>
#include <QPointer>
#endif
-
#include <QFile>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include <QtCore/private/qcore_unix_p.h>
@@ -196,33 +193,45 @@ void QBluetoothServiceDiscoveryAgentPrivate::start(const QBluetoothAddress &addr
#else
qCDebug(QT_BT_QNX) << "Starting Service discovery for" << address.toString();
const QString filePath = QStringLiteral("/pps/services/bluetooth/remote_devices/").append(address.toString());
+ bool hasError = false;
if ((m_rdfd = qt_safe_open(filePath.toLocal8Bit().constData(), O_RDONLY)) == -1) {
- if (QFile::exists(filePath + QLatin1String("-00")) ||
- QFile::exists(filePath + QLatin1String("-01"))) {
+ if (QFile::exists(filePath + QStringLiteral("-00")) ||
+ QFile::exists(filePath + QStringLiteral("-01")))
+ {
qCDebug(QT_BT_QNX) << "LE device discovered...skipping";
+ QString lePath = filePath + QStringLiteral("-00");
+ if ((m_rdfd = qt_safe_open(lePath.toLocal8Bit().constData(), O_RDONLY)) == -1) {
+ lePath = filePath + QStringLiteral("-01");
+ if ((m_rdfd = qt_safe_open(lePath.toLocal8Bit().constData(), O_RDONLY)) == -1)
+ hasError = true;
+ }
} else {
- qCWarning(QT_BT_QNX) << "Failed to open " << filePath;
- error = QBluetoothServiceDiscoveryAgent::InputOutputError;
- errorString = QBluetoothServiceDiscoveryAgent::tr("Failed to open remote device file");
- q->error(error);
+ hasError = true;
}
+ }
+ if (hasError) {
+ qCWarning(QT_BT_QNX) << "Failed to open " << filePath;
+ error = QBluetoothServiceDiscoveryAgent::InputOutputError;
+ errorString = QBluetoothServiceDiscoveryAgent::tr("Failed to open remote device file");
+ q->error(error);
_q_serviceDiscoveryFinished();
return;
+ }
+
+ if (rdNotifier)
+ delete rdNotifier;
+ rdNotifier = new QSocketNotifier(m_rdfd, QSocketNotifier::Read, this);
+ if (rdNotifier) {
+ connect(rdNotifier, SIGNAL(activated(int)), this, SLOT(remoteDevicesChanged(int)));
} else {
- if (rdNotifier)
- delete rdNotifier;
- rdNotifier = new QSocketNotifier(m_rdfd, QSocketNotifier::Read, this);
- if (rdNotifier) {
- connect(rdNotifier, SIGNAL(activated(int)), this, SLOT(remoteDevicesChanged(int)));
- } else {
- qCWarning(QT_BT_QNX) << "Service Discovery: Failed to connect to rdNotifier";
- error = QBluetoothServiceDiscoveryAgent::InputOutputError;
- errorString = QBluetoothServiceDiscoveryAgent::tr("Failed to connect to notifier");
- q->error(error);
- _q_serviceDiscoveryFinished();
- return;
- }
+ qWarning() << "Service Discovery: Failed to connect to rdNotifier";
+ error = QBluetoothServiceDiscoveryAgent::InputOutputError;
+ errorString = QStringLiteral("Failed to connect to rdNotifier");
+ q->error(error);
+ _q_serviceDiscoveryFinished();
+ return;
}
+
m_queryTimer.start(10000);
ppsSendControlMessage("service_query", QStringLiteral("{\"addr\":\"%1\"}").arg(address.toString()), this);
#endif
@@ -258,14 +267,14 @@ void QBluetoothServiceDiscoveryAgentPrivate::remoteDevicesChanged(int fd)
pps_decoder_cleanup(&ppsDecoder);
return;
}
-
+ // Checking for standard Bluetooth services
pps_decoder_push(&ppsDecoder, "available_services");
-
+ bool standardService = false;
const char *next_service = 0;
for (int service_count=0; pps_decoder_get_string(&ppsDecoder, 0, &next_service ) == PPS_DECODER_OK; service_count++) {
if (next_service == 0)
break;
-
+ standardService = true;
qCDebug(QT_BT_QNX) << Q_FUNC_INFO << "Service" << next_service;
QBluetoothServiceInfo serviceInfo;
@@ -306,26 +315,46 @@ void QBluetoothServiceDiscoveryAgentPrivate::remoteDevicesChanged(int fd)
serviceInfo.setAttribute(QBluetoothServiceInfo::BrowseGroupList,
QBluetoothUuid(QBluetoothUuid::PublicBrowseGroup));
- bool entryExists = false;
//Did we already discover this service?
- foreach (QBluetoothServiceInfo sInfo, q_ptr->discoveredServices()) {
- if (sInfo.device() == serviceInfo.device()
- && sInfo.serviceUuid() == serviceInfo.serviceUuid()
- && sInfo.serviceClassUuids() == serviceInfo.serviceClassUuids()) {
- entryExists = true;
- //qCDebug(QT_BT_QNX) << "Entry exists" << serviceInfo.serviceClassUuids().first() << sInfo.serviceClassUuids().first();
- break;
- }
- }
-
- if (!entryExists) {
+ if (!isDuplicatedService(serviceInfo)) {
qCDebug(QT_BT_QNX) << "Adding service" << next_service << " " << serviceInfo.socketProtocol();
discoveredServices << serviceInfo;
q_ptr->serviceDiscovered(serviceInfo);
}
}
+ if (standardService) // we need to pop back for the LE service scan
+ pps_decoder_pop(&ppsDecoder);
+ //Checking for Bluetooth Low Energy services
+ pps_decoder_push(&ppsDecoder, "gatt_available_services");
+
+ for (int service_count=0; pps_decoder_get_string(&ppsDecoder, 0, &next_service ) == PPS_DECODER_OK; service_count++) {
+ if (next_service == 0)
+ break;
+
+ QString lowEnergyUuid(next_service);
+ qCDebug(QT_BT_QNX) << "LE Service: " << lowEnergyUuid << next_service;
+ QBluetoothUuid leUuid;
+
+ //In case of custom UUIDs (e.g. Texas Instruments SenstorTag LE Device)
+ if ( lowEnergyUuid.length() > 4 ) {
+ leUuid = QBluetoothUuid(lowEnergyUuid);
+ }
+ else {// Official UUIDs are presented in 4 characters (for instance 180A)
+ lowEnergyUuid = QStringLiteral("0x") + lowEnergyUuid;
+ leUuid = QBluetoothUuid(lowEnergyUuid.toUShort(0,0));
+ }
+
+ QLowEnergyServiceInfo lowEnergyService(leUuid);
+ lowEnergyService.setDevice(discoveredDevices.at(0));
+ qCDebug(QT_BT_QNX) << "Adding Low Energy service" << lowEnergyService.serviceUuid();
+ q_ptr->serviceDiscovered(lowEnergyService);
+ }
+
pps_decoder_cleanup(&ppsDecoder);
+ //Deleting notifier since services will not change.
+ delete rdNotifier;
+ rdNotifier = 0;
}
void QBluetoothServiceDiscoveryAgentPrivate::controlReply(ppsResult result)
@@ -338,6 +367,8 @@ void QBluetoothServiceDiscoveryAgentPrivate::controlReply(ppsResult result)
if (!result.errorMsg.isEmpty()) {
qCWarning(QT_BT_QNX) << Q_FUNC_INFO << result.errorMsg;
errorString = result.errorMsg;
+ if (errorString == QObject::tr("Operation canceled"))
+ _q_serviceDiscoveryFinished();
error = QBluetoothServiceDiscoveryAgent::InputOutputError;
q->error(error);
} else {
diff --git a/src/bluetooth/qbluetoothserviceinfo.cpp b/src/bluetooth/qbluetoothserviceinfo.cpp
index cfb2bbcb..9c2f1ed1 100644
--- a/src/bluetooth/qbluetoothserviceinfo.cpp
+++ b/src/bluetooth/qbluetoothserviceinfo.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothserviceinfo.h b/src/bluetooth/qbluetoothserviceinfo.h
index 4d3b8612..1ec1d7d9 100644
--- a/src/bluetooth/qbluetoothserviceinfo.h
+++ b/src/bluetooth/qbluetoothserviceinfo.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothserviceinfo_android.cpp b/src/bluetooth/qbluetoothserviceinfo_android.cpp
index 078554d0..5d7f0fac 100644
--- a/src/bluetooth/qbluetoothserviceinfo_android.cpp
+++ b/src/bluetooth/qbluetoothserviceinfo_android.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothserviceinfo_bluez.cpp b/src/bluetooth/qbluetoothserviceinfo_bluez.cpp
index bde3e264..59a9abca 100644
--- a/src/bluetooth/qbluetoothserviceinfo_bluez.cpp
+++ b/src/bluetooth/qbluetoothserviceinfo_bluez.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -44,114 +36,120 @@
#include "bluez/manager_p.h"
#include "bluez/service_p.h"
+#include "bluez/bluez5_helper_p.h"
+#include "bluez/profile1_p.h"
#include <QtCore/QLoggingCategory>
#include <QtCore/QXmlStreamWriter>
+#include <QtCore/QAtomicInt>
QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(QT_BT_BLUEZ)
+static const QLatin1String profilePathTemplate("/qt/profile");
+static QAtomicInt pathCounter;
+
static void writeAttribute(QXmlStreamWriter *stream, const QVariant &attribute)
{
- const QString unsignedFormat(QLatin1String("0x%1"));
+ const QString unsignedFormat(QStringLiteral("0x%1"));
switch (int(attribute.type())) {
case QMetaType::Void:
- stream->writeEmptyElement(QLatin1String("nil"));
+ stream->writeEmptyElement(QStringLiteral("nil"));
break;
case QMetaType::UChar:
- stream->writeEmptyElement(QLatin1String("uint8"));
- stream->writeAttribute(QLatin1String("value"),
+ stream->writeEmptyElement(QStringLiteral("uint8"));
+ stream->writeAttribute(QStringLiteral("value"),
unsignedFormat.arg(attribute.value<quint8>(), 2, 16,
QLatin1Char('0')));
- //stream->writeAttribute(QLatin1String("name"), foo);
+ //stream->writeAttribute(QStringLiteral("name"), foo);
break;
case QMetaType::UShort:
- stream->writeEmptyElement(QLatin1String("uint16"));
- stream->writeAttribute(QLatin1String("value"),
+ stream->writeEmptyElement(QStringLiteral("uint16"));
+ stream->writeAttribute(QStringLiteral("value"),
unsignedFormat.arg(attribute.value<quint16>(), 4, 16,
QLatin1Char('0')));
- //stream->writeAttribute(QLatin1String("name"), foo);
+ //stream->writeAttribute(QStringLiteral("name"), foo);
break;
case QMetaType::UInt:
- stream->writeEmptyElement(QLatin1String("uint32"));
- stream->writeAttribute(QLatin1String("value"),
+ stream->writeEmptyElement(QStringLiteral("uint32"));
+ stream->writeAttribute(QStringLiteral("value"),
unsignedFormat.arg(attribute.value<quint32>(), 8, 16,
QLatin1Char('0')));
- //stream->writeAttribute(QLatin1String("name"), foo);
+ //stream->writeAttribute(QStringLiteral("name"), foo);
break;
case QMetaType::Char:
- stream->writeEmptyElement(QLatin1String("int8"));
- stream->writeAttribute(QLatin1String("value"),
+ stream->writeEmptyElement(QStringLiteral("int8"));
+ stream->writeAttribute(QStringLiteral("value"),
QString::number(attribute.value<uchar>(), 16));
- //stream->writeAttribute(QLatin1String("name"), foo);
+ //stream->writeAttribute(QStringLiteral("name"), foo);
break;
case QMetaType::Short:
- stream->writeEmptyElement(QLatin1String("int16"));
- stream->writeAttribute(QLatin1String("value"),
+ stream->writeEmptyElement(QStringLiteral("int16"));
+ stream->writeAttribute(QStringLiteral("value"),
QString::number(attribute.value<qint16>(), 16));
- //stream->writeAttribute(QLatin1String("name"), foo);
+ //stream->writeAttribute(QStringLiteral("name"), foo);
break;
case QMetaType::Int:
- stream->writeEmptyElement(QLatin1String("int32"));
- stream->writeAttribute(QLatin1String("value"),
+ stream->writeEmptyElement(QStringLiteral("int32"));
+ stream->writeAttribute(QStringLiteral("value"),
QString::number(attribute.value<qint32>(), 16));
- //stream->writeAttribute(QLatin1String("name"), foo);
+ //stream->writeAttribute(QStringLiteral("name"), foo);
break;
case QMetaType::QString:
- stream->writeEmptyElement(QLatin1String("text"));
+ stream->writeEmptyElement(QStringLiteral("text"));
if (/* require hex encoding */ false) {
- stream->writeAttribute(QLatin1String("value"), QString::fromLatin1(
+ stream->writeAttribute(QStringLiteral("value"), QString::fromLatin1(
attribute.value<QString>().toUtf8().toHex().constData()));
- stream->writeAttribute(QLatin1String("encoding"), QLatin1String("hex"));
+ stream->writeAttribute(QStringLiteral("encoding"), QStringLiteral("hex"));
} else {
- stream->writeAttribute(QLatin1String("value"), attribute.value<QString>());
- stream->writeAttribute(QLatin1String("encoding"), QLatin1String("normal"));
+ stream->writeAttribute(QStringLiteral("value"), attribute.value<QString>());
+ stream->writeAttribute(QStringLiteral("encoding"), QStringLiteral("normal"));
}
- //stream->writeAttribute(QLatin1String("name"), foo);
+ //stream->writeAttribute(QStringLiteral("name"), foo);
break;
case QMetaType::Bool:
- stream->writeEmptyElement(QLatin1String("boolean"));
+ stream->writeEmptyElement(QStringLiteral("boolean"));
if (attribute.value<bool>())
- stream->writeAttribute(QLatin1String("value"), QLatin1String("true"));
+ stream->writeAttribute(QStringLiteral("value"), QStringLiteral("true"));
else
- stream->writeAttribute(QLatin1String("value"), QLatin1String("false"));
- //stream->writeAttribute(QLatin1String("name"), foo);
+ stream->writeAttribute(QStringLiteral("value"), QStringLiteral("false"));
+ //stream->writeAttribute(QStringLiteral("name"), foo);
break;
case QMetaType::QUrl:
- stream->writeEmptyElement(QLatin1String("url"));
- stream->writeAttribute(QLatin1String("value"), attribute.value<QUrl>().toString());
- //stream->writeAttribute(QLatin1String("name"), foo);
+ stream->writeEmptyElement(QStringLiteral("url"));
+ stream->writeAttribute(QStringLiteral("value"), attribute.value<QUrl>().toString());
+ //stream->writeAttribute(QStringLiteral("name"), foo);
break;
case QVariant::UserType:
if (attribute.userType() == qMetaTypeId<QBluetoothUuid>()) {
- stream->writeEmptyElement(QLatin1String("uuid"));
+ stream->writeEmptyElement(QStringLiteral("uuid"));
QBluetoothUuid uuid = attribute.value<QBluetoothUuid>();
switch (uuid.minimumSize()) {
case 0:
- stream->writeAttribute(QLatin1String("value"),
+ stream->writeAttribute(QStringLiteral("value"),
unsignedFormat.arg(quint16(0), 4, 16, QLatin1Char('0')));
break;
case 2:
- stream->writeAttribute(QLatin1String("value"),
+ stream->writeAttribute(QStringLiteral("value"),
unsignedFormat.arg(uuid.toUInt16(), 4, 16,
QLatin1Char('0')));
break;
case 4:
- stream->writeAttribute(QLatin1String("value"),
+ stream->writeAttribute(QStringLiteral("value"),
unsignedFormat.arg(uuid.toUInt32(), 8, 16,
QLatin1Char('0')));
break;
case 16:
- stream->writeAttribute(QLatin1String("value"), uuid.toString().mid(1, 36));
+ stream->writeAttribute(QStringLiteral("value"), uuid.toString().mid(1, 36));
break;
default:
- stream->writeAttribute(QLatin1String("value"), uuid.toString().mid(1, 36));
+ stream->writeAttribute(QStringLiteral("value"), uuid.toString().mid(1, 36));
}
} else if (attribute.userType() == qMetaTypeId<QBluetoothServiceInfo::Sequence>()) {
- stream->writeStartElement(QLatin1String("sequence"));
+ stream->writeStartElement(QStringLiteral("sequence"));
const QBluetoothServiceInfo::Sequence *sequence =
static_cast<const QBluetoothServiceInfo::Sequence *>(attribute.data());
foreach (const QVariant &v, *sequence)
@@ -171,8 +169,14 @@ static void writeAttribute(QXmlStreamWriter *stream, const QVariant &attribute)
}
QBluetoothServiceInfoPrivate::QBluetoothServiceInfoPrivate()
-: service(0), serviceRecord(0), registered(false)
+: service(0), serviceBluez5(0), serviceRecord(0), registered(false)
{
+ if (isBluez5()) {
+ serviceBluez5 = new OrgBluezProfileManager1Interface(
+ QStringLiteral("org.bluez"),
+ QStringLiteral("/org/bluez"),
+ QDBusConnection::systemBus(), this);
+ }
}
QBluetoothServiceInfoPrivate::~QBluetoothServiceInfoPrivate()
@@ -189,15 +193,30 @@ bool QBluetoothServiceInfoPrivate::unregisterService()
if (!registered)
return false;
- if (!ensureSdpConnection(currentLocalAdapter))
- return false;
+ if (serviceBluez5) { // Bluez 5
+ if (profilePath.isEmpty())
+ return false;
- QDBusPendingReply<> reply = service->RemoveRecord(serviceRecord);
- reply.waitForFinished();
- if (reply.isError())
- return false;
+ QDBusPendingReply<> reply = serviceBluez5->UnregisterProfile(
+ QDBusObjectPath(profilePath));
+ reply.waitForFinished();
+ if (reply.isError()) {
+ qCWarning(QT_BT_BLUEZ) << "Cannot unregister profile:"
+ << profilePath << reply.error().message();
+ return false;
+ }
+ profilePath.clear();
+ } else { // Bluez 4
+ if (!ensureSdpConnection(currentLocalAdapter))
+ return false;
+
+ QDBusPendingReply<> reply = service->RemoveRecord(serviceRecord);
+ reply.waitForFinished();
+ if (reply.isError())
+ return false;
- serviceRecord = 0;
+ serviceRecord = 0;
+ }
registered = false;
return true;
@@ -210,7 +229,7 @@ bool QBluetoothServiceInfoPrivate::ensureSdpConnection(const QBluetoothAddress &
delete service;
- OrgBluezManagerInterface manager(QLatin1String("org.bluez"), QLatin1String("/"),
+ OrgBluezManagerInterface manager(QStringLiteral("org.bluez"), QStringLiteral("/"),
QDBusConnection::systemBus());
@@ -224,7 +243,7 @@ bool QBluetoothServiceInfoPrivate::ensureSdpConnection(const QBluetoothAddress &
return false;
currentLocalAdapter = localAdapter;
- service = new OrgBluezServiceInterface(QLatin1String("org.bluez"), reply.value().path(),
+ service = new OrgBluezServiceInterface(QStringLiteral("org.bluez"), reply.value().path(),
QDBusConnection::systemBus(), this);
return true;
@@ -232,13 +251,18 @@ bool QBluetoothServiceInfoPrivate::ensureSdpConnection(const QBluetoothAddress &
bool QBluetoothServiceInfoPrivate::registerService(const QBluetoothAddress &localAdapter)
{
- //if new adapter unregister previous one first
- if (registered && localAdapter != currentLocalAdapter)
- unregisterService();
+ if (serviceBluez5) { // Bluez 5
+ if (registered)
+ return false;
+ } else { // Bluez 4
+ //if new adapter unregister previous one first
+ if (registered && localAdapter != currentLocalAdapter)
+ unregisterService();
- if (!ensureSdpConnection(localAdapter)) {
- qCWarning(QT_BT_BLUEZ) << "SDP not connected. Cannot register";
- return false;
+ if (!ensureSdpConnection(localAdapter)) {
+ qCWarning(QT_BT_BLUEZ) << "SDP not connected. Cannot register";
+ return false;
+ }
}
QString xmlServiceRecord;
@@ -246,16 +270,16 @@ bool QBluetoothServiceInfoPrivate::registerService(const QBluetoothAddress &loca
QXmlStreamWriter stream(&xmlServiceRecord);
stream.setAutoFormatting(true);
- stream.writeStartDocument(QLatin1String("1.0"));
+ stream.writeStartDocument(QStringLiteral("1.0"));
- stream.writeStartElement(QLatin1String("record"));
+ stream.writeStartElement(QStringLiteral("record"));
- const QString unsignedFormat(QLatin1String("0x%1"));
+ const QString unsignedFormat(QStringLiteral("0x%1"));
QMap<quint16, QVariant>::ConstIterator i = attributes.constBegin();
while (i != attributes.constEnd()) {
- stream.writeStartElement(QLatin1String("attribute"));
- stream.writeAttribute(QLatin1String("id"), unsignedFormat.arg(i.key(), 4, 16, QLatin1Char('0')));
+ stream.writeStartElement(QStringLiteral("attribute"));
+ stream.writeAttribute(QStringLiteral("id"), unsignedFormat.arg(i.key(), 4, 16, QLatin1Char('0')));
writeAttribute(&stream, i.value());
stream.writeEndElement();
@@ -266,22 +290,84 @@ bool QBluetoothServiceInfoPrivate::registerService(const QBluetoothAddress &loca
stream.writeEndDocument();
- if (!registered) {
- QDBusPendingReply<uint> reply = service->AddRecord(xmlServiceRecord);
- reply.waitForFinished();
- if (reply.isError()) {
- qCWarning(QT_BT_BLUEZ) << "AddRecord returned error" << reply.error();
- return false;
+ if (serviceBluez5) { // Bluez 5
+ // create path
+ profilePath = profilePathTemplate;
+ profilePath.append(QString::fromLatin1("/%1%2/%3").
+ arg(QCoreApplication::applicationName()).
+ arg(QCoreApplication::applicationPid()).
+ arg(pathCounter.fetchAndAddOrdered(1)));
+
+ QVariantMap mapping;
+ mapping.insert(QStringLiteral("ServiceRecord"), xmlServiceRecord);
+
+ // Strategy to pick service uuid
+ // 1.) use serviceUuid()
+ // 2.) use first custom uuid if available
+ // 3.) use first service class uuid
+ QBluetoothUuid profileUuid = attributes.value(QBluetoothServiceInfo::ServiceId)
+ .value<QBluetoothUuid>();
+ QBluetoothUuid firstCustomUuid;
+ if (profileUuid.isNull()) {
+ const QVariant var = attributes.value(QBluetoothServiceInfo::ServiceClassIds);
+ if (var.isValid()) {
+ const QBluetoothServiceInfo::Sequence seq
+ = var.value<QBluetoothServiceInfo::Sequence>();
+ QBluetoothUuid tempUuid;
+
+ for (int i = 0; i < seq.count(); i++) {
+ tempUuid = seq.at(i).value<QBluetoothUuid>();
+ if (tempUuid.isNull())
+ continue;
+
+ int size = tempUuid.minimumSize();
+ if (size == 2 || size == 4) { // Base UUID derived
+ if (profileUuid.isNull())
+ profileUuid = tempUuid;
+ } else if (firstCustomUuid.isNull()){
+ firstCustomUuid = tempUuid;
+ }
+ }
+ }
}
- serviceRecord = reply.value();
- } else {
- QDBusPendingReply<> reply = service->UpdateRecord(serviceRecord, xmlServiceRecord);
+ if (!firstCustomUuid.isNull())
+ profileUuid = firstCustomUuid;
+
+ QString uuidString = profileUuid.toString();
+ uuidString.chop(1); // remove trailing '}'
+ uuidString.remove(0, 1); // remove beginning '{'
+
+ qCDebug(QT_BT_BLUEZ) << "Registering profile under" << profilePath
+ << uuidString;
+
+ QDBusPendingReply<> reply = serviceBluez5->RegisterProfile(
+ QDBusObjectPath(profilePath),
+ uuidString,
+ mapping);
reply.waitForFinished();
if (reply.isError()) {
- qCWarning(QT_BT_BLUEZ) << "UpdateRecord returned error" << reply.error();
+ qCWarning(QT_BT_BLUEZ) << "Cannot register profile" << reply.error().message();
return false;
}
+ } else { // Bluez 4
+ if (!registered) {
+ QDBusPendingReply<uint> reply = service->AddRecord(xmlServiceRecord);
+ reply.waitForFinished();
+ if (reply.isError()) {
+ qCWarning(QT_BT_BLUEZ) << "AddRecord returned error" << reply.error();
+ return false;
+ }
+
+ serviceRecord = reply.value();
+ } else {
+ QDBusPendingReply<> reply = service->UpdateRecord(serviceRecord, xmlServiceRecord);
+ reply.waitForFinished();
+ if (reply.isError()) {
+ qCWarning(QT_BT_BLUEZ) << "UpdateRecord returned error" << reply.error();
+ return false;
+ }
+ }
}
registered = true;
diff --git a/src/bluetooth/qbluetoothserviceinfo_p.cpp b/src/bluetooth/qbluetoothserviceinfo_p.cpp
index e5f2f4e5..ba6a9526 100644
--- a/src/bluetooth/qbluetoothserviceinfo_p.cpp
+++ b/src/bluetooth/qbluetoothserviceinfo_p.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothserviceinfo_p.h b/src/bluetooth/qbluetoothserviceinfo_p.h
index ab957325..7ff7132c 100644
--- a/src/bluetooth/qbluetoothserviceinfo_p.h
+++ b/src/bluetooth/qbluetoothserviceinfo_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -62,6 +54,7 @@
#include <QVariant>
class OrgBluezServiceInterface;
+class OrgBluezProfileManager1Interface;
QT_BEGIN_NAMESPACE
@@ -91,8 +84,10 @@ private:
bool ensureSdpConnection(const QBluetoothAddress &localAdapter = QBluetoothAddress());
OrgBluezServiceInterface *service;
+ OrgBluezProfileManager1Interface *serviceBluez5;
quint32 serviceRecord;
QBluetoothAddress currentLocalAdapter;
+ QString profilePath;
#endif
mutable bool registered;
diff --git a/src/bluetooth/qbluetoothserviceinfo_qnx.cpp b/src/bluetooth/qbluetoothserviceinfo_qnx.cpp
index 8767889b..387f4751 100644
--- a/src/bluetooth/qbluetoothserviceinfo_qnx.cpp
+++ b/src/bluetooth/qbluetoothserviceinfo_qnx.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothsocket.cpp b/src/bluetooth/qbluetoothsocket.cpp
index 87456a2e..8f6309d4 100644
--- a/src/bluetooth/qbluetoothsocket.cpp
+++ b/src/bluetooth/qbluetoothsocket.cpp
@@ -6,36 +6,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothsocket.h b/src/bluetooth/qbluetoothsocket.h
index b06330c7..6540e0c9 100644
--- a/src/bluetooth/qbluetoothsocket.h
+++ b/src/bluetooth/qbluetoothsocket.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -160,8 +152,7 @@ protected:
QBluetoothSocketPrivate *d_ptr;
private:
- Q_PRIVATE_SLOT(d_func(), void _q_readNotify())
- Q_PRIVATE_SLOT(d_func(), void _q_writeNotify())
+ friend class QLowEnergyControllerPrivate;
};
#ifndef QT_NO_DEBUG_STREAM
diff --git a/src/bluetooth/qbluetoothsocket_android.cpp b/src/bluetooth/qbluetoothsocket_android.cpp
index 8d9cba2a..ce68d236 100644
--- a/src/bluetooth/qbluetoothsocket_android.cpp
+++ b/src/bluetooth/qbluetoothsocket_android.cpp
@@ -6,36 +6,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -343,14 +335,6 @@ void QBluetoothSocketPrivate::connectToServiceConc(const QBluetoothAddress &addr
emit q->connected();
}
-void QBluetoothSocketPrivate::_q_writeNotify()
-{
-}
-
-void QBluetoothSocketPrivate::_q_readNotify()
-{
-}
-
void QBluetoothSocketPrivate::abort()
{
if (state == QBluetoothSocket::UnconnectedState)
diff --git a/src/bluetooth/qbluetoothsocket_bluez.cpp b/src/bluetooth/qbluetoothsocket_bluez.cpp
index 150c2c28..3be1125b 100644
--- a/src/bluetooth/qbluetoothsocket_bluez.cpp
+++ b/src/bluetooth/qbluetoothsocket_bluez.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -45,6 +37,8 @@
#include "bluez/manager_p.h"
#include "bluez/adapter_p.h"
#include "bluez/device_p.h"
+#include "bluez/objectmanager_p.h"
+#include <QtBluetooth/QBluetoothLocalDevice>
#include "bluez/bluez_data_p.h"
#include <qplatformdefs.h>
@@ -69,7 +63,8 @@ QBluetoothSocketPrivate::QBluetoothSocketPrivate()
readNotifier(0),
connectWriteNotifier(0),
connecting(false),
- discoveryAgent(0)
+ discoveryAgent(0),
+ isLowEnergySocket(false)
{
}
@@ -115,9 +110,9 @@ bool QBluetoothSocketPrivate::ensureNativeSocket(QBluetoothServiceInfo::Protocol
Q_Q(QBluetoothSocket);
readNotifier = new QSocketNotifier(socket, QSocketNotifier::Read);
- QObject::connect(readNotifier, SIGNAL(activated(int)), q, SLOT(_q_readNotify()));
+ QObject::connect(readNotifier, SIGNAL(activated(int)), this, SLOT(_q_readNotify()));
connectWriteNotifier = new QSocketNotifier(socket, QSocketNotifier::Write, q);
- QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), q, SLOT(_q_writeNotify()));
+ QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), this, SLOT(_q_writeNotify()));
connectWriteNotifier->setEnabled(false);
readNotifier->setEnabled(false);
@@ -133,7 +128,7 @@ void QBluetoothSocketPrivate::connectToService(const QBluetoothAddress &address,
int result = -1;
if (socket == -1 && !ensureNativeSocket(socketType)) {
- errorString = QObject::tr("Unknown socket error");
+ errorString = QBluetoothSocket::tr("Unknown socket error");
q->setSocketError(QBluetoothSocket::UnknownSocketError);
return;
}
@@ -156,7 +151,22 @@ void QBluetoothSocketPrivate::connectToService(const QBluetoothAddress &address,
memset(&addr, 0, sizeof(addr));
addr.l2_family = AF_BLUETOOTH;
+ // This is an ugly hack but the socket class does what's needed already.
+ // For L2CP GATT we need a channel rather than a socket and the LE address type
+ // We don't want to make this public API offering for now especially since
+ // only Linux (of all platforms supported by this library) supports this type
+ // of socket.
+
+#if defined(QT_BLUEZ_BLUETOOTH) && !defined(QT_BLUEZ_NO_BTLE)
+ if (isLowEnergySocket) {
+ addr.l2_cid = htobs(port);
+ addr.l2_bdaddr_type = BDADDR_LE_PUBLIC;
+ } else {
+ addr.l2_psm = port;
+ }
+#else
addr.l2_psm = port;
+#endif
convertAddress(address.toUInt64(), addr.l2_bdaddr.b);
@@ -222,8 +232,6 @@ void QBluetoothSocketPrivate::_q_writeNotify()
}
}
-// TODO: move to private backend?
-
void QBluetoothSocketPrivate::_q_readNotify()
{
Q_Q(QBluetoothSocket);
@@ -269,23 +277,8 @@ QString QBluetoothSocketPrivate::localName() const
if (address.isNull())
return QString();
- OrgBluezManagerInterface manager(QLatin1String("org.bluez"), QLatin1String("/"),
- QDBusConnection::systemBus());
-
- QDBusPendingReply<QDBusObjectPath> reply = manager.FindAdapter(address.toString());
- reply.waitForFinished();
- if (reply.isError())
- return QString();
-
- OrgBluezAdapterInterface adapter(QLatin1String("org.bluez"), reply.value().path(),
- QDBusConnection::systemBus());
-
- QDBusPendingReply<QVariantMap> properties = adapter.GetProperties();
- properties.waitForFinished();
- if (properties.isError())
- return QString();
-
- return properties.value().value(QLatin1String("Name")).toString();
+ QBluetoothLocalDevice device(address);
+ return device.name();
}
QBluetoothAddress QBluetoothSocketPrivate::localAddress() const
@@ -360,38 +353,60 @@ QString QBluetoothSocketPrivate::peerName() const
const QString peerAddress = QBluetoothAddress(bdaddr).toString();
const QString localAdapter = localAddress().toString();
- OrgBluezManagerInterface manager(QLatin1String("org.bluez"), QLatin1String("/"),
- QDBusConnection::systemBus());
+ if (isBluez5()) {
+ OrgFreedesktopDBusObjectManagerInterface manager(QStringLiteral("org.bluez"),
+ QStringLiteral("/"),
+ QDBusConnection::systemBus());
+ QDBusPendingReply<ManagedObjectList> reply = manager.GetManagedObjects();
+ reply.waitForFinished();
+ if (reply.isError())
+ return QString();
- QDBusPendingReply<QDBusObjectPath> reply = manager.FindAdapter(localAdapter);
- reply.waitForFinished();
- if (reply.isError())
+ foreach (const QDBusObjectPath &path, reply.value().keys()) {
+ const InterfaceList ifaceList = reply.value().value(path);
+ foreach (const QString &iface, ifaceList.keys()) {
+ if (iface == QStringLiteral("org.bluez.Device1")) {
+ if (ifaceList.value(iface).value(QStringLiteral("Address")).toString()
+ == peerAddress)
+ return ifaceList.value(iface).value(QStringLiteral("Alias")).toString();
+ }
+ }
+ }
return QString();
+ } else {
+ OrgBluezManagerInterface manager(QStringLiteral("org.bluez"), QStringLiteral("/"),
+ QDBusConnection::systemBus());
- OrgBluezAdapterInterface adapter(QLatin1String("org.bluez"), reply.value().path(),
- QDBusConnection::systemBus());
-
- QDBusPendingReply<QDBusObjectPath> deviceObjectPath = adapter.CreateDevice(peerAddress);
- deviceObjectPath.waitForFinished();
- if (deviceObjectPath.isError()) {
- if (deviceObjectPath.error().name() != QLatin1String("org.bluez.Error.AlreadyExists"))
+ QDBusPendingReply<QDBusObjectPath> reply = manager.FindAdapter(localAdapter);
+ reply.waitForFinished();
+ if (reply.isError())
return QString();
- deviceObjectPath = adapter.FindDevice(peerAddress);
+ OrgBluezAdapterInterface adapter(QStringLiteral("org.bluez"), reply.value().path(),
+ QDBusConnection::systemBus());
+
+ QDBusPendingReply<QDBusObjectPath> deviceObjectPath = adapter.CreateDevice(peerAddress);
deviceObjectPath.waitForFinished();
- if (deviceObjectPath.isError())
- return QString();
- }
+ if (deviceObjectPath.isError()) {
+ if (deviceObjectPath.error().name() != QStringLiteral("org.bluez.Error.AlreadyExists"))
+ return QString();
+
+ deviceObjectPath = adapter.FindDevice(peerAddress);
+ deviceObjectPath.waitForFinished();
+ if (deviceObjectPath.isError())
+ return QString();
+ }
- OrgBluezDeviceInterface device(QLatin1String("org.bluez"), deviceObjectPath.value().path(),
- QDBusConnection::systemBus());
+ OrgBluezDeviceInterface device(QStringLiteral("org.bluez"), deviceObjectPath.value().path(),
+ QDBusConnection::systemBus());
- QDBusPendingReply<QVariantMap> properties = device.GetProperties();
- properties.waitForFinished();
- if (properties.isError())
- return QString();
+ QDBusPendingReply<QVariantMap> properties = device.GetProperties();
+ properties.waitForFinished();
+ if (properties.isError())
+ return QString();
- return properties.value().value(QLatin1String("Alias")).toString();
+ return properties.value().value(QStringLiteral("Alias")).toString();
+ }
}
QBluetoothAddress QBluetoothSocketPrivate::peerAddress() const
@@ -466,7 +481,7 @@ qint64 QBluetoothSocketPrivate::writeData(const char *data, qint64 maxSize)
if(txBuffer.size() == 0) {
connectWriteNotifier->setEnabled(true);
- QMetaObject::invokeMethod(q, "_q_writeNotify", Qt::QueuedConnection);
+ QMetaObject::invokeMethod(this, "_q_writeNotify", Qt::QueuedConnection);
}
char *txbuf = txBuffer.reserve(maxSize);
@@ -530,9 +545,9 @@ bool QBluetoothSocketPrivate::setSocketDescriptor(int socketDescriptor, QBluetoo
fcntl(socket, F_SETFL, flags | O_NONBLOCK);
readNotifier = new QSocketNotifier(socket, QSocketNotifier::Read);
- QObject::connect(readNotifier, SIGNAL(activated(int)), q, SLOT(_q_readNotify()));
+ QObject::connect(readNotifier, SIGNAL(activated(int)), this, SLOT(_q_readNotify()));
connectWriteNotifier = new QSocketNotifier(socket, QSocketNotifier::Write, q);
- QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), q, SLOT(_q_writeNotify()));
+ QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), this, SLOT(_q_writeNotify()));
q->setSocketState(socketState);
q->setOpenMode(openMode);
diff --git a/src/bluetooth/qbluetoothsocket_p.cpp b/src/bluetooth/qbluetoothsocket_p.cpp
index 6e78be9e..85b730dd 100644
--- a/src/bluetooth/qbluetoothsocket_p.cpp
+++ b/src/bluetooth/qbluetoothsocket_p.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -69,14 +61,6 @@ void QBluetoothSocketPrivate::connectToService(const QBluetoothAddress &address,
Q_UNUSED(port);
}
-void QBluetoothSocketPrivate::_q_writeNotify()
-{
-}
-
-void QBluetoothSocketPrivate::_q_readNotify()
-{
-}
-
void QBluetoothSocketPrivate::abort()
{
}
diff --git a/src/bluetooth/qbluetoothsocket_p.h b/src/bluetooth/qbluetoothsocket_p.h
index 9586ebbe..1eedbfcd 100644
--- a/src/bluetooth/qbluetoothsocket_p.h
+++ b/src/bluetooth/qbluetoothsocket_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -89,14 +81,9 @@ public:
class QBluetoothSocket;
class QBluetoothServiceDiscoveryAgent;
-class QBluetoothSocketPrivate
-#if defined(QT_QNX_BLUETOOTH) || defined(QT_ANDROID_BLUETOOTH)
-: public QObject
+class QBluetoothSocketPrivate : public QObject
{
Q_OBJECT
-#else
-{
-#endif
Q_DECLARE_PUBLIC(QBluetoothSocket)
friend class QBluetoothServerPrivate;
@@ -171,12 +158,6 @@ public:
// qint64 rxOffset;
QString errorString;
- // private slots
- void _q_readNotify();
- void _q_writeNotify();
- void _q_serviceDiscovered(const QBluetoothServiceInfo &service);
- void _q_discoveryFinished();
-
#ifdef QT_ANDROID_BLUETOOTH
QAndroidJniObject adapter;
QAndroidJniObject socketObject;
@@ -185,11 +166,17 @@ public:
QAndroidJniObject outputStream;
InputStreamThread *inputThread;
-private Q_SLOTS:
+private slots:
void inputThreadError(int errorCode);
#endif
+#if defined(QT_QNX_BLUETOOTH) || defined(QT_BLUEZ_BLUETOOTH)
+private slots:
+ void _q_readNotify();
+ void _q_writeNotify();
+#endif
+
protected:
QBluetoothSocket *q_ptr;
@@ -199,10 +186,15 @@ private:
QBluetoothUuid m_uuid;
bool isServerSocket;
-private Q_SLOTS:
+private slots:
void controlReply(ppsResult result);
void controlEvent(ppsResult result);
#endif
+
+#ifdef QT_BLUEZ_BLUETOOTH
+public:
+ bool isLowEnergySocket;
+#endif
};
diff --git a/src/bluetooth/qbluetoothsocket_qnx.cpp b/src/bluetooth/qbluetoothsocket_qnx.cpp
index c54a0937..5926d8ad 100644
--- a/src/bluetooth/qbluetoothsocket_qnx.cpp
+++ b/src/bluetooth/qbluetoothsocket_qnx.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -122,9 +114,9 @@ void QBluetoothSocketPrivate::connectToService(const QBluetoothAddress &address,
delete connectWriteNotifier;
readNotifier = new QSocketNotifier(socket, QSocketNotifier::Read);
- QObject::connect(readNotifier, SIGNAL(activated(int)), q, SLOT(_q_readNotify()));
+ QObject::connect(readNotifier, SIGNAL(activated(int)), this, SLOT(_q_readNotify()));
connectWriteNotifier = new QSocketNotifier(socket, QSocketNotifier::Write, q);
- QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), q, SLOT(_q_writeNotify()));
+ QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), this, SLOT(_q_writeNotify()));
connecting = true;
q->setOpenMode(openMode);
@@ -279,7 +271,7 @@ qint64 QBluetoothSocketPrivate::writeData(const char *data, qint64 maxSize)
return -1;
}
- Q_EMIT q->bytesWritten(maxSize);
+ emit q->bytesWritten(maxSize);
return maxSize;
} else {
@@ -288,7 +280,7 @@ qint64 QBluetoothSocketPrivate::writeData(const char *data, qint64 maxSize)
if (txBuffer.size() == 0) {
connectWriteNotifier->setEnabled(true);
- QMetaObject::invokeMethod(q, "_q_writeNotify", Qt::QueuedConnection);
+ QMetaObject::invokeMethod(this, "_q_writeNotify", Qt::QueuedConnection);
}
char *txbuf = txBuffer.reserve(maxSize);
@@ -333,9 +325,9 @@ bool QBluetoothSocketPrivate::setSocketDescriptor(int socketDescriptor, QBluetoo
socketType = socketType_;
readNotifier = new QSocketNotifier(socket, QSocketNotifier::Read);
- QObject::connect(readNotifier, SIGNAL(activated(int)), q, SLOT(_q_readNotify()));
+ QObject::connect(readNotifier, SIGNAL(activated(int)), this, SLOT(_q_readNotify()));
connectWriteNotifier = new QSocketNotifier(socket, QSocketNotifier::Write, q);
- QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), q, SLOT(_q_writeNotify()));
+ QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), this, SLOT(_q_writeNotify()));
q->setSocketState(socketState);
q->setOpenMode(openMode);
@@ -398,9 +390,9 @@ void QBluetoothSocketPrivate::controlReply(ppsResult result)
Q_Q(QBluetoothSocket);
readNotifier = new QSocketNotifier(socket, QSocketNotifier::Read);
- QObject::connect(readNotifier, SIGNAL(activated(int)), q, SLOT(_q_readNotify()));
+ QObject::connect(readNotifier, SIGNAL(activated(int)), this, SLOT(_q_readNotify()));
connectWriteNotifier = new QSocketNotifier(socket, QSocketNotifier::Write, q);
- QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), q, SLOT(_q_writeNotify()));
+ QObject::connect(connectWriteNotifier, SIGNAL(activated(int)), this, SLOT(_q_writeNotify()));
connectWriteNotifier->setEnabled(true);
readNotifier->setEnabled(true);
diff --git a/src/bluetooth/qbluetoothtransfermanager.cpp b/src/bluetooth/qbluetoothtransfermanager.cpp
index 6e1d7f83..2b9ddc8b 100644
--- a/src/bluetooth/qbluetoothtransfermanager.cpp
+++ b/src/bluetooth/qbluetoothtransfermanager.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothtransfermanager.h b/src/bluetooth/qbluetoothtransfermanager.h
index 501a40a0..f252f975 100644
--- a/src/bluetooth/qbluetoothtransfermanager.h
+++ b/src/bluetooth/qbluetoothtransfermanager.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothtransferreply.cpp b/src/bluetooth/qbluetoothtransferreply.cpp
index 9acd917d..6ade4808 100644
--- a/src/bluetooth/qbluetoothtransferreply.cpp
+++ b/src/bluetooth/qbluetoothtransferreply.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -63,13 +55,14 @@ QT_BEGIN_NAMESPACE
This enum describes the type of error that occurred
- \value NoError No error.
- \value UnknownError Unknown error, no better enum available
- \value FileNotFoundError Unable to open the file specified
- \value HostNotFoundError Unable to connect to the target host
- \value UserCanceledTransferError User terminated the transfer
- \value IODeviceNotReadableError File was not open before initiating the sending command
- \value ResourceBusyError Unable to access the resource.
+ \value NoError No error.
+ \value UnknownError Unknown error, no better enum available.
+ \value FileNotFoundError Unable to open the file specified.
+ \value HostNotFoundError Unable to connect to the target host.
+ \value UserCanceledTransferError User terminated the transfer.
+ \value IODeviceNotReadableError File was not open before initiating the sending command.
+ \value ResourceBusyError Unable to access the resource..
+ \value SessionError An error occurred during the handling of the session.
*/
diff --git a/src/bluetooth/qbluetoothtransferreply.h b/src/bluetooth/qbluetoothtransferreply.h
index 958d4ff6..a8fda6ce 100644
--- a/src/bluetooth/qbluetoothtransferreply.h
+++ b/src/bluetooth/qbluetoothtransferreply.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -63,7 +55,8 @@ public:
HostNotFoundError,
UserCanceledTransferError,
IODeviceNotReadableError,
- ResourceBusyError
+ ResourceBusyError,
+ SessionError
};
diff --git a/src/bluetooth/qbluetoothtransferreply_bluez.cpp b/src/bluetooth/qbluetoothtransferreply_bluez.cpp
index f0b4b5c2..be5fccd0 100644
--- a/src/bluetooth/qbluetoothtransferreply_bluez.cpp
+++ b/src/bluetooth/qbluetoothtransferreply_bluez.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -44,17 +36,23 @@
#include "qbluetoothaddress.h"
#include "bluez/obex_client_p.h"
-#include "bluez/obex_manager_p.h"
#include "bluez/obex_agent_p.h"
#include "bluez/obex_transfer_p.h"
+#include "bluez/bluez5_helper_p.h"
+#include "bluez/obex_client1_bluez5_p.h"
+#include "bluez/obex_objectpush1_bluez5_p.h"
+#include "bluez/obex_transfer1_bluez5_p.h"
+#include "bluez/properties_p.h"
#include "qbluetoothtransferreply.h"
+#include <QtCore/QAtomicInt>
#include <QtCore/QLoggingCategory>
#include <QFuture>
#include <QFutureWatcher>
#include <QtConcurrentRun>
static const QLatin1String agentPath("/qt/agent");
+static QAtomicInt agentPathCounter;
QT_BEGIN_NAMESPACE
@@ -62,26 +60,40 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT_BLUEZ)
QBluetoothTransferReplyBluez::QBluetoothTransferReplyBluez(QIODevice *input, const QBluetoothTransferRequest &request,
QBluetoothTransferManager *parent)
-: QBluetoothTransferReply(parent), tempfile(0), source(input),
+: QBluetoothTransferReply(parent),
+ m_client(0), m_agent(0), m_clientBluez(0), m_objectPushBluez(0),
+ m_tempfile(0), m_source(input),
m_running(false), m_finished(false), m_size(0),
m_error(QBluetoothTransferReply::NoError), m_errorStr(), m_transfer_path()
{
setRequest(request);
setManager(parent);
- client = new OrgOpenobexClientInterface(QLatin1String("org.openobex.client"), QLatin1String("/"),
- QDBusConnection::sessionBus());
- qsrand(QTime::currentTime().msec());
- m_agent_path = agentPath;
- m_agent_path.append(QString::fromLatin1("/%1").arg(qrand()));
+ qRegisterMetaType<QBluetoothTransferReply*>("QBluetoothTransferReply*");
- agent = new AgentAdaptor(this);
+ if (isBluez5()) {
+ m_clientBluez = new OrgBluezObexClient1Interface(QStringLiteral("org.bluez.obex"),
+ QStringLiteral("/org/bluez/obex"),
+ QDBusConnection::sessionBus(), this);
- bool res = QDBusConnection::sessionBus().registerObject(m_agent_path, this);
- if(!res)
- qCWarning(QT_BT_BLUEZ) << "Failed Creating dbus objects";
- qRegisterMetaType<QBluetoothTransferReply*>("QBluetoothTransferReply*");
+ } else {
+ m_client = new OrgOpenobexClientInterface(QStringLiteral("org.openobex.client"),
+ QStringLiteral("/"),
+ QDBusConnection::sessionBus());
+
+ m_agent_path = agentPath;
+ m_agent_path.append(QStringLiteral("/%1%2/%3").
+ arg(QCoreApplication::applicationName()).
+ arg(QCoreApplication::applicationPid()).
+ arg(agentPathCounter.fetchAndAddOrdered(1)));
+
+ m_agent = new AgentAdaptor(this);
+
+ if (!QDBusConnection::sessionBus().registerObject(m_agent_path, this))
+ qCWarning(QT_BT_BLUEZ) << "Failed creating obex agent dbus objects";
+ }
+
QMetaObject::invokeMethod(this, "start", Qt::QueuedConnection);
m_running = true;
}
@@ -92,19 +104,18 @@ QBluetoothTransferReplyBluez::QBluetoothTransferReplyBluez(QIODevice *input, con
QBluetoothTransferReplyBluez::~QBluetoothTransferReplyBluez()
{
QDBusConnection::sessionBus().unregisterObject(m_agent_path);
- delete client;
+ delete m_client;
}
bool QBluetoothTransferReplyBluez::start()
{
-// qDebug() << "Got a:" << source->metaObject()->className();
- QFile *file = qobject_cast<QFile *>(source);
+ QFile *file = qobject_cast<QFile *>(m_source);
if(!file){
- tempfile = new QTemporaryFile(this );
- tempfile->open();
- qCDebug(QT_BT_BLUEZ) << "Not a QFile, making a copy" << tempfile->fileName();
- if (!source->isReadable()) {
+ m_tempfile = new QTemporaryFile(this );
+ m_tempfile->open();
+ qCDebug(QT_BT_BLUEZ) << "Not a QFile, making a copy" << m_tempfile->fileName();
+ if (!m_source->isReadable()) {
m_errorStr = QBluetoothTransferReply::tr("QIODevice cannot be read."
"Make sure it is open for reading.");
m_error = QBluetoothTransferReply::IODeviceNotReadableError;
@@ -117,7 +128,7 @@ bool QBluetoothTransferReplyBluez::start()
QFutureWatcher<bool> *watcher = new QFutureWatcher<bool>();
QObject::connect(watcher, SIGNAL(finished()), this, SLOT(copyDone()));
- QFuture<bool> results = QtConcurrent::run(QBluetoothTransferReplyBluez::copyToTempFile, tempfile, source);
+ QFuture<bool> results = QtConcurrent::run(QBluetoothTransferReplyBluez::copyToTempFile, m_tempfile, m_source);
watcher->setFuture(results);
}
else {
@@ -158,27 +169,154 @@ bool QBluetoothTransferReplyBluez::copyToTempFile(QIODevice *to, QIODevice *from
return true;
}
+void QBluetoothTransferReplyBluez::cleanupSession()
+{
+ if (!m_objectPushBluez)
+ return;
+
+ QDBusPendingReply<> reply = m_clientBluez->RemoveSession(QDBusObjectPath(m_objectPushBluez->path()));
+ reply.waitForFinished();
+ if (reply.isError())
+ qCWarning(QT_BT_BLUEZ) << "Abort: Cannot remove obex session";
+
+ delete m_objectPushBluez;
+ m_objectPushBluez = 0;
+}
+
void QBluetoothTransferReplyBluez::copyDone()
{
- m_size = tempfile->size();
- startOPP(tempfile->fileName());
+ m_size = m_tempfile->size();
+ startOPP(m_tempfile->fileName());
QObject::sender()->deleteLater();
}
-void QBluetoothTransferReplyBluez::startOPP(QString filename)
+void QBluetoothTransferReplyBluez::sessionCreated(QDBusPendingCallWatcher *watcher)
{
- QVariantMap device;
- QStringList files;
+ QDBusPendingReply<QDBusObjectPath> reply = *watcher;
+ if (reply.isError()) {
+ qCWarning(QT_BT_BLUEZ) << "Failed to create obex session:"
+ << reply.error().name() << reply.reply().errorMessage();
- device.insert(QString::fromLatin1("Destination"), request().address().toString());
- files << filename;
+ m_errorStr = QBluetoothTransferReply::tr("Invalid target address");
+ m_error = QBluetoothTransferReply::HostNotFoundError;
+ m_finished = true;
+ m_running = false;
+ QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection,
+ Q_ARG(QBluetoothTransferReply*, this));
- QDBusObjectPath path(m_agent_path);
- QDBusPendingReply<> sendReply = client->SendFiles(device, files, path);
+ watcher->deleteLater();
+ return;
+ }
- QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(sendReply, this);
- QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- this, SLOT(sendReturned(QDBusPendingCallWatcher*)));
+ m_objectPushBluez = new OrgBluezObexObjectPush1Interface(QStringLiteral("org.bluez.obex"),
+ reply.value().path(),
+ QDBusConnection::sessionBus(), this);
+ QDBusPendingReply<QDBusObjectPath, QVariantMap> newReply = m_objectPushBluez->SendFile(fileToTranser);
+ QDBusPendingCallWatcher *newWatcher = new QDBusPendingCallWatcher(newReply, this);
+ connect(newWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ SLOT(sessionStarted(QDBusPendingCallWatcher*)));
+ watcher->deleteLater();
+}
+
+void QBluetoothTransferReplyBluez::sessionStarted(QDBusPendingCallWatcher *watcher)
+{
+ QDBusPendingReply<QDBusObjectPath, QVariantMap> reply = *watcher;
+ if (reply.isError()) {
+ qCWarning(QT_BT_BLUEZ) << "Failed to start obex session:"
+ << reply.error().name() << reply.reply().errorMessage();
+
+ m_errorStr = QBluetoothTransferReply::tr("Push session cannot be started");
+ m_error = QBluetoothTransferReply::SessionError;
+ m_finished = true;
+ m_running = false;
+
+ cleanupSession();
+
+ QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection,
+ Q_ARG(QBluetoothTransferReply *, this));
+
+ watcher->deleteLater();
+ return;
+ }
+
+ const QDBusObjectPath path = reply.argumentAt<0>();
+ const QVariantMap map = reply.argumentAt<1>();
+ m_transfer_path = path.path();
+
+ //watch the transfer
+ OrgFreedesktopDBusPropertiesInterface *properties = new OrgFreedesktopDBusPropertiesInterface(
+ QStringLiteral("org.bluez.obex"), path.path(),
+ QDBusConnection::sessionBus(), this);
+ connect(properties, SIGNAL(PropertiesChanged(QString,QVariantMap,QStringList)),
+ SLOT(sessionChanged(QString,QVariantMap,QStringList)));
+
+ watcher->deleteLater();
+}
+
+void QBluetoothTransferReplyBluez::sessionChanged(const QString &interface,
+ const QVariantMap &changed_properties,
+ const QStringList &)
+{
+ if (changed_properties.contains(QStringLiteral("Transferred"))) {
+ emit transferProgress(
+ changed_properties.value(QStringLiteral("Transferred")).toULongLong(),
+ m_size);
+ }
+
+ if (changed_properties.contains(QStringLiteral("Status"))) {
+ const QString s = changed_properties.
+ value(QStringLiteral("Status")).toString();
+ if (s == QStringLiteral("complete")
+ || s == QStringLiteral("error")) {
+
+ m_transfer_path.clear();
+ m_finished = true;
+ m_running = false;
+
+ if (s == QStringLiteral("error")) {
+ m_error = QBluetoothTransferReply::UnknownError;
+ m_errorStr = tr("Unknown Error");
+ } else { // complete
+ // allow progress bar to complete
+ emit transferProgress(m_size, m_size);
+ }
+
+ cleanupSession();
+
+ QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection,
+ Q_ARG(QBluetoothTransferReply*, this));
+ } // ignore "active", "queued" & "suspended" status
+ }
+ qCDebug(QT_BT_BLUEZ) << "Transfer update:" << interface << changed_properties;
+}
+
+void QBluetoothTransferReplyBluez::startOPP(const QString &filename)
+{
+ if (m_client) { // Bluez 4
+ QVariantMap device;
+ QStringList files;
+
+ device.insert(QStringLiteral("Destination"), request().address().toString());
+ files << filename;
+
+ QDBusObjectPath path(m_agent_path);
+ QDBusPendingReply<> sendReply = m_client->SendFiles(device, files, path);
+
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(sendReply, this);
+ connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ this, SLOT(sendReturned(QDBusPendingCallWatcher*)));
+ } else { //Bluez 5
+ fileToTranser = filename;
+ QVariantMap mapping;
+ mapping.insert(QStringLiteral("Target"), QStringLiteral("opp"));
+
+ QDBusPendingReply<QDBusObjectPath> reply = m_clientBluez->CreateSession(
+ request().address().toString(), mapping);
+
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
+ connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ SLOT(sessionCreated(QDBusPendingCallWatcher*)));
+ }
}
void QBluetoothTransferReplyBluez::sendReturned(QDBusPendingCallWatcher *watcher)
@@ -278,15 +416,35 @@ bool QBluetoothTransferReplyBluez::isRunning() const
void QBluetoothTransferReplyBluez::abort()
{
- if(!m_transfer_path.isEmpty()){
- OrgOpenobexTransferInterface *xfer = new OrgOpenobexTransferInterface(QLatin1String("org.openobex.client"), m_transfer_path,
- QDBusConnection::sessionBus());
- QDBusPendingReply<> reply = xfer->Cancel();
+ if (m_transfer_path.isEmpty())
+ return;
+
+ if (m_client) {
+ OrgOpenobexTransferInterface xfer(QStringLiteral("org.openobex.client"),
+ m_transfer_path,
+ QDBusConnection::sessionBus());
+
+ QDBusPendingReply<> reply = xfer.Cancel();
reply.waitForFinished();
- if(reply.isError()){
- qCWarning(QT_BT_BLUEZ) << "Failed to abort transfer" << reply.error();
- }
- delete xfer;
+ if (reply.isError())
+ qCWarning(QT_BT_BLUEZ) << "Failed to abort transfer" << reply.error().message();
+
+ } else if (m_clientBluez) {
+ OrgBluezObexTransfer1Interface iface(QStringLiteral("org.bluez.obex"),
+ m_transfer_path,
+ QDBusConnection::sessionBus());
+
+ QDBusPendingReply<> reply = iface.Cancel();
+ reply.waitForFinished();
+ if (reply.isError())
+ qCDebug(QT_BT_BLUEZ) << "Failed to abort transfer" << reply.error().message();
+
+ m_error = QBluetoothTransferReply::UserCanceledTransferError;
+ m_errorStr = tr("Operation canceled");
+
+ cleanupSession();
+
+ emit finished(this);
}
}
diff --git a/src/bluetooth/qbluetoothtransferreply_bluez_p.h b/src/bluetooth/qbluetoothtransferreply_bluez_p.h
index 4063fd44..0a9f9bca 100644
--- a/src/bluetooth/qbluetoothtransferreply_bluez_p.h
+++ b/src/bluetooth/qbluetoothtransferreply_bluez_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -62,8 +54,9 @@
#include "qbluetoothtransferreply.h"
class OrgOpenobexClientInterface;
-class OrgOpenobexManagerInterface;
class AgentAdaptor;
+class OrgBluezObexClient1Interface;
+class OrgBluezObexObjectPush1Interface;
QT_BEGIN_NAMESPACE
@@ -82,18 +75,20 @@ public:
QBluetoothTransferReply::TransferError error() const;
QString errorString() const;
-private Q_SLOTS:
+private slots:
bool start();
private:
- void startOPP(QString filename);
+ void startOPP(const QString &filename);
+
+ OrgOpenobexClientInterface *m_client;
+ AgentAdaptor *m_agent;
+ OrgBluezObexClient1Interface *m_clientBluez;
+ OrgBluezObexObjectPush1Interface *m_objectPushBluez;
- OrgOpenobexClientInterface *client;
- OrgOpenobexManagerInterface *manager;
- AgentAdaptor *agent;
- QTemporaryFile *tempfile;
- QIODevice *source;
+ QTemporaryFile *m_tempfile;
+ QIODevice *m_source;
bool m_running;
bool m_finished;
@@ -106,11 +101,18 @@ private:
QString m_agent_path;
QString m_transfer_path;
+ QString fileToTranser;
static bool copyToTempFile(QIODevice *to, QIODevice *from);
+ void cleanupSession();
private slots:
void copyDone();
+ void sessionCreated(QDBusPendingCallWatcher *watcher);
+ void sessionStarted(QDBusPendingCallWatcher *watcher);
+ void sessionChanged(const QString &interface,
+ const QVariantMap &changed_properties,
+ const QStringList &invalidated_properties);
public slots:
void abort();
diff --git a/src/bluetooth/qbluetoothtransferreply_p.h b/src/bluetooth/qbluetoothtransferreply_p.h
index 8ab5fc1b..caf3890d 100644
--- a/src/bluetooth/qbluetoothtransferreply_p.h
+++ b/src/bluetooth/qbluetoothtransferreply_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothtransferreply_qnx.cpp b/src/bluetooth/qbluetoothtransferreply_qnx.cpp
index 3f22d536..072230b1 100644
--- a/src/bluetooth/qbluetoothtransferreply_qnx.cpp
+++ b/src/bluetooth/qbluetoothtransferreply_qnx.cpp
@@ -1,41 +1,33 @@
/***************************************************************************
**
** Copyright (C) 2013 Research In Motion
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -114,7 +106,7 @@ bool QBluetoothTransferReplyQnx::start()
m_error = QBluetoothTransferReply::ResourceBusyError;
m_finished = true;
m_running = false;
- Q_EMIT finished(this);
+ emit finished(this);
return false;
}
if (!source->isReadable()) {
@@ -123,7 +115,7 @@ bool QBluetoothTransferReplyQnx::start()
m_error = QBluetoothTransferReply::IODeviceNotReadableError;
m_finished = true;
m_running = false;
- Q_EMIT finished(this);
+ emit finished(this);
return false;
}
QString fileName = agentPath + QStringLiteral("Qt5OPP_tmp");
@@ -223,7 +215,7 @@ void QBluetoothTransferReplyQnx::controlEvent(ppsResult result)
m_errorStr = result.errorMsg;
m_error = QBluetoothTransferReply::UnknownError;
// }
- Q_EMIT finished(this);
+ emit finished(this);
} else if (result.msg == QStringLiteral("opp_update")) {
bool ok;
qint64 sentBytes = result.dat.at(result.dat.indexOf(QStringLiteral("sent")) + 1).toDouble(&ok);
@@ -237,13 +229,13 @@ void QBluetoothTransferReplyQnx::controlEvent(ppsResult result)
return;
}
qCDebug(QT_BT_QNX) << "opp update" << sentBytes << totalBytes;
- Q_EMIT transferProgress(sentBytes, totalBytes);
+ emit transferProgress(sentBytes, totalBytes);
} else if (result.msg == QStringLiteral("opp_complete")) {
qCDebug(QT_BT_QNX) << "opp complete";
removeTempFile();
m_finished = true;
m_running = false;
- Q_EMIT finished(this);
+ emit finished(this);
}
}
diff --git a/src/bluetooth/qbluetoothtransferreply_qnx_p.h b/src/bluetooth/qbluetoothtransferreply_qnx_p.h
index 83b45ef6..d6b4d64b 100644
--- a/src/bluetooth/qbluetoothtransferreply_qnx_p.h
+++ b/src/bluetooth/qbluetoothtransferreply_qnx_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -81,7 +73,7 @@ public:
QBluetoothTransferReply::TransferError error() const;
QString errorString() const;
-private Q_SLOTS:
+private slots:
void controlReply(ppsResult result);
void controlEvent(ppsResult result);
void copyDone();
diff --git a/src/bluetooth/qbluetoothtransferrequest.cpp b/src/bluetooth/qbluetoothtransferrequest.cpp
index 4317b08c..685c70fb 100644
--- a/src/bluetooth/qbluetoothtransferrequest.cpp
+++ b/src/bluetooth/qbluetoothtransferrequest.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothtransferrequest.h b/src/bluetooth/qbluetoothtransferrequest.h
index b91429a0..981e99a8 100644
--- a/src/bluetooth/qbluetoothtransferrequest.h
+++ b/src/bluetooth/qbluetoothtransferrequest.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothtransferrequest_p.h b/src/bluetooth/qbluetoothtransferrequest_p.h
index 69b94d34..ff146ec7 100644
--- a/src/bluetooth/qbluetoothtransferrequest_p.h
+++ b/src/bluetooth/qbluetoothtransferrequest_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qbluetoothuuid.cpp b/src/bluetooth/qbluetoothuuid.cpp
index 85d48d49..15d238e1 100644
--- a/src/bluetooth/qbluetoothuuid.cpp
+++ b/src/bluetooth/qbluetoothuuid.cpp
@@ -1,45 +1,38 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qbluetoothuuid.h"
+#include "qbluetoothservicediscoveryagent.h"
#include <QStringList>
#include <QtEndian>
@@ -107,73 +100,296 @@ Q_GLOBAL_STATIC_WITH_ARGS(QUuid, baseUuid, ("{00000000-0000-1000-8000-00805F9B34
The list below explicitly states as what type each UUID shall be used.
- \value ServiceDiscoveryServer Service discovery server UUID (service)
- \value BrowseGroupDescriptor Browser group descriptor (service)
- \value PublicBrowseGroup Public browse group service class. Services which have the public
- browse group in their \l {QBluetoothServiceInfo::BrowseGroupList}{browse group list}
- are discoverable by the remote devices.
- \value SerialPort Serial Port Profile UUID (service & profile)
- \value LANAccessUsingPPP LAN Access Profile UUID (service & profile)
- \value DialupNetworking Dial-up Networking Profile UUID (service & profile)
- \value IrMCSync Synchronization Profile UUID (service & profile)
- \value ObexObjectPush OBEX object push service UUID (service & profile)
- \value OBEXFileTransfer File Transfer Profile (FTP) UUID (service & profile)
- \value IrMCSyncCommand Synchronization Profile UUID (profile)
- \value Headset Headset Profile (HSP) UUID (service & profile)
- \value AudioSource Advanced Audio Distribution Profile (A2DP) UUID (service)
- \value AudioSink Advanced Audio Distribution Profile (A2DP) UUID (service)
- \value AV_RemoteControlTarget Audio/Video Remote Control Profile (AVRCP) UUID (service)
- \value AdvancedAudioDistribution Advanced Audio Distribution Profile (A2DP) UUID (profile)
- \value AV_RemoteControl Audio/Video Remote Control Profile (AVRCP) UUID (service & profile)
+ \value ServiceDiscoveryServer Service discovery server UUID (service)
+ \value BrowseGroupDescriptor Browser group descriptor (service)
+ \value PublicBrowseGroup Public browse group service class. Services which have the public
+ browse group in their \l {QBluetoothServiceInfo::BrowseGroupList}{browse group list}
+ are discoverable by the remote devices.
+ \value SerialPort Serial Port Profile UUID (service & profile)
+ \value LANAccessUsingPPP LAN Access Profile UUID (service & profile)
+ \value DialupNetworking Dial-up Networking Profile UUID (service & profile)
+ \value IrMCSync Synchronization Profile UUID (service & profile)
+ \value ObexObjectPush OBEX object push service UUID (service & profile)
+ \value OBEXFileTransfer File Transfer Profile (FTP) UUID (service & profile)
+ \value IrMCSyncCommand Synchronization Profile UUID (profile)
+ \value Headset Headset Profile (HSP) UUID (service & profile)
+ \value AudioSource Advanced Audio Distribution Profile (A2DP) UUID (service)
+ \value AudioSink Advanced Audio Distribution Profile (A2DP) UUID (service)
+ \value AV_RemoteControlTarget Audio/Video Remote Control Profile (AVRCP) UUID (service)
+ \value AdvancedAudioDistribution Advanced Audio Distribution Profile (A2DP) UUID (profile)
+ \value AV_RemoteControl Audio/Video Remote Control Profile (AVRCP) UUID (service & profile)
\value AV_RemoteControlController Audio/Video Remote Control Profile UUID (service)
- \value HeadsetAG Headset Profile (HSP) UUID (service)
- \value PANU Personal Area Networking Profile (PAN) UUID (service & profile)
- \value NAP Personal Area Networking Profile (PAN) UUID (service & profile)
- \value GN Personal Area Networking Profile (PAN) UUID (service & profile)
- \value DirectPrinting Basic Printing Profile (BPP) UUID (service)
- \value ReferencePrinting Related to Basic Printing Profile (BPP) UUID (service)
- \value BasicImage Basic Imaging Profile (BIP) UUID (profile)
- \value ImagingResponder Basic Imaging Profile (BIP) UUID (service)
+ \value HeadsetAG Headset Profile (HSP) UUID (service)
+ \value PANU Personal Area Networking Profile (PAN) UUID (service & profile)
+ \value NAP Personal Area Networking Profile (PAN) UUID (service & profile)
+ \value GN Personal Area Networking Profile (PAN) UUID (service & profile)
+ \value DirectPrinting Basic Printing Profile (BPP) UUID (service)
+ \value ReferencePrinting Related to Basic Printing Profile (BPP) UUID (service)
+ \value BasicImage Basic Imaging Profile (BIP) UUID (profile)
+ \value ImagingResponder Basic Imaging Profile (BIP) UUID (service)
\value ImagingAutomaticArchive Basic Imaging Profile (BIP) UUID (service)
\value ImagingReferenceObjects Basic Imaging Profile (BIP) UUID (service)
- \value Handsfree Hands-Free Profile (HFP) UUID (service & profile)
- \value HandsfreeAudioGateway Hands-Free Audio Gateway (HFP) UUID (service)
+ \value Handsfree Hands-Free Profile (HFP) UUID (service & profile)
+ \value HandsfreeAudioGateway Hands-Free Audio Gateway (HFP) UUID (service)
\value DirectPrintingReferenceObjectsService Basic Printing Profile (BPP) UUID (service)
- \value ReflectedUI Basic Printing Profile (BPP) UUID (service)
- \value BasicPrinting Basic Printing Profile (BPP) UUID (profile)
- \value PrintingStatus Basic Printing Profile (BPP) UUID (service)
+ \value ReflectedUI Basic Printing Profile (BPP) UUID (service)
+ \value BasicPrinting Basic Printing Profile (BPP) UUID (profile)
+ \value PrintingStatus Basic Printing Profile (BPP) UUID (service)
\value HumanInterfaceDeviceService Human Interface Device (HID) UUID (service & profile)
\value HardcopyCableReplacement Hardcopy Cable Replacement Profile (HCRP) (profile)
- \value HCRPrint Hardcopy Cable Replacement Profile (HCRP) (service)
- \value HCRScan Hardcopy Cable Replacement Profile (HCRP) (service)
- \value SIMAccess SIM Access Profile (SAP) UUID (service and profile)
- \value PhonebookAccessPCE Phonebook Access Profile (PBAP) UUID (service)
- \value PhonebookAccessPSE Phonebook Access Profile (PBAP) UUID (service)
- \value PhonebookAccess Phonebook Access Profile (PBAP) (profile)
- \value HeadsetHS Headset Profile (HSP) UUID (service)
- \value MessageAccessServer Message Access Profile (MAP) UUID (service)
- \value MessageNotificationServer Message Access Profile (MAP) UUID (service)
- \value MessageAccessProfile Message Access Profile (MAP) UUID (profile)
- \value GNSS Global Navigation Satellite System UUID (profile)
- \value GNSSServer Global Navigation Satellite System Server (UUID) (service)
- \value Display3D 3D Synchronization Display UUID (service)
- \value Glasses3D 3D Synchronization Glasses UUID (service)
- \value Synchronization3D 3D Synchronization UUID (profile)
- \value MPSProfile Multi-Profile Specification UUID (profile)
- \value MPSService Multi-Profile Specification UUID (service)
- \value PnPInformation Device Identification (DID) UUID (service & profile)
- \value GenericNetworking Generic networking UUID (service)
- \value GenericFileTransfer Generic file transfer UUID (service)
- \value GenericAudio Generic audio UUID (service)
- \value GenericTelephony Generic telephone UUID (service)
- \value VideoSource Video Distribution Profile (VDP) UUID (service)
- \value VideoSink Video Distribution Profile (VDP) UUID (service)
- \value VideoDistribution Video Distribution Profile (VDP) UUID (profile)
- \value HDP Health Device Profile (HDP) UUID (profile)
- \value HDPSource Health Device Profile Source (HDP) UUID (service)
- \value HDPSink Health Device Profile Sink (HDP) UUID (service)
-
- \sa QBluetoothServiceInfo::ServiceClassIds
+ \value HCRPrint Hardcopy Cable Replacement Profile (HCRP) (service)
+ \value HCRScan Hardcopy Cable Replacement Profile (HCRP) (service)
+ \value SIMAccess SIM Access Profile (SAP) UUID (service and profile)
+ \value PhonebookAccessPCE Phonebook Access Profile (PBAP) UUID (service)
+ \value PhonebookAccessPSE Phonebook Access Profile (PBAP) UUID (service)
+ \value PhonebookAccess Phonebook Access Profile (PBAP) (profile)
+ \value HeadsetHS Headset Profile (HSP) UUID (service)
+ \value MessageAccessServer Message Access Profile (MAP) UUID (service)
+ \value MessageNotificationServer Message Access Profile (MAP) UUID (service)
+ \value MessageAccessProfile Message Access Profile (MAP) UUID (profile)
+ \value GNSS Global Navigation Satellite System UUID (profile)
+ \value GNSSServer Global Navigation Satellite System Server (UUID) (service)
+ \value Display3D 3D Synchronization Display UUID (service)
+ \value Glasses3D 3D Synchronization Glasses UUID (service)
+ \value Synchronization3D 3D Synchronization UUID (profile)
+ \value MPSProfile Multi-Profile Specification UUID (profile)
+ \value MPSService Multi-Profile Specification UUID (service)
+ \value PnPInformation Device Identification (DID) UUID (service & profile)
+ \value GenericNetworking Generic networking UUID (service)
+ \value GenericFileTransfer Generic file transfer UUID (service)
+ \value GenericAudio Generic audio UUID (service)
+ \value GenericTelephony Generic telephone UUID (service)
+ \value VideoSource Video Distribution Profile (VDP) UUID (service)
+ \value VideoSink Video Distribution Profile (VDP) UUID (service)
+ \value VideoDistribution Video Distribution Profile (VDP) UUID (profile)
+ \value HDP Health Device Profile (HDP) UUID (profile)
+ \value HDPSource Health Device Profile Source (HDP) UUID (service)
+ \value HDPSink Health Device Profile Sink (HDP) UUID (service)
+ \value GenericAccess Generic access service for Bluetooth Low Energy devices UUID (service).
+ It contains generic information about the device. All available Characteristics are readonly.
+ \value GenericAttribute
+ \value ImmediateAlert Immediate Alert UUID (service). The service exposes a control point to allow a peer
+ device to cause the device to immediately alert.
+ \value LinkLoss Link Loss UUID (service). The service defines behavior when a link is lost between two devices.
+ \value TxPower Transmission Power UUID (service). The service exposes a device’s current
+ transmit power level when in a connection.
+ \value CurrentTimeService Current Time UUID (service). The service defines how the current time can be exposed using
+ the Generic Attribute Profile (GATT).
+ \value ReferenceTimeUpdateService Reference Time update UUID (service). The service defines how a client can request
+ an update from a reference time source from a time server.
+ \value NextDSTChangeService Next DST change UUID (service). The service defines how the information about an
+ upcoming DST change can be exposed.
+ \value Glucose Glucose UUID (service). The service exposes glucose and other data from a glucose sensor
+ for use in consumer and professional healthcare applications.
+ \value HealthThermometer Health Thermometer UUID (service). The Health Thermometer service exposes temperature
+ and other data from a thermometer intended for healthcare and fitness applications.
+ \value DeviceInformation Device Information UUID (service). The Device Information Service exposes manufacturer
+ and/or vendor information about a device.
+ \value HeartRate Heart Rate UUID (service). The service exposes the heart rate and other data from a
+ Heart Rate Sensor intended for fitness applications.
+ \value PhoneAlertStatusService Phone Alert Status UUID (service). The service exposes the phone alert status when
+ in a connection.
+ \value BatteryService Battery UUID (service). The Battery Service exposes the state of a battery within a device.
+ \value BloodPressure Blood Pressure UUID (service). The service exposes blood pressure and other data from a blood pressure
+ monitor intended for healthcare applications.
+ \value AlertNotificationService Alert Notification UUID (service). The Alert Notification service exposes alert
+ information on a device.
+ \value HumanInterfaceDevice Human Interface UUID (service). The service exposes the HID reports and other HID data
+ intended for HID Hosts and HID Devices.
+ \value ScanParameters Scan Parameters UUID (service). The Scan Parameters Service enables a GATT Server device
+ to expose a characteristic for the GATT Client to write its scan interval and scan window
+ on the GATT Server device.
+ \value RunningSpeedAndCadence Runnung Speed and Cadence UUID (service). The service exposes speed, cadence and other
+ data from a Running Speed and Cadence Sensor intended for fitness applications.
+ \value CyclingSpeedAndCadence Cycling Speed and Cadence UUID (service). The service exposes speed-related and
+ cadence-related data from a Cycling Speed and Cadence sensor intended for fitness
+ applications.
+ \value CyclingPower Cycling Speed UUID (service). The service exposes power- and force-related data and
+ optionally speed- and cadence-related data from a Cycling Power
+ sensor intended for sports and fitness applications.
+ \value LocationAndNavigation Location Navigation UUID (service). The service exposes location and navigation-related
+ data from a Location and Navigation sensor intended for outdoor activity applications.
+*/
+
+/*!
+ \enum QBluetoothUuid::CharacteristicType
+
+ This enum is a convienience type for Bluetooth low energy service characteristics class UUIDs. Values of this type
+ will be implicitly converted into a QBluetoothUuid when necessary.
+
+ \value AlertCategoryID Categories of alerts/messages.
+ \value AlertCategoryIDBitMask Categories of alerts/messages.
+ \value AlertLevel The level of an alert a device is to sound.
+ If this level is changed while the alert is being sounded,
+ the new level should take effect.
+ \value AlertNotificationControlPoint Control point of the Alert Notification server.
+ Client can write the command here to request the several
+ functions toward the server.
+ \value AlertStatus The Alert Status characteristic defines the Status of alert.
+ \value Appearance The external appearance of this device. The values are composed
+ of a category (10-bits) and sub-categories (6-bits).
+ \value BatteryLevel The current charge level of a battery. 100% represents fully charged
+ while 0% represents fully discharged.
+ \value BloodPressureFeature The Blood Pressure Feature characteristic is used to describe the supported
+ features of the Blood Pressure Sensor.
+ \value BloodPressureMeasurement The Blood Pressure Measurement characteristic is a variable length structure
+ containing a Flags field, a Blood Pressure Measurement Compound Value field,
+ and contains additional fields such as Time Stamp, Pulse Rate and User ID
+ as determined by the contents of the Flags field.
+ \value BodySensorLocation
+ \value BootKeyboardInputReport The Boot Keyboard Input Report characteristic is used to transfer fixed format
+ and length Input Report data between a HID Host operating in Boot Protocol Mode
+ and a HID Service corresponding to a boot keyboard.
+ \value BootKeyboardOutputReport The Boot Keyboard Output Report characteristic is used to transfer fixed format
+ and length Output Report data between a HID Host operating in Boot Protocol Mode
+ and a HID Service corresponding to a boot keyboard.
+ \value BootMouseInputReport The Boot Mouse Input Report characteristic is used to transfer fixed format and
+ length Input Report data between a HID Host operating in Boot Protocol Mode and
+ a HID Service corresponding to a boot mouse.
+ \value CSCFeature The CSC (Cycling Speed and Cadence) Feature characteristic is used to describe
+ the supported features of the Server.
+ \value CSCMeasurement The CSC Measurement characteristic (CSC refers to Cycling Speed and Cadence)
+ is a variable length structure containing a Flags field and, based on the contents
+ of the Flags field, may contain one or more additional fields as shown in the tables
+ below.
+ \value CurrentTime
+ \value CyclingPowerControlPoint The Cycling Power Control Point characteristic is used to request a specific function
+ to be executed on the receiving device.
+ \value CyclingPowerFeature The CP Feature characteristic is used to report a list of features supported by
+ the device.
+ \value CyclingPowerMeasurement The Cycling Power Measurement characteristic is a variable length structure containing
+ a Flags field, an Instantaneous Power field and, based on the contents of the Flags
+ field, may contain one or more additional fields as shown in the table below.
+ \value CyclingPowerVector The Cycling Power Vector characteristic is a variable length structure containing
+ a Flags fieldand based on the contents of the Flags field, may contain one or more
+ additional fields as shown in the table below.
+ \value DateTime The Date Time characteristic is used to represent time.
+ \value DayDateTime
+ \value DayOfWeek
+ \value DeviceName
+ \value DSTOffset
+ \value ExactTime256
+ \value FirmwareRevisionString The value of this characteristic is a UTF-8 string representing the firmware revision
+ for the firmware within the device.
+ \value GlucoseFeature The Glucose Feature characteristic is used to describe the supported features
+ of the Server. When read, the Glucose Feature characteristic returns a value
+ that is used by a Client to determine the supported features of the Server.
+ \value GlucoseMeasurement The Glucose Measurement characteristic is a variable length structure containing
+ a Flags field, a Sequence Number field, a Base Time field and, based upon the contents
+ of the Flags field, may contain a Time Offset field, Glucose Concentration field,
+ Type-Sample Location field and a Sensor Status Annunciation field.
+ \value GlucoseMeasurementContext
+ \value HardwareRevisionString The value of this characteristic is a UTF-8 string representing the hardware revision
+ for the hardware within the device.
+ \value HeartRateControlPoint
+ \value HeartRateMeasurement
+ \value HIDControlPoint The HID Control Point characteristic is a control-point attribute that defines the
+ HID Commands when written.
+ \value HIDInformation The HID Information Characteristic returns the HID attributes when read.
+ \value IEEE1107320601RegulatoryCertificationDataList The value of the characteristic is an opaque structure listing
+ various regulatory and/or certification compliance items to which the device
+ claims adherence.
+ \value IntermediateCuffPressure This characteristic has the same format as the Blood Pressure Measurement
+ characteristic.
+ \value IntermediateTemperature The Intermediate Temperature characteristic has the same format as the
+ Temperature Measurement characteristic
+ \value LNControlPoint The LN Control Point characteristic is used to request a specific function
+ to be executed on the receiving device.
+ \value LNFeature The LN Feature characteristic is used to report a list of features supported
+ by the device.
+ \value LocalTimeInformation
+ \value LocationAndSpeed The Location and Speed characteristic is a variable length structure containing
+ a Flags field and, based on the contents of the Flags field, may contain a combination
+ of data fields.
+ \value ManufacturerNameString The value of this characteristic is a UTF-8 string representing the name of the
+ manufacturer of the device.
+ \value MeasurementInterval The Measurement Interval characteristic defines the time between measurements.
+ \value ModelNumberString The value of this characteristic is a UTF-8 string representing the model number
+ assigned by the device vendor.
+ \value Navigation The Navigation characteristic is a variable length structure containing a Flags field,
+ a Bearing field, a Heading field and, based on the contents of the Flags field.
+ \value NewAlert This characteristic defines the category of the alert and how many new alerts of
+ that category have occurred in the server device.
+ \value PeripheralPreferredConnectionParameters
+ \value PeripheralPrivacyFlag
+ \value PnPID The PnP_ID characteristic returns its value when read using the GATT Characteristic
+ Value Read procedure.
+ \value PositionQuality The Position Quality characteristic is a variable length structure containing a
+ Flags field and at least one of the optional data
+ \value ProtocolMode The Protocol Mode characteristic is used to expose the current protocol mode of
+ the HID Service with which it is associated, or to set the desired protocol
+ mode of the HID Service.
+ \value ReconnectionAddress The Information included in this page is informative. The normative descriptions
+ are contained in the applicable specification.
+ \value RecordAccessControlPoint This control point is used with a service to provide basic management functionality
+ for the Glucose Sensor patient record database.
+ \value ReferenceTimeInformation
+ \value Report The Report characteristic is used to exchange data between a HID Device and a HID Host.
+ \value ReportMap Only a single instance of this characteristic exists as part of a HID Service.
+ \value RingerControlPoint The Ringer Control Point characteristic defines the Control Point of Ringer.
+ \value RingerSetting The Ringer Setting characteristic defines the Setting of the Ringer.
+ \value RSCFeature The RSC (Running Speed and Cadence) Feature characteristic is used to describe the
+ supported features of the Server.
+ \value RSCMeasurement RSC refers to Running Speed and Cadence.
+ \value SCControlPoint The SC Control Point characteristic is used to request a specific function to be
+ executed on the receiving device.
+ \value ScanIntervalWindow The Scan Interval Window characteristic is used to store the scan parameters of
+ the GATT Client.
+ \value ScanRefresh The Scan Refresh characteristic is used to notify the Client that the Server
+ requires the Scan Interval Window characteristic to be written with the latest
+ values upon notification.
+ \value SensorLocation The Sensor Location characteristic is used to expose the location of the sensor.
+ \value SerialNumberString The value of this characteristic is a variable-length UTF-8 string representing
+ the serial number for a particular instance of the device.
+ \value ServiceChanged
+ \value SoftwareRevisionString The value of this characteristic is a UTF-8 string representing the software
+ revision for the software within the device.
+ \value SupportedNewAlertCategory Category that the server supports for new alert.
+ \value SupportedUnreadAlertCategory Category that the server supports for unread alert.
+ \value SystemID If the system ID is based of a Bluetooth Device Address with a Company Identifier
+ (OUI) is 0x123456 and the Company Assigned Identifier is 0x9ABCDE, then the System
+ Identifier is required to be 0x123456FFFE9ABCDE.
+ \value TemperatureMeasurement The Temperature Measurement characteristic is a variable length structure containing
+ a Flags field, a Temperature Measurement Value field and, based upon the contents of
+ the Flags field, optionally a Time Stamp field and/or a Temperature Type field.
+ \value TemperatureType The Temperature Type characteristic is an enumeration that indicates where the
+ temperature was measured.
+ \value TimeAccuracy
+ \value TimeSource
+ \value TimeUpdateControlPoint
+ \value TimeUpdateState
+ \value TimeWithDST
+ \value TimeZone
+ \value TxPowerLevel The value of the characteristic is a signed 8 bit integer that has a fixed point
+ exponent of 0.
+ \value UnreadAlertStatus This characteristic shows how many numbers of unread alerts exist in the specific
+ category in the device.
+*/
+
+/*!
+ \enum QBluetoothUuid::DescriptorType
+
+ Descriptors are attributes that describe Bluetooth Low Energy characteristic values.
+
+ This enum is a convienience type for descriptor class UUIDs. Values of this type
+ will be implicitly converted into a QBluetoothUuid when necessary.
+
+ \value CharacteristicExtendedProperties Descriptor defines additional Characteristic Properties.
+ \value CharacteristicUserDescription Descriptor provides a textual user description for a characteristic value.
+ \value ClientCharacteristicConfiguration Descriptor defines how the characteristic may be configured by a specific client.
+ \value ServerCharacteristicConfiguration Descriptor defines how the characteristic descriptor is associated with may be
+ configured for the server.
+ \value CharacteristicPresentationFormat Descriptor defines the format of the Characteristic Value.
+ \value CharacteristicAggregateFormat Descriptor defines the format of an aggregated Characteristic Value.
+ \value ValidRange descriptor is used for defining the range of a characteristics.
+ Two mandatory fields are contained (upper and lower bounds) which define the range.
+ \value ExternalReportReference Allows a HID Host to map information from the Report Map characteristic value for
+ Input Report, Output Report or Feature Report data to the Characteristic UUID of
+ external service characteristics used to transfer the associated data.
+ \value ReportReference Mapping information in the form of a Report ID and Report Type which maps the
+ current parent characteristic to the Report ID(s) and Report Type (s) defined
+ within the Report Map characteristic.
+ \value UnknownDescriptorType The descriptor type is unknown.
*/
/*!
@@ -205,6 +421,27 @@ QBluetoothUuid::QBluetoothUuid(ServiceClassUuid uuid)
}
/*!
+ Constructs a new Bluetooth UUID from the characteristic type \a uuid.
+*/
+QBluetoothUuid::QBluetoothUuid(CharacteristicType uuid)
+: QUuid(uuid, baseUuid()->data2, baseUuid()->data3, baseUuid()->data4[0], baseUuid()->data4[1],
+ baseUuid()->data4[2], baseUuid()->data4[3], baseUuid()->data4[4], baseUuid()->data4[5],
+ baseUuid()->data4[6], baseUuid()->data4[7])
+{
+}
+
+/*!
+ Constructs a new Bluetooth UUID from the descriptor type \a uuid.
+*/
+QBluetoothUuid::QBluetoothUuid(DescriptorType uuid)
+ : QUuid(uuid, baseUuid()->data2, baseUuid()->data3, baseUuid()->data4[0], baseUuid()->data4[1],
+ baseUuid()->data4[2], baseUuid()->data4[3], baseUuid()->data4[4], baseUuid()->data4[5],
+ baseUuid()->data4[6], baseUuid()->data4[7])
+{
+
+}
+
+/*!
Constructs a new Bluetooth UUID from the 16 bit \a uuid.
*/
QBluetoothUuid::QBluetoothUuid(quint16 uuid)
@@ -226,20 +463,14 @@ QBluetoothUuid::QBluetoothUuid(quint32 uuid)
/*!
Constructs a new Bluetooth UUID from the 128 bit \a uuid.
+
+ Note that \a uuid must be in big endian order.
*/
QBluetoothUuid::QBluetoothUuid(quint128 uuid)
{
- // TODO: look at the memcpy(), should not be needed
- quint32 tmp32;
- memcpy(&tmp32, &uuid.data[0], 4);
- data1 = qFromBigEndian<quint32>(tmp32);
-
- quint16 tmp16;
- memcpy(&tmp16, &uuid.data[4], 2);
- data2 = qFromBigEndian<quint16>(tmp16);
-
- memcpy(&tmp16, &uuid.data[6], 2);
- data3 = qFromBigEndian<quint16>(tmp16);
+ data1 = qFromBigEndian<quint32>(*reinterpret_cast<quint32 *>(&uuid.data[0]));
+ data2 = qFromBigEndian<quint16>(*reinterpret_cast<quint16 *>(&uuid.data[4]));
+ data3 = qFromBigEndian<quint16>(*reinterpret_cast<quint16 *>(&uuid.data[6]));
memcpy(data4, &uuid.data[8], 8);
}
@@ -364,6 +595,307 @@ quint128 QBluetoothUuid::toUInt128() const
}
/*!
+ Returns a human-readable and translated name for the given service class
+ represented by \a uuid.
+
+ \sa QBluetoothUuid::ServiceClassUuid
+ \since Qt 5.4
+ */
+QString QBluetoothUuid::serviceClassToString(QBluetoothUuid::ServiceClassUuid uuid)
+{
+ switch (uuid) {
+ case QBluetoothUuid::ServiceDiscoveryServer: return QBluetoothServiceDiscoveryAgent::tr("Service Discovery");
+ case QBluetoothUuid::BrowseGroupDescriptor: return QBluetoothServiceDiscoveryAgent::tr("Browse Group Descriptor");
+ case QBluetoothUuid::PublicBrowseGroup: return QBluetoothServiceDiscoveryAgent::tr("Public Browse Group");
+ case QBluetoothUuid::SerialPort: return QBluetoothServiceDiscoveryAgent::tr("Serial Port Profile");
+ case QBluetoothUuid::LANAccessUsingPPP: return QBluetoothServiceDiscoveryAgent::tr("LAN Access Profile");
+ case QBluetoothUuid::DialupNetworking: return QBluetoothServiceDiscoveryAgent::tr("Dial-Up Networking");
+ case QBluetoothUuid::IrMCSync: return QBluetoothServiceDiscoveryAgent::tr("Synchronization");
+ case QBluetoothUuid::ObexObjectPush: return QBluetoothServiceDiscoveryAgent::tr("Object Push");
+ case QBluetoothUuid::OBEXFileTransfer: return QBluetoothServiceDiscoveryAgent::tr("File Transfer");
+ case QBluetoothUuid::IrMCSyncCommand: return QBluetoothServiceDiscoveryAgent::tr("Synchronization Command");
+ case QBluetoothUuid::Headset: return QBluetoothServiceDiscoveryAgent::tr("Headset");
+ case QBluetoothUuid::AudioSource: return QBluetoothServiceDiscoveryAgent::tr("Audio Source");
+ case QBluetoothUuid::AudioSink: return QBluetoothServiceDiscoveryAgent::tr("Audio Sink");
+ case QBluetoothUuid::AV_RemoteControlTarget: return QBluetoothServiceDiscoveryAgent::tr("Audio/Video Remote Control Target");
+ case QBluetoothUuid::AdvancedAudioDistribution: return QBluetoothServiceDiscoveryAgent::tr("Advanced Audio Distribution");
+ case QBluetoothUuid::AV_RemoteControl: return QBluetoothServiceDiscoveryAgent::tr("Audio/Video Remote Control");
+ case QBluetoothUuid::AV_RemoteControlController: return QBluetoothServiceDiscoveryAgent::tr("Audio/Video Remote Control Controller");
+ case QBluetoothUuid::HeadsetAG: return QBluetoothServiceDiscoveryAgent::tr("Headset AG");
+ case QBluetoothUuid::PANU: return QBluetoothServiceDiscoveryAgent::tr("Personal Area Networking (PANU)");
+ case QBluetoothUuid::NAP: return QBluetoothServiceDiscoveryAgent::tr("Personal Area Networking (NAP)");
+ case QBluetoothUuid::GN: return QBluetoothServiceDiscoveryAgent::tr("Personal Area Networking (GN)");
+ case QBluetoothUuid::DirectPrinting: return QBluetoothServiceDiscoveryAgent::tr("Basic Direct Printing (BPP)");
+ case QBluetoothUuid::ReferencePrinting: return QBluetoothServiceDiscoveryAgent::tr("Basic Reference Printing (BPP)");
+ case QBluetoothUuid::BasicImage: return QBluetoothServiceDiscoveryAgent::tr("Basic Imaging Profile");
+ case QBluetoothUuid::ImagingResponder: return QBluetoothServiceDiscoveryAgent::tr("Basic Imaging Responder");
+ case QBluetoothUuid::ImagingAutomaticArchive: return QBluetoothServiceDiscoveryAgent::tr("Basic Imaging Archive");
+ case QBluetoothUuid::ImagingReferenceObjects: return QBluetoothServiceDiscoveryAgent::tr("Basic Imaging Ref Objects");
+ case QBluetoothUuid::Handsfree: return QBluetoothServiceDiscoveryAgent::tr("Hands-Free");
+ case QBluetoothUuid::HandsfreeAudioGateway: return QBluetoothServiceDiscoveryAgent::tr("Hands-Free AG");
+ case QBluetoothUuid::DirectPrintingReferenceObjectsService: return QBluetoothServiceDiscoveryAgent::tr("Basic Printing RefObject Service");
+ case QBluetoothUuid::ReflectedUI: return QBluetoothServiceDiscoveryAgent::tr("Basic Printing Reflected UI");
+ case QBluetoothUuid::BasicPrinting: return QBluetoothServiceDiscoveryAgent::tr("Basic Printing");
+ case QBluetoothUuid::PrintingStatus: return QBluetoothServiceDiscoveryAgent::tr("Basic Printing Status");
+ case QBluetoothUuid::HumanInterfaceDeviceService: return QBluetoothServiceDiscoveryAgent::tr("Human Interface Device");
+ case QBluetoothUuid::HardcopyCableReplacement: return QBluetoothServiceDiscoveryAgent::tr("Hardcopy Cable Replacement");
+ case QBluetoothUuid::HCRPrint: return QBluetoothServiceDiscoveryAgent::tr("Hardcopy Cable Replacement Print");
+ case QBluetoothUuid::HCRScan: return QBluetoothServiceDiscoveryAgent::tr("Hardcopy Cable Replacement Scan");
+ case QBluetoothUuid::SIMAccess: return QBluetoothServiceDiscoveryAgent::tr("SIM Access Server");
+ case QBluetoothUuid::PhonebookAccessPCE: return QBluetoothServiceDiscoveryAgent::tr("Phonebook Access PCE");
+ case QBluetoothUuid::PhonebookAccessPSE: return QBluetoothServiceDiscoveryAgent::tr("Phonebook Access PSE");
+ case QBluetoothUuid::PhonebookAccess: return QBluetoothServiceDiscoveryAgent::tr("Phonebook Access");
+ case QBluetoothUuid::HeadsetHS: return QBluetoothServiceDiscoveryAgent::tr("Headset HS");
+ case QBluetoothUuid::MessageAccessServer: return QBluetoothServiceDiscoveryAgent::tr("Message Access Server");
+ case QBluetoothUuid::MessageNotificationServer: return QBluetoothServiceDiscoveryAgent::tr("Message Notification Server");
+ case QBluetoothUuid::MessageAccessProfile: return QBluetoothServiceDiscoveryAgent::tr("Message Access");
+ case QBluetoothUuid::GNSS: return QBluetoothServiceDiscoveryAgent::tr("Global Navigation Satellite System");
+ case QBluetoothUuid::GNSSServer: return QBluetoothServiceDiscoveryAgent::tr("Global Navigation Satellite System Server");
+ case QBluetoothUuid::Display3D: return QBluetoothServiceDiscoveryAgent::tr("3D Synchronization Display");
+ case QBluetoothUuid::Glasses3D: return QBluetoothServiceDiscoveryAgent::tr("3D Synchronization Glasses");
+ case QBluetoothUuid::Synchronization3D: return QBluetoothServiceDiscoveryAgent::tr("3D Synchronization");
+ case QBluetoothUuid::MPSProfile: return QBluetoothServiceDiscoveryAgent::tr("Multi-Profile Specification (Profile)");
+ case QBluetoothUuid::MPSService: return QBluetoothServiceDiscoveryAgent::tr("Multi-Profile Specification");
+ case QBluetoothUuid::PnPInformation: return QBluetoothServiceDiscoveryAgent::tr("Device Identification");
+ case QBluetoothUuid::GenericNetworking: return QBluetoothServiceDiscoveryAgent::tr("Generic Networking");
+ case QBluetoothUuid::GenericFileTransfer: return QBluetoothServiceDiscoveryAgent::tr("Generic File Transfer");
+ case QBluetoothUuid::GenericAudio: return QBluetoothServiceDiscoveryAgent::tr("Generic Audio");
+ case QBluetoothUuid::GenericTelephony: return QBluetoothServiceDiscoveryAgent::tr("Generic Telephony");
+ case QBluetoothUuid::VideoSource: return QBluetoothServiceDiscoveryAgent::tr("Video Source");
+ case QBluetoothUuid::VideoSink: return QBluetoothServiceDiscoveryAgent::tr("Video Sink");
+ case QBluetoothUuid::VideoDistribution: return QBluetoothServiceDiscoveryAgent::tr("Video Distribution");
+ case QBluetoothUuid::HDP: return QBluetoothServiceDiscoveryAgent::tr("Health Device");
+ case QBluetoothUuid::HDPSource: return QBluetoothServiceDiscoveryAgent::tr("Health Device Source");
+ case QBluetoothUuid::HDPSink: return QBluetoothServiceDiscoveryAgent::tr("Health Device Sink");
+ case QBluetoothUuid::GenericAccess: return QBluetoothServiceDiscoveryAgent::tr("Generic Access");
+ case QBluetoothUuid::GenericAttribute: return QBluetoothServiceDiscoveryAgent::tr("Generic Attribute");
+ case QBluetoothUuid::ImmediateAlert: return QBluetoothServiceDiscoveryAgent::tr("Immediate Alert");
+ case QBluetoothUuid::LinkLoss: return QBluetoothServiceDiscoveryAgent::tr("Link Loss");
+ case QBluetoothUuid::TxPower: return QBluetoothServiceDiscoveryAgent::tr("Tx Power");
+ case QBluetoothUuid::CurrentTimeService: return QBluetoothServiceDiscoveryAgent::tr("Current Time Service");
+ case QBluetoothUuid::ReferenceTimeUpdateService: return QBluetoothServiceDiscoveryAgent::tr("Reference Time Update Service");
+ case QBluetoothUuid::NextDSTChangeService: return QBluetoothServiceDiscoveryAgent::tr("Next DST Change Service");
+ case QBluetoothUuid::Glucose: return QBluetoothServiceDiscoveryAgent::tr("Glucose");
+ case QBluetoothUuid::HealthThermometer: return QBluetoothServiceDiscoveryAgent::tr("Health Thermometer");
+ case QBluetoothUuid::DeviceInformation: return QBluetoothServiceDiscoveryAgent::tr("Device Information");
+ case QBluetoothUuid::HeartRate: return QBluetoothServiceDiscoveryAgent::tr("Heart Rate");
+ case QBluetoothUuid::PhoneAlertStatusService: return QBluetoothServiceDiscoveryAgent::tr("Phone Alert Status Service");
+ case QBluetoothUuid::BatteryService: return QBluetoothServiceDiscoveryAgent::tr("Battery Service");
+ case QBluetoothUuid::BloodPressure: return QBluetoothServiceDiscoveryAgent::tr("Blood Pressure");
+ case QBluetoothUuid::AlertNotificationService: return QBluetoothServiceDiscoveryAgent::tr("Alert Notification Service");
+ case QBluetoothUuid::HumanInterfaceDevice: return QBluetoothServiceDiscoveryAgent::tr("Human Interface Device");
+ case QBluetoothUuid::ScanParameters: return QBluetoothServiceDiscoveryAgent::tr("Scan Parameters");
+ case QBluetoothUuid::RunningSpeedAndCadence: return QBluetoothServiceDiscoveryAgent::tr("Running Speed and Cadance");
+ case QBluetoothUuid::CyclingSpeedAndCadence: return QBluetoothServiceDiscoveryAgent::tr("Cycling Speed and Cadance");
+ case QBluetoothUuid::CyclingPower: return QBluetoothServiceDiscoveryAgent::tr("Cycling Power");
+ case QBluetoothUuid::LocationAndNavigation: return QBluetoothServiceDiscoveryAgent::tr("Location and Navigation");
+ default:
+ break;
+ }
+
+ return QString();
+}
+
+
+/*!
+ Returns a human-readable and translated name for the given protocol
+ represented by \a uuid.
+
+ \sa QBluetoothUuid::ProtocolUuid
+
+ \since 5.4
+ */
+QString QBluetoothUuid::protocolToString(QBluetoothUuid::ProtocolUuid uuid)
+{
+ switch (uuid) {
+ case QBluetoothUuid::Sdp: return QBluetoothServiceDiscoveryAgent::tr("Service Discovery Protocol");
+ case QBluetoothUuid::Udp: return QBluetoothServiceDiscoveryAgent::tr("User Datagram Protocol");
+ case QBluetoothUuid::Rfcomm: return QBluetoothServiceDiscoveryAgent::tr("Radio Frequency Communication");
+ case QBluetoothUuid::Tcp: return QBluetoothServiceDiscoveryAgent::tr("Transmission Control Protocol");
+ case QBluetoothUuid::TcsBin: return QBluetoothServiceDiscoveryAgent::tr("Telephony Control Specification - Binary");
+ case QBluetoothUuid::TcsAt: return QBluetoothServiceDiscoveryAgent::tr("Telephony Control Specification - AT");
+ case QBluetoothUuid::Att: return QBluetoothServiceDiscoveryAgent::tr("Attribute Protocol");
+ case QBluetoothUuid::Obex: return QBluetoothServiceDiscoveryAgent::tr("Object Exchange Protocol");
+ case QBluetoothUuid::Ip: return QBluetoothServiceDiscoveryAgent::tr("Internet Protocol");
+ case QBluetoothUuid::Ftp: return QBluetoothServiceDiscoveryAgent::tr("File Transfer Protocol");
+ case QBluetoothUuid::Http: return QBluetoothServiceDiscoveryAgent::tr("Hypertext Transfer Protocol");
+ case QBluetoothUuid::Wsp: return QBluetoothServiceDiscoveryAgent::tr("Wireless Short Packet Protocol");
+ case QBluetoothUuid::Bnep: return QBluetoothServiceDiscoveryAgent::tr("Bluetooth Network Encapsulation Protocol");
+ case QBluetoothUuid::Upnp: return QBluetoothServiceDiscoveryAgent::tr("Extended Service Discovery Protocol");
+ case QBluetoothUuid::Hidp: return QBluetoothServiceDiscoveryAgent::tr("Human Interface Device Protocol");
+ case QBluetoothUuid::HardcopyControlChannel: return QBluetoothServiceDiscoveryAgent::tr("Hardcopy Control Channel");
+ case QBluetoothUuid::HardcopyDataChannel: return QBluetoothServiceDiscoveryAgent::tr("Hardcopy Data Channel");
+ case QBluetoothUuid::HardcopyNotification: return QBluetoothServiceDiscoveryAgent::tr("Hardcopy Notification");
+ case QBluetoothUuid::Avctp: return QBluetoothServiceDiscoveryAgent::tr("Audio/Video Control Transport Protocol");
+ case QBluetoothUuid::Avdtp: return QBluetoothServiceDiscoveryAgent::tr("Audio/Video Distribution Transport Protocol");
+ case QBluetoothUuid::Cmtp: return QBluetoothServiceDiscoveryAgent::tr("Common ISDN Access Protocol");
+ case QBluetoothUuid::UdiCPlain: return QBluetoothServiceDiscoveryAgent::tr("UdiCPlain");
+ case QBluetoothUuid::McapControlChannel: return QBluetoothServiceDiscoveryAgent::tr("Multi-Channel Adaptation Protocol -Conrol");
+ case QBluetoothUuid::McapDataChannel: return QBluetoothServiceDiscoveryAgent::tr("Multi-Channel Adaptation Protocol - Data");
+ case QBluetoothUuid::L2cap: return QBluetoothServiceDiscoveryAgent::tr("Layer 2 Control Protocol");
+ default:
+ break;
+ }
+
+ return QString();
+}
+
+/*!
+ Returns a human-readable and translated name for the given characteristic type
+ represented by \a uuid.
+
+ \sa QBluetoothUuid::CharacteristicType
+
+ \since 5.4
+*/
+QString QBluetoothUuid::characteristicToString(CharacteristicType uuid)
+{
+ switch (uuid) {
+ case QBluetoothUuid::DeviceName: return QBluetoothServiceDiscoveryAgent::tr("GAP Device Name");
+ case QBluetoothUuid::Appearance: return QBluetoothServiceDiscoveryAgent::tr("GAP Appearance");
+ case QBluetoothUuid::PeripheralPrivacyFlag:
+ return QBluetoothServiceDiscoveryAgent::tr("GAP Peripheral Privacy Flag");
+ case QBluetoothUuid::ReconnectionAddress:
+ return QBluetoothServiceDiscoveryAgent::tr("GAP Reconnection Address");
+ case QBluetoothUuid::PeripheralPreferredConnectionParameters:
+ return QBluetoothServiceDiscoveryAgent::tr("GAP Peripheral Preferred Connection Parameters");
+ case QBluetoothUuid::ServiceChanged: return QBluetoothServiceDiscoveryAgent::tr("GATT Service Changed");
+ case QBluetoothUuid::AlertLevel: return QBluetoothServiceDiscoveryAgent::tr("Alert Level");
+ case QBluetoothUuid::TxPowerLevel: return QBluetoothServiceDiscoveryAgent::tr("TX Power");
+ case QBluetoothUuid::DateTime: return QBluetoothServiceDiscoveryAgent::tr("Date Time");
+ case QBluetoothUuid::DayOfWeek: return QBluetoothServiceDiscoveryAgent::tr("Day Of Week");
+ case QBluetoothUuid::DayDateTime: return QBluetoothServiceDiscoveryAgent::tr("Day Date Time");
+ case QBluetoothUuid::ExactTime256: return QBluetoothServiceDiscoveryAgent::tr("Exact Time 256");
+ case QBluetoothUuid::DSTOffset: return QBluetoothServiceDiscoveryAgent::tr("DST Offset");
+ case QBluetoothUuid::TimeZone: return QBluetoothServiceDiscoveryAgent::tr("Time Zone");
+ case QBluetoothUuid::LocalTimeInformation:
+ return QBluetoothServiceDiscoveryAgent::tr("Local Time Information");
+ case QBluetoothUuid::TimeWithDST: return QBluetoothServiceDiscoveryAgent::tr("Time With DST");
+ case QBluetoothUuid::TimeAccuracy: return QBluetoothServiceDiscoveryAgent::tr("Time Accuracy");
+ case QBluetoothUuid::TimeSource: return QBluetoothServiceDiscoveryAgent::tr("Time Source");
+ case QBluetoothUuid::ReferenceTimeInformation:
+ return QBluetoothServiceDiscoveryAgent::tr("Reference Time Information");
+ case QBluetoothUuid::TimeUpdateControlPoint:
+ return QBluetoothServiceDiscoveryAgent::tr("Time Update Control Point");
+ case QBluetoothUuid::TimeUpdateState: return QBluetoothServiceDiscoveryAgent::tr("Time Update State");
+ case QBluetoothUuid::GlucoseMeasurement: return QBluetoothServiceDiscoveryAgent::tr("Glucose Measurement");
+ case QBluetoothUuid::BatteryLevel: return QBluetoothServiceDiscoveryAgent::tr("Battery Level");
+ case QBluetoothUuid::TemperatureMeasurement:
+ return QBluetoothServiceDiscoveryAgent::tr("Temperature Measurement");
+ case QBluetoothUuid::TemperatureType: return QBluetoothServiceDiscoveryAgent::tr("Temperature Type");
+ case QBluetoothUuid::IntermediateTemperature:
+ return QBluetoothServiceDiscoveryAgent::tr("Intermediate Temperature");
+ case QBluetoothUuid::MeasurementInterval: return QBluetoothServiceDiscoveryAgent::tr("Measurement Interval");
+ case QBluetoothUuid::BootKeyboardInputReport: return QBluetoothServiceDiscoveryAgent::tr("Boot Keyboard Input Report");
+ case QBluetoothUuid::SystemID: return QBluetoothServiceDiscoveryAgent::tr("System ID");
+ case QBluetoothUuid::ModelNumberString: return QBluetoothServiceDiscoveryAgent::tr("Model Number String");
+ case QBluetoothUuid::SerialNumberString: return QBluetoothServiceDiscoveryAgent::tr("Serial Number String");
+ case QBluetoothUuid::FirmwareRevisionString: return QBluetoothServiceDiscoveryAgent::tr("Firmware Revision String");
+ case QBluetoothUuid::HardwareRevisionString: return QBluetoothServiceDiscoveryAgent::tr("Hardware Revision String");
+ case QBluetoothUuid::SoftwareRevisionString: return QBluetoothServiceDiscoveryAgent::tr("Software Revision String");
+ case QBluetoothUuid::ManufacturerNameString: return QBluetoothServiceDiscoveryAgent::tr("Manufacturer Name String");
+ case QBluetoothUuid::IEEE1107320601RegulatoryCertificationDataList:
+ return QBluetoothServiceDiscoveryAgent::tr("IEEE 11073 20601 Regulatory Certification Data List");
+ case QBluetoothUuid::CurrentTime: return QBluetoothServiceDiscoveryAgent::tr("Current Time");
+ case QBluetoothUuid::ScanRefresh: return QBluetoothServiceDiscoveryAgent::tr("Scan Refresh");
+ case QBluetoothUuid::BootKeyboardOutputReport:
+ return QBluetoothServiceDiscoveryAgent::tr("Boot Keyboard Output Report");
+ case QBluetoothUuid::BootMouseInputReport: return QBluetoothServiceDiscoveryAgent::tr("Boot Mouse Input Report");
+ case QBluetoothUuid::GlucoseMeasurementContext:
+ return QBluetoothServiceDiscoveryAgent::tr("Glucose Measurement Context");
+ case QBluetoothUuid::BloodPressureMeasurement:
+ return QBluetoothServiceDiscoveryAgent::tr("Blood Pressure Measurement");
+ case QBluetoothUuid::IntermediateCuffPressure:
+ return QBluetoothServiceDiscoveryAgent::tr("Intermediate Cuff Pressure");
+ case QBluetoothUuid::HeartRateMeasurement: return QBluetoothServiceDiscoveryAgent::tr("Heart Rate Measurement");
+ case QBluetoothUuid::BodySensorLocation: return QBluetoothServiceDiscoveryAgent::tr("Body Sensor Location");
+ case QBluetoothUuid::HeartRateControlPoint: return QBluetoothServiceDiscoveryAgent::tr("Heart Rate Control Point");
+ case QBluetoothUuid::AlertStatus: return QBluetoothServiceDiscoveryAgent::tr("Alert Status");
+ case QBluetoothUuid::RingerControlPoint: return QBluetoothServiceDiscoveryAgent::tr("Ringer Control Point");
+ case QBluetoothUuid::RingerSetting: return QBluetoothServiceDiscoveryAgent::tr("Ringer Setting");
+ case QBluetoothUuid::AlertCategoryIDBitMask:
+ return QBluetoothServiceDiscoveryAgent::tr("Alert Category ID Bit Mask");
+ case QBluetoothUuid::AlertCategoryID: return QBluetoothServiceDiscoveryAgent::tr("Alert Category ID");
+ case QBluetoothUuid::AlertNotificationControlPoint:
+ return QBluetoothServiceDiscoveryAgent::tr("Alert Notification Control Point");
+ case QBluetoothUuid::UnreadAlertStatus: return QBluetoothServiceDiscoveryAgent::tr("Unread Alert Status");
+ case QBluetoothUuid::NewAlert: return QBluetoothServiceDiscoveryAgent::tr("New Alert");
+ case QBluetoothUuid::SupportedNewAlertCategory:
+ return QBluetoothServiceDiscoveryAgent::tr("Supported New Alert Category");
+ case QBluetoothUuid::SupportedUnreadAlertCategory:
+ return QBluetoothServiceDiscoveryAgent::tr("Supported Unread Alert Category");
+ case QBluetoothUuid::BloodPressureFeature: return QBluetoothServiceDiscoveryAgent::tr("Blood Pressure Feature");
+ case QBluetoothUuid::HIDInformation: return QBluetoothServiceDiscoveryAgent::tr("HID Information");
+ case QBluetoothUuid::ReportMap: return QBluetoothServiceDiscoveryAgent::tr("Report Map");
+ case QBluetoothUuid::HIDControlPoint: return QBluetoothServiceDiscoveryAgent::tr("HID Control Point");
+ case QBluetoothUuid::Report: return QBluetoothServiceDiscoveryAgent::tr("Report");
+ case QBluetoothUuid::ProtocolMode: return QBluetoothServiceDiscoveryAgent::tr("Protocol Mode");
+ case QBluetoothUuid::ScanIntervalWindow: return QBluetoothServiceDiscoveryAgent::tr("Scan Interval Window");
+ case QBluetoothUuid::PnPID: return QBluetoothServiceDiscoveryAgent::tr("PnP ID");
+ case QBluetoothUuid::GlucoseFeature: return QBluetoothServiceDiscoveryAgent::tr("Glucose Feature");
+ case QBluetoothUuid::RecordAccessControlPoint:
+ return QBluetoothServiceDiscoveryAgent::tr("Record Access Control Point");
+ case QBluetoothUuid::RSCMeasurement: return QBluetoothServiceDiscoveryAgent::tr("RSC Measurement");
+ case QBluetoothUuid::RSCFeature: return QBluetoothServiceDiscoveryAgent::tr("RSC Feature");
+ case QBluetoothUuid::SCControlPoint: return QBluetoothServiceDiscoveryAgent::tr("SC Control Point");
+ case QBluetoothUuid::CSCMeasurement: return QBluetoothServiceDiscoveryAgent::tr("CSC Measurement");
+ case QBluetoothUuid::CSCFeature: return QBluetoothServiceDiscoveryAgent::tr("CSC Feature");
+ case QBluetoothUuid::SensorLocation: return QBluetoothServiceDiscoveryAgent::tr("Sensor Location");
+ case QBluetoothUuid::CyclingPowerMeasurement:
+ return QBluetoothServiceDiscoveryAgent::tr("Cycling Power Measurement");
+ case QBluetoothUuid::CyclingPowerVector: return QBluetoothServiceDiscoveryAgent::tr("Cycling Power Vector");
+ case QBluetoothUuid::CyclingPowerFeature: return QBluetoothServiceDiscoveryAgent::tr("Cycling Power Feature");
+ case QBluetoothUuid::CyclingPowerControlPoint:
+ return QBluetoothServiceDiscoveryAgent::tr("Cycling Power COntrol Point");
+ case QBluetoothUuid::LocationAndSpeed: return QBluetoothServiceDiscoveryAgent::tr("Location And Speed");
+ case QBluetoothUuid::Navigation: return QBluetoothServiceDiscoveryAgent::tr("Navigation");
+ case QBluetoothUuid::PositionQuality: return QBluetoothServiceDiscoveryAgent::tr("Position Quality");
+ case QBluetoothUuid::LNFeature: return QBluetoothServiceDiscoveryAgent::tr("LN Feature");
+ case QBluetoothUuid::LNControlPoint: return QBluetoothServiceDiscoveryAgent::tr("LN Control Point");
+ default:
+ break;
+ }
+
+ return QString();
+}
+
+/*!
+ Returns a human-readable and translated name for the given descriptor type
+ represented by \a uuid.
+
+ \sa QBluetoothUuid::CharacteristicType
+
+ \since 5.4
+*/
+QString QBluetoothUuid::descriptorToString(QBluetoothUuid::DescriptorType uuid)
+{
+ switch (uuid) {
+ case QBluetoothUuid::CharacteristicExtendedProperties:
+ return QBluetoothServiceDiscoveryAgent::tr("Characteristic Extended Properties");
+ case QBluetoothUuid::CharacteristicUserDescription:
+ return QBluetoothServiceDiscoveryAgent::tr("Characteristic User Description");
+ case QBluetoothUuid::ClientCharacteristicConfiguration:
+ return QBluetoothServiceDiscoveryAgent::tr("Client Characteristic Configuration");
+ case QBluetoothUuid::ServerCharacteristicConfiguration:
+ return QBluetoothServiceDiscoveryAgent::tr("Server Characteristic Configuratio");
+ case QBluetoothUuid::CharacteristicPresentationFormat:
+ return QBluetoothServiceDiscoveryAgent::tr("Characteristic Presentation Format");
+ case QBluetoothUuid::CharacteristicAggregateFormat:
+ return QBluetoothServiceDiscoveryAgent::tr("Characteristic Aggregate Format");
+ case QBluetoothUuid::ValidRange:
+ return QBluetoothServiceDiscoveryAgent::tr("Valid Range");
+ case QBluetoothUuid::ExternalReportReference:
+ return QBluetoothServiceDiscoveryAgent::tr("External Report Reference");
+ case QBluetoothUuid::ReportReference:
+ return QBluetoothServiceDiscoveryAgent::tr("Report Reference");
+ default:
+ break;
+ }
+
+ return QString();
+}
+
+/*!
Returns true if \a other is equal to this Bluetooth UUID, otherwise false.
*/
bool QBluetoothUuid::operator==(const QBluetoothUuid &other) const
diff --git a/src/bluetooth/qbluetoothuuid.h b/src/bluetooth/qbluetoothuuid.h
index f33d8c13..2c035ffa 100644
--- a/src/bluetooth/qbluetoothuuid.h
+++ b/src/bluetooth/qbluetoothuuid.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -151,12 +143,133 @@ public:
VideoDistribution = 0x1305,
HDP = 0x1400,
HDPSource = 0x1401,
- HDPSink = 0x1402
+ HDPSink = 0x1402,
+ GenericAccess = 0x1800,
+ GenericAttribute = 0x1801,
+ ImmediateAlert = 0x1802,
+ LinkLoss = 0x1803,
+ TxPower = 0x1804,
+ CurrentTimeService = 0x1805,
+ ReferenceTimeUpdateService = 0x1806,
+ NextDSTChangeService = 0x1807,
+ Glucose = 0x1808,
+ HealthThermometer = 0x1809,
+ DeviceInformation = 0x180a,
+ HeartRate = 0x180d,
+ PhoneAlertStatusService = 0x180e,
+ BatteryService = 0x180f,
+ BloodPressure = 0x1810,
+ AlertNotificationService = 0x1811,
+ HumanInterfaceDevice = 0x1812,
+ ScanParameters = 0x1813,
+ RunningSpeedAndCadence = 0x1814,
+ CyclingSpeedAndCadence = 0x1816,
+ CyclingPower = 0x1818,
+ LocationAndNavigation = 0x1819,
+ };
+
+ enum CharacteristicType {
+ DeviceName = 0x2a00,
+ Appearance = 0x2a01,
+ PeripheralPrivacyFlag = 0x2a02,
+ ReconnectionAddress = 0x2a03,
+ PeripheralPreferredConnectionParameters = 0x2a04,
+ ServiceChanged = 0x2a05,
+ AlertLevel = 0x2a06,
+ TxPowerLevel = 0x2a07,
+ DateTime = 0x2a08,
+ DayOfWeek = 0x2a09,
+ DayDateTime = 0x2a0a,
+ ExactTime256 = 0x2a0c,
+ DSTOffset = 0x2a0d,
+ TimeZone = 0x2a0e,
+ LocalTimeInformation = 0x2a0f,
+ TimeWithDST = 0x2a11,
+ TimeAccuracy = 0x2a12,
+ TimeSource = 0x2a13,
+ ReferenceTimeInformation = 0x2a14,
+ TimeUpdateControlPoint = 0x2a16,
+ TimeUpdateState = 0x2a17,
+ GlucoseMeasurement = 0x2a18,
+ BatteryLevel = 0x2a19,
+ TemperatureMeasurement = 0x2a1c,
+ TemperatureType = 0x2a1d,
+ IntermediateTemperature = 0x2a1e,
+ MeasurementInterval = 0x2a21,
+ BootKeyboardInputReport = 0x2a22,
+ SystemID = 0x2a23,
+ ModelNumberString = 0x2a24,
+ SerialNumberString = 0x2a25,
+ FirmwareRevisionString = 0x2a26,
+ HardwareRevisionString = 0x2a27,
+ SoftwareRevisionString = 0x2a28,
+ ManufacturerNameString = 0x2a29,
+ IEEE1107320601RegulatoryCertificationDataList = 0x2a2a,
+ CurrentTime = 0x2a2b,
+ ScanRefresh = 0x2a31,
+ BootKeyboardOutputReport = 0x2a32,
+ BootMouseInputReport = 0x2a33,
+ GlucoseMeasurementContext = 0x2a34,
+ BloodPressureMeasurement = 0x2a35,
+ IntermediateCuffPressure = 0x2a36,
+ HeartRateMeasurement = 0x2a37,
+ BodySensorLocation = 0x2a38,
+ HeartRateControlPoint = 0x2a39,
+ AlertStatus = 0x2a3f,
+ RingerControlPoint = 0x2a40,
+ RingerSetting = 0x2a41,
+ AlertCategoryIDBitMask = 0x2a42,
+ AlertCategoryID = 0x2a43,
+ AlertNotificationControlPoint = 0x2a44,
+ UnreadAlertStatus = 0x2a45,
+ NewAlert = 0x2a46,
+ SupportedNewAlertCategory = 0x2a47,
+ SupportedUnreadAlertCategory = 0x2a48,
+ BloodPressureFeature = 0x2a49,
+ HIDInformation = 0x2a4a,
+ ReportMap = 0x2a4b,
+ HIDControlPoint = 0x2a4c,
+ Report = 0x2a4d,
+ ProtocolMode = 0x2a4e,
+ ScanIntervalWindow = 0x2a4f,
+ PnPID = 0x2a50,
+ GlucoseFeature = 0x2a51,
+ RecordAccessControlPoint = 0x2a52,
+ RSCMeasurement = 0x2a53,
+ RSCFeature = 0x2a54,
+ SCControlPoint = 0x2a55,
+ CSCMeasurement = 0x2a5b,
+ CSCFeature = 0x2a5c,
+ SensorLocation = 0x2a5d,
+ CyclingPowerMeasurement = 0x2a63,
+ CyclingPowerVector = 0x2a64,
+ CyclingPowerFeature = 0x2a65,
+ CyclingPowerControlPoint = 0x2a66,
+ LocationAndSpeed = 0x2a67,
+ Navigation = 0x2a68,
+ PositionQuality = 0x2a69,
+ LNFeature = 0x2a6a,
+ LNControlPoint = 0x2a6b,
+ };
+
+ enum DescriptorType {
+ UnknownDescriptorType = 0x0,
+ CharacteristicExtendedProperties = 0x2900,
+ CharacteristicUserDescription = 0x2901,
+ ClientCharacteristicConfiguration = 0x2902,
+ ServerCharacteristicConfiguration = 0x2903,
+ CharacteristicPresentationFormat = 0x2904,
+ CharacteristicAggregateFormat = 0x2905,
+ ValidRange = 0x2906,
+ ExternalReportReference = 0x2907,
+ ReportReference = 0x2908
};
QBluetoothUuid();
QBluetoothUuid(ProtocolUuid uuid);
QBluetoothUuid(ServiceClassUuid uuid);
+ QBluetoothUuid(CharacteristicType uuid);
+ QBluetoothUuid(DescriptorType uuid);
explicit QBluetoothUuid(quint16 uuid);
explicit QBluetoothUuid(quint32 uuid);
explicit QBluetoothUuid(quint128 uuid);
@@ -172,6 +285,11 @@ public:
quint16 toUInt16(bool *ok = 0) const;
quint32 toUInt32(bool *ok = 0) const;
quint128 toUInt128() const;
+
+ static QString serviceClassToString(ServiceClassUuid uuid);
+ static QString protocolToString(ProtocolUuid uuid);
+ static QString characteristicToString(CharacteristicType uuid);
+ static QString descriptorToString(DescriptorType uuid);
};
#ifndef QT_NO_DEBUG_STREAM
diff --git a/src/bluetooth/qlowenergycharacteristic.cpp b/src/bluetooth/qlowenergycharacteristic.cpp
new file mode 100644
index 00000000..69f68a59
--- /dev/null
+++ b/src/bluetooth/qlowenergycharacteristic.cpp
@@ -0,0 +1,357 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qlowenergycharacteristic.h"
+#include "qlowenergyserviceprivate_p.h"
+#include <QHash>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QLowEnergyCharacteristic
+ \inmodule QtBluetooth
+ \brief The QLowEnergyCharacteristic class stores information about a Bluetooth
+ Low Energy service characteristic.
+
+ \since 5.4
+
+ QLowEnergyCharacteristic provides information about a Bluetooth Low Energy
+ service characteristic's \l name(), \l uuid(), \l value(), \l properties(),
+ \l handle() and \l descriptors(). To obtain the characteristic's specification
+ and information, it is necessary to connect to the device using the
+ \l QLowEnergyService and \l QLowEnergyController classes.
+
+ The characteristic value may be written via the \l QLowEnergyService instance
+ that manages the service to which this characteristic belongs. The
+ \l {QLowEnergyService::writeCharacteristic()} function writes the new value.
+ The \l {QLowEnergyService::characteristicChanged()} signal is emitted upon success.
+ The \l value() of this object is automatically updated accordingly.
+
+ Characteristics may contain none, one or more descriptors. They can be individually
+ retrieved using the \l descriptor() function. The \l descriptors() function returns
+ all descriptors as a list. The general purpose of a descriptor is to add contextual
+ information to the characteristic. For example, the descriptor might provide
+ format or range information specifying how the characteristic's value is to be\
+ interpreted.
+
+ \sa QLowEnergyService, QLowEnergyDescriptor
+*/
+
+/*!
+ \enum QLowEnergyCharacteristic::PropertyType
+
+ This enum describes the properties of a characteristic.
+
+ \value Unknown The type is not known.
+ \value Broadcasting Allow for the broadcasting of Generic Attributes (GATT) characteristic values.
+ \value Read Allow the characteristic values to be read.
+ \value WriteNoResponse Allow characteristic values without responses to be written.
+ \value Write Allow for characteristic values to be written.
+ \value Notify Permits notification of characteristic values.
+ \value Indicate Permits indications of characteristic values.
+ \value WriteSigned Permits signed writes of the GATT characteristic values.
+ \value ExtendedProperty Additional characteristic properties are defined in the characteristic
+ extended properties descriptor.
+
+ \sa properties()
+*/
+
+struct QLowEnergyCharacteristicPrivate
+{
+ QLowEnergyHandle handle;
+};
+
+/*!
+ Construct a new QLowEnergyCharacteristic. A default-constructed instance of
+ this class is always invalid.
+
+ \sa isValid()
+*/
+QLowEnergyCharacteristic::QLowEnergyCharacteristic():
+ d_ptr(0), data(0)
+{
+
+}
+
+/*!
+ Construct a new QLowEnergyCharacteristic that is a copy of \a other.
+
+ The two copies continue to share the same underlying data which does not detach
+ upon write.
+*/
+QLowEnergyCharacteristic::QLowEnergyCharacteristic(const QLowEnergyCharacteristic &other):
+ d_ptr(other.d_ptr), data(0)
+{
+ if (other.data) {
+ data = new QLowEnergyCharacteristicPrivate();
+ data->handle = other.data->handle;
+ }
+}
+
+/*!
+ \internal
+*/
+QLowEnergyCharacteristic::QLowEnergyCharacteristic(
+ QSharedPointer<QLowEnergyServicePrivate> p, QLowEnergyHandle handle):
+ d_ptr(p)
+{
+ data = new QLowEnergyCharacteristicPrivate();
+ data->handle = handle;
+}
+
+/*!
+ Destroys the QLowEnergyCharacteristic object.
+*/
+QLowEnergyCharacteristic::~QLowEnergyCharacteristic()
+{
+ delete data;
+}
+
+/*!
+ Returns the human-readable name of the characteristic.
+
+ The name is based on the characteristic's \l uuid() which must have been
+ standardized. The complete list of characteristic types can be found
+ under \l {https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicsHome.aspx}{Bluetooth.org Characteristics}.
+
+ The returned string is empty if the \l uuid() is unknown.
+
+ \sa QBluetoothUuid::characteristicToString()
+*/
+QString QLowEnergyCharacteristic::name() const
+{
+ return QBluetoothUuid::characteristicToString(
+ static_cast<QBluetoothUuid::CharacteristicType>(uuid().toUInt16()));
+}
+
+/*!
+ Returns the UUID of the characteristic if \l isValid() returns \c true; otherwise a
+ \l {QUuid::isNull()}{null} UUID.
+*/
+QBluetoothUuid QLowEnergyCharacteristic::uuid() const
+{
+ if (d_ptr.isNull() || !data
+ || !d_ptr->characteristicList.contains(data->handle))
+ return QBluetoothUuid();
+
+ return d_ptr->characteristicList[data->handle].uuid;
+}
+
+/*!
+ Returns the properties of the characteristic.
+
+ The properties define the access permissions for the characteristic.
+*/
+QLowEnergyCharacteristic::PropertyTypes QLowEnergyCharacteristic::properties() const
+{
+ if (d_ptr.isNull() || !data
+ || !d_ptr->characteristicList.contains(data->handle))
+ return QLowEnergyCharacteristic::Unknown;
+
+ return d_ptr->characteristicList[data->handle].properties;
+}
+
+/*!
+ Returns the value of the characteristic.
+
+ If the characteristic's \l properties() permit writing of new values,
+ the value can be updated using \l QLowEnergyService::writeCharacteristic().
+*/
+QByteArray QLowEnergyCharacteristic::value() const
+{
+ if (d_ptr.isNull() || !data
+ || !d_ptr->characteristicList.contains(data->handle))
+ return QByteArray();
+
+ return d_ptr->characteristicList[data->handle].value;
+}
+
+/*!
+ Returns the handle of the characteristic's value attribute;
+ or \c 0 if the handle cannot be accessed on the platform.
+*/
+QLowEnergyHandle QLowEnergyCharacteristic::handle() const
+{
+ if (d_ptr.isNull() || !data
+ || !d_ptr->characteristicList.contains(data->handle))
+ return 0;
+
+ return d_ptr->characteristicList[data->handle].valueHandle;
+}
+
+/*!
+ Makes a copy of \a other and assigns it to this \l QLowEnergyCharacteristic object.
+ The two copies continue to share the same service and controller details.
+*/
+QLowEnergyCharacteristic &QLowEnergyCharacteristic::operator=(const QLowEnergyCharacteristic &other)
+{
+ d_ptr = other.d_ptr;
+
+ if (!other.data) {
+ if (data) {
+ delete data;
+ data = 0;
+ }
+ } else {
+ if (!data)
+ data = new QLowEnergyCharacteristicPrivate();
+
+ data->handle = other.data->handle;
+ }
+ return *this;
+}
+
+/*!
+ Returns \c true if \a other is equal to this QLowEnergyCharacteristic; otherwise \c false.
+
+ Two \l QLowEnergyCharacteristic instances are considered to be equal if they refer to
+ the same characteristic on the same remote Bluetooth Low Energy device or both instances
+ have been default-constructed.
+ */
+bool QLowEnergyCharacteristic::operator==(const QLowEnergyCharacteristic &other) const
+{
+ if (d_ptr != other.d_ptr)
+ return false;
+
+ if ((data && !other.data) || (!data && other.data))
+ return false;
+
+ if (!data)
+ return true;
+
+ if (data->handle != other.data->handle)
+ return false;
+
+ return true;
+}
+
+/*!
+ Returns \c true if \a other is not equal to this QLowEnergyCharacteristic; otherwise \c false.
+
+ Two QLowEnergyCharcteristic instances are considered to be equal if they refer to
+ the same characteristic on the same remote Bluetooth Low Energy device or both instances
+ have been default-constructed.
+ */
+
+bool QLowEnergyCharacteristic::operator!=(const QLowEnergyCharacteristic &other) const
+{
+ return !(*this == other);
+}
+
+/*!
+ Returns \c true if the QLowEnergyCharacteristic object is valid, otherwise returns \c false.
+
+ An invalid characteristic object is not associated with any service (default-constructed)
+ or the associated service is no longer valid due to a disconnect from
+ the underlying Bluetooth Low Energy device, for example. Once the object is invalid
+ it cannot become valid anymore.
+
+ \note If a \l QLowEnergyCharacteristic instance turns invalid due to a disconnect
+ from the underlying device, the information encapsulated by the current
+ instance remains as it was at the time of the disconnect. Therefore it can be
+ retrieved after the disconnect event.
+*/
+bool QLowEnergyCharacteristic::isValid() const
+{
+ if (d_ptr.isNull() || !data)
+ return false;
+
+ if (d_ptr->state == QLowEnergyService::InvalidService)
+ return false;
+
+ return true;
+}
+
+/*!
+ \internal
+
+ Returns the handle of the characteristic or
+ \c 0 if the handle cannot be accessed on the platform.
+ */
+QLowEnergyHandle QLowEnergyCharacteristic::attributeHandle() const
+{
+ if (d_ptr.isNull() || !data)
+ return 0;
+
+ return data->handle;
+}
+
+
+/*!
+ Returns the descriptor for \a uuid or an invalid \c QLowEnergyDescriptor instance.
+
+ \sa descriptors()
+*/
+QLowEnergyDescriptor QLowEnergyCharacteristic::descriptor(const QBluetoothUuid &uuid) const
+{
+ if (d_ptr.isNull() || !data)
+ return QLowEnergyDescriptor();
+
+ QList<QLowEnergyHandle> descriptorKeys = d_ptr->characteristicList[data->handle].
+ descriptorList.keys();
+ foreach (const QLowEnergyHandle descHandle, descriptorKeys) {
+ if (uuid == d_ptr->characteristicList[data->handle].descriptorList[descHandle].uuid)
+ return QLowEnergyDescriptor(d_ptr, data->handle, descHandle);
+ }
+
+ return QLowEnergyDescriptor();
+}
+
+/*!
+ Returns the list of descriptors belonging to this characteristic; otherwise
+ an empty list.
+
+ \sa descriptor()
+*/
+QList<QLowEnergyDescriptor> QLowEnergyCharacteristic::descriptors() const
+{
+ QList<QLowEnergyDescriptor> result;
+
+ if (d_ptr.isNull() || !data
+ || !d_ptr->characteristicList.contains(data->handle))
+ return result;
+
+ QList<QLowEnergyHandle> descriptorKeys = d_ptr->characteristicList[data->handle].
+ descriptorList.keys();
+
+ std::sort(descriptorKeys.begin(), descriptorKeys.end());
+
+ foreach (const QLowEnergyHandle descHandle, descriptorKeys) {
+ QLowEnergyDescriptor descriptor(d_ptr, data->handle, descHandle);
+ result.append(descriptor);
+ }
+
+ return result;
+}
+
+QT_END_NAMESPACE
diff --git a/src/bluetooth/qlowenergycharacteristic.h b/src/bluetooth/qlowenergycharacteristic.h
new file mode 100644
index 00000000..e0ed2976
--- /dev/null
+++ b/src/bluetooth/qlowenergycharacteristic.h
@@ -0,0 +1,103 @@
+/***************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 BlackBerry Limited all rights reserved
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QLOWENERGYCHARACTERISTIC_H
+#define QLOWENERGYCHARACTERISTIC_H
+#include <QtCore/QSharedPointer>
+#include <QtCore/QObject>
+#include <QtBluetooth/qbluetooth.h>
+#include <QtBluetooth/QBluetoothUuid>
+#include <QtBluetooth/QLowEnergyDescriptor>
+
+QT_BEGIN_NAMESPACE
+
+class QBluetoothUuid;
+class QLowEnergyServicePrivate;
+struct QLowEnergyCharacteristicPrivate;
+class Q_BLUETOOTH_EXPORT QLowEnergyCharacteristic
+{
+public:
+
+ enum PropertyType {
+ Unknown = 0x00,
+ Broadcasting = 0x01,
+ Read = 0x02,
+ WriteNoResponse = 0x04,
+ Write = 0x08,
+ Notify = 0x10,
+ Indicate = 0x20,
+ WriteSigned = 0x40,
+ ExtendedProperty = 0x80
+ };
+ Q_DECLARE_FLAGS(PropertyTypes, PropertyType)
+
+ QLowEnergyCharacteristic();
+ QLowEnergyCharacteristic(const QLowEnergyCharacteristic &other);
+ ~QLowEnergyCharacteristic();
+
+ QLowEnergyCharacteristic &operator=(const QLowEnergyCharacteristic &other);
+ bool operator==(const QLowEnergyCharacteristic &other) const;
+ bool operator!=(const QLowEnergyCharacteristic &other) const;
+
+ QString name() const;
+
+ QBluetoothUuid uuid() const;
+
+ QByteArray value() const;
+
+ QLowEnergyCharacteristic::PropertyTypes properties() const;
+ QLowEnergyHandle handle() const;
+
+ QLowEnergyDescriptor descriptor(const QBluetoothUuid &uuid) const;
+ QList<QLowEnergyDescriptor> descriptors() const;
+
+ bool isValid() const;
+
+protected:
+ QLowEnergyHandle attributeHandle() const;
+
+ QSharedPointer<QLowEnergyServicePrivate> d_ptr;
+
+ friend class QLowEnergyService;
+ friend class QLowEnergyControllerPrivate;
+ QLowEnergyCharacteristicPrivate *data;
+ QLowEnergyCharacteristic(QSharedPointer<QLowEnergyServicePrivate> p,
+ QLowEnergyHandle handle);
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QLowEnergyCharacteristic::PropertyTypes)
+
+QT_END_NAMESPACE
+
+#endif // QLOWENERGYCHARACTERISTIC_H
diff --git a/src/bluetooth/qlowenergycontroller.cpp b/src/bluetooth/qlowenergycontroller.cpp
new file mode 100644
index 00000000..315d18dd
--- /dev/null
+++ b/src/bluetooth/qlowenergycontroller.cpp
@@ -0,0 +1,563 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qlowenergycontroller.h"
+#include "qlowenergycontroller_p.h"
+
+#include <QtBluetooth/QBluetoothLocalDevice>
+
+#include <algorithm>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QLowEnergyController
+ \inmodule QtBluetooth
+ \brief The QLowEnergyController class provides access to Bluetooth
+ Low Energy Devices.
+
+ \since 5.4
+
+ QLowEnergyController acts as the entry point for Bluetooth Low Energy
+ development. Each QLowEnergyController instance acts as placeholder
+ towards a remote Low Energy device enabling connection control,
+ service discovery and state tracking.
+
+ Bluetooth Low Energy defines two types of devices; the peripheral and
+ the central. Each role performs a different task. The peripheral device
+ provides data which is utilized by central devices. An example might be a
+ humidity sensor which measures the moisture in a winter garden. A device
+ such as a mobile phone might read the sensor's value and display it to the user
+ in the greater context of all sensors in the same environment. In this case
+ the sensor is the peripheral device and the mobile phone acts as the
+ central device.
+
+ At the moment Qt only supports the central role and therefore the remote
+ device can only be a device acting as a peripheral. This implies that the local
+ device acts within the boundaries of the central role as per the Bluetooth 4.0
+ specification.
+
+ The first step is to establish a connection via \l connectToDevice().
+ Once the connection has been established, the controller's \l state()
+ changes to \l QLowEnergyController::ConnectedState and the \l connected()
+ signal is emitted. It is important to mention that the remote device can
+ usually only be connected to a single device. Therefore it is not
+ possible to have multiple instances of this class being connected to the
+ same remote device. The \l disconnectFromDevice() function is used to break
+ the existing connection.
+
+ The second step after establishing the connection is to discover the services
+ offered by the remote peripheral device. This process is started via
+ \l discoverServices() and has finished once the \l discoveryFinished() signal
+ has been emitted. The discovered services can be enumerated via
+ \l services().
+
+ The last step is to create service objects. The \l createServiceObject()
+ function acts as factory for each service object and expects the service
+ UUID as parameter. The calling context should take ownership of the returned
+ \l QLowEnergyService instance.
+
+ Any \l QLowEnergyService, \l QLowEnergyCharacteristic or
+ \l QLowEnergyDescriptor instance which is later created from this controller's
+ connection becomes invalid as soon as the controller disconnects from the
+ remote Bluetooth Low Energy device.
+
+ \sa QLowEnergyService, QLowEnergyCharacteristic, QLowEnergyDescriptor
+*/
+
+/*!
+ \enum QLowEnergyController::Error
+
+ Indicates all possible error conditions found during the controller's
+ existence.
+
+ \value NoError No error has occurred.
+ \value UnknownError An unknown error has occurred.
+ \value UnknownRemoteDeviceError The remote Bluetooth Low Energy device with the address passed to
+ the constructor of this class cannot be found.
+ \value NetworkError The attempt to read from or write to the
+ remote device failed.
+ \value InvalidBluetoothAdapterError The local Bluetooth device with the address passed to
+ the constructor of this class cannot be found or
+ there is no local Bluetooth device.
+*/
+
+/*!
+ \enum QLowEnergyController::ControllerState
+
+ Indicates the state of the controller object.
+
+ \value UnconnectedState The controller is not connected to a remote device.
+ \value ConnectingState The controller is attempting to connect to a remote device.
+ \value ConnectedState The controller is connected to a remote device.
+ \value ClosingState The controller is about to be disconnected from the remote device.
+*/
+
+/*!
+ \fn void QLowEnergyController::connected()
+
+ This signal is emitted when the controller successfully connects to the remote
+ Low Energy device.
+*/
+
+/*!
+ \fn void QLowEnergyController::disconnected()
+
+ This signal is emitted when the controller disconnects from the remote
+ Low Energy device.
+*/
+
+/*!
+ \fn void QLowEnergyController::stateChanged(ControllerState state)
+
+ This signal is emitted when the controller's state changes. The new
+ \a state can also be retrieved via \l state().
+
+ \sa state()
+*/
+
+/*!
+ \fn void QLowEnergyController::error(QLowEnergyController::Error newError)
+
+ This signal is emitted when an error occurs.
+ The \a newError parameter describes the error that occurred.
+
+ \sa error(), errorString()
+*/
+
+/*!
+ \fn void QLowEnergyController::serviceDiscovered(const QBluetoothUuid &newService)
+
+ This signal is emitted each time a new service is discovered. The
+ \a newService parameter contains the UUID of the found service.
+
+ \sa discoverServices(), discoveryFinished()
+*/
+
+/*!
+ \fn void QLowEnergyController::discoveryFinished()
+
+ This signal is emitted when the running service discovery finishes.
+ The signal is not emitted if the discovery process finishes with
+ an error.
+
+ \sa discoverServices(), error()
+*/
+
+void QLowEnergyControllerPrivate::setError(
+ QLowEnergyController::Error newError)
+{
+ Q_Q(QLowEnergyController);
+ error = newError;
+
+ switch (newError) {
+ case QLowEnergyController::UnknownRemoteDeviceError:
+ errorString = QLowEnergyController::tr("Remote device cannot be found");
+ break;
+ case QLowEnergyController::InvalidBluetoothAdapterError:
+ errorString = QLowEnergyController::tr("Cannot find local adapter");
+ break;
+ case QLowEnergyController::NetworkError:
+ errorString = QLowEnergyController::tr("Error occurred during connection I/O");
+ break;
+ case QLowEnergyController::UnknownError:
+ default:
+ errorString = QLowEnergyController::tr("Unknown Error");
+ break;
+ }
+
+ emit q->error(newError);
+}
+
+bool QLowEnergyControllerPrivate::isValidLocalAdapter()
+{
+ if (localAdapter.isNull())
+ return false;
+
+ const QList<QBluetoothHostInfo> foundAdapters = QBluetoothLocalDevice::allDevices();
+ bool adapterFound = false;
+
+ foreach (const QBluetoothHostInfo &info, foundAdapters) {
+ if (info.address() == localAdapter) {
+ adapterFound = true;
+ break;
+ }
+ }
+
+ return adapterFound;
+}
+
+void QLowEnergyControllerPrivate::setState(
+ QLowEnergyController::ControllerState newState)
+{
+ Q_Q(QLowEnergyController);
+ if (state == newState)
+ return;
+
+ state = newState;
+ emit q->stateChanged(state);
+}
+
+void QLowEnergyControllerPrivate::invalidateServices()
+{
+ foreach (const QSharedPointer<QLowEnergyServicePrivate> service, serviceList.values()) {
+ service->setController(0);
+ service->setState(QLowEnergyService::InvalidService);
+ }
+
+ serviceList.clear();
+}
+
+QSharedPointer<QLowEnergyServicePrivate> QLowEnergyControllerPrivate::serviceForHandle(
+ QLowEnergyHandle handle)
+{
+ foreach (QSharedPointer<QLowEnergyServicePrivate> service, serviceList.values())
+ if (service->startHandle <= handle && handle <= service->endHandle)
+ return service;
+
+ return QSharedPointer<QLowEnergyServicePrivate>();
+}
+
+/*!
+ Returns a valid characteristic if the given handle is the
+ handle of the characteristic itself or one of its descriptors
+ */
+QLowEnergyCharacteristic QLowEnergyControllerPrivate::characteristicForHandle(
+ QLowEnergyHandle handle)
+{
+ QSharedPointer<QLowEnergyServicePrivate> service = serviceForHandle(handle);
+ if (service.isNull())
+ return QLowEnergyCharacteristic();
+
+ if (service->characteristicList.isEmpty())
+ return QLowEnergyCharacteristic();
+
+ // check whether it is the handle of a characteristic header
+ if (service->characteristicList.contains(handle))
+ return QLowEnergyCharacteristic(service, handle);
+
+ // check whether it is the handle of the characteristic value or its descriptors
+ QList<QLowEnergyHandle> charHandles = service->characteristicList.keys();
+ std::sort(charHandles.begin(), charHandles.end());
+ for (int i = charHandles.size() - 1; i >= 0; i--) {
+ if (charHandles.at(i) > handle)
+ continue;
+
+ return QLowEnergyCharacteristic(service, charHandles.at(i));
+ }
+
+ return QLowEnergyCharacteristic();
+}
+
+/*!
+ Returns a valid descriptor if \a handle blongs to a descriptor;
+ otherwise an invalid one.
+ */
+QLowEnergyDescriptor QLowEnergyControllerPrivate::descriptorForHandle(
+ QLowEnergyHandle handle)
+{
+ const QLowEnergyCharacteristic matchingChar = characteristicForHandle(handle);
+ if (!matchingChar.isValid())
+ return QLowEnergyDescriptor();
+
+ const QLowEnergyServicePrivate::CharData charData = matchingChar.
+ d_ptr->characteristicList[matchingChar.attributeHandle()];
+
+ if (charData.descriptorList.contains(handle))
+ return QLowEnergyDescriptor(matchingChar.d_ptr, matchingChar.attributeHandle(),
+ handle);
+
+ return QLowEnergyDescriptor();
+}
+
+/*!
+ Returns the length of the updated characteristic value.
+ */
+quint16 QLowEnergyControllerPrivate::updateValueOfCharacteristic(
+ QLowEnergyHandle charHandle,const QByteArray &value, bool appendValue)
+{
+ QSharedPointer<QLowEnergyServicePrivate> service = serviceForHandle(charHandle);
+ if (!service.isNull() && service->characteristicList.contains(charHandle)) {
+ if (appendValue)
+ service->characteristicList[charHandle].value += value;
+ else
+ service->characteristicList[charHandle].value = value;
+
+ return service->characteristicList[charHandle].value.size();
+ }
+
+ return 0;
+}
+
+/*!
+ Returns the length of the updated descriptor value.
+ */
+quint16 QLowEnergyControllerPrivate::updateValueOfDescriptor(
+ QLowEnergyHandle charHandle, QLowEnergyHandle descriptorHandle,
+ const QByteArray &value, bool appendValue)
+{
+ QSharedPointer<QLowEnergyServicePrivate> service = serviceForHandle(charHandle);
+ if (service.isNull() || !service->characteristicList.contains(charHandle))
+ return 0;
+
+ if (!service->characteristicList[charHandle].descriptorList.contains(descriptorHandle))
+ return 0;
+
+ if (appendValue)
+ service->characteristicList[charHandle].descriptorList[descriptorHandle].value += value;
+ else
+ service->characteristicList[charHandle].descriptorList[descriptorHandle].value = value;
+
+ return service->characteristicList[charHandle].descriptorList[descriptorHandle].value.size();
+}
+
+/*!
+ Constructs a new instance of this class with \a parent.
+
+ The \a remoteDevice must contain the address of the
+ remote Bluetooth Low Energy device to which this object
+ should attempt to connect later on.
+
+ The controller uses the local default Bluetooth adapter for
+ the connection management.
+ */
+QLowEnergyController::QLowEnergyController(
+ const QBluetoothAddress &remoteDevice,
+ QObject *parent)
+ : QObject(parent), d_ptr(new QLowEnergyControllerPrivate())
+{
+ Q_D(QLowEnergyController);
+ d->q_ptr = this;
+ d->remoteDevice = remoteDevice;
+ d->localAdapter = QBluetoothLocalDevice().address();
+}
+
+/*!
+ Constructs a new instance of this class with \a parent.
+
+ The \a remoteDevice must contain the address of the
+ remote Bluetooth Low Energy device to which this object
+ should attempt to connect later on.
+
+ The connection is established via \a localDevice. If \a localDevice
+ is invalid, the local default device is automatically selected. If
+ \a localDevice specifies a local device that is not a local Bluetooth
+ adapter, \l error() is set to \l InvalidBluetoothAdapterError once
+ \l connectToDevice() is called.
+ */
+QLowEnergyController::QLowEnergyController(
+ const QBluetoothAddress &remoteDevice,
+ const QBluetoothAddress &localDevice,
+ QObject *parent)
+ : QObject(parent), d_ptr(new QLowEnergyControllerPrivate())
+{
+ Q_D(QLowEnergyController);
+ d->q_ptr = this;
+ d->remoteDevice = remoteDevice;
+ d->localAdapter = localDevice;
+}
+
+/*!
+ Destroys the QLowEnergyController instance.
+ */
+QLowEnergyController::~QLowEnergyController()
+{
+ disconnectFromDevice(); //in case we were connected
+ delete d_ptr;
+}
+
+/*!
+ Returns the address of the local Bluetooth adapter being used for the
+ communication.
+
+ If this class instance was requested to use the default adapter
+ but there was no default adapter when creating this
+ class instance, the returned \l QBluetoothAddress will be null.
+
+ \sa QBluetoothAddress::isNull()
+ */
+QBluetoothAddress QLowEnergyController::localAddress() const
+{
+ return d_ptr->localAdapter;
+}
+
+/*!
+ Returns the address of the remote Bluetooth Low Energy device.
+ */
+QBluetoothAddress QLowEnergyController::remoteAddress() const
+{
+ return d_ptr->remoteDevice;
+}
+
+/*!
+ Returns the current state of the controller.
+
+ \sa stateChanged()
+ */
+QLowEnergyController::ControllerState QLowEnergyController::state() const
+{
+ return d_ptr->state;
+}
+
+
+/*!
+ Connects to the remote Bluetooth Low Energy device.
+
+ This function does nothing if the controller's \l state()
+ is \l UnconnectedState. The \l connected() signal is emitted
+ once the connection is successfully established.
+
+ \sa disconnectFromDevice()
+ */
+void QLowEnergyController::connectToDevice()
+{
+ Q_D(QLowEnergyController);
+
+ if (!d->isValidLocalAdapter()) {
+ d->setError(QLowEnergyController::InvalidBluetoothAdapterError);
+ return;
+ }
+
+ if (state() != QLowEnergyController::UnconnectedState)
+ return;
+
+ d->connectToDevice();
+}
+
+/*!
+ Disconnects from the remote device.
+
+ Any \l QLowEnergyService, \l QLowEnergyCharacteristic or \l QLowEnergyDescriptor
+ instance that resulted from the current connection is automatically invalidated.
+ Once any of those objects become invalid they remain invalid even if this
+ controller object reconnects.
+
+ \sa connectToDevice()
+ */
+void QLowEnergyController::disconnectFromDevice()
+{
+ Q_D(QLowEnergyController);
+
+ if (state() == QLowEnergyController::UnconnectedState)
+ return;
+
+ d->invalidateServices();
+ d->disconnectFromDevice();
+}
+
+/*!
+ Initiates the service discovery process.
+
+ The discovery progress is indicated via the \l serviceDiscovered() signal.
+ The \l discoveryFinished() signal is emitted when the process has finished.
+
+ If the controller instance is not connected or the controller has performed
+ the service discovery already this function will do nothing.
+ */
+void QLowEnergyController::discoverServices()
+{
+ Q_D(QLowEnergyController);
+
+ if (d->state != QLowEnergyController::ConnectedState)
+ return;
+
+ d->discoverServices();
+}
+
+/*!
+ Returns the list of services offered by the remote device.
+
+ The list contains all primary and secondary services.
+
+ \sa createServiceObject()
+ */
+QList<QBluetoothUuid> QLowEnergyController::services() const
+{
+ return d_ptr->serviceList.keys();
+}
+
+/*!
+ Creates an instance of the service represented by \a serviceUuid.
+ The \a serviceUuid parameter must have been obtained via
+ \l services().
+
+ The caller takes ownership of the returned pointer and may pass
+ a \a parent parameter as default owner.
+
+ This function returns a null pointer if no service with
+ \a serviceUuid can be found on the remote device or the controller
+ is disconnected.
+
+ This function can return instances for secondary services
+ too. The include relationships between services can be expressed
+ via \l QLowEnergyService::includedServices().
+
+ If this function is called multiple times using the same service UUID,
+ the returned \l QLowEnergyService instances share their internal
+ data. Therefore if one of the instances initiates the discovery
+ of the service details, the other instances automatically
+ transition into the discovery state too.
+
+ \sa services()
+ */
+QLowEnergyService *QLowEnergyController::createServiceObject(
+ const QBluetoothUuid &serviceUuid, QObject *parent)
+{
+ Q_D(QLowEnergyController);
+ if (!d->serviceList.contains(serviceUuid))
+ return 0;
+
+ QLowEnergyService *service = new QLowEnergyService(
+ d->serviceList.value(serviceUuid), parent);
+
+ return service;
+}
+
+/*!
+ Returns the last occurred error or \l NoError.
+*/
+QLowEnergyController::Error QLowEnergyController::error() const
+{
+ return d_ptr->error;
+}
+
+/*!
+ Returns a textual representation of the last occurred error.
+ The string is translated.
+*/
+QString QLowEnergyController::errorString() const
+{
+ return d_ptr->errorString;
+}
+
+QT_END_NAMESPACE
diff --git a/src/bluetooth/qlowenergycontroller.h b/src/bluetooth/qlowenergycontroller.h
new file mode 100644
index 00000000..8d14f2af
--- /dev/null
+++ b/src/bluetooth/qlowenergycontroller.h
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QLOWENERGYCONTROLLER_H
+#define QLOWENERGYCONTROLLER_H
+
+#include <QObject>
+#include <QtBluetooth/QBluetoothAddress>
+#include <QtBluetooth/QBluetoothUuid>
+#include <QtBluetooth/QLowEnergyService>
+
+QT_BEGIN_NAMESPACE
+
+class QLowEnergyControllerPrivate;
+class Q_BLUETOOTH_EXPORT QLowEnergyController : public QObject
+{
+ Q_OBJECT
+public:
+ enum Error {
+ NoError,
+ UnknownError,
+ UnknownRemoteDeviceError,
+ NetworkError,
+ InvalidBluetoothAdapterError
+ };
+
+ enum ControllerState {
+ UnconnectedState = 0,
+ ConnectingState,
+ ConnectedState,
+ ClosingState,
+ };
+
+ explicit QLowEnergyController(const QBluetoothAddress &remoteDevice,
+ QObject *parent = 0);
+ explicit QLowEnergyController(const QBluetoothAddress &remoteDevice,
+ const QBluetoothAddress &localDevice,
+ QObject *parent = 0);
+ ~QLowEnergyController();
+
+ QBluetoothAddress localAddress() const;
+ QBluetoothAddress remoteAddress() const;
+
+ ControllerState state() const;
+
+ void connectToDevice();
+ void disconnectFromDevice();
+
+ // TODO add a way of detecting whether discoverDetails() as already called
+ void discoverServices();
+ QList<QBluetoothUuid> services() const;
+ QLowEnergyService *createServiceObject(
+ const QBluetoothUuid &service, QObject *parent = 0);
+
+ Error error() const;
+ QString errorString() const;
+
+Q_SIGNALS:
+ void connected();
+ void disconnected();
+ void stateChanged(QLowEnergyController::ControllerState state);
+ void error(QLowEnergyController::Error newError);
+
+ void serviceDiscovered(const QBluetoothUuid &newService);
+ void discoveryFinished();
+
+private:
+ Q_DECLARE_PRIVATE(QLowEnergyController)
+ QLowEnergyControllerPrivate *d_ptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // QLOWENERGYCONTROLLER_H
diff --git a/src/bluetooth/qlowenergycontroller_bluez.cpp b/src/bluetooth/qlowenergycontroller_bluez.cpp
new file mode 100644
index 00000000..277fea44
--- /dev/null
+++ b/src/bluetooth/qlowenergycontroller_bluez.cpp
@@ -0,0 +1,1183 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Javier S. Pedro <maemo@javispedro.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qlowenergycontroller_p.h"
+#include "qbluetoothsocket_p.h"
+#include "bluez/bluez_data_p.h"
+
+#include <QtCore/QLoggingCategory>
+#include <QtBluetooth/QBluetoothSocket>
+#include <QtBluetooth/QLowEnergyService>
+
+#define ATTRIBUTE_CHANNEL_ID 4
+
+#define ATT_DEFAULT_LE_MTU 23
+#define ATT_MAX_LE_MTU 0x200
+
+#define GATT_PRIMARY_SERVICE 0x2800
+#define GATT_SECONDARY_SERVICE 0x2801
+#define GATT_INCLUDED_SERVICE 0x2802
+#define GATT_CHARACTERISTIC 0x2803
+
+// GATT commands
+#define ATT_OP_ERROR_RESPONSE 0x1
+#define ATT_OP_EXCHANGE_MTU_REQUEST 0x2 //send own mtu
+#define ATT_OP_EXCHANGE_MTU_RESPONSE 0x3 //receive server MTU
+#define ATT_OP_FIND_INFORMATION_REQUEST 0x4 //discover individual attribute info
+#define ATT_OP_FIND_INFORMATION_RESPONSE 0x5
+#define ATT_OP_READ_BY_TYPE_REQUEST 0x8 //discover characteristics
+#define ATT_OP_READ_BY_TYPE_RESPONSE 0x9
+#define ATT_OP_READ_REQUEST 0xA //read characteristic & descriptor values
+#define ATT_OP_READ_RESPONSE 0xB
+#define ATT_OP_READ_BLOB_REQUEST 0xC //read values longer than MTU-1
+#define ATT_OP_READ_BLOB_RESPONSE 0xD
+#define ATT_OP_READ_BY_GROUP_REQUEST 0x10 //discover services
+#define ATT_OP_READ_BY_GROUP_RESPONSE 0x11
+#define ATT_OP_WRITE_REQUEST 0x12 //write characteristic
+#define ATT_OP_WRITE_RESPONSE 0x13
+#define ATT_OP_HANDLE_VAL_NOTIFICATION 0x1b //informs about value change
+#define ATT_OP_HANDLE_VAL_INDICATION 0x1d //informs about value change -> requires reply
+#define ATT_OP_HANDLE_VAL_CONFIRMATION 0x1e //answer for ATT_OP_HANDLE_VAL_INDICATION
+
+//GATT command sizes in bytes
+#define FIND_INFO_REQUEST_SIZE 5
+#define GRP_TYPE_REQ_SIZE 7
+#define READ_BY_TYPE_REQ_SIZE 7
+#define READ_REQUEST_SIZE 3
+#define READ_BLOB_REQUEST_SIZE 5
+#define WRITE_REQUEST_SIZE 3
+#define MTU_EXCHANGE_SIZE 3
+
+// GATT error codes
+#define ATT_ERROR_INVALID_HANDLE 0x01
+#define ATT_ERROR_READ_NOT_PERM 0x02
+#define ATT_ERROR_WRITE_NOT_PERM 0x03
+#define ATT_ERROR_INVALID_PDU 0x04
+#define ATT_ERROR_INSUF_AUTHENTICATION 0x05
+#define ATT_ERROR_REQUEST_NOT_SUPPORTED 0x06
+#define ATT_ERROR_INVALID_OFFSET 0x07
+#define ATT_ERROR_INSUF_AUTHORIZATION 0x08
+#define ATT_ERROR_PREPARE_QUEUE_FULL 0x09
+#define ATT_ERROR_ATTRIBUTE_NOT_FOUND 0x0A
+#define ATT_ERROR_ATTRIBUTE_NOT_LONG 0x0B
+#define ATT_ERROR_INSUF_ENCR_KEY_SIZE 0x0C
+#define ATT_ERROR_INVAL_ATTR_VALUE_LEN 0x0D
+#define ATT_ERROR_UNLIKELY 0x0E
+#define ATT_ERROR_INSUF_ENCRYPTION 0x0F
+#define ATT_ERROR_APPLICATION 0x10
+#define ATT_ERROR_INSUF_RESOURCES 0x11
+
+#define APPEND_VALUE true
+#define NEW_VALUE false
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(QT_BT_BLUEZ)
+
+static inline QBluetoothUuid convert_uuid128(const quint128 *p)
+{
+ quint128 dst_hostOrder, dst_bigEndian;
+
+ // Bluetooth LE data comes as little endian
+ // uuids are constructed using high endian
+ btoh128(p, &dst_hostOrder);
+ hton128(&dst_hostOrder, &dst_bigEndian);
+
+ // convert to Qt's own data type
+ quint128 qtdst;
+ memcpy(&qtdst, &dst_bigEndian, sizeof(quint128));
+
+ return QBluetoothUuid(qtdst);
+}
+
+static void dumpErrorInformation(const QByteArray &response)
+{
+ const char *data = response.constData();
+ if (response.size() != 5 || data[0] != ATT_OP_ERROR_RESPONSE) {
+ qCWarning(QT_BT_BLUEZ) << QLatin1String("Not a valid error response");
+ return;
+ }
+
+ quint8 lastCommand = data[1];
+ quint16 handle = bt_get_le16(&data[2]);
+ quint8 errorCode = data[4];
+
+ QString errorString;
+ switch (errorCode) {
+ case ATT_ERROR_INVALID_HANDLE:
+ errorString = QStringLiteral("invalid handle"); break;
+ case ATT_ERROR_READ_NOT_PERM:
+ errorString = QStringLiteral("not readable attribute - permissions"); break;
+ case ATT_ERROR_WRITE_NOT_PERM:
+ errorString = QStringLiteral("not writable attribute - permissions"); break;
+ case ATT_ERROR_INVALID_PDU:
+ errorString = QStringLiteral("PDU invalid"); break;
+ case ATT_ERROR_INSUF_AUTHENTICATION:
+ errorString = QStringLiteral("needs authentication - permissions"); break;
+ case ATT_ERROR_REQUEST_NOT_SUPPORTED:
+ errorString = QStringLiteral("server does not support request"); break;
+ case ATT_ERROR_INVALID_OFFSET:
+ errorString = QStringLiteral("offset past end of attribute"); break;
+ case ATT_ERROR_INSUF_AUTHORIZATION:
+ errorString = QStringLiteral("need authorization - permissions"); break;
+ case ATT_ERROR_PREPARE_QUEUE_FULL:
+ errorString = QStringLiteral("run out of prepare queue space"); break;
+ case ATT_ERROR_ATTRIBUTE_NOT_FOUND:
+ errorString = QStringLiteral("no attribute in given range found"); break;
+ case ATT_ERROR_ATTRIBUTE_NOT_LONG:
+ errorString = QStringLiteral("attribute not read/written using read blob"); break;
+ case ATT_ERROR_INSUF_ENCR_KEY_SIZE:
+ errorString = QStringLiteral("need encryption key size - permissions"); break;
+ case ATT_ERROR_INVAL_ATTR_VALUE_LEN:
+ errorString = QStringLiteral("written value is invalid size"); break;
+ case ATT_ERROR_UNLIKELY:
+ errorString = QStringLiteral("unlikely error"); break;
+ case ATT_ERROR_INSUF_ENCRYPTION:
+ errorString = QStringLiteral("needs encryption - permissions"); break;
+ case ATT_ERROR_APPLICATION:
+ errorString = QStringLiteral("application error"); break;
+ case ATT_ERROR_INSUF_RESOURCES:
+ errorString = QStringLiteral("insufficient resources to complete request"); break;
+ default:
+ errorString = QStringLiteral("unknown error code"); break;
+ }
+
+ qCDebug(QT_BT_BLUEZ) << "Error1:" << errorString
+ << "last command:" << hex << lastCommand
+ << "handle:" << handle;
+}
+
+QLowEnergyControllerPrivate::QLowEnergyControllerPrivate()
+ : QObject(),
+ state(QLowEnergyController::UnconnectedState),
+ error(QLowEnergyController::NoError),
+ l2cpSocket(0), requestPending(false),
+ mtuSize(ATT_DEFAULT_LE_MTU)
+{
+ qRegisterMetaType<QList<QLowEnergyHandle> >();
+}
+
+QLowEnergyControllerPrivate::~QLowEnergyControllerPrivate()
+{
+}
+
+void QLowEnergyControllerPrivate::connectToDevice()
+{
+ setState(QLowEnergyController::ConnectingState);
+ if (l2cpSocket)
+ delete l2cpSocket;
+
+ l2cpSocket = new QBluetoothSocket(QBluetoothServiceInfo::L2capProtocol, this);
+ connect(l2cpSocket, SIGNAL(connected()), this, SLOT(l2cpConnected()));
+ connect(l2cpSocket, SIGNAL(disconnected()), this, SLOT(l2cpDisconnected()));
+ connect(l2cpSocket, SIGNAL(error(QBluetoothSocket::SocketError)),
+ this, SLOT(l2cpErrorChanged(QBluetoothSocket::SocketError)));
+ connect(l2cpSocket, SIGNAL(readyRead()), this, SLOT(l2cpReadyRead()));
+
+ l2cpSocket->d_ptr->isLowEnergySocket = true;
+
+ // bind the socket to the local device
+ int sockfd = l2cpSocket->socketDescriptor();
+ if (sockfd < 0) {
+ qCWarning(QT_BT_BLUEZ) << "l2cp socket not initialised";
+ setError(QLowEnergyController::UnknownError);
+ return;
+ }
+
+ struct sockaddr_l2 addr;
+ memset(&addr, 0, sizeof(addr));
+ addr.l2_family = AF_BLUETOOTH;
+ addr.l2_cid = htobs(ATTRIBUTE_CHANNEL_ID);
+ addr.l2_bdaddr_type = BDADDR_LE_PUBLIC;
+ convertAddress(localAdapter.toUInt64(), addr.l2_bdaddr.b);
+
+ if (::bind(sockfd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+ qCWarning(QT_BT_BLUEZ) << qt_error_string(errno);
+ setError(QLowEnergyController::UnknownError);
+ return;
+ }
+
+ // connect
+ l2cpSocket->connectToService(remoteDevice, ATTRIBUTE_CHANNEL_ID);
+}
+
+void QLowEnergyControllerPrivate::l2cpConnected()
+{
+ Q_Q(QLowEnergyController);
+
+ exchangeMTU();
+
+ setState(QLowEnergyController::ConnectedState);
+ emit q->connected();
+}
+
+void QLowEnergyControllerPrivate::disconnectFromDevice()
+{
+ setState(QLowEnergyController::ClosingState);
+ l2cpSocket->close();
+}
+
+void QLowEnergyControllerPrivate::l2cpDisconnected()
+{
+ Q_Q(QLowEnergyController);
+
+ setState(QLowEnergyController::UnconnectedState);
+ emit q->disconnected();
+}
+
+void QLowEnergyControllerPrivate::l2cpErrorChanged(QBluetoothSocket::SocketError e)
+{
+ switch (e) {
+ case QBluetoothSocket::HostNotFoundError:
+ setError(QLowEnergyController::UnknownRemoteDeviceError);
+ qCDebug(QT_BT_BLUEZ) << "The passed remote device address cannot be found";
+ break;
+ case QBluetoothSocket::NetworkError:
+ setError(QLowEnergyController::NetworkError);
+ qCDebug(QT_BT_BLUEZ) << "Network IO error while talking to LE device";
+ break;
+ case QBluetoothSocket::UnknownSocketError:
+ case QBluetoothSocket::UnsupportedProtocolError:
+ case QBluetoothSocket::OperationError:
+ case QBluetoothSocket::ServiceNotFoundError:
+ default:
+ // these errors shouldn't happen -> as it means
+ // the code in this file has bugs
+ qCDebug(QT_BT_BLUEZ) << "Unknown l2cp socket error: " << e << l2cpSocket->errorString();
+ setError(QLowEnergyController::UnknownError);
+ break;
+ }
+
+ invalidateServices();
+ setState(QLowEnergyController::UnconnectedState);
+}
+
+void QLowEnergyControllerPrivate::l2cpReadyRead()
+{
+ const QByteArray reply = l2cpSocket->readAll();
+ qCDebug(QT_BT_BLUEZ) << "Received size:" << reply.size() << "data:" << reply.toHex();
+ if (reply.isEmpty())
+ return;
+
+ const quint8 command = reply.constData()[0];
+ switch (command) {
+ case ATT_OP_HANDLE_VAL_NOTIFICATION:
+ {
+ processUnsolicitedReply(reply);
+ return;
+ }
+ case ATT_OP_HANDLE_VAL_INDICATION:
+ {
+ //send confirmation
+ QByteArray packet;
+ packet.append(static_cast<char>(ATT_OP_HANDLE_VAL_CONFIRMATION));
+ sendCommand(packet);
+
+ processUnsolicitedReply(reply);
+ return;
+ }
+ case ATT_OP_EXCHANGE_MTU_REQUEST:
+ case ATT_OP_READ_BY_GROUP_REQUEST:
+ case ATT_OP_READ_BY_TYPE_REQUEST:
+ case ATT_OP_READ_REQUEST:
+ case ATT_OP_FIND_INFORMATION_REQUEST:
+ case ATT_OP_WRITE_REQUEST:
+ qCWarning(QT_BT_BLUEZ) << "Unexpected message type" << hex << command
+ << "will be ignored" ;
+ return;
+ default:
+ //only solicited replies finish pending requests
+ requestPending = false;
+ break;
+ }
+
+ Q_ASSERT(!openRequests.isEmpty());
+ const Request request = openRequests.dequeue();
+ processReply(request, reply);
+
+ sendNextPendingRequest();
+}
+
+void QLowEnergyControllerPrivate::sendCommand(const QByteArray &packet)
+{
+ qint64 result = l2cpSocket->write(packet.constData(),
+ packet.size());
+ if (result == -1) {
+ qCDebug(QT_BT_BLUEZ) << "Cannot write L2CP command:" << hex
+ << packet.toHex()
+ << l2cpSocket->errorString();
+ setError(QLowEnergyController::NetworkError);
+ }
+}
+
+void QLowEnergyControllerPrivate::sendNextPendingRequest()
+{
+ if (openRequests.isEmpty() || requestPending)
+ return;
+
+ const Request &request = openRequests.head();
+// qCDebug(QT_BT_BLUEZ) << "Sending request, type:" << hex << request.command
+// << request.payload.toHex();
+
+ requestPending = true;
+ sendCommand(request.payload);
+}
+
+QLowEnergyHandle parseReadByTypeCharDiscovery(
+ QLowEnergyServicePrivate::CharData *charData,
+ const char *data, quint16 elementLength)
+{
+ Q_ASSERT(charData);
+ Q_ASSERT(data);
+
+ QLowEnergyHandle attributeHandle = bt_get_le16(&data[0]);
+ charData->properties =
+ (QLowEnergyCharacteristic::PropertyTypes)data[2];
+ charData->valueHandle = bt_get_le16(&data[3]);
+
+ if (elementLength == 7) // 16 bit uuid
+ charData->uuid = QBluetoothUuid(bt_get_le16(&data[5]));
+ else
+ charData->uuid = convert_uuid128((quint128 *)&data[5]);
+
+ qCDebug(QT_BT_BLUEZ) << "Found handle:" << hex << attributeHandle
+ << "properties:" << charData->properties
+ << "value handle:" << charData->valueHandle
+ << "uuid:" << charData->uuid.toString();
+
+ return attributeHandle;
+}
+
+QLowEnergyHandle parseReadByTypeIncludeDiscovery(
+ QList<QBluetoothUuid> *foundServices,
+ const char *data, quint16 elementLength)
+{
+ Q_ASSERT(foundServices);
+ Q_ASSERT(data);
+
+ QLowEnergyHandle attributeHandle = bt_get_le16(&data[0]);
+
+ // the next 2 elements are not required as we have discovered
+ // all (primary/secondary) services already. Now we are only
+ // interested in their relationship to each other
+ // data[2] -> included service start handle
+ // data[4] -> included service end handle
+
+ if (elementLength == 8) //16 bit uuid
+ foundServices->append(QBluetoothUuid(bt_get_le16(&data[6])));
+ else
+ foundServices->append(convert_uuid128((quint128 *) &data[6]));
+
+ qCDebug(QT_BT_BLUEZ) << "Found included service: " << hex
+ << attributeHandle << "uuid:" << *foundServices;
+
+ return attributeHandle;
+}
+
+void QLowEnergyControllerPrivate::processReply(
+ const Request &request, const QByteArray &response)
+{
+ Q_Q(QLowEnergyController);
+
+ quint8 command = response.constData()[0];
+
+ bool isErrorResponse = false;
+ // if error occurred 2. byte is previous request type
+ if (command == ATT_OP_ERROR_RESPONSE) {
+ dumpErrorInformation(response);
+ command = response.constData()[1];
+ isErrorResponse = true;
+ }
+
+ switch (command) {
+ case ATT_OP_EXCHANGE_MTU_REQUEST: // in case of error
+ case ATT_OP_EXCHANGE_MTU_RESPONSE:
+ {
+ Q_ASSERT(request.command == ATT_OP_EXCHANGE_MTU_REQUEST);
+ if (isErrorResponse) {
+ mtuSize = ATT_DEFAULT_LE_MTU;
+ break;
+ }
+
+ const char *data = response.constData();
+ quint16 mtu = bt_get_le16(&data[1]);
+ mtuSize = mtu;
+ if (mtuSize < ATT_DEFAULT_LE_MTU)
+ mtuSize = ATT_DEFAULT_LE_MTU;
+
+ qCDebug(QT_BT_BLUEZ) << "Server MTU:" << mtu << "resulting mtu:" << mtuSize;
+ }
+ break;
+ case ATT_OP_READ_BY_GROUP_REQUEST: // in case of error
+ case ATT_OP_READ_BY_GROUP_RESPONSE:
+ {
+ // Discovering services
+ Q_ASSERT(request.command == ATT_OP_READ_BY_GROUP_REQUEST);
+
+ const quint16 type = request.reference.toUInt();
+
+ if (isErrorResponse) {
+ if (type == GATT_SECONDARY_SERVICE)
+ q->discoveryFinished();
+ else // search for secondary services
+ sendReadByGroupRequest(0x0001, 0xFFFF, GATT_SECONDARY_SERVICE);
+ break;
+ }
+
+ QLowEnergyHandle start = 0, end = 0;
+ const quint16 elementLength = response.constData()[1];
+ const quint16 numElements = (response.size() - 2) / elementLength;
+ quint16 offset = 2;
+ const char *data = response.constData();
+ for (int i = 0; i < numElements; i++) {
+ start = bt_get_le16(&data[offset]);
+ end = bt_get_le16(&data[offset+2]);
+
+ QBluetoothUuid uuid;
+ if (elementLength == 6) //16 bit uuid
+ uuid = QBluetoothUuid(bt_get_le16(&data[offset+4]));
+ else if (elementLength == 20) //128 bit uuid
+ uuid = convert_uuid128((quint128 *)&data[offset+4]);
+ //else -> do nothing
+
+ offset += elementLength;
+
+
+ qCDebug(QT_BT_BLUEZ) << "Found uuid:" << uuid << "start handle:" << hex
+ << start << "end handle:" << end;
+
+ QLowEnergyServicePrivate *priv = new QLowEnergyServicePrivate();
+ priv->uuid = uuid;
+ priv->startHandle = start;
+ priv->endHandle = end;
+ if (type != GATT_PRIMARY_SERVICE) //unset PrimaryService bit
+ priv->type &= ~QLowEnergyService::PrimaryService;
+ priv->setController(this);
+
+ QSharedPointer<QLowEnergyServicePrivate> pointer(priv);
+
+ serviceList.insert(uuid, pointer);
+ emit q->serviceDiscovered(uuid);
+ }
+
+ if (end != 0xFFFF) {
+ sendReadByGroupRequest(end+1, 0xFFFF, type);
+ } else {
+ if (type == GATT_SECONDARY_SERVICE)
+ emit q->discoveryFinished();
+ else // search for secondary services
+ sendReadByGroupRequest(0x0001, 0xFFFF, GATT_SECONDARY_SERVICE);
+ }
+ }
+ break;
+ case ATT_OP_READ_BY_TYPE_REQUEST: //in case of error
+ case ATT_OP_READ_BY_TYPE_RESPONSE:
+ {
+ // Discovering characteristics
+ Q_ASSERT(request.command == ATT_OP_READ_BY_TYPE_REQUEST);
+
+ QSharedPointer<QLowEnergyServicePrivate> p =
+ request.reference.value<QSharedPointer<QLowEnergyServicePrivate> >();
+ const quint16 attributeType = request.reference2.toUInt();
+
+ if (isErrorResponse) {
+ if (attributeType == GATT_CHARACTERISTIC) {
+ // we reached end of service handle
+ // just finished up characteristic discovery
+ // continue with values of characteristics
+ if (!p->characteristicList.isEmpty()) {
+ readServiceValues(p->uuid, true);
+ } else {
+ // discovery finished since the service doesn't have any
+ // characteristics
+ p->setState(QLowEnergyService::ServiceDiscovered);
+ }
+ } else if (attributeType == GATT_INCLUDED_SERVICE) {
+ // finished up include discovery
+ // continue with characteristic discovery
+ sendReadByTypeRequest(p, p->startHandle, GATT_CHARACTERISTIC);
+ }
+ break;
+ }
+
+ /* packet format:
+ * if GATT_CHARACTERISTIC discovery
+ * <opcode><elementLength>
+ * [<handle><property><charHandle><uuid>]+
+ *
+ * if GATT_INCLUDE discovery
+ * <opcode><elementLength>
+ * [<handle><startHandle_included><endHandle_included><uuid>]+
+ *
+ * The uuid can be 16 or 128 bit.
+ */
+ QLowEnergyHandle lastHandle;
+ const quint16 elementLength = response.constData()[1];
+ const quint16 numElements = (response.size() - 2) / elementLength;
+ quint16 offset = 2;
+ const char *data = response.constData();
+ for (int i = 0; i < numElements; i++) {
+ if (attributeType == GATT_CHARACTERISTIC) {
+ QLowEnergyServicePrivate::CharData characteristic;
+ lastHandle = parseReadByTypeCharDiscovery(
+ &characteristic, &data[offset], elementLength);
+ p->characteristicList[lastHandle] = characteristic;
+ } else if (attributeType == GATT_INCLUDED_SERVICE) {
+ QList<QBluetoothUuid> includedServices;
+ lastHandle = parseReadByTypeIncludeDiscovery(
+ &includedServices, &data[offset], elementLength);
+ p->includedServices = includedServices;
+ foreach (const QBluetoothUuid &uuid, includedServices) {
+ if (serviceList.contains(uuid))
+ serviceList[uuid]->type |= QLowEnergyService::IncludedService;
+ }
+ }
+ }
+
+ if (lastHandle + 1 < p->endHandle) { // more chars to discover
+ sendReadByTypeRequest(p, lastHandle + 1, attributeType);
+ } else {
+ if (attributeType == GATT_INCLUDED_SERVICE)
+ sendReadByTypeRequest(p, p->startHandle, GATT_CHARACTERISTIC);
+ else
+ readServiceValues(p->uuid, true);
+ }
+ }
+ break;
+ case ATT_OP_READ_REQUEST: //error case
+ case ATT_OP_READ_RESPONSE:
+ {
+ //Reading characteristics and descriptors
+ Q_ASSERT(request.command == ATT_OP_READ_REQUEST);
+
+ uint handleData = request.reference.toUInt();
+ const QLowEnergyHandle charHandle = (handleData & 0xffff);
+ const QLowEnergyHandle descriptorHandle = ((handleData >> 16) & 0xffff);
+
+ // we ignore error response
+ if (!isErrorResponse) {
+ if (!descriptorHandle)
+ updateValueOfCharacteristic(charHandle, response.mid(1), NEW_VALUE);
+ else
+ updateValueOfDescriptor(charHandle, descriptorHandle,
+ response.mid(1), NEW_VALUE);
+
+ if (response.size() == mtuSize) {
+ // Potentially more data -> switch to blob reads
+ readServiceValuesByOffset(handleData, mtuSize-1,
+ request.reference2.toBool());
+ break;
+ }
+ }
+
+ if (request.reference2.toBool()) {
+ //last characteristic -> progress to descriptor discovery
+ //last descriptor -> service discovery is done
+ QSharedPointer<QLowEnergyServicePrivate> service = serviceForHandle(charHandle);
+ Q_ASSERT(!service.isNull());
+ if (!descriptorHandle)
+ discoverServiceDescriptors(service->uuid);
+ else
+ service->setState(QLowEnergyService::ServiceDiscovered);
+ }
+ }
+ break;
+ case ATT_OP_READ_BLOB_REQUEST: //error case
+ case ATT_OP_READ_BLOB_RESPONSE:
+ {
+ //Reading characteristic or descriptor with value longer than MTU
+ Q_ASSERT(request.command == ATT_OP_READ_BLOB_REQUEST);
+
+ uint handleData = request.reference.toUInt();
+ const QLowEnergyHandle charHandle = (handleData & 0xffff);
+ const QLowEnergyHandle descriptorHandle = ((handleData >> 16) & 0xffff);
+
+ //ignore errors
+ if (!isErrorResponse) {
+ quint16 length = 0;
+ if (!descriptorHandle)
+ length = updateValueOfCharacteristic(charHandle, response.mid(1), APPEND_VALUE);
+ else
+ length = updateValueOfDescriptor(charHandle, descriptorHandle,
+ response.mid(1), APPEND_VALUE);
+ if (response.size() == mtuSize) {
+ readServiceValuesByOffset(handleData, length,
+ request.reference2.toBool());
+ break;
+ }
+ }
+
+ if (request.reference2.toBool()) {
+ //last overlong characteristic -> progress to descriptor discovery
+ //last overlong descriptor -> service discovery is done
+ QSharedPointer<QLowEnergyServicePrivate> service = serviceForHandle(charHandle);
+ Q_ASSERT(!service.isNull());
+ if (!descriptorHandle)
+ discoverServiceDescriptors(service->uuid);
+ else
+ service->setState(QLowEnergyService::ServiceDiscovered);
+ }
+
+ }
+ break;
+ case ATT_OP_FIND_INFORMATION_REQUEST: //error case
+ case ATT_OP_FIND_INFORMATION_RESPONSE:
+ {
+ //Discovering descriptors
+ Q_ASSERT(request.command == ATT_OP_FIND_INFORMATION_REQUEST);
+
+ /* packet format:
+ * <opcode><format>[<handle><descriptor_uuid>]+
+ *
+ * The uuid can be 16 or 128 bit which is indicated by format.
+ */
+
+ QList<QLowEnergyHandle> keys = request.reference.value<QList<QLowEnergyHandle> >();
+ if (keys.isEmpty()) {
+ qCWarning(QT_BT_BLUEZ) << "Descriptor discovery for unknown characteristic received";
+ break;
+ }
+ QLowEnergyHandle charHandle = keys.first();
+
+ QSharedPointer<QLowEnergyServicePrivate> p =
+ serviceForHandle(charHandle);
+ Q_ASSERT(!p.isNull());
+
+ if (isErrorResponse) {
+ readServiceValues(p->uuid, false); //read descriptor values
+ break;
+ }
+
+ const quint8 format = response[1];
+ quint16 elementLength;
+ switch (format) {
+ case 0x01:
+ elementLength = 2 + 2; //sizeof(QLowEnergyHandle) + 16bit uuid
+ break;
+ case 0x02:
+ elementLength = 2 + 16; //sizeof(QLowEnergyHandle) + 128bit uuid
+ break;
+ default:
+ qCWarning(QT_BT_BLUEZ) << "Unknown format in FIND_INFORMATION_RESPONSE";
+ return;
+ }
+
+ const quint16 numElements = (response.size() - 2) / elementLength;
+
+ quint16 offset = 2;
+ QLowEnergyHandle descriptorHandle;
+ QBluetoothUuid uuid;
+ const char *data = response.constData();
+ for (int i = 0; i < numElements; i++) {
+ descriptorHandle = bt_get_le16(&data[offset]);
+
+ if (format == 0x01)
+ uuid = QBluetoothUuid(bt_get_le16(&data[offset+2]));
+ else if (format == 0x02)
+ uuid = convert_uuid128((quint128 *)&data[offset+2]);
+
+ offset += elementLength;
+
+ // ignore all attributes which are not of type descriptor
+ // examples are the characteristics value or
+ bool ok = false;
+ quint16 shortUuid = uuid.toUInt16(&ok);
+ if (ok && shortUuid >= QLowEnergyServicePrivate::PrimaryService
+ && shortUuid <= QLowEnergyServicePrivate::Characteristic){
+ qCDebug(QT_BT_BLUEZ) << "Suppressing primary/characteristic" << hex << shortUuid;
+ continue;
+ }
+
+ // ignore value handle
+ if (descriptorHandle == p->characteristicList[charHandle].valueHandle) {
+ qCDebug(QT_BT_BLUEZ) << "Suppressing char handle" << hex << descriptorHandle;
+ continue;
+ }
+
+ QLowEnergyServicePrivate::DescData data;
+ data.uuid = uuid;
+ p->characteristicList[charHandle].descriptorList.insert(
+ descriptorHandle, data);
+
+ qCDebug(QT_BT_BLUEZ) << "Descriptor found, uuid:"
+ << uuid.toString()
+ << "descriptor handle:" << hex << descriptorHandle;
+ }
+
+ const QLowEnergyHandle nextPotentialHandle = descriptorHandle + 1;
+ if (keys.count() == 1) {
+ // Reached last characteristic of service
+
+ // The endhandle of a service is always the last handle of
+ // the current service. We must either continue until we have reached
+ // the starting handle of the next service (endHandle+1) or
+ // the last physical handle address (0xffff). Note that
+ // the endHandle of the last service on the device is 0xffff.
+
+ if ((p->endHandle != 0xffff && nextPotentialHandle >= p->endHandle + 1)
+ || (descriptorHandle == 0xffff)) {
+ keys.removeFirst();
+ // last descriptor of last characteristic found
+ // continue with reading descriptor values
+ readServiceValues(p->uuid, false);
+ } else {
+ discoverNextDescriptor(p, keys, nextPotentialHandle);
+ }
+ } else {
+ if (nextPotentialHandle >= keys[1]) //reached next char
+ keys.removeFirst();
+ discoverNextDescriptor(p, keys, nextPotentialHandle);
+ }
+ }
+ break;
+ case ATT_OP_WRITE_REQUEST: //error case
+ case ATT_OP_WRITE_RESPONSE:
+ {
+ //Write command response
+ Q_ASSERT(request.command == ATT_OP_WRITE_REQUEST);
+
+ uint ref = request.reference.toUInt();
+ const QLowEnergyHandle charHandle = (ref & 0xffff);
+ const QLowEnergyHandle descriptorHandle = ((ref >> 16) & 0xffff);
+
+ QSharedPointer<QLowEnergyServicePrivate> service = serviceForHandle(charHandle);
+ if (service.isNull() || !service->characteristicList.contains(charHandle))
+ break;
+
+ if (isErrorResponse) {
+ if (!descriptorHandle)
+ service->setError(QLowEnergyService::CharacteristicWriteError);
+ else
+ service->setError(QLowEnergyService::DescriptorWriteError);
+ break;
+ }
+
+ const QByteArray newValue = request.reference2.toByteArray();
+ if (!descriptorHandle) {
+ service->characteristicList[charHandle].value = newValue;
+ QLowEnergyCharacteristic ch(service, charHandle);
+ emit service->characteristicChanged(ch, newValue);
+ } else {
+ service->characteristicList[charHandle].descriptorList[descriptorHandle].value = newValue;
+ QLowEnergyDescriptor descriptor(service, charHandle, descriptorHandle);
+ emit service->descriptorChanged(descriptor, newValue);
+ }
+ }
+ break;
+ default:
+ qCDebug(QT_BT_BLUEZ) << "Unknown packet: " << response.toHex();
+ break;
+ }
+}
+
+void QLowEnergyControllerPrivate::discoverServices()
+{
+ sendReadByGroupRequest(0x0001, 0xFFFF, GATT_PRIMARY_SERVICE);
+}
+
+void QLowEnergyControllerPrivate::sendReadByGroupRequest(
+ QLowEnergyHandle start, QLowEnergyHandle end, quint16 type)
+{
+ //call for primary and secondary services
+ quint8 packet[GRP_TYPE_REQ_SIZE];
+
+ packet[0] = ATT_OP_READ_BY_GROUP_REQUEST;
+ bt_put_unaligned(htobs(start), (quint16 *) &packet[1]);
+ bt_put_unaligned(htobs(end), (quint16 *) &packet[3]);
+ bt_put_unaligned(htobs(type), (quint16 *) &packet[5]);
+
+ QByteArray data(GRP_TYPE_REQ_SIZE, Qt::Uninitialized);
+ memcpy(data.data(), packet, GRP_TYPE_REQ_SIZE);
+ qCDebug(QT_BT_BLUEZ) << "Sending read_by_group_type request, startHandle:" << hex
+ << start << "endHandle:" << end << type;
+
+ Request request;
+ request.payload = data;
+ request.command = ATT_OP_READ_BY_GROUP_REQUEST;
+ request.reference = type;
+ openRequests.enqueue(request);
+
+ sendNextPendingRequest();
+}
+
+void QLowEnergyControllerPrivate::discoverServiceDetails(const QBluetoothUuid &service)
+{
+ if (!serviceList.contains(service)) {
+ qCWarning(QT_BT_BLUEZ) << "Discovery of unknown service" << service.toString()
+ << "not possible";
+ return;
+ }
+
+ QSharedPointer<QLowEnergyServicePrivate> serviceData = serviceList.value(service);
+ serviceData->characteristicList.clear();
+ sendReadByTypeRequest(serviceData, serviceData->startHandle, GATT_INCLUDED_SERVICE);
+}
+
+void QLowEnergyControllerPrivate::sendReadByTypeRequest(
+ QSharedPointer<QLowEnergyServicePrivate> serviceData,
+ QLowEnergyHandle nextHandle, quint16 attributeType)
+{
+ quint8 packet[READ_BY_TYPE_REQ_SIZE];
+
+ packet[0] = ATT_OP_READ_BY_TYPE_REQUEST;
+ bt_put_unaligned(htobs(nextHandle), (quint16 *) &packet[1]);
+ bt_put_unaligned(htobs(serviceData->endHandle), (quint16 *) &packet[3]);
+ bt_put_unaligned(htobs(attributeType), (quint16 *) &packet[5]);
+
+ QByteArray data(READ_BY_TYPE_REQ_SIZE, Qt::Uninitialized);
+ memcpy(data.data(), packet, READ_BY_TYPE_REQ_SIZE);
+ qCDebug(QT_BT_BLUEZ) << "Sending read_by_type request, startHandle:" << hex
+ << nextHandle << "endHandle:" << serviceData->endHandle
+ << "type:" << attributeType << "packet:" << data.toHex();
+
+ Request request;
+ request.payload = data;
+ request.command = ATT_OP_READ_BY_TYPE_REQUEST;
+ request.reference = QVariant::fromValue(serviceData);
+ request.reference2 = attributeType;
+ openRequests.enqueue(request);
+
+ sendNextPendingRequest();
+}
+
+/*!
+ \internal
+
+ Reads the value of characteristics and descriptors.
+
+ \a readCharacteristics determines whether we intend to read a characteristic;
+ otherwise we read a descriptor.
+ */
+void QLowEnergyControllerPrivate::readServiceValues(
+ const QBluetoothUuid &serviceUuid, bool readCharacteristics)
+{
+ quint8 packet[READ_REQUEST_SIZE];
+ if (QT_BT_BLUEZ().isDebugEnabled()) {
+ if (readCharacteristics)
+ qCDebug(QT_BT_BLUEZ) << "Reading characteristic values for"
+ << serviceUuid.toString();
+ else
+ qCDebug(QT_BT_BLUEZ) << "Reading descriptor values for"
+ << serviceUuid.toString();
+ }
+
+ QSharedPointer<QLowEnergyServicePrivate> service = serviceList.value(serviceUuid);
+
+ // pair.first -> target attribute
+ // pair.second -> context information for read request
+ QPair<QLowEnergyHandle, quint32> pair;
+
+ // Create list of attribute handles which need to be read
+ QList<QPair<QLowEnergyHandle, quint32> > targetHandles;
+ const QList<QLowEnergyHandle> keys = service->characteristicList.keys();
+ for (int i = 0; i < keys.count(); i++) {
+ const QLowEnergyHandle charHandle = keys[i];
+ const QLowEnergyServicePrivate::CharData &charDetails =
+ service->characteristicList[charHandle];
+
+
+ if (readCharacteristics) {
+ // Collect handles of all characteristic value attributes
+
+ // Don't try to read writeOnly characteristic
+ if (!(charDetails.properties & QLowEnergyCharacteristic::Read))
+ continue;
+
+ pair.first = charDetails.valueHandle;
+ pair.second = charHandle;
+ targetHandles.append(pair);
+
+ } else {
+ // Collect handles of all descriptor attributes
+ foreach (QLowEnergyHandle descriptorHandle, charDetails.descriptorList.keys()) {
+ pair.first = descriptorHandle;
+ pair.second = (charHandle | (descriptorHandle << 16));
+ targetHandles.append(pair);
+ }
+ }
+ }
+
+
+ if (targetHandles.isEmpty()) {
+ if (readCharacteristics) {
+ // none of the characteristics is readable
+ // -> continue with descriptor discovery
+ discoverServiceDescriptors(service->uuid);
+ } else {
+ // characteristic w/o descriptors
+ service->setState(QLowEnergyService::ServiceDiscovered);
+ }
+ return;
+ }
+
+ for (int i = 0; i < targetHandles.count(); i++) {
+ pair = targetHandles.at(i);
+ packet[0] = ATT_OP_READ_REQUEST;
+ bt_put_unaligned(htobs(pair.first), (quint16 *) &packet[1]);
+
+ QByteArray data(READ_REQUEST_SIZE, Qt::Uninitialized);
+ memcpy(data.data(), packet, READ_REQUEST_SIZE);
+
+ Request request;
+ request.payload = data;
+ request.command = ATT_OP_READ_REQUEST;
+ request.reference = pair.second;
+ // last entry?
+ request.reference2 = QVariant((bool)(i + 1 == targetHandles.count()));
+ openRequests.enqueue(request);
+ }
+
+ sendNextPendingRequest();
+}
+
+/*!
+ \internal
+
+ This function is used when reading a handle value that is
+ longer than the mtuSize.
+
+ The BLOB read request is prepended to the list of
+ open requests to finish the current value read up before
+ starting the next read request.
+ */
+void QLowEnergyControllerPrivate::readServiceValuesByOffset(
+ quint16 handleData, quint16 offset, bool isLastValue)
+{
+ const QLowEnergyHandle charHandle = (handleData & 0xffff);
+ const QLowEnergyHandle descriptorHandle = ((handleData >> 16) & 0xffff);
+ quint8 packet[READ_REQUEST_SIZE];
+
+ packet[0] = ATT_OP_READ_BLOB_REQUEST;
+
+ QLowEnergyHandle handleToRead = charHandle;
+ if (descriptorHandle) {
+ handleToRead = descriptorHandle;
+ qCDebug(QT_BT_BLUEZ) << "Reading descriptor via blob request"
+ << hex << descriptorHandle;
+ } else {
+ //charHandle is not the char's value handle
+ QSharedPointer<QLowEnergyServicePrivate> service =
+ serviceForHandle(charHandle);
+ if (!service.isNull()
+ && service->characteristicList.contains(charHandle)) {
+ handleToRead = service->characteristicList[charHandle].valueHandle;
+ qCDebug(QT_BT_BLUEZ) << "Reading characteristic via blob request"
+ << hex << handleToRead;
+ } else {
+ Q_ASSERT(false);
+ }
+ }
+
+ bt_put_unaligned(htobs(handleToRead), (quint16 *) &packet[1]);
+ bt_put_unaligned(htobs(offset), (quint16 *) &packet[3]);
+
+ QByteArray data(READ_BLOB_REQUEST_SIZE, Qt::Uninitialized);
+ memcpy(data.data(), packet, READ_BLOB_REQUEST_SIZE);
+
+ Request request;
+ request.payload = data;
+ request.command = ATT_OP_READ_BLOB_REQUEST;
+ request.reference = handleData;
+ request.reference2 = isLastValue;
+ openRequests.prepend(request);
+}
+
+void QLowEnergyControllerPrivate::discoverServiceDescriptors(
+ const QBluetoothUuid &serviceUuid)
+{
+ qCDebug(QT_BT_BLUEZ) << "Discovering descriptor values for"
+ << serviceUuid.toString();
+ QSharedPointer<QLowEnergyServicePrivate> service = serviceList.value(serviceUuid);
+ // start handle of all known characteristics
+ QList<QLowEnergyHandle> keys = service->characteristicList.keys();
+
+ if (keys.isEmpty()) { // service has no characteristics
+ // implies that characteristic & descriptor discovery can be skipped
+ service->setState(QLowEnergyService::ServiceDiscovered);
+ return;
+ }
+
+ std::sort(keys.begin(), keys.end());
+
+ discoverNextDescriptor(service, keys, keys[0]);
+}
+
+void QLowEnergyControllerPrivate::processUnsolicitedReply(const QByteArray &payload)
+{
+ const char *data = payload.constData();
+ bool isNotification = (data[0] == ATT_OP_HANDLE_VAL_NOTIFICATION);
+ const QLowEnergyHandle changedHandle = bt_get_le16(&data[1]);
+
+ if (QT_BT_BLUEZ().isDebugEnabled()) {
+ if (isNotification)
+ qCDebug(QT_BT_BLUEZ) << "Change notification for handle" << hex << changedHandle;
+ else
+ qCDebug(QT_BT_BLUEZ) << "Change indication for handle" << hex << changedHandle;
+ }
+
+ const QLowEnergyCharacteristic ch = characteristicForHandle(changedHandle);
+ if (ch.isValid() && ch.handle() == changedHandle) {
+ updateValueOfCharacteristic(ch.attributeHandle(), payload.mid(3), NEW_VALUE);
+ emit ch.d_ptr->characteristicChanged(ch, payload.mid(3));
+ } else {
+ qCWarning(QT_BT_BLUEZ) << "Cannot find matching characteristic for "
+ "notification/indication";
+ }
+}
+
+void QLowEnergyControllerPrivate::exchangeMTU()
+{
+ qCDebug(QT_BT_BLUEZ) << "Exchanging MTU";
+
+ quint8 packet[MTU_EXCHANGE_SIZE];
+ packet[0] = ATT_OP_EXCHANGE_MTU_REQUEST;
+ bt_put_unaligned(htobs(ATT_MAX_LE_MTU), (quint16 *) &packet[1]);
+
+ QByteArray data(MTU_EXCHANGE_SIZE, Qt::Uninitialized);
+ memcpy(data.data(), packet, MTU_EXCHANGE_SIZE);
+
+ Request request;
+ request.payload = data;
+ request.command = ATT_OP_EXCHANGE_MTU_REQUEST;
+ openRequests.enqueue(request);
+
+ sendNextPendingRequest();
+}
+
+void QLowEnergyControllerPrivate::discoverNextDescriptor(
+ QSharedPointer<QLowEnergyServicePrivate> serviceData,
+ const QList<QLowEnergyHandle> pendingCharHandles,
+ const QLowEnergyHandle startingHandle)
+{
+ Q_ASSERT(!pendingCharHandles.isEmpty());
+ Q_ASSERT(!serviceData.isNull());
+
+ qCDebug(QT_BT_BLUEZ) << "Sending find_info request" << hex
+ << pendingCharHandles << startingHandle;
+
+ quint8 packet[FIND_INFO_REQUEST_SIZE];
+ packet[0] = ATT_OP_FIND_INFORMATION_REQUEST;
+
+ const QLowEnergyHandle charStartHandle = startingHandle;
+ QLowEnergyHandle charEndHandle = 0;
+ if (pendingCharHandles.count() == 1) //single characteristic
+ charEndHandle = serviceData->endHandle;
+ else
+ charEndHandle = pendingCharHandles[1] - 1;
+
+ bt_put_unaligned(htobs(charStartHandle), (quint16 *) &packet[1]);
+ bt_put_unaligned(htobs(charEndHandle), (quint16 *) &packet[3]);
+
+ QByteArray data(FIND_INFO_REQUEST_SIZE, Qt::Uninitialized);
+ memcpy(data.data(), packet, FIND_INFO_REQUEST_SIZE);
+
+ Request request;
+ request.payload = data;
+ request.command = ATT_OP_FIND_INFORMATION_REQUEST;
+ request.reference = QVariant::fromValue<QList<QLowEnergyHandle> >(pendingCharHandles);
+ request.reference2 = startingHandle;
+ openRequests.enqueue(request);
+
+ sendNextPendingRequest();
+}
+
+void QLowEnergyControllerPrivate::writeCharacteristic(
+ const QSharedPointer<QLowEnergyServicePrivate> service,
+ const QLowEnergyHandle charHandle,
+ const QByteArray &newValue)
+{
+ Q_ASSERT(!service.isNull());
+
+ if (!service->characteristicList.contains(charHandle))
+ return;
+
+ const QLowEnergyHandle valueHandle = service->characteristicList[charHandle].valueHandle;
+ // sizeof(command) + sizeof(handle) + sizeof(newValue)
+ const int size = 1 + 2 + newValue.size();
+
+ quint8 packet[WRITE_REQUEST_SIZE];
+ packet[0] = ATT_OP_WRITE_REQUEST;
+ bt_put_unaligned(htobs(valueHandle), (quint16 *) &packet[1]);
+
+
+ QByteArray data(size, Qt::Uninitialized);
+ memcpy(data.data(), packet, WRITE_REQUEST_SIZE);
+ memcpy(&(data.data()[WRITE_REQUEST_SIZE]), newValue.constData(), newValue.size());
+
+ qCDebug(QT_BT_BLUEZ) << "Writing characteristic" << hex << charHandle
+ << "(size:" << size << ")";
+
+ Request request;
+ request.payload = data;
+ request.command = ATT_OP_WRITE_REQUEST;
+ request.reference = charHandle;
+ request.reference2 = newValue;
+ openRequests.enqueue(request);
+
+ sendNextPendingRequest();
+}
+
+void QLowEnergyControllerPrivate::writeDescriptor(
+ const QSharedPointer<QLowEnergyServicePrivate> service,
+ const QLowEnergyHandle charHandle,
+ const QLowEnergyHandle descriptorHandle,
+ const QByteArray &newValue)
+{
+ Q_ASSERT(!service.isNull());
+
+ // sizeof(command) + sizeof(handle) + sizeof(newValue)
+ const int size = 1 + 2 + newValue.size();
+
+ quint8 packet[WRITE_REQUEST_SIZE];
+ packet[0] = ATT_OP_WRITE_REQUEST;
+ bt_put_unaligned(htobs(descriptorHandle), (quint16 *) &packet[1]);
+
+ QByteArray data(size, Qt::Uninitialized);
+ memcpy(data.data(), packet, WRITE_REQUEST_SIZE);
+ memcpy(&(data.data()[WRITE_REQUEST_SIZE]), newValue.constData(), newValue.size());
+
+ qCDebug(QT_BT_BLUEZ) << "Writing descriptor" << hex << descriptorHandle
+ << "(size:" << size << ")";
+
+ Request request;
+ request.payload = data;
+ request.command = ATT_OP_WRITE_REQUEST;
+ request.reference = (charHandle | (descriptorHandle << 16));
+ request.reference2 = newValue;
+ openRequests.enqueue(request);
+
+ sendNextPendingRequest();
+}
+
+QT_END_NAMESPACE
diff --git a/src/bluetooth/qlowenergycontroller_p.cpp b/src/bluetooth/qlowenergycontroller_p.cpp
new file mode 100644
index 00000000..0135df1c
--- /dev/null
+++ b/src/bluetooth/qlowenergycontroller_p.cpp
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qlowenergycontroller_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QLowEnergyControllerPrivate::QLowEnergyControllerPrivate()
+ : QObject(),
+ state(QLowEnergyController::UnconnectedState),
+ error(QLowEnergyController::NoError)
+{
+}
+
+QLowEnergyControllerPrivate::~QLowEnergyControllerPrivate()
+{
+}
+
+void QLowEnergyControllerPrivate::connectToDevice()
+{
+ setError(QLowEnergyController::UnknownError);
+}
+
+void QLowEnergyControllerPrivate::disconnectFromDevice()
+{
+
+}
+
+void QLowEnergyControllerPrivate::discoverServices()
+{
+
+}
+
+void QLowEnergyControllerPrivate::discoverServiceDetails(const QBluetoothUuid &/*service*/)
+{
+
+}
+
+void QLowEnergyControllerPrivate::writeCharacteristic(
+ const QSharedPointer<QLowEnergyServicePrivate> /*service*/,
+ const QLowEnergyHandle /*charHandle*/,
+ const QByteArray &/*newValue*/)
+{
+
+}
+
+void QLowEnergyControllerPrivate::writeDescriptor(
+ const QSharedPointer<QLowEnergyServicePrivate> /*service*/,
+ const QLowEnergyHandle /*charHandle*/,
+ const QLowEnergyHandle /*descriptorHandle*/,
+ const QByteArray &/*newValue*/)
+{
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/bluetooth/qlowenergycontroller_p.h b/src/bluetooth/qlowenergycontroller_p.h
new file mode 100644
index 00000000..a2b2f411
--- /dev/null
+++ b/src/bluetooth/qlowenergycontroller_p.h
@@ -0,0 +1,158 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QLOWENERGYCONTROLLERPRIVATE_P_H
+#define QLOWENERGYCONTROLLERPRIVATE_P_H
+
+#include <qglobal.h>
+#include <QtCore/QQueue>
+#include <QtBluetooth/qbluetooth.h>
+#include "qlowenergycontroller.h"
+#include "qlowenergyserviceprivate_p.h"
+
+#if defined(QT_BLUEZ_BLUETOOTH) && !defined(QT_BLUEZ_NO_BTLE)
+#include <QtBluetooth/QBluetoothSocket>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+typedef QMap<QBluetoothUuid, QSharedPointer<QLowEnergyServicePrivate> > ServiceDataMap;
+
+class QLowEnergyControllerPrivate : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PUBLIC(QLowEnergyController)
+public:
+ QLowEnergyControllerPrivate();
+ ~QLowEnergyControllerPrivate();
+
+ void setError(QLowEnergyController::Error newError);
+ bool isValidLocalAdapter();
+
+ void setState(QLowEnergyController::ControllerState newState);
+
+ void connectToDevice();
+ void disconnectFromDevice();
+
+ void discoverServices();
+ void invalidateServices();
+
+ void discoverServiceDetails(const QBluetoothUuid &service);
+
+ // misc helpers
+ QSharedPointer<QLowEnergyServicePrivate> serviceForHandle(
+ QLowEnergyHandle handle);
+ QLowEnergyCharacteristic characteristicForHandle(
+ QLowEnergyHandle handle);
+ QLowEnergyDescriptor descriptorForHandle(
+ QLowEnergyHandle handle);
+
+ quint16 updateValueOfCharacteristic(QLowEnergyHandle charHandle,
+ const QByteArray &value,
+ bool appendValue);
+ quint16 updateValueOfDescriptor(QLowEnergyHandle charHandle,
+ QLowEnergyHandle descriptorHandle,
+ const QByteArray &value,
+ bool appendValue);
+
+
+ // write data
+ void writeCharacteristic(const QSharedPointer<QLowEnergyServicePrivate> service,
+ const QLowEnergyHandle charHandle,
+ const QByteArray &newValue);
+ void writeDescriptor(const QSharedPointer<QLowEnergyServicePrivate> service,
+ const QLowEnergyHandle charHandle,
+ const QLowEnergyHandle descriptorHandle,
+ const QByteArray &newValue);
+
+
+ QBluetoothAddress remoteDevice;
+ QBluetoothAddress localAdapter;
+
+ QLowEnergyController::ControllerState state;
+ QLowEnergyController::Error error;
+ QString errorString;
+
+ // list of all found service uuids
+ ServiceDataMap serviceList;
+
+private:
+#if defined(QT_BLUEZ_BLUETOOTH) && !defined(QT_BLUEZ_NO_BTLE)
+ QBluetoothSocket *l2cpSocket;
+ struct Request {
+ quint8 command;
+ QByteArray payload;
+ // TODO reference below is ugly but until we know all commands and their
+ // requirements this is WIP
+ QVariant reference;
+ QVariant reference2;
+ };
+ QQueue<Request> openRequests;
+ bool requestPending;
+ quint16 mtuSize;
+
+ void sendCommand(const QByteArray &packet);
+ void sendNextPendingRequest();
+ void processReply(const Request &request, const QByteArray &reply);
+
+ void sendReadByGroupRequest(QLowEnergyHandle start, QLowEnergyHandle end,
+ quint16 type);
+ void sendReadByTypeRequest(QSharedPointer<QLowEnergyServicePrivate> serviceData,
+ QLowEnergyHandle nextHandle, quint16 attributeType);
+ void sendReadValueRequest(QLowEnergyHandle attributeHandle, bool isDescriptor);
+ void readServiceValues(const QBluetoothUuid &service,
+ bool readCharacteristics);
+ void readServiceValuesByOffset(quint16 handleData, quint16 offset,
+ bool isLastValue);
+
+ void discoverServiceDescriptors(const QBluetoothUuid &serviceUuid);
+ void discoverNextDescriptor(QSharedPointer<QLowEnergyServicePrivate> serviceData,
+ const QList<QLowEnergyHandle> pendingCharHandles,
+ QLowEnergyHandle startingHandle);
+ void processUnsolicitedReply(const QByteArray &msg);
+ void exchangeMTU();
+
+
+private slots:
+ void l2cpConnected();
+ void l2cpDisconnected();
+ void l2cpErrorChanged(QBluetoothSocket::SocketError);
+ void l2cpReadyRead();
+#endif
+private:
+ QLowEnergyController *q_ptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // QLOWENERGYCONTROLLERPRIVATE_P_H
diff --git a/src/bluetooth/qlowenergydescriptor.cpp b/src/bluetooth/qlowenergydescriptor.cpp
new file mode 100644
index 00000000..c7ee87ad
--- /dev/null
+++ b/src/bluetooth/qlowenergydescriptor.cpp
@@ -0,0 +1,311 @@
+/***************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtBluetooth/QLowEnergyService>
+#include "qlowenergyserviceprivate_p.h"
+#include "qlowenergydescriptor.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QLowEnergyDescriptor
+ \inmodule QtBluetooth
+ \brief The QLowEnergyDescriptor class stores information about the Bluetooth
+ Low Energy descriptor.
+ \since 5.4
+
+ QLowEnergyDescriptor provides information about a Bluetooth Low Energy
+ descriptor's \l name(), \l uuid(), \l value() and \l handle(). Descriptors are
+ encapsulated by Bluetooth Low Energy characteristics and provide additional
+ centextual information about the characteristic (data format, notification activation
+ and so on).
+
+ The descriptor value may be written via the \l QLowEnergyService instance
+ that manages the service to which this descriptor belongs. the
+ \l {QLowEnergyService::writeDescriptor()} function writes the new value.
+ The \l {QLowEnergyService::descriptorChanged()} signal
+ is emitted upon success. The \l value() of this object is automatically updated accordingly.
+
+ \sa QLowEnergyService, QLowEnergyCharacteristic
+*/
+
+struct QLowEnergyDescriptorPrivate
+{
+ QLowEnergyHandle charHandle;
+ QLowEnergyHandle descHandle;
+};
+
+/*!
+ Construct a new QLowEnergyDescriptor. A default-constructed instance
+ of this class is always invalid.
+*/
+QLowEnergyDescriptor::QLowEnergyDescriptor():
+ d_ptr(0), data(0)
+{
+}
+
+/*!
+ Construct a new QLowEnergyDescriptor that is a copy of \a other.
+
+ The two copies continue to share the same underlying data which does not detach
+ upon write.
+*/
+QLowEnergyDescriptor::QLowEnergyDescriptor(const QLowEnergyDescriptor &other):
+ d_ptr(other.d_ptr), data(0)
+{
+ if (other.data) {
+ data = new QLowEnergyDescriptorPrivate();
+ data->charHandle = other.data->charHandle;
+ data->descHandle = other.data->descHandle;
+ }
+}
+
+/*!
+ \internal
+
+*/
+QLowEnergyDescriptor::QLowEnergyDescriptor(QSharedPointer<QLowEnergyServicePrivate> p,
+ QLowEnergyHandle charHandle,
+ QLowEnergyHandle descHandle):
+ d_ptr(p)
+{
+ data = new QLowEnergyDescriptorPrivate();
+ data->charHandle = charHandle;
+ data->descHandle = descHandle;
+
+}
+
+/*!
+ Destroys the QLowEnergyDescriptor object.
+*/
+QLowEnergyDescriptor::~QLowEnergyDescriptor()
+{
+ delete data;
+}
+
+/*!
+ Makes a copy of \a other and assigns it to this QLowEnergyDescriptor object.
+ The two copies continue to share the same service and controller details.
+*/
+QLowEnergyDescriptor &QLowEnergyDescriptor::operator=(const QLowEnergyDescriptor &other)
+{
+ d_ptr = other.d_ptr;
+
+ if (!other.data) {
+ if (data) {
+ delete data;
+ data = 0;
+ }
+ } else {
+ if (!data)
+ data = new QLowEnergyDescriptorPrivate();
+
+ data->charHandle = other.data->charHandle;
+ data->descHandle = other.data->descHandle;
+ }
+
+ return *this;
+}
+
+/*!
+ Returns \c true if \a other is equal to this QLowEnergyCharacteristic; otherwise \c false.
+
+ Two QLowEnergyDescriptor instances are considered to be equal if they refer to
+ the same descriptor on the same remote Bluetooth Low Energy device or both
+ instances have been default-constructed.
+ */
+bool QLowEnergyDescriptor::operator==(const QLowEnergyDescriptor &other) const
+{
+ if (d_ptr != other.d_ptr)
+ return false;
+
+ if ((data && !other.data) || (!data && other.data))
+ return false;
+
+ if (!data)
+ return true;
+
+ if (data->charHandle != other.data->charHandle
+ || data->descHandle != other.data->descHandle) {
+ return false;
+ }
+
+ return true;
+}
+
+/*!
+ Returns \c true if \a other is not equal to this QLowEnergyCharacteristic; otherwise \c false.
+
+ Two QLowEnergyDescriptor instances are considered to be equal if they refer to
+ the same descriptor on the same remote Bluetooth Low Energy device or both
+ instances have been default-constructed.
+ */
+bool QLowEnergyDescriptor::operator!=(const QLowEnergyDescriptor &other) const
+{
+ return !(*this == other);
+}
+
+/*!
+ Returns \c true if the QLowEnergyDescriptor object is valid, otherwise returns \c false.
+
+ An invalid descriptor instance is not associated with any service (default-constructed)
+ or the associated service is no longer valid due to a disconnect from
+ the underlying Bluetooth Low Energy device, for example. Once the object is invalid
+ it cannot become valid anymore.
+
+ \note If a QLowEnergyDescriptor instance turns invalid due to a disconnect
+ from the underlying device, the information encapsulated by the current
+ instance remains as it was at the time of the disconnect. Therefore it can be
+ retrieved after the disconnect event.
+*/
+bool QLowEnergyDescriptor::isValid() const
+{
+ if (d_ptr.isNull() || !data)
+ return false;
+
+ if (d_ptr->state == QLowEnergyService::InvalidService)
+ return false;
+
+ return true;
+}
+
+/*!
+ Returns the UUID of this descriptor if \l isValid() returns \c true; otherwise a
+ \l {QUuid::isNull()}{null} UUID.
+*/
+QBluetoothUuid QLowEnergyDescriptor::uuid() const
+{
+ if (d_ptr.isNull() || !data
+ || !d_ptr->characteristicList.contains(data->charHandle)
+ || !d_ptr->characteristicList[data->charHandle].
+ descriptorList.contains(data->descHandle)) {
+ return QBluetoothUuid();
+ }
+
+ return d_ptr->characteristicList[data->charHandle].descriptorList[data->descHandle].uuid;
+}
+
+/*!
+ Returns the handle of the descriptor or \c 0 if the handle
+ cannot be accessed on the platform.
+*/
+QLowEnergyHandle QLowEnergyDescriptor::handle() const
+{
+ if (!data)
+ return 0;
+
+ return data->descHandle;
+}
+
+/*!
+ Returns the value of the descriptor.
+
+ A descriptor value may be updated using
+ \l QLowEnergyService::writeDescriptor().
+*/
+QByteArray QLowEnergyDescriptor::value() const
+{
+ if (d_ptr.isNull() || !data
+ || !d_ptr->characteristicList.contains(data->charHandle)
+ || !d_ptr->characteristicList[data->charHandle].
+ descriptorList.contains(data->descHandle)) {
+ return QByteArray();
+ }
+
+ return d_ptr->characteristicList[data->charHandle].descriptorList[data->descHandle].value;
+}
+
+/*!
+ Returns the human-readable name of the descriptor.
+
+ The name is based on the descriptor's \l type(). The complete list
+ of descriptor types can be found under
+ \l {https://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorsHomePage.aspx}{Bluetooth.org Descriptors}.
+
+ The returned string is empty if the \l type() is unknown.
+
+ \sa type(), QBluetoothUuid::descriptorToString()
+*/
+
+QString QLowEnergyDescriptor::name() const
+{
+ return QBluetoothUuid::descriptorToString(type());
+}
+
+/*!
+ Returns the type of the descriptor.
+
+ \sa name()
+ */
+QBluetoothUuid::DescriptorType QLowEnergyDescriptor::type() const
+{
+ const QBluetoothUuid u = uuid();
+ bool ok = false;
+ quint16 shortUuid = u.toUInt16(&ok);
+
+ if (!ok)
+ return QBluetoothUuid::UnknownDescriptorType;
+
+ switch (shortUuid) {
+ case QBluetoothUuid::CharacteristicExtendedProperties:
+ case QBluetoothUuid::CharacteristicUserDescription:
+ case QBluetoothUuid::ClientCharacteristicConfiguration:
+ case QBluetoothUuid::ServerCharacteristicConfiguration:
+ case QBluetoothUuid::CharacteristicPresentationFormat:
+ case QBluetoothUuid::CharacteristicAggregateFormat:
+ case QBluetoothUuid::ValidRange:
+ case QBluetoothUuid::ExternalReportReference:
+ case QBluetoothUuid::ReportReference:
+ return (QBluetoothUuid::DescriptorType) shortUuid;
+ default:
+ break;
+ }
+
+ return QBluetoothUuid::UnknownDescriptorType;
+}
+
+/*!
+ \internal
+
+ Returns the handle of the characteristic to which this descriptor belongs
+ */
+QLowEnergyHandle QLowEnergyDescriptor::characteristicHandle() const
+{
+ if (d_ptr.isNull() || !data)
+ return 0;
+
+ return data->charHandle;
+}
+
+QT_END_NAMESPACE
diff --git a/src/bluetooth/qlowenergydescriptor.h b/src/bluetooth/qlowenergydescriptor.h
new file mode 100644
index 00000000..38c8518f
--- /dev/null
+++ b/src/bluetooth/qlowenergydescriptor.h
@@ -0,0 +1,85 @@
+/***************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QLOWENERGYDESCRIPTOR_H
+#define QLOWENERGYDESCRIPTOR_H
+
+#include <QtCore/QSharedPointer>
+#include <QtCore/QVariantMap>
+#include <QtBluetooth/qbluetooth.h>
+#include <QtBluetooth/QBluetoothUuid>
+
+QT_BEGIN_NAMESPACE
+
+class QLowEnergyDescriptorPrivate;
+class QLowEnergyServicePrivate;
+
+class Q_BLUETOOTH_EXPORT QLowEnergyDescriptor
+{
+public:
+ QLowEnergyDescriptor();
+ QLowEnergyDescriptor(const QLowEnergyDescriptor &other);
+ ~QLowEnergyDescriptor();
+
+ QLowEnergyDescriptor &operator=(const QLowEnergyDescriptor &other);
+ bool operator==(const QLowEnergyDescriptor &other) const;
+ bool operator!=(const QLowEnergyDescriptor &other) const;
+
+ bool isValid() const;
+
+ QByteArray value() const;
+
+ QBluetoothUuid uuid() const;
+ QLowEnergyHandle handle() const;
+ QString name() const;
+
+ QBluetoothUuid::DescriptorType type() const;
+
+protected:
+ QLowEnergyHandle characteristicHandle() const;
+ QSharedPointer<QLowEnergyServicePrivate> d_ptr;
+
+ friend class QLowEnergyCharacteristic;
+ friend class QLowEnergyService;
+ friend class QLowEnergyControllerPrivate;
+ QLowEnergyDescriptorPrivate *data;
+
+ QLowEnergyDescriptor(QSharedPointer<QLowEnergyServicePrivate> p,
+ QLowEnergyHandle charHandle,
+ QLowEnergyHandle descHandle);
+};
+
+QT_END_NAMESPACE
+
+#endif // QLOWENERGYDESCRIPTOR_H
diff --git a/src/bluetooth/qlowenergyservice.cpp b/src/bluetooth/qlowenergyservice.cpp
new file mode 100644
index 00000000..a55ed6e9
--- /dev/null
+++ b/src/bluetooth/qlowenergyservice.cpp
@@ -0,0 +1,508 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QPointer>
+#include <QtBluetooth/QLowEnergyService>
+
+#include <algorithm>
+
+#include "qlowenergycontroller_p.h"
+#include "qlowenergyserviceprivate_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QLowEnergyService
+ \inmodule QtBluetooth
+ \brief The QLowEnergyService class represents an individual service
+ on a Bluetooth Low Energy Device.
+
+ \since 5.4
+
+ QLowEnergyService provides access to the details of Bluetooth Low Energy
+ services. The class facilitates the discovery and publification of
+ service details, permits reading and writing of the contained data
+ and notifies about data changes.
+
+ \section1 Service Structure
+
+ A Bluetooth Low Energy peripheral device can contain multiple services.
+ In turn each service may include further services. This class represents a
+ single service of the peripheral device and is created via
+ \l QLowEnergyController::createServiceObject(). The \l type() indicates
+ whether this service is a primary (top-level) service or whether the
+ service is part of another service. Each service may contain one or more
+ characteristics and each characteristic may contain descriptors. The
+ resulting structure may look like the following diagram:
+
+ \image peripheral-structure.png Structure of a generic peripheral
+
+ A characteristic is the principle information carrier. It has a
+ \l {QLowEnergyCharacteristic::value()}{value()} and
+ \l {QLowEnergyCharacteristic::value()}{properties()}
+ describing the access permissions for the value. The general purpose
+ of the contained descriptor is to further define the nature of the
+ characteristic. For example, it might specify how the value is meant to be
+ interpreted or whether it can notify the value consumer about value
+ changes.
+
+ \section1 Service Interaction
+
+ Once a service object was created for the first time, its details are yet to
+ be discovered. This is indicated by its current \l state() being \l DiscoveryRequired.
+ It is only possible to retrieve the \l serviceUuid() and \l serviceName().
+
+ The discovery of its included services, characteristics and descriptors
+ is triggered when calling \l discoverDetails(). During the discovery the
+ \l state() transitions from \l DiscoveryRequired via \l DiscoveringServices
+ to its final \l ServiceDiscovered state. This transition is advertised via
+ the \l stateChanged() signal. Once the details are known, all of the contained
+ characteristics, descriptors and included services are known and can be read
+ or written.
+
+ The values of characteristics and descriptors can be retrieved via
+ \l QLowEnergyCharacteristic and \l QLowEnergyDescriptor, respectively.
+ However writing those attributes requires the service object. The
+ \l writeCharacteristic() function attempts to write a new value to the given
+ characteristic. If the write attempt is successful, the \l characteristicChanged()
+ signal is emitted. A failure to write triggers the \l CharacteristicWriteError.
+ Writing a descriptor follows the same pattern.
+
+ \section1 Service Data Sharing
+
+ Each QLowEnergyService instance shares its internal states and information
+ with other QLowEnergyService instance of the same service. If one instance
+ initiates the discovery of the service details, all remaining instances
+ automatically follow. Therefore the following snippet always works:
+
+ \snippet doc_src_qtbluetooth.cpp data_share_qlowenergyservice
+
+ Other operations such as calls to \l writeCharacteristic(),
+ writeDescriptor() or the invalidation of the service due to the
+ related \l QLowEnergyController disconnecting from the device are shared
+ the same way.
+
+ \sa QLowEnergyController, QLowEnergyCharacteristic, QLowEnergyDescriptor
+ */
+
+/*!
+ \enum QLowEnergyService::ServiceType
+
+ This enum describes the type of the service.
+
+ \value PrimaryService The service is a top-level/primary service.
+ If this type flag is not set, the service is considered
+ to be a secondary service. Each service may be included
+ by another service which is indicated by IncludedService.
+ \value IncludedService The service is included by another service.
+*/
+
+/*!
+ \enum QLowEnergyService::ServiceError
+
+ This enum describes all possible error conditions during the service's
+ existence. The \l error() function returns the last occurred error.
+
+ \value NoError No error has occurred.
+ \value OperationError An operation was attempted while the service was not ready.
+ An example might be the attempt to write to
+ the service while it was not yet in the
+ \l ServiceDiscovered \l state() or the service is invalid
+ due to a loss of connection to the peripheral device.
+ \value CharacteristicWriteError An attempt to write a new value to a characteristic
+ failed. For example, it might be triggered when attempting
+ to write to a read-only characteristic.
+ \value DescriptorWriteError An attempt to write a new value to a descriptor
+ failed. For example, it might be triggered when attempting
+ to write to a read-only descriptor.
+ */
+
+/*!
+ \enum QLowEnergyService::ServiceState
+
+ This enum describes the \l state() of the service object.
+
+ \value InvalidService A service can become invalid when it looses
+ the connection to the underlying device. Even though
+ the connection may be lost it retains its last information.
+ An invalid service cannot become valid anymore even if
+ the connection to the device is re-established.
+ \value DiscoveryRequired The service details are yet to be discovered by calling \l discoverDetails().
+ The only reliable pieces of information are its
+ \l serviceUuid() and \l serviceName().
+ \value DiscoveringServices The service details are being discovered.
+ \value ServiceDiscovered The service details have been discovered.
+ */
+
+/*!
+ \fn void QLowEnergyService::stateChanged(QLowEnergyService::ServiceState newState)
+
+ This signal is emitted when the service's state changes. The \a newState can also be
+ retrieved via \l state().
+
+ \sa state()
+ */
+
+/*!
+ \fn void QLowEnergyService::error(QLowEnergyService::ServiceError newError)
+
+ This signal is emitted when an error occurrs. The \a newError parameter
+ describes the error that occurred.
+ */
+
+/*!
+ \fn void QLowEnergyService::characteristicChanged(const QLowEnergyCharacteristic &characteristic, const QByteArray &newValue);
+
+ This signal is emitted when the value of \a characteristic
+ is successfully changed to \a newValue. The change may have been caused
+ by calling \l writeCharacteristic() or otherwise triggering a change
+ notification on the peripheral device.
+
+ \sa writeCharacteristic()
+ */
+
+/*!
+ \fn void QLowEnergyService::descriptorChanged(const QLowEnergyDescriptor &descriptor, const QByteArray &newValue)
+
+ This signal is emitted when the value of \a descriptor
+ is successfully changed to \a newValue. The change may have been caused
+ by calling \l writeDescriptor() or otherwise triggering a change
+ notification on the peripheral device.
+
+ \sa writeDescriptor()
+ */
+
+/*!
+ \internal
+
+ QLowEnergyControllerPrivate creates instances of this class.
+ The user gets access to class instances via
+ \l QLowEnergyController::services().
+ */
+QLowEnergyService::QLowEnergyService(QSharedPointer<QLowEnergyServicePrivate> p,
+ QObject *parent)
+ : QObject(parent),
+ d_ptr(p)
+{
+ qRegisterMetaType<QLowEnergyService::ServiceState>("QLowEnergyService::ServiceState");
+ qRegisterMetaType<QLowEnergyService::ServiceError>("QLowEnergyService::ServiceError");
+
+ connect(p.data(), SIGNAL(error(QLowEnergyService::ServiceError)),
+ this, SIGNAL(error(QLowEnergyService::ServiceError)));
+ connect(p.data(), SIGNAL(stateChanged(QLowEnergyService::ServiceState)),
+ this, SIGNAL(stateChanged(QLowEnergyService::ServiceState)));
+ connect(p.data(), SIGNAL(characteristicChanged(QLowEnergyCharacteristic,QByteArray)),
+ this, SIGNAL(characteristicChanged(QLowEnergyCharacteristic,QByteArray)));
+ connect(p.data(), SIGNAL(descriptorChanged(QLowEnergyDescriptor,QByteArray)),
+ this, SIGNAL(descriptorChanged(QLowEnergyDescriptor,QByteArray)));
+}
+
+/*!
+ Destroys the \l QLowEnergyService instance.
+ */
+QLowEnergyService::~QLowEnergyService()
+{
+}
+
+/*!
+ Returns the UUIDs of all services which are included by the
+ current service.
+
+ It is possible that an included service contains yet another service. Such
+ second level includes have to be obtained via their relevant first level
+ QLowEnergyService instance. Technically, this could create
+ a circular dependency.
+
+ \l {QLowEnergyController::createServiceObject()} should be used to obtain
+ service instances for each of the UUIDs.
+
+ \sa createServiceObject()
+ */
+QList<QBluetoothUuid> QLowEnergyService::includedServices() const
+{
+ return d_ptr->includedServices;
+}
+
+/*!
+ Returns the current state of the service.
+
+ If the device's service was instantiated for the first time, the object's
+ state is \l DiscoveryRequired. The state of all service objects which
+ point to the same service on the peripheral device are always equal.
+ This is caused by the shared nature of the internal object data.
+ Therefore any service object instance created after
+ the first one has a state equal to already existing instances.
+
+
+ A service becomes invalid if the \l QLowEnergyController disconnects
+ from the remote device. An invalid service retains its internal state
+ at the time of the disconnect event. This implies that once the service
+ details are discovered they can even be retrieved from an invalid
+ service. This permits scenarios where the device connection is established,
+ the service details are retrieved and the device immediately disconnected
+ to permit the next device to connect to the peripheral device.
+
+ However, under normal circumstances the connection should remain to avoid
+ repeated discovery of services and their details. The discovery may take
+ a while and the client can subscribe to ongoing change notifications.
+
+ \sa stateChanged()
+ */
+QLowEnergyService::ServiceState QLowEnergyService::state() const
+{
+ return d_ptr->state;
+}
+
+/*!
+ Returns the type of the service.
+ */
+QLowEnergyService::ServiceTypes QLowEnergyService::type() const
+{
+ return d_ptr->type;
+}
+
+/*!
+ Returns the matching characteristic for \a uuid; otherwise an invalid
+ characteristic.
+
+ \sa characteristics()
+*/
+QLowEnergyCharacteristic QLowEnergyService::characteristic(const QBluetoothUuid &uuid) const
+{
+ foreach (const QLowEnergyHandle handle, d_ptr->characteristicList.keys()) {
+ if (d_ptr->characteristicList[handle].uuid == uuid)
+ return QLowEnergyCharacteristic(d_ptr, handle);
+ }
+
+ return QLowEnergyCharacteristic();
+}
+
+/*!
+ Returns all characteristics associated with this \c QLowEnergyService instance.
+
+ The returned list is empty if this service instance's \l discoverDetails()
+ was not yet called or there are no known characteristics.
+
+ \sa characteristic(), state(), discoverDetails()
+*/
+
+QList<QLowEnergyCharacteristic> QLowEnergyService::characteristics() const
+{
+ QList<QLowEnergyCharacteristic> results;
+ QList<QLowEnergyHandle> handles = d_ptr->characteristicList.keys();
+ std::sort(handles.begin(), handles.end());
+
+ foreach (const QLowEnergyHandle &handle, handles) {
+ QLowEnergyCharacteristic characteristic(d_ptr, handle);
+ results.append(characteristic);
+ }
+ return results;
+}
+
+
+/*!
+ Returns the UUID of the service; otherwise a null UUID.
+ */
+QBluetoothUuid QLowEnergyService::serviceUuid() const
+{
+ return d_ptr->uuid;
+}
+
+
+/*!
+ Returns the name of the service; otherwise an empty string.
+
+ The returned name can only be retrieved if \l serviceUuid()
+ is a \l {https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx}{well-known UUID}.
+*/
+QString QLowEnergyService::serviceName() const
+{
+ bool ok = false;
+ quint16 clsId = d_ptr->uuid.toUInt16(&ok);
+ if (ok) {
+ QBluetoothUuid::ServiceClassUuid id
+ = static_cast<QBluetoothUuid::ServiceClassUuid>(clsId);
+ const QString name = QBluetoothUuid::serviceClassToString(id);
+ if (!name.isEmpty())
+ return name;
+ }
+ return qApp ?
+ qApp->translate("QBluetoothServiceDiscoveryAgent", "Unknown Service") :
+ QStringLiteral("Unknown Service");
+}
+
+
+/*!
+ Initiates the discovery of the services, characteristics
+ and descriptors contained by the service. The discovery process is indicated
+ via the \l stateChanged() signal.
+
+ \sa state()
+ */
+void QLowEnergyService::discoverDetails()
+{
+ Q_D(QLowEnergyService);
+
+ if (!d->controller || d->state == QLowEnergyService::InvalidService) {
+ d->setError(QLowEnergyService::OperationError);
+ return;
+ }
+
+ if (d->state != QLowEnergyService::DiscoveryRequired)
+ return;
+
+ d->setState(QLowEnergyService::DiscoveringServices);
+
+ d->controller->discoverServiceDetails(d->uuid);
+}
+
+/*!
+ Returns the last occurred error or \l NoError.
+ */
+QLowEnergyService::ServiceError QLowEnergyService::error() const
+{
+ return d_ptr->lastError;
+}
+
+/*!
+ Returns \c true if \a characteristic belongs to this service;
+ otherwise \c false.
+
+ A characteristic belongs to a service if \l characteristics()
+ contains the \a characteristic.
+ */
+bool QLowEnergyService::contains(const QLowEnergyCharacteristic &characteristic) const
+{
+ if (characteristic.d_ptr.isNull() || !characteristic.data)
+ return false;
+
+ if (d_ptr == characteristic.d_ptr
+ && d_ptr->characteristicList.contains(characteristic.attributeHandle())) {
+ return true;
+ }
+
+ return false;
+}
+
+/*!
+ Writes \a newValue as value for the \a characteristic. If the operation is successful,
+ the \l characteristicChanged() signal is emitted.
+
+ A characteristic can only be written if this service is in the \l ServiceDiscovered state,
+ belongs to the service and is writable.
+ */
+void QLowEnergyService::writeCharacteristic(
+ const QLowEnergyCharacteristic &characteristic, const QByteArray &newValue)
+{
+ //TODO check behavior when writing to WriteNoResponse characteristic
+ //TODO check behavior when writing to WriteSigned characteristic
+ //TODO add support for write long characteristic value (newValue.size() > MTU - 3)
+ Q_D(QLowEnergyService);
+
+ // not a characteristic of this service
+ if (!contains(characteristic))
+ return;
+
+ // don't write if we don't have to
+ if (characteristic.value() == newValue)
+ return;
+
+ // don't write write-protected or undiscovered characteristic
+ if (!(characteristic.properties() & QLowEnergyCharacteristic::Write)
+ || state() != ServiceDiscovered) {
+ d->setError(QLowEnergyService::OperationError);
+ return;
+ }
+
+ if (!d->controller)
+ return;
+
+ d->controller->writeCharacteristic(characteristic.d_ptr,
+ characteristic.attributeHandle(),
+ newValue);
+}
+
+/*!
+ Returns \c true if \a descriptor belongs to this service; otherwise \c false.
+ */
+bool QLowEnergyService::contains(const QLowEnergyDescriptor &descriptor) const
+{
+ if (descriptor.d_ptr.isNull() || !descriptor.data)
+ return false;
+
+ const QLowEnergyHandle charHandle = descriptor.characteristicHandle();
+ if (!charHandle)
+ return false;
+
+ if (d_ptr == descriptor.d_ptr
+ && d_ptr->characteristicList.contains(charHandle)
+ && d_ptr->characteristicList[charHandle].descriptorList.contains(descriptor.handle()))
+ {
+ return true;
+ }
+
+ return false;
+}
+
+/*!
+ Writes \a newValue as value for \a descriptor. If the operation is successful,
+ the \l descriptorChanged() signal is emitted.
+
+ A descriptor can only be written if this service is in the \l ServiceDiscovered state,
+ belongs to the service and is writable.
+ */
+void QLowEnergyService::writeDescriptor(const QLowEnergyDescriptor &descriptor,
+ const QByteArray &newValue)
+{
+ //TODO not all descriptors are writable (how to deal with write errors)
+ Q_D(QLowEnergyService);
+
+ if (!contains(descriptor))
+ return;
+
+ if (descriptor.value() == newValue)
+ return;
+
+ if (state() != ServiceDiscovered || !d->controller) {
+ d->setError(QLowEnergyService::OperationError);
+ return;
+ }
+
+ d->controller->writeDescriptor(descriptor.d_ptr,
+ descriptor.characteristicHandle(),
+ descriptor.handle(),
+ newValue);
+}
+
+QT_END_NAMESPACE
diff --git a/src/bluetooth/qlowenergyservice.h b/src/bluetooth/qlowenergyservice.h
new file mode 100644
index 00000000..37fa82d7
--- /dev/null
+++ b/src/bluetooth/qlowenergyservice.h
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QLOWENERGYSERVICE_H
+#define QLOWENERGYSERVICE_H
+
+#include <QtBluetooth/QBluetoothAddress>
+#include <QtBluetooth/QBluetoothUuid>
+#include <QtBluetooth/QLowEnergyCharacteristic>
+
+QT_BEGIN_NAMESPACE
+
+class QLowEnergyServicePrivate;
+class QLowEnergyControllerPrivate;
+class Q_BLUETOOTH_EXPORT QLowEnergyService : public QObject
+{
+ Q_OBJECT
+public:
+ enum ServiceType {
+ PrimaryService = 0x0001,
+ IncludedService = 0x0002
+ };
+ Q_DECLARE_FLAGS(ServiceTypes, ServiceType)
+
+ enum ServiceError {
+ NoError = 0,
+ OperationError,
+ CharacteristicWriteError,
+ DescriptorWriteError
+ };
+
+ enum ServiceState {
+ InvalidService = 0,
+ DiscoveryRequired, // we know start/end handle but nothing more
+ //TODO Rename DiscoveringServices -> DiscoveringDetails or DiscoveringService
+ DiscoveringServices,// discoverDetails() called and running
+ ServiceDiscovered, // all details have been synchronized
+ };
+
+ ~QLowEnergyService();
+
+ QList<QBluetoothUuid> includedServices() const;
+
+ QLowEnergyService::ServiceTypes type() const;
+ QLowEnergyService::ServiceState state() const;
+
+ QLowEnergyCharacteristic characteristic(const QBluetoothUuid &uuid) const;
+ QList<QLowEnergyCharacteristic> characteristics() const;
+ QBluetoothUuid serviceUuid() const;
+ QString serviceName() const;
+
+ void discoverDetails();
+
+ ServiceError error() const;
+
+ bool contains(const QLowEnergyCharacteristic &characteristic) const;
+ void writeCharacteristic(const QLowEnergyCharacteristic &characteristic,
+ const QByteArray &newValue);
+
+ bool contains(const QLowEnergyDescriptor &descriptor) const;
+ void writeDescriptor(const QLowEnergyDescriptor &descriptor,
+ const QByteArray &newValue);
+
+Q_SIGNALS:
+ void stateChanged(QLowEnergyService::ServiceState newState);
+ void characteristicChanged(const QLowEnergyCharacteristic &info,
+ const QByteArray &value);
+ void descriptorChanged(const QLowEnergyDescriptor &info,
+ const QByteArray &value);
+ void error(QLowEnergyService::ServiceError error);
+
+private:
+ Q_DECLARE_PRIVATE(QLowEnergyService)
+ QSharedPointer<QLowEnergyServicePrivate> d_ptr;
+
+ // QLowEnergyController is the factory for this class
+ friend class QLowEnergyController;
+ QLowEnergyService(QSharedPointer<QLowEnergyServicePrivate> p,
+ QObject *parent = 0);
+};
+
+QT_END_NAMESPACE
+
+#endif // QLOWENERGYSERVICE_H
diff --git a/src/bluetooth/qlowenergyserviceinfo.cpp b/src/bluetooth/qlowenergyserviceinfo.cpp
new file mode 100644
index 00000000..e5956e25
--- /dev/null
+++ b/src/bluetooth/qlowenergyserviceinfo.cpp
@@ -0,0 +1,172 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited all rights reserved
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qlowenergyserviceinfo.h"
+#include "qlowenergyserviceinfo_p.h"
+#include <QtCore/QCoreApplication>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QLowEnergyServiceInfo
+ \inmodule QtBluetooth
+ \brief The QLowEnergyServiceInfo class stores information about the Bluetooth
+ Low Energy service.
+ \since 5.4
+
+ QLowEnergyServiceInfo provides information about a Bluetooth Low Energy
+ service's name, device, UUID, connection status, service type, handle
+ and characteristics. A Bluetooth Low Energy device can have one or more
+ low energy services. Each low energy service contains one or more
+ characteristics. The class is used with the QLowEnergyController
+ class. It is necessary to connect to the service first in order
+ to get the all service information and characteristics.
+*/
+
+/*!
+ \enum QLowEnergyServiceInfo::ServiceType
+
+ This enum describes the type of the service. One LE device can have one or more primary services.
+
+ \value PrimaryService The primary service. The primary service can have one or
+ more included services.
+ \value IncludedService The included service by primary services.
+*/
+
+/*!
+ Construct a new QLowEnergyServiceInfo.
+*/
+QLowEnergyServiceInfo::QLowEnergyServiceInfo():
+ d_ptr(QSharedPointer<QLowEnergyServiceInfoPrivate>(new QLowEnergyServiceInfoPrivate))
+{
+
+}
+
+/*!
+ Construct a new QLowEnergyServiceInfo object with the given \a uuid.
+
+ Based on uuid, corresponsing service name is given.
+*/
+QLowEnergyServiceInfo::QLowEnergyServiceInfo(const QBluetoothUuid &uuid):
+ d_ptr(QSharedPointer<QLowEnergyServiceInfoPrivate>(new QLowEnergyServiceInfoPrivate))
+{
+ d_ptr->uuid = QBluetoothUuid(uuid);
+}
+
+/*!
+ Construct a new QLowEnergyServiceInfo that is a copy of \a other.
+
+ The two copies continue to share the same underlying data which does not detach
+ upon write.
+*/
+QLowEnergyServiceInfo::QLowEnergyServiceInfo(const QLowEnergyServiceInfo &other):
+ d_ptr(other.d_ptr)
+{
+
+}
+
+/*!
+ Destroys the QLowEnergyServiceInfo object.
+*/
+QLowEnergyServiceInfo::~QLowEnergyServiceInfo()
+{
+
+}
+
+/*!
+ Returns the gatt service uuid.
+*/
+QBluetoothUuid QLowEnergyServiceInfo::serviceUuid() const
+{
+ return d_ptr->uuid;
+}
+
+/*!
+ Returns the service name.
+*/
+QString QLowEnergyServiceInfo::serviceName() const
+{
+ bool ok = false;
+ quint16 clsId = d_ptr->uuid.toUInt16(&ok);
+ if (ok) {
+ QBluetoothUuid::ServiceClassUuid id
+ = static_cast<QBluetoothUuid::ServiceClassUuid>(clsId);
+ return QBluetoothUuid::serviceClassToString(id);
+ }
+ return qApp ?
+ qApp->translate("QBluetoothServiceDiscoveryAgent", "Unknown Service") :
+ QStringLiteral("Unknown Service");
+}
+
+/*!
+ Returns a copy of \a other and assigns it to this QLowEnergyServiceInfo object.
+ The two copies continue to share the same service and registration details.
+*/
+QLowEnergyServiceInfo &QLowEnergyServiceInfo::operator=(const QLowEnergyServiceInfo &other)
+{
+ d_ptr = other.d_ptr;
+ return *this;
+}
+
+/*!
+ Returns the address of the Bluetooth device that provides this service.
+*/
+QBluetoothDeviceInfo QLowEnergyServiceInfo::device() const
+{
+ return d_ptr->deviceInfo;
+}
+
+/*!
+ Sets the Bluetooth device that provides this service to \a device.
+*/
+void QLowEnergyServiceInfo::setDevice(const QBluetoothDeviceInfo &device)
+{
+ d_ptr->deviceInfo = device;
+}
+
+/*!
+ Returns true if the QLowEnergyServiceInfo object is valid, otherwise returns false.
+*/
+bool QLowEnergyServiceInfo::isValid() const
+{
+ if (d_ptr->uuid == QBluetoothUuid())
+ return false;
+ if (!d_ptr->deviceInfo.isValid())
+ return false;
+ return true;
+}
+
+QT_END_NAMESPACE
+
+
diff --git a/src/bluetooth/qlowenergyserviceinfo.h b/src/bluetooth/qlowenergyserviceinfo.h
new file mode 100644
index 00000000..cfe1e4d6
--- /dev/null
+++ b/src/bluetooth/qlowenergyserviceinfo.h
@@ -0,0 +1,73 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited all rights reserved
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QLOWENERGYSERVICEINFO_H
+#define QLOWENERGYSERVICEINFO_H
+#include <QtCore/QSharedPointer>
+#include <QtBluetooth/QBluetoothAddress>
+#include <QtBluetooth/QBluetoothDeviceInfo>
+#include <QtBluetooth/QBluetoothUuid>
+
+QT_BEGIN_NAMESPACE
+
+class QLowEnergyServiceInfoPrivate;
+
+class Q_BLUETOOTH_EXPORT QLowEnergyServiceInfo
+{
+public:
+ QLowEnergyServiceInfo();
+ QLowEnergyServiceInfo(const QBluetoothUuid &uuid);
+ QLowEnergyServiceInfo(const QLowEnergyServiceInfo &other);
+
+ ~QLowEnergyServiceInfo();
+
+ QLowEnergyServiceInfo &operator=(const QLowEnergyServiceInfo &other);
+
+ void setDevice(const QBluetoothDeviceInfo &info);
+ QBluetoothDeviceInfo device() const;
+
+ QBluetoothUuid serviceUuid() const;
+
+ QString serviceName() const;
+
+ bool isValid() const;
+
+protected:
+ QSharedPointer<QLowEnergyServiceInfoPrivate> d_ptr;
+
+};
+
+QT_END_NAMESPACE
+
+#endif // QLOWENERGYSERVICEINFO_H
diff --git a/src/bluetooth/qlowenergyserviceinfo_p.h b/src/bluetooth/qlowenergyserviceinfo_p.h
new file mode 100644
index 00000000..ad372339
--- /dev/null
+++ b/src/bluetooth/qlowenergyserviceinfo_p.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited all rights reserved
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QLOWENERGYSERVICEINFO_P_H
+#define QLOWENERGYSERVICEINFO_P_H
+#include "qlowenergyserviceinfo.h"
+
+QT_BEGIN_NAMESPACE
+
+class QLowEnergyServiceInfoPrivate
+{
+public:
+ QBluetoothUuid uuid;
+ QBluetoothDeviceInfo deviceInfo;
+};
+
+QT_END_NAMESPACE
+
+#endif // QLOWENERGYSERVICEINFO_P_H
diff --git a/src/bluetooth/qlowenergyserviceprivate.cpp b/src/bluetooth/qlowenergyserviceprivate.cpp
new file mode 100644
index 00000000..43bb3498
--- /dev/null
+++ b/src/bluetooth/qlowenergyserviceprivate.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qlowenergyserviceprivate_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QLowEnergyServicePrivate::QLowEnergyServicePrivate(QObject *parent) :
+ QObject(parent),
+ type(QLowEnergyService::PrimaryService),
+ state(QLowEnergyService::InvalidService),
+ lastError(QLowEnergyService::NoError)
+{
+}
+
+QLowEnergyServicePrivate::~QLowEnergyServicePrivate()
+{
+}
+
+void QLowEnergyServicePrivate::setController(QLowEnergyControllerPrivate *control)
+{
+ controller = control;
+
+ if (control)
+ setState(QLowEnergyService::DiscoveryRequired);
+ else
+ setState(QLowEnergyService::InvalidService);
+}
+
+void QLowEnergyServicePrivate::setError(QLowEnergyService::ServiceError newError)
+{
+ lastError = newError;
+ emit error(newError);
+}
+
+void QLowEnergyServicePrivate::setState(QLowEnergyService::ServiceState newState)
+{
+ state = newState;
+ emit stateChanged(newState);
+}
+
+QT_END_NAMESPACE
diff --git a/src/bluetooth/qlowenergyserviceprivate_p.h b/src/bluetooth/qlowenergyserviceprivate_p.h
new file mode 100644
index 00000000..ec87da1f
--- /dev/null
+++ b/src/bluetooth/qlowenergyserviceprivate_p.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QLOWENERGYSERVICEPRIVATE_P_H
+#define QLOWENERGYSERVICEPRIVATE_P_H
+
+#include <QtCore/QObject>
+#include <QtCore/QPointer>
+#include <QtBluetooth/qbluetooth.h>
+#include <QtBluetooth/QLowEnergyService>
+#include <QtBluetooth/QLowEnergyCharacteristic>
+
+#include "qlowenergycontroller_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QLowEnergyServicePrivate : public QObject
+{
+ Q_OBJECT
+public:
+ explicit QLowEnergyServicePrivate(QObject *parent = 0);
+ ~QLowEnergyServicePrivate();
+
+ struct DescData {
+ QByteArray value;
+ QBluetoothUuid uuid;
+ };
+
+ struct CharData {
+ QLowEnergyHandle valueHandle;
+ QBluetoothUuid uuid;
+ QLowEnergyCharacteristic::PropertyTypes properties;
+ QByteArray value;
+ QHash<QLowEnergyHandle, DescData> descriptorList;
+ };
+
+ enum GattAttributeTypes {
+ PrimaryService = 0x2800,
+ SecondaryService = 0x2801,
+ IncludeAttribute = 0x2802,
+ Characteristic = 0x2803
+ };
+
+ void setController(QLowEnergyControllerPrivate* control);
+ void setError(QLowEnergyService::ServiceError newError);
+ void setState(QLowEnergyService::ServiceState newState);
+
+signals:
+ void stateChanged(QLowEnergyService::ServiceState newState);
+ void error(QLowEnergyService::ServiceError error);
+ void characteristicChanged(const QLowEnergyCharacteristic &characteristic,
+ const QByteArray &newValue);
+ void descriptorChanged(const QLowEnergyDescriptor &descriptor,
+ const QByteArray &newValue);
+
+public:
+ QLowEnergyHandle startHandle;
+ QLowEnergyHandle endHandle;
+
+ QBluetoothUuid uuid;
+ QList<QBluetoothUuid> includedServices;
+ QLowEnergyService::ServiceTypes type;
+ QLowEnergyService::ServiceState state;
+ QLowEnergyService::ServiceError lastError;
+
+ QHash<QLowEnergyHandle, CharData> characteristicList;
+
+ QPointer<QLowEnergyControllerPrivate> controller;
+};
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QSharedPointer<QLowEnergyServicePrivate>)
+
+#endif // QLOWENERGYSERVICEPRIVATE_P_H
diff --git a/src/bluetooth/qnx/ppshelpers.cpp b/src/bluetooth/qnx/ppshelpers.cpp
index 9b1d3e4b..eaf9c374 100644
--- a/src/bluetooth/qnx/ppshelpers.cpp
+++ b/src/bluetooth/qnx/ppshelpers.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/bluetooth/qnx/ppshelpers_p.h b/src/bluetooth/qnx/ppshelpers_p.h
index 0eaea981..e771fd8e 100644
--- a/src/bluetooth/qnx/ppshelpers_p.h
+++ b/src/bluetooth/qnx/ppshelpers_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -74,7 +66,7 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT_QNX)
class BBSocketNotifier : public QObject
{
Q_OBJECT
-public Q_SLOTS:
+public slots:
void distribute();
void closeControlFD();
};
diff --git a/src/bluetooth/qprivatelinearbuffer_p.h b/src/bluetooth/qprivatelinearbuffer_p.h
index d8f6d218..b13e68d3 100644
--- a/src/bluetooth/qprivatelinearbuffer_p.h
+++ b/src/bluetooth/qprivatelinearbuffer_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/bluetooth/plugin.cpp b/src/imports/bluetooth/plugin.cpp
index bcf59794..24206106 100644
--- a/src/imports/bluetooth/plugin.cpp
+++ b/src/imports/bluetooth/plugin.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -75,9 +67,9 @@ public:
qmlRegisterType<QDeclarativeBluetoothService >(uri, major, minor, "BluetoothService");
qmlRegisterType<QDeclarativeBluetoothSocket >(uri, major, minor, "BluetoothSocket");
- // Register the 5.3 types
- // introduces 5.3 version, other existing 5.2 exports automatically become availabe under 5.3 as well
- minor = 3;
+ // Register the 5.4 types
+ // introduces 5.4 version, other existing 5.2 exports become automatically available under 5.2-5.4
+ minor = 4;
qmlRegisterType<QDeclarativeBluetoothDiscoveryModel >(uri, major, minor, "BluetoothDiscoveryModel");
}
};
diff --git a/src/imports/bluetooth/plugins.qmltypes b/src/imports/bluetooth/plugins.qmltypes
index 18647c2c..f7d0d08d 100644
--- a/src/imports/bluetooth/plugins.qmltypes
+++ b/src/imports/bluetooth/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.1
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -notrelocatable QtBluetooth 5.3'
+// 'qmlplugindump -notrelocatable QtBluetooth 5.4'
Module {
Component {
@@ -13,7 +13,7 @@ Module {
exports: [
"QtBluetooth/BluetoothDiscoveryModel 5.0",
"QtBluetooth/BluetoothDiscoveryModel 5.2",
- "QtBluetooth/BluetoothDiscoveryModel 5.3"
+ "QtBluetooth/BluetoothDiscoveryModel 5.4"
]
exportMetaObjectRevisions: [0, 0, 0]
Enum {
diff --git a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp
index d042bdfe..20f47f65 100644
--- a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp
+++ b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp
@@ -1,41 +1,33 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -418,7 +410,7 @@ void QDeclarativeBluetoothDiscoveryModel::setRunning(bool running)
}
}
- Q_EMIT runningChanged();
+ emit runningChanged();
}
/*!
@@ -472,5 +464,5 @@ QString QDeclarativeBluetoothDiscoveryModel::remoteAddress()
void QDeclarativeBluetoothDiscoveryModel::setRemoteAddress(QString address)
{
d->m_remoteAddress = address;
- Q_EMIT remoteAddressChanged();
+ emit remoteAddressChanged();
}
diff --git a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h
index 5e372b7d..279fb063 100644
--- a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h
+++ b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h
@@ -1,41 +1,33 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/bluetooth/qdeclarativebluetoothservice.cpp b/src/imports/bluetooth/qdeclarativebluetoothservice.cpp
index e246ca8d..749dd65d 100644
--- a/src/imports/bluetooth/qdeclarativebluetoothservice.cpp
+++ b/src/imports/bluetooth/qdeclarativebluetoothservice.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/bluetooth/qdeclarativebluetoothservice_p.h b/src/imports/bluetooth/qdeclarativebluetoothservice_p.h
index b617d595..0e04b790 100644
--- a/src/imports/bluetooth/qdeclarativebluetoothservice_p.h
+++ b/src/imports/bluetooth/qdeclarativebluetoothservice_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/bluetooth/qdeclarativebluetoothsocket.cpp b/src/imports/bluetooth/qdeclarativebluetoothsocket.cpp
index 75a1b85c..a53b0cca 100644
--- a/src/imports/bluetooth/qdeclarativebluetoothsocket.cpp
+++ b/src/imports/bluetooth/qdeclarativebluetoothsocket.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/bluetooth/qdeclarativebluetoothsocket_p.h b/src/imports/bluetooth/qdeclarativebluetoothsocket_p.h
index f850ae57..35a8c504 100644
--- a/src/imports/bluetooth/qdeclarativebluetoothsocket_p.h
+++ b/src/imports/bluetooth/qdeclarativebluetoothsocket_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/nfc/plugin.cpp b/src/imports/nfc/plugin.cpp
index 8694e185..52b4db9c 100644
--- a/src/imports/nfc/plugin.cpp
+++ b/src/imports/nfc/plugin.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -43,7 +35,6 @@
#include <QtQml/QQmlExtensionPlugin>
#include "qqmlndefrecord.h"
-//#include "qdeclarativenearfieldsocket_p.h"
#include "qdeclarativenearfield_p.h"
#include "qdeclarativendeffilter_p.h"
#include "qdeclarativendeftextrecord_p.h"
@@ -67,7 +58,6 @@ public:
// Register the 5.0 types
int major = 5;
int minor = 0;
- //qmlRegisterType<QDeclarativeNearFieldSocket>(uri, major, minor, "NearFieldSocket");
qmlRegisterType<QDeclarativeNearField>(uri, major, minor, "NearField");
qmlRegisterType<QDeclarativeNdefFilter>(uri, major, minor, "NdefFilter");
@@ -85,9 +75,9 @@ public:
qmlRegisterType<QDeclarativeNdefUriRecord>(uri, major, minor, "NdefUriRecord");
qmlRegisterType<QDeclarativeNdefMimeRecord>(uri, major, minor, "NdefMimeRecord");
- // Register the 5.3 types
- // introduces 5.3 version, other existing 5.2 exports automatically become availabe under 5.3 as well
- minor = 3;
+ // Register the 5.4 types
+ // introduces 5.4 version, other existing 5.2 exports become automatically available under 5.2-5.4l
+ minor = 4;
qmlRegisterType<QDeclarativeNearField>(uri, major, minor, "NearField");
}
};
diff --git a/src/imports/nfc/plugins.qmltypes b/src/imports/nfc/plugins.qmltypes
index fff2834f..bbdc4398 100644
--- a/src/imports/nfc/plugins.qmltypes
+++ b/src/imports/nfc/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.1
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -notrelocatable QtNfc 5.3'
+// 'qmlplugindump -notrelocatable QtNfc 5.4'
Module {
Component {
@@ -55,7 +55,7 @@ Module {
exports: [
"QtNfc/NearField 5.0",
"QtNfc/NearField 5.2",
- "QtNfc/NearField 5.3"
+ "QtNfc/NearField 5.4"
]
exportMetaObjectRevisions: [0, 0, 0]
Property { name: "messageRecords"; type: "QQmlNdefRecord"; isList: true; isReadonly: true }
diff --git a/src/imports/nfc/qdeclarativendeffilter.cpp b/src/imports/nfc/qdeclarativendeffilter.cpp
index 5d1dd43f..7c6d725e 100644
--- a/src/imports/nfc/qdeclarativendeffilter.cpp
+++ b/src/imports/nfc/qdeclarativendeffilter.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -129,7 +121,7 @@ void QDeclarativeNdefFilter::setTypeNameFormat(QQmlNdefRecord::TypeNameFormat fo
return;
m_typeNameFormat = format;
- Q_EMIT(typeNameFormatChanged());
+ emit typeNameFormatChanged();
}
int QDeclarativeNdefFilter::minimum() const
diff --git a/src/imports/nfc/qdeclarativendeffilter_p.h b/src/imports/nfc/qdeclarativendeffilter_p.h
index 206e2466..e5b2fced 100644
--- a/src/imports/nfc/qdeclarativendeffilter_p.h
+++ b/src/imports/nfc/qdeclarativendeffilter_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/nfc/qdeclarativendefmimerecord.cpp b/src/imports/nfc/qdeclarativendefmimerecord.cpp
index 3141c94f..65915275 100644
--- a/src/imports/nfc/qdeclarativendefmimerecord.cpp
+++ b/src/imports/nfc/qdeclarativendefmimerecord.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/nfc/qdeclarativendefmimerecord_p.h b/src/imports/nfc/qdeclarativendefmimerecord_p.h
index 2cd03447..8438a1f6 100644
--- a/src/imports/nfc/qdeclarativendefmimerecord_p.h
+++ b/src/imports/nfc/qdeclarativendefmimerecord_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/nfc/qdeclarativendeftextrecord.cpp b/src/imports/nfc/qdeclarativendeftextrecord.cpp
index bd63aa2b..8e5507a2 100644
--- a/src/imports/nfc/qdeclarativendeftextrecord.cpp
+++ b/src/imports/nfc/qdeclarativendeftextrecord.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/nfc/qdeclarativendeftextrecord_p.h b/src/imports/nfc/qdeclarativendeftextrecord_p.h
index a657d9ef..ca11c017 100644
--- a/src/imports/nfc/qdeclarativendeftextrecord_p.h
+++ b/src/imports/nfc/qdeclarativendeftextrecord_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/nfc/qdeclarativendefurirecord.cpp b/src/imports/nfc/qdeclarativendefurirecord.cpp
index a1f4824f..ec0f4bb8 100644
--- a/src/imports/nfc/qdeclarativendefurirecord.cpp
+++ b/src/imports/nfc/qdeclarativendefurirecord.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/nfc/qdeclarativendefurirecord_p.h b/src/imports/nfc/qdeclarativendefurirecord_p.h
index 803466fc..02abe36e 100644
--- a/src/imports/nfc/qdeclarativendefurirecord_p.h
+++ b/src/imports/nfc/qdeclarativendefurirecord_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/nfc/qdeclarativenearfield.cpp b/src/imports/nfc/qdeclarativenearfield.cpp
index b1aeced7..30d020b9 100644
--- a/src/imports/nfc/qdeclarativenearfield.cpp
+++ b/src/imports/nfc/qdeclarativenearfield.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/nfc/qdeclarativenearfield_p.h b/src/imports/nfc/qdeclarativenearfield_p.h
index 9a954dad..2e151e36 100644
--- a/src/imports/nfc/qdeclarativenearfield_p.h
+++ b/src/imports/nfc/qdeclarativenearfield_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/nfc/qdeclarativenearfieldsocket.cpp b/src/imports/nfc/qdeclarativenearfieldsocket.cpp
index 062970b7..77b12fb5 100644
--- a/src/imports/nfc/qdeclarativenearfieldsocket.cpp
+++ b/src/imports/nfc/qdeclarativenearfieldsocket.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/nfc/qdeclarativenearfieldsocket_p.h b/src/imports/nfc/qdeclarativenearfieldsocket_p.h
index bc7cb1c3..e6664d8e 100644
--- a/src/imports/nfc/qdeclarativenearfieldsocket_p.h
+++ b/src/imports/nfc/qdeclarativenearfieldsocket_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/doc/qtnfc.qdocconf b/src/nfc/doc/qtnfc.qdocconf
index 2d5b0ef5..61ed15b6 100644
--- a/src/nfc/doc/qtnfc.qdocconf
+++ b/src/nfc/doc/qtnfc.qdocconf
@@ -2,7 +2,6 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtNfc
description = Qt NFC Reference Documentation
-url = http://qt-project.org/doc/qt-$QT_VER
version = $QT_VERSION
examplesinstallpath = nfc
diff --git a/src/nfc/qllcpserver.cpp b/src/nfc/qllcpserver.cpp
index e7a2982d..c29295a5 100644
--- a/src/nfc/qllcpserver.cpp
+++ b/src/nfc/qllcpserver.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qllcpserver_p.cpp b/src/nfc/qllcpserver_p.cpp
index c22c868a..f7eca859 100644
--- a/src/nfc/qllcpserver_p.cpp
+++ b/src/nfc/qllcpserver_p.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qllcpserver_p.h b/src/nfc/qllcpserver_p.h
index 5d72f558..f7be4e35 100644
--- a/src/nfc/qllcpserver_p.h
+++ b/src/nfc/qllcpserver_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -84,7 +76,7 @@ public:
QLlcpSocket::SocketError serverError() const;
-Q_SIGNALS:
+signals:
void newConnection();
private:
diff --git a/src/nfc/qllcpserver_p_p.h b/src/nfc/qllcpserver_p_p.h
index 5dd5749c..fb95bea5 100644
--- a/src/nfc/qllcpserver_p_p.h
+++ b/src/nfc/qllcpserver_p_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qllcpserver_qnx_p.cpp b/src/nfc/qllcpserver_qnx_p.cpp
index f0b56d15..9351d505 100644
--- a/src/nfc/qllcpserver_qnx_p.cpp
+++ b/src/nfc/qllcpserver_qnx_p.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qllcpserver_qnx_p.h b/src/nfc/qllcpserver_qnx_p.h
index 89706b03..005d23d3 100644
--- a/src/nfc/qllcpserver_qnx_p.h
+++ b/src/nfc/qllcpserver_qnx_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qllcpserver_simulator_p.cpp b/src/nfc/qllcpserver_simulator_p.cpp
index 59ab0af8..53b92689 100644
--- a/src/nfc/qllcpserver_simulator_p.cpp
+++ b/src/nfc/qllcpserver_simulator_p.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qllcpserver_simulator_p.h b/src/nfc/qllcpserver_simulator_p.h
index 11bf2ea3..6381d403 100644
--- a/src/nfc/qllcpserver_simulator_p.h
+++ b/src/nfc/qllcpserver_simulator_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qllcpsocket.cpp b/src/nfc/qllcpsocket.cpp
index 79cb1284..1e701e67 100644
--- a/src/nfc/qllcpsocket.cpp
+++ b/src/nfc/qllcpsocket.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qllcpsocket_p.cpp b/src/nfc/qllcpsocket_p.cpp
index b1af336f..700b97f0 100644
--- a/src/nfc/qllcpsocket_p.cpp
+++ b/src/nfc/qllcpsocket_p.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qllcpsocket_p.h b/src/nfc/qllcpsocket_p.h
index 6bda57be..4b74e203 100644
--- a/src/nfc/qllcpsocket_p.h
+++ b/src/nfc/qllcpsocket_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -121,7 +113,7 @@ public:
virtual bool waitForDisconnected(int msecs = 30000);
bool isSequential() const;
-Q_SIGNALS:
+signals:
void connected();
void disconnected();
void error(QLlcpSocket::SocketError socketError);
diff --git a/src/nfc/qllcpsocket_p_p.h b/src/nfc/qllcpsocket_p_p.h
index e40c720c..7d10278d 100644
--- a/src/nfc/qllcpsocket_p_p.h
+++ b/src/nfc/qllcpsocket_p_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qllcpsocket_qnx_p.cpp b/src/nfc/qllcpsocket_qnx_p.cpp
index d74e68d8..c35f570c 100644
--- a/src/nfc/qllcpsocket_qnx_p.cpp
+++ b/src/nfc/qllcpsocket_qnx_p.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qllcpsocket_qnx_p.h b/src/nfc/qllcpsocket_qnx_p.h
index 29206f7f..de552eb3 100644
--- a/src/nfc/qllcpsocket_qnx_p.h
+++ b/src/nfc/qllcpsocket_qnx_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -105,7 +97,7 @@ public:
void dataRead(QByteArray&);
void dataWritten();
-public Q_SLOTS:
+public slots:
void disconnectFromService();
private:
@@ -126,7 +118,7 @@ private:
Idle, Reading, Writing
} socketState;
-private Q_SLOTS:
+private slots:
void read();
void enteringIdle();
};
diff --git a/src/nfc/qllcpsocket_simulator_p.cpp b/src/nfc/qllcpsocket_simulator_p.cpp
index edef7584..d418d654 100644
--- a/src/nfc/qllcpsocket_simulator_p.cpp
+++ b/src/nfc/qllcpsocket_simulator_p.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qllcpsocket_simulator_p.h b/src/nfc/qllcpsocket_simulator_p.h
index 1b5eeaba..76af2f01 100644
--- a/src/nfc/qllcpsocket_simulator_p.h
+++ b/src/nfc/qllcpsocket_simulator_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qndeffilter.cpp b/src/nfc/qndeffilter.cpp
index 27d08e20..fc3f65b6 100644
--- a/src/nfc/qndeffilter.cpp
+++ b/src/nfc/qndeffilter.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qndeffilter.h b/src/nfc/qndeffilter.h
index 5b121cc2..053dfe21 100644
--- a/src/nfc/qndeffilter.h
+++ b/src/nfc/qndeffilter.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qndefmessage.cpp b/src/nfc/qndefmessage.cpp
index 99eb7ce2..c55d141e 100644
--- a/src/nfc/qndefmessage.cpp
+++ b/src/nfc/qndefmessage.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qndefmessage.h b/src/nfc/qndefmessage.h
index 66a2f260..1aca198c 100644
--- a/src/nfc/qndefmessage.h
+++ b/src/nfc/qndefmessage.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qndefnfcsmartposterrecord.cpp b/src/nfc/qndefnfcsmartposterrecord.cpp
index f2e9f1d5..23747ea9 100644
--- a/src/nfc/qndefnfcsmartposterrecord.cpp
+++ b/src/nfc/qndefnfcsmartposterrecord.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qndefnfcsmartposterrecord.h b/src/nfc/qndefnfcsmartposterrecord.h
index c317c92f..ffd45dad 100644
--- a/src/nfc/qndefnfcsmartposterrecord.h
+++ b/src/nfc/qndefnfcsmartposterrecord.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qndefnfcsmartposterrecord_p.h b/src/nfc/qndefnfcsmartposterrecord_p.h
index 55530d76..093a4253 100644
--- a/src/nfc/qndefnfcsmartposterrecord_p.h
+++ b/src/nfc/qndefnfcsmartposterrecord_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qndefnfctextrecord.cpp b/src/nfc/qndefnfctextrecord.cpp
index e22c35e6..3bb27288 100644
--- a/src/nfc/qndefnfctextrecord.cpp
+++ b/src/nfc/qndefnfctextrecord.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qndefnfctextrecord.h b/src/nfc/qndefnfctextrecord.h
index 30e0eeb4..05a85949 100644
--- a/src/nfc/qndefnfctextrecord.h
+++ b/src/nfc/qndefnfctextrecord.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qndefnfcurirecord.cpp b/src/nfc/qndefnfcurirecord.cpp
index a38b1252..c58b2a26 100644
--- a/src/nfc/qndefnfcurirecord.cpp
+++ b/src/nfc/qndefnfcurirecord.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qndefnfcurirecord.h b/src/nfc/qndefnfcurirecord.h
index 1f96e4d8..38686544 100644
--- a/src/nfc/qndefnfcurirecord.h
+++ b/src/nfc/qndefnfcurirecord.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qndefrecord.cpp b/src/nfc/qndefrecord.cpp
index a1673def..3af010e5 100644
--- a/src/nfc/qndefrecord.cpp
+++ b/src/nfc/qndefrecord.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qndefrecord.h b/src/nfc/qndefrecord.h
index 63ef04c8..8c61d8c2 100644
--- a/src/nfc/qndefrecord.h
+++ b/src/nfc/qndefrecord.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qndefrecord_p.h b/src/nfc/qndefrecord_p.h
index 5bfd48f6..04e9c72c 100644
--- a/src/nfc/qndefrecord_p.h
+++ b/src/nfc/qndefrecord_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldmanager.cpp b/src/nfc/qnearfieldmanager.cpp
index 88656a6e..d79b2a82 100644
--- a/src/nfc/qnearfieldmanager.cpp
+++ b/src/nfc/qnearfieldmanager.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldmanager.h b/src/nfc/qnearfieldmanager.h
index 0e91abcc..7fad3b4d 100644
--- a/src/nfc/qnearfieldmanager.h
+++ b/src/nfc/qnearfieldmanager.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldmanager_emulator.cpp b/src/nfc/qnearfieldmanager_emulator.cpp
index ea699a73..c532fea1 100644
--- a/src/nfc/qnearfieldmanager_emulator.cpp
+++ b/src/nfc/qnearfieldmanager_emulator.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldmanager_emulator_p.h b/src/nfc/qnearfieldmanager_emulator_p.h
index 26aa76cf..b69bf8a9 100644
--- a/src/nfc/qnearfieldmanager_emulator_p.h
+++ b/src/nfc/qnearfieldmanager_emulator_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldmanager_p.h b/src/nfc/qnearfieldmanager_p.h
index a53c4fb7..97b2899c 100644
--- a/src/nfc/qnearfieldmanager_p.h
+++ b/src/nfc/qnearfieldmanager_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldmanager_qnx.cpp b/src/nfc/qnearfieldmanager_qnx.cpp
index df8619a7..6e3b0eb9 100644
--- a/src/nfc/qnearfieldmanager_qnx.cpp
+++ b/src/nfc/qnearfieldmanager_qnx.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldmanager_qnx_p.h b/src/nfc/qnearfieldmanager_qnx_p.h
index a4175c0a..5d78ece6 100644
--- a/src/nfc/qnearfieldmanager_qnx_p.h
+++ b/src/nfc/qnearfieldmanager_qnx_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -85,7 +77,7 @@ public:
void releaseAccess(QNearFieldManager::TargetAccessModes accessModes);
-private Q_SLOTS:
+private slots:
void handleMessage(const QNdefMessage&, QNearFieldTarget *);
void newTarget(QNearFieldTarget *target, const QList<QNdefMessage> &);
diff --git a/src/nfc/qnearfieldmanager_simulator.cpp b/src/nfc/qnearfieldmanager_simulator.cpp
index 2800aa51..63574de8 100644
--- a/src/nfc/qnearfieldmanager_simulator.cpp
+++ b/src/nfc/qnearfieldmanager_simulator.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldmanager_simulator_p.h b/src/nfc/qnearfieldmanager_simulator_p.h
index 59523346..63ef977d 100644
--- a/src/nfc/qnearfieldmanager_simulator_p.h
+++ b/src/nfc/qnearfieldmanager_simulator_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldmanagerimpl_p.cpp b/src/nfc/qnearfieldmanagerimpl_p.cpp
index cc1d0795..915f4372 100644
--- a/src/nfc/qnearfieldmanagerimpl_p.cpp
+++ b/src/nfc/qnearfieldmanagerimpl_p.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldmanagerimpl_p.h b/src/nfc/qnearfieldmanagerimpl_p.h
index 3cccf694..13fbd4ff 100644
--- a/src/nfc/qnearfieldmanagerimpl_p.h
+++ b/src/nfc/qnearfieldmanagerimpl_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldmanagervirtualbase.cpp b/src/nfc/qnearfieldmanagervirtualbase.cpp
index 115a94d6..5bd0dfa7 100644
--- a/src/nfc/qnearfieldmanagervirtualbase.cpp
+++ b/src/nfc/qnearfieldmanagervirtualbase.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldmanagervirtualbase_p.h b/src/nfc/qnearfieldmanagervirtualbase_p.h
index c05c296c..52bb19f0 100644
--- a/src/nfc/qnearfieldmanagervirtualbase_p.h
+++ b/src/nfc/qnearfieldmanagervirtualbase_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldsharemanager.cpp b/src/nfc/qnearfieldsharemanager.cpp
index 43b1634b..a5303e4e 100644
--- a/src/nfc/qnearfieldsharemanager.cpp
+++ b/src/nfc/qnearfieldsharemanager.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldsharemanager.h b/src/nfc/qnearfieldsharemanager.h
index 00879d24..550858f1 100644
--- a/src/nfc/qnearfieldsharemanager.h
+++ b/src/nfc/qnearfieldsharemanager.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldsharemanager_p.h b/src/nfc/qnearfieldsharemanager_p.h
index f515d469..f9f5c90b 100644
--- a/src/nfc/qnearfieldsharemanager_p.h
+++ b/src/nfc/qnearfieldsharemanager_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldsharemanager_qnx_p.cpp b/src/nfc/qnearfieldsharemanager_qnx_p.cpp
index 41700afe..04e6a1a7 100644
--- a/src/nfc/qnearfieldsharemanager_qnx_p.cpp
+++ b/src/nfc/qnearfieldsharemanager_qnx_p.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldsharemanager_qnx_p.h b/src/nfc/qnearfieldsharemanager_qnx_p.h
index 79941921..9478bbdb 100644
--- a/src/nfc/qnearfieldsharemanager_qnx_p.h
+++ b/src/nfc/qnearfieldsharemanager_qnx_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -73,7 +65,7 @@ public:
QNearFieldShareManager::ShareModes shareModes() const;
QNearFieldShareManager::ShareError shareError() const;
-private Q_SLOTS:
+private slots:
void onShareModeChanged(bb::system::NfcShareMode::Type mode);
void onError(bb::system::NfcShareError::Type error);
void onFinished(bb::system::NfcShareSuccess::Type result);
diff --git a/src/nfc/qnearfieldsharemanagerimpl_p.cpp b/src/nfc/qnearfieldsharemanagerimpl_p.cpp
index d9cd2f45..2cf8ead5 100644
--- a/src/nfc/qnearfieldsharemanagerimpl_p.cpp
+++ b/src/nfc/qnearfieldsharemanagerimpl_p.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldsharemanagerimpl_p.h b/src/nfc/qnearfieldsharemanagerimpl_p.h
index 707ae837..dd350834 100644
--- a/src/nfc/qnearfieldsharemanagerimpl_p.h
+++ b/src/nfc/qnearfieldsharemanagerimpl_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldsharetarget.cpp b/src/nfc/qnearfieldsharetarget.cpp
index 606090b5..9f58b6ef 100644
--- a/src/nfc/qnearfieldsharetarget.cpp
+++ b/src/nfc/qnearfieldsharetarget.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldsharetarget.h b/src/nfc/qnearfieldsharetarget.h
index 96a4a312..41d6880d 100644
--- a/src/nfc/qnearfieldsharetarget.h
+++ b/src/nfc/qnearfieldsharetarget.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldsharetarget_p.h b/src/nfc/qnearfieldsharetarget_p.h
index cb19c900..aa28ee2b 100644
--- a/src/nfc/qnearfieldsharetarget_p.h
+++ b/src/nfc/qnearfieldsharetarget_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldsharetarget_qnx_p.cpp b/src/nfc/qnearfieldsharetarget_qnx_p.cpp
index 01445641..a68f7a4f 100644
--- a/src/nfc/qnearfieldsharetarget_qnx_p.cpp
+++ b/src/nfc/qnearfieldsharetarget_qnx_p.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldsharetarget_qnx_p.h b/src/nfc/qnearfieldsharetarget_qnx_p.h
index 61c2f407..3afd6adb 100644
--- a/src/nfc/qnearfieldsharetarget_qnx_p.h
+++ b/src/nfc/qnearfieldsharetarget_qnx_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -76,7 +68,7 @@ public:
bool isShareInProgress() const;
QNearFieldShareManager::ShareError shareError() const;
-private Q_SLOTS:
+private slots:
void onShareModeChanged(bb::system::NfcShareMode::Type mode);
void onError(bb::system::NfcShareError::Type error);
void onFinished(bb::system::NfcShareSuccess::Type result);
diff --git a/src/nfc/qnearfieldsharetargetimpl_p.cpp b/src/nfc/qnearfieldsharetargetimpl_p.cpp
index f5d86cf6..f346f70e 100644
--- a/src/nfc/qnearfieldsharetargetimpl_p.cpp
+++ b/src/nfc/qnearfieldsharetargetimpl_p.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldsharetargetimpl_p.h b/src/nfc/qnearfieldsharetargetimpl_p.h
index 2bd9a2c2..5eddf0eb 100644
--- a/src/nfc/qnearfieldsharetargetimpl_p.h
+++ b/src/nfc/qnearfieldsharetargetimpl_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldtagtype1.cpp b/src/nfc/qnearfieldtagtype1.cpp
index 2509dec4..ce1af1c7 100644
--- a/src/nfc/qnearfieldtagtype1.cpp
+++ b/src/nfc/qnearfieldtagtype1.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldtagtype1_p.h b/src/nfc/qnearfieldtagtype1_p.h
index 0ec02b57..0825fc86 100644
--- a/src/nfc/qnearfieldtagtype1_p.h
+++ b/src/nfc/qnearfieldtagtype1_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldtagtype2.cpp b/src/nfc/qnearfieldtagtype2.cpp
index b679fa9d..d323ace6 100644
--- a/src/nfc/qnearfieldtagtype2.cpp
+++ b/src/nfc/qnearfieldtagtype2.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldtagtype2_p.h b/src/nfc/qnearfieldtagtype2_p.h
index 91394441..de02b75b 100644
--- a/src/nfc/qnearfieldtagtype2_p.h
+++ b/src/nfc/qnearfieldtagtype2_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldtagtype3.cpp b/src/nfc/qnearfieldtagtype3.cpp
index 8668dda4..df48823e 100644
--- a/src/nfc/qnearfieldtagtype3.cpp
+++ b/src/nfc/qnearfieldtagtype3.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldtagtype3_p.h b/src/nfc/qnearfieldtagtype3_p.h
index 322e3d30..df2eb079 100644
--- a/src/nfc/qnearfieldtagtype3_p.h
+++ b/src/nfc/qnearfieldtagtype3_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldtagtype4.cpp b/src/nfc/qnearfieldtagtype4.cpp
index a6e37fde..2b111216 100644
--- a/src/nfc/qnearfieldtagtype4.cpp
+++ b/src/nfc/qnearfieldtagtype4.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldtagtype4_p.h b/src/nfc/qnearfieldtagtype4_p.h
index 340d6056..22b79056 100644
--- a/src/nfc/qnearfieldtagtype4_p.h
+++ b/src/nfc/qnearfieldtagtype4_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldtarget.cpp b/src/nfc/qnearfieldtarget.cpp
index c4f00d6d..47f5e129 100644
--- a/src/nfc/qnearfieldtarget.cpp
+++ b/src/nfc/qnearfieldtarget.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldtarget.h b/src/nfc/qnearfieldtarget.h
index 4e90e275..f3c1292b 100644
--- a/src/nfc/qnearfieldtarget.h
+++ b/src/nfc/qnearfieldtarget.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldtarget_emulator.cpp b/src/nfc/qnearfieldtarget_emulator.cpp
index 80953ce6..ee0c6188 100644
--- a/src/nfc/qnearfieldtarget_emulator.cpp
+++ b/src/nfc/qnearfieldtarget_emulator.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -212,15 +204,15 @@ void TagActivator::initialize()
if (!tagMap.isEmpty())
return;
- QDirIterator nfcTargets(QDir::currentPath(), QStringList(QLatin1String("*.nfc")), QDir::Files);
+ QDirIterator nfcTargets(QDir::currentPath(), QStringList(QStringLiteral("*.nfc")), QDir::Files);
while (nfcTargets.hasNext()) {
const QString targetFilename = nfcTargets.next();
QSettings target(targetFilename, QSettings::IniFormat);
- target.beginGroup(QLatin1String("Target"));
+ target.beginGroup(QStringLiteral("Target"));
- const QString tagType = target.value(QLatin1String("Type")).toString();
+ const QString tagType = target.value(QStringLiteral("Type")).toString();
target.endGroup();
diff --git a/src/nfc/qnearfieldtarget_emulator_p.h b/src/nfc/qnearfieldtarget_emulator_p.h
index 4e04d5d9..aba30b60 100644
--- a/src/nfc/qnearfieldtarget_emulator_p.h
+++ b/src/nfc/qnearfieldtarget_emulator_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldtarget_p.h b/src/nfc/qnearfieldtarget_p.h
index 265652b0..48b4a943 100644
--- a/src/nfc/qnearfieldtarget_p.h
+++ b/src/nfc/qnearfieldtarget_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnearfieldtarget_qnx_p.h b/src/nfc/qnearfieldtarget_qnx_p.h
index a1d6ae91..239153be 100644
--- a/src/nfc/qnearfieldtarget_qnx_p.h
+++ b/src/nfc/qnearfieldtarget_qnx_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -135,7 +127,7 @@ public:
QNearFieldTarget::RequestId readNdefMessages()
{
for (int i = 0; i < m_ndefMessages.size(); i++) {
- Q_EMIT QNearFieldTarget::ndefMessageRead(m_ndefMessages.at(i));
+ emit QNearFieldTarget::ndefMessageRead(m_ndefMessages.at(i));
}
QNearFieldTarget::RequestId requestId = QNearFieldTarget::RequestId(new QNearFieldTarget::RequestIdPrivate());
QMetaObject::invokeMethod(this, "requestCompleted", Qt::QueuedConnection,
@@ -160,7 +152,7 @@ public:
tagType = TAG_TYPE_ISO_15693_3;
//We don't support this tag
if (!isSupported) {
- Q_EMIT QNearFieldTarget::error(QNearFieldTarget::UnsupportedError, QNearFieldTarget::RequestId());
+ emit QNearFieldTarget::error(QNearFieldTarget::UnsupportedError, QNearFieldTarget::RequestId());
return QNearFieldTarget::RequestId();
}
}
@@ -168,11 +160,11 @@ public:
m_cmdRespons = reinterpret_cast<char *> malloc (max_nfc_command_length);
nfc_result_t result = nfc_tag_transceive (m_target, tagType, command.data(), command.length(), m_cmdRespons, max_nfc_command_length, &m_cmdResponseLength);
if (result != NFC_RESULT_SUCCESS) {
- Q_EMIT QNearFieldTarget::error(QNearFieldTarget::UnknownError, QNearFieldTarget::RequestId());
+ emit QNearFieldTarget::error(QNearFieldTarget::UnknownError, QNearFieldTarget::RequestId());
qWarning() << Q_FUNC_INFO << "nfc_tag_transceive failed"
}
#else
- Q_EMIT QNearFieldTarget::error(QNearFieldTarget::UnsupportedError, QNearFieldTarget::RequestId());
+ emit QNearFieldTarget::error(QNearFieldTarget::UnsupportedError, QNearFieldTarget::RequestId());
return QNearFieldTarget::RequestId();
#endif
}
@@ -196,7 +188,7 @@ public:
if (result != NFC_RESULT_SUCCESS) {
qWarning() << Q_FUNC_INFO << "Could not convert QNdefMessage to byte array" << result;
nfc_delete_ndef_message(newMessage, true);
- Q_EMIT QNearFieldTarget::error(QNearFieldTarget::UnknownError,
+ emit QNearFieldTarget::error(QNearFieldTarget::UnknownError,
QNearFieldTarget::RequestId());
return QNearFieldTarget::RequestId();
}
@@ -206,7 +198,7 @@ public:
if (result != NFC_RESULT_SUCCESS) {
qWarning() << Q_FUNC_INFO << "Could not write message";
- Q_EMIT QNearFieldTarget::error(QNearFieldTarget::NdefWriteError,
+ emit QNearFieldTarget::error(QNearFieldTarget::NdefWriteError,
QNearFieldTarget::RequestId());
return QNearFieldTarget::RequestId();
diff --git a/src/nfc/qnfcglobal.h b/src/nfc/qnfcglobal.h
index de659590..4b975c36 100644
--- a/src/nfc/qnfcglobal.h
+++ b/src/nfc/qnfcglobal.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnx/qnxnfceventfilter.cpp b/src/nfc/qnx/qnxnfceventfilter.cpp
index eed1a280..25af8f64 100644
--- a/src/nfc/qnx/qnxnfceventfilter.cpp
+++ b/src/nfc/qnx/qnxnfceventfilter.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -94,7 +86,7 @@ bool QNXNFCEventFilter::nativeEventFilter(const QByteArray &eventType, void *mes
qQNXNFCDebug() << "Got Invoke event" << uri << "Type" << type;
- Q_EMIT ndefEvent(message);
+ emit ndefEvent(message);
}
return false;
diff --git a/src/nfc/qnx/qnxnfceventfilter_p.h b/src/nfc/qnx/qnxnfceventfilter_p.h
index e1f97510..4349ea71 100644
--- a/src/nfc/qnx/qnxnfceventfilter_p.h
+++ b/src/nfc/qnx/qnxnfceventfilter_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -77,7 +69,7 @@ private:
QAbstractNativeEventFilter *prevFilter;
-Q_SIGNALS:
+signals:
void ndefEvent(const QNdefMessage &msg);
};
diff --git a/src/nfc/qnx/qnxnfcmanager.cpp b/src/nfc/qnx/qnxnfcmanager.cpp
index a93068fd..de0d65dd 100644
--- a/src/nfc/qnx/qnxnfcmanager.cpp
+++ b/src/nfc/qnx/qnxnfcmanager.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -44,6 +36,7 @@
#include <QMetaObject>
#include "../qllcpsocket_qnx_p.h"
#include <QCoreApplication>
+#include <QStringList>
QT_BEGIN_NAMESPACE
@@ -220,7 +213,7 @@ void QNXNFCManager::newNfcEvent(int fd)
void QNXNFCManager::invokeNdefMessage(const QNdefMessage &msg)
{
- Q_EMIT ndefMessage(msg, 0);
+ emit ndefMessage(msg, 0);
}
void QNXNFCManager::llcpReadComplete(nfc_event_t *nfcEvent)
diff --git a/src/nfc/qnx/qnxnfcmanager_p.h b/src/nfc/qnx/qnxnfcmanager_p.h
index 11a63d7c..4253ba1a 100644
--- a/src/nfc/qnx/qnxnfcmanager_p.h
+++ b/src/nfc/qnx/qnxnfcmanager_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -125,7 +117,7 @@ private:
void setupInvokeTarget();
-private Q_SLOTS:
+private slots:
void newNfcEvent(int fd);
void invokeNdefMessage(const QNdefMessage &);
@@ -137,7 +129,7 @@ public:
QNdefMessage decodeMessage(nfc_ndef_message_t *nextMessage);
-Q_SIGNALS:
+signals:
void newLlcpConnection(nfc_target_t *);
void ndefMessage(const QNdefMessage &, QNearFieldTarget *);
void targetDetected(QNearFieldTarget *, const QList<QNdefMessage> &);
diff --git a/src/nfc/qnx/qnxnfcsharemanager_p.cpp b/src/nfc/qnx/qnxnfcsharemanager_p.cpp
index 684a1a46..9ceed65e 100644
--- a/src/nfc/qnx/qnxnfcsharemanager_p.cpp
+++ b/src/nfc/qnx/qnxnfcsharemanager_p.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qnx/qnxnfcsharemanager_p.h b/src/nfc/qnx/qnxnfcsharemanager_p.h
index 0aacf4e2..7b70eca6 100644
--- a/src/nfc/qnx/qnxnfcsharemanager_p.h
+++ b/src/nfc/qnx/qnxnfcsharemanager_p.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
- ** $QT_BEGIN_LICENSE:LGPL$
+ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia. For licensing terms and
- ** conditions see http://qt.digia.com/licensing. For further information
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ ** General Public License version 2.1 or version 3 as published by the Free
+ ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+ ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+ ** following information to ensure the GNU Lesser General Public License
+ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
- ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file. Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -88,7 +80,7 @@ private:
bb::system::NfcShareManager *_manager;
static const char *RECORD_NDEF;
-Q_SIGNALS:
+signals:
void shareModeChanged(bb::system::NfcShareMode::Type);
void error(bb::system::NfcShareError::Type);
void finished(bb::system::NfcShareSuccess::Type);
diff --git a/src/nfc/qqmlndefrecord.cpp b/src/nfc/qqmlndefrecord.cpp
index c94578eb..7252f247 100644
--- a/src/nfc/qqmlndefrecord.cpp
+++ b/src/nfc/qqmlndefrecord.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -186,11 +178,11 @@ static QString urnForRecordType(QNdefRecord::TypeNameFormat typeNameFormat, cons
{
switch (typeNameFormat) {
case QNdefRecord::NfcRtd:
- return QLatin1String("urn:nfc:wkt:") + QString::fromLatin1(type);
+ return QStringLiteral("urn:nfc:wkt:") + QString::fromLatin1(type);
case QNdefRecord::ExternalRtd:
- return QLatin1String("urn:nfc:ext:") + QString::fromLatin1(type);
+ return QStringLiteral("urn:nfc:ext:") + QString::fromLatin1(type);
case QNdefRecord::Mime:
- return QLatin1String("urn:nfc:mime:") + QString::fromLatin1(type);
+ return QStringLiteral("urn:nfc:mime:") + QString::fromLatin1(type);
default:
return QString();
}
diff --git a/src/nfc/qqmlndefrecord.h b/src/nfc/qqmlndefrecord.h
index 76ba8bf2..7c282e77 100644
--- a/src/nfc/qqmlndefrecord.h
+++ b/src/nfc/qqmlndefrecord.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qtlv.cpp b/src/nfc/qtlv.cpp
index 3ad23c8f..14624e5b 100644
--- a/src/nfc/qtlv.cpp
+++ b/src/nfc/qtlv.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/qtlv_p.h b/src/nfc/qtlv_p.h
index a4ce219c..082c4e77 100644
--- a/src/nfc/qtlv_p.h
+++ b/src/nfc/qtlv_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/nfc/targetemulator.cpp b/src/nfc/targetemulator.cpp
index e1d21e87..61370bf1 100644
--- a/src/nfc/targetemulator.cpp
+++ b/src/nfc/targetemulator.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -79,18 +71,18 @@ NfcTagType1::~NfcTagType1()
void NfcTagType1::load(QSettings *settings)
{
- settings->beginGroup(QLatin1String("TagType1"));
+ settings->beginGroup(QStringLiteral("TagType1"));
- hr0 = settings->value(QLatin1String("HR0"), 0x11).toUInt();
+ hr0 = settings->value(QStringLiteral("HR0"), 0x11).toUInt();
if (!(hr0 & 0x10)) {
settings->endGroup();
return;
}
- hr1 = settings->value(QLatin1String("HR1"), 0x00).toUInt();
+ hr1 = settings->value(QStringLiteral("HR1"), 0x00).toUInt();
- memory = settings->value(QLatin1String("Data")).toByteArray();
+ memory = settings->value(QStringLiteral("Data")).toByteArray();
//quint8 nmn = memory.at(8);
@@ -302,9 +294,9 @@ NfcTagType2::~NfcTagType2()
void NfcTagType2::load(QSettings *settings)
{
- settings->beginGroup(QLatin1String("TagType2"));
+ settings->beginGroup(QStringLiteral("TagType2"));
- memory = settings->value(QLatin1String("Data")).toByteArray();
+ memory = settings->value(QStringLiteral("Data")).toByteArray();
settings->endGroup();
}
diff --git a/src/nfc/targetemulator_p.h b/src/nfc/targetemulator_p.h
index 3cc694fa..cfeb5413 100644
--- a/src/nfc/targetemulator_p.h
+++ b/src/nfc/targetemulator_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/src.pro b/src/src.pro
index e017d34b..c5585757 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -17,3 +17,7 @@ qtHaveModule(quick) {
imports.depends += bluetooth nfc
SUBDIRS += imports
}
+
+config_bluez:qtHaveModule(dbus) {
+ SUBDIRS += tools/sdpscanner
+}
diff --git a/src/tools/sdpscanner/main.cpp b/src/tools/sdpscanner/main.cpp
new file mode 100644
index 00000000..5f2fd976
--- /dev/null
+++ b/src/tools/sdpscanner/main.cpp
@@ -0,0 +1,319 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QByteArray>
+#include <QtCore/QDebug>
+#include <stdio.h>
+#include <bluetooth/bluetooth.h>
+#include <bluetooth/sdp.h>
+#include <bluetooth/sdp_lib.h>
+
+#define RETURN_SUCCESS 0
+#define RETURN_USAGE 1
+#define RETURN_INVALPARAM 2
+#define RETURN_SDP_ERROR 3
+
+void usage()
+{
+ fprintf(stderr, "Usage:\n");
+ fprintf(stderr, "\tsdpscanner <remote bdaddr> <local bdaddr>\n\n");
+ fprintf(stderr, "Performs an SDP scan on remote device, using the SDP server\n"
+ "represented by the local Bluetooth device.\n");
+}
+
+#define BUFFER_SIZE 1024
+
+static void parseAttributeValues(sdp_data_t *data, int indentation, QByteArray &xmlOutput)
+{
+ if (!data)
+ return;
+
+ const int length = indentation*2 + 1;
+ QByteArray indentString(length, ' ');
+
+ char snBuffer[BUFFER_SIZE];
+
+ xmlOutput.append(indentString);
+
+ // deal with every dtd type
+ switch (data->dtd) {
+ case SDP_DATA_NIL:
+ xmlOutput.append("<nil/>\n");
+ break;
+ case SDP_UINT8:
+ qsnprintf(snBuffer, BUFFER_SIZE, "<uint8 value=\"0x%02x\"/>\n", data->val.uint8);
+ xmlOutput.append(snBuffer);
+ break;
+ case SDP_UINT16:
+ qsnprintf(snBuffer, BUFFER_SIZE, "<uint16 value=\"0x%04x\"/>\n", data->val.uint16);
+ xmlOutput.append(snBuffer);
+ break;
+ case SDP_UINT32:
+ qsnprintf(snBuffer, BUFFER_SIZE, "<uint32 value=\"0x%08x\"/>\n", data->val.uint32);
+ xmlOutput.append(snBuffer);
+ break;
+ case SDP_UINT64:
+ qsnprintf(snBuffer, BUFFER_SIZE, "<uint64 value=\"0x%016x\"/>\n", data->val.uint64);
+ xmlOutput.append(snBuffer);
+ break;
+ case SDP_UINT128:
+ xmlOutput.append("<uint128 value=\"0x");
+ for (int i = 0; i < 16; i++)
+ ::sprintf(&snBuffer[i * 2], "%02x", data->val.uint128.data[i]);
+ xmlOutput.append(snBuffer);
+ xmlOutput.append("\"/>\n");
+ break;
+ case SDP_INT8:
+ qsnprintf(snBuffer, BUFFER_SIZE, "<int8 value=\"%d\"/>/n", data->val.int8);
+ xmlOutput.append(snBuffer);
+ break;
+ case SDP_INT16:
+ qsnprintf(snBuffer, BUFFER_SIZE, "<int16 value=\"%d\"/>/n", data->val.int16);
+ xmlOutput.append(snBuffer);
+ break;
+ case SDP_INT32:
+ qsnprintf(snBuffer, BUFFER_SIZE, "<int32 value=\"%d\"/>/n", data->val.int32);
+ xmlOutput.append(snBuffer);
+ break;
+ case SDP_INT64:
+ qsnprintf(snBuffer, BUFFER_SIZE, "<int64 value=\"%d\"/>/n", data->val.int64);
+ xmlOutput.append(snBuffer);
+ break;
+ case SDP_INT128:
+ xmlOutput.append("<int128 value=\"0x");
+ for (int i = 0; i < 16; i++)
+ ::sprintf(&snBuffer[i * 2], "%02x", data->val.int128.data[i]);
+ xmlOutput.append(snBuffer);
+ xmlOutput.append("\"/>\n");
+ break;
+ case SDP_UUID_UNSPEC:
+ break;
+ case SDP_UUID16:
+ case SDP_UUID32:
+ xmlOutput.append("<uuid value=\"0x");
+ sdp_uuid2strn(&(data->val.uuid), snBuffer, BUFFER_SIZE);
+ xmlOutput.append(snBuffer);
+ xmlOutput.append("\"/>\n");
+ break;
+ case SDP_UUID128:
+ xmlOutput.append("<uuid value=\"");
+ sdp_uuid2strn(&(data->val.uuid), snBuffer, BUFFER_SIZE);
+ xmlOutput.append(snBuffer);
+ xmlOutput.append("\"/>\n");
+ break;
+ case SDP_TEXT_STR_UNSPEC:
+ break;
+ case SDP_TEXT_STR8:
+ case SDP_TEXT_STR16:
+ case SDP_TEXT_STR32:
+ {
+ xmlOutput.append("<text ");
+ QByteArray text = QByteArray::fromRawData(data->val.str, data->unitSize);
+
+ bool hasNonPrintableChar = false;
+ for (int i = 0; i < text.count() && !hasNonPrintableChar; i++) {
+ if (!isprint(text[i])) {
+ hasNonPrintableChar = true;
+ break;
+ }
+ }
+
+ if (hasNonPrintableChar) {
+ xmlOutput.append("encoding=\"hex\" value=\"");
+ xmlOutput.append(text.toHex());
+ } else {
+ text.replace("&", "&amp");
+ text.replace("<", "&lt");
+ text.replace(">", "&gt");
+ text.replace("\"", "&quot");
+
+ xmlOutput.append("value=\"");
+ xmlOutput.append(text);
+ }
+
+ xmlOutput.append("\"/>\n");
+ break;
+ }
+ case SDP_BOOL:
+ if (data->val.uint8)
+ xmlOutput.append("<boolean value=\"true\"/>\n");
+ else
+ xmlOutput.append("<boolean value=\"false\"/>\n");
+ break;
+ case SDP_SEQ_UNSPEC:
+ break;
+ case SDP_SEQ8:
+ case SDP_SEQ16:
+ case SDP_SEQ32:
+ xmlOutput.append("<sequence>\n");
+ parseAttributeValues(data->val.dataseq, indentation + 1, xmlOutput);
+ xmlOutput.append(indentString);
+ xmlOutput.append("</sequence>\n");
+ break;
+ case SDP_ALT_UNSPEC:
+ break;
+ case SDP_ALT8:
+ case SDP_ALT16:
+ case SDP_ALT32:
+ xmlOutput.append("<alternate>\n");
+ parseAttributeValues(data->val.dataseq, indentation + 1, xmlOutput);
+ xmlOutput.append(indentString);
+ xmlOutput.append("</alternate>\n");
+ break;
+ case SDP_URL_STR_UNSPEC:
+ break;
+ case SDP_URL_STR8:
+ case SDP_URL_STR16:
+ case SDP_URL_STR32:
+ strncpy(snBuffer, data->val.str, data->unitSize - 1);
+ xmlOutput.append("<url value=\"");
+ xmlOutput.append(snBuffer);
+ xmlOutput.append("\"/>\n");
+ break;
+ default:
+ fprintf(stderr, "Unknown dtd type\n");
+ }
+
+ parseAttributeValues(data->next, indentation, xmlOutput);
+}
+
+static void parseAttribute(void *value, void *extraData)
+{
+ sdp_data_t *data = (sdp_data_t *) value;
+ QByteArray *xmlOutput = static_cast<QByteArray *>(extraData);
+
+ char buffer[BUFFER_SIZE];
+
+ ::qsnprintf(buffer, BUFFER_SIZE, " <attribute id=\"0x%04x\">\n", data->attrId);
+ xmlOutput->append(buffer);
+
+ parseAttributeValues(data, 2, *xmlOutput);
+
+ xmlOutput->append(" </attribute>\n");
+}
+
+// the resulting xml output is based on the already used xml parser
+QByteArray parseSdpRecord(sdp_record_t *record)
+{
+ if (!record || !record->attrlist)
+ return QByteArray();
+
+ QByteArray xmlOutput;
+
+ xmlOutput.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<record>\n");
+
+ sdp_list_foreach(record->attrlist, parseAttribute, &xmlOutput);
+ xmlOutput.append("</record>");
+
+ return xmlOutput;
+}
+
+
+int main(int argc, char **argv)
+{
+ if (argc != 3) {
+ usage();
+ return RETURN_USAGE;
+ }
+
+ fprintf(stderr, "SDP for %s %s\n", argv[1], argv[2]);
+
+ bdaddr_t remote;
+ bdaddr_t local;
+ int result = str2ba(argv[1], &remote);
+ if (result < 0) {
+ fprintf(stderr, "Invalid remote address: %s\n", argv[1]);
+ return RETURN_INVALPARAM;
+ }
+
+ result = str2ba(argv[2], &local);
+ if (result < 0) {
+ fprintf(stderr, "Invalid local address: %s\n", argv[2]);
+ return RETURN_INVALPARAM;
+ }
+
+ sdp_session_t *session = sdp_connect( &local, &remote, SDP_RETRY_IF_BUSY);
+ if (!session) {
+ //try one more time if first time failed
+ session = sdp_connect( &local, &remote, SDP_RETRY_IF_BUSY);
+ }
+
+ if (!session) {
+ fprintf(stderr, "Cannot establish sdp session\n");
+ return RETURN_SDP_ERROR;
+ }
+
+ // set the filter for service matches
+ uuid_t publicBrowseGroupUuid;
+ sdp_uuid16_create(&publicBrowseGroupUuid, PUBLIC_BROWSE_GROUP);
+ sdp_list_t *serviceFilter;
+ serviceFilter = sdp_list_append(0, &publicBrowseGroupUuid);
+
+ uint32_t attributeRange = 0x0000ffff; //all attributes
+ sdp_list_t *attributes;
+ attributes = sdp_list_append(0, &attributeRange);
+
+ sdp_list_t *sdpResults, *previous;
+ result = sdp_service_search_attr_req(session, serviceFilter,
+ SDP_ATTR_REQ_RANGE,
+ attributes, &sdpResults);
+ sdp_list_free(attributes, 0);
+ sdp_list_free(serviceFilter, 0);
+
+ if (result != 0) {
+ fprintf(stderr, "sdp_service_search_attr_req failed\n");
+ sdp_close(session);
+ return RETURN_SDP_ERROR;
+ }
+
+ QByteArray total;
+ while (sdpResults) {
+ sdp_record_t *record = (sdp_record_t *) sdpResults->data;
+
+ const QByteArray xml = parseSdpRecord(record);
+ total += xml;
+
+ previous = sdpResults;
+ sdpResults = sdpResults->next;
+ free(previous);
+ sdp_record_free(record);
+ }
+
+ if (!total.isEmpty()) {
+ printf("%s", total.toBase64().constData());
+ }
+
+ sdp_close(session);
+
+ return RETURN_SUCCESS;
+}
diff --git a/src/tools/sdpscanner/sdpscanner.pro b/src/tools/sdpscanner/sdpscanner.pro
new file mode 100644
index 00000000..6bf0a96c
--- /dev/null
+++ b/src/tools/sdpscanner/sdpscanner.pro
@@ -0,0 +1,24 @@
+TEMPLATE = app
+TARGET = sdpscanner
+
+QT = core
+
+SOURCES = main.cpp
+
+CONFIG += link_pkgconfig
+PKGCONFIG_PRIVATE += bluez
+
+load(qt_tool)
+
+linux-*: {
+ # bluetooth.h is not standards compliant
+ contains(QMAKE_CXXFLAGS, -std=c++0x) {
+ QMAKE_CXXFLAGS -= -std=c++0x
+ QMAKE_CXXFLAGS += -std=gnu++0x
+ CONFIG -= c++11
+ }
+ c++11 {
+ CONFIG -= c++11
+ QMAKE_CXXFLAGS += -std=gnu++0x
+ }
+}
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 5a703944..8966e5d9 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -16,7 +16,11 @@ qtHaveModule(bluetooth) {
qbluetoothtransfermanager \
qbluetoothtransferrequest \
qbluetoothuuid \
- qbluetoothserver
+ qbluetoothserver \
+ qlowenergycharacteristic \
+ qlowenergydescriptor \
+ qlowenergyserviceinfo \
+ qlowenergycontroller
}
qtHaveModule(nfc) {
diff --git a/tests/auto/qbluetoothaddress/tst_qbluetoothaddress.cpp b/tests/auto/qbluetoothaddress/tst_qbluetoothaddress.cpp
index d53f39dd..171726b8 100644
--- a/tests/auto/qbluetoothaddress/tst_qbluetoothaddress.cpp
+++ b/tests/auto/qbluetoothaddress/tst_qbluetoothaddress.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp b/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp
index 2da1a8a9..ca22c8ea 100644
--- a/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp
+++ b/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -250,13 +242,27 @@ void tst_QBluetoothDeviceDiscoveryAgent::tst_startStopDeviceDiscoveries()
QVERIFY(discoveryAgent.error() == discoveryAgent.NoError);
QVERIFY(discoveryAgent.errorString().isEmpty());
+ /*
+ Starting case 4: start-stop-start-stop:
+ We are testing that two subsequent stop() calls reduce total number
+ of cancel() signals to 1 if the true cancellation requires
+ asynchronous function calls (signal consolidation); otherwise we
+ expect 2x cancel() signal.
- // Starting case 4: start-stop-start-stop, expecting only 1 cancel signal
+ Examples are:
+ - Bluez4 (event loop needs to run for cancel)
+ - Bluez5 (no event loop required)
+ */
+
+ bool immediateSignal = false;
discoveryAgent.start();
QVERIFY(discoveryAgent.isActive());
QVERIFY(errorSpy.isEmpty());
// cancel current request.
discoveryAgent.stop();
+ //should only have triggered cancel() if stop didn't involve the event loop
+ if (cancelSpy.count() == 1) immediateSignal = true;
+
// start a new one
discoveryAgent.start();
// we should be active now
@@ -264,6 +270,8 @@ void tst_QBluetoothDeviceDiscoveryAgent::tst_startStopDeviceDiscoveries()
QVERIFY(errorSpy.isEmpty());
// stop
discoveryAgent.stop();
+ if (immediateSignal)
+ QVERIFY(cancelSpy.count() == 2);
// Wait for up to MaxWaitForCancelTime for the cancel to finish
waitTime = MaxWaitForCancelTime;
@@ -271,12 +279,15 @@ void tst_QBluetoothDeviceDiscoveryAgent::tst_startStopDeviceDiscoveries()
QTest::qWait(100);
waitTime-=100;
}
-
// we should not be active anymore
QVERIFY(!discoveryAgent.isActive());
QVERIFY(errorSpy.isEmpty());
// should only have 1 cancel
- QVERIFY(cancelSpy.count() == 1);
+
+ if (immediateSignal)
+ QVERIFY(cancelSpy.count() == 2);
+ else
+ QVERIFY(cancelSpy.count() == 1);
cancelSpy.clear();
// Starting case 5: start-stop-start: expecting finished signal & no cancel
diff --git a/tests/auto/qbluetoothdeviceinfo/qbluetoothdeviceinfo.pro b/tests/auto/qbluetoothdeviceinfo/qbluetoothdeviceinfo.pro
index 43ca52ed..e33125c2 100644
--- a/tests/auto/qbluetoothdeviceinfo/qbluetoothdeviceinfo.pro
+++ b/tests/auto/qbluetoothdeviceinfo/qbluetoothdeviceinfo.pro
@@ -4,3 +4,6 @@ CONFIG += testcase
QT = core concurrent bluetooth testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+blackberry {
+ LIBS += -lbtapi
+}
diff --git a/tests/auto/qbluetoothdeviceinfo/tst_qbluetoothdeviceinfo.cpp b/tests/auto/qbluetoothdeviceinfo/tst_qbluetoothdeviceinfo.cpp
index adc61199..ea3c471c 100644
--- a/tests/auto/qbluetoothdeviceinfo/tst_qbluetoothdeviceinfo.cpp
+++ b/tests/auto/qbluetoothdeviceinfo/tst_qbluetoothdeviceinfo.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -52,6 +44,7 @@ QT_USE_NAMESPACE
Q_DECLARE_METATYPE(QBluetoothDeviceInfo::ServiceClasses)
Q_DECLARE_METATYPE(QBluetoothDeviceInfo::MajorDeviceClass)
+Q_DECLARE_METATYPE(QBluetoothDeviceInfo::CoreConfiguration)
class tst_QBluetoothDeviceInfo : public QObject
{
@@ -101,6 +94,7 @@ void tst_QBluetoothDeviceInfo::tst_construction_data()
QTest::addColumn<QBluetoothDeviceInfo::ServiceClasses>("serviceClasses");
QTest::addColumn<QBluetoothDeviceInfo::MajorDeviceClass>("majorDeviceClass");
QTest::addColumn<quint8>("minorDeviceClass");
+ QTest::addColumn<QBluetoothDeviceInfo::CoreConfiguration>("coreConfiguration");
// bits 12-8 Major
// bits 7-2 Minor
@@ -110,120 +104,144 @@ void tst_QBluetoothDeviceInfo::tst_construction_data()
<< quint32(0x000000)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::MiscellaneousDevice
- << quint8(QBluetoothDeviceInfo::UncategorizedMiscellaneous);
+ << quint8(QBluetoothDeviceInfo::UncategorizedMiscellaneous)
+ << QBluetoothDeviceInfo::BaseRateCoreConfiguration;
QTest::newRow("0x000100 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x000100)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::ComputerDevice
- << quint8(QBluetoothDeviceInfo::UncategorizedComputer);
+ << quint8(QBluetoothDeviceInfo::UncategorizedComputer)
+ << QBluetoothDeviceInfo::BaseRateCoreConfiguration;
QTest::newRow("0x000104 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x000104)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::ComputerDevice
- << quint8(QBluetoothDeviceInfo::DesktopComputer);
+ << quint8(QBluetoothDeviceInfo::DesktopComputer)
+ << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration;
QTest::newRow("0x000118 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x000118)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::ComputerDevice
- << quint8(QBluetoothDeviceInfo::WearableComputer);
+ << quint8(QBluetoothDeviceInfo::WearableComputer)
+ << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration;
QTest::newRow("0x000200 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device" << quint32(0x000200)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::PhoneDevice
- << quint8(QBluetoothDeviceInfo::UncategorizedPhone);
+ << quint8(QBluetoothDeviceInfo::UncategorizedPhone)
+ << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration;
QTest::newRow("0x000204 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x000204)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::PhoneDevice
- << quint8(QBluetoothDeviceInfo::CellularPhone);
+ << quint8(QBluetoothDeviceInfo::CellularPhone)
+ << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration;
QTest::newRow("0x000214 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device" << quint32(0x000214)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::PhoneDevice
- << quint8(QBluetoothDeviceInfo::CommonIsdnAccessPhone);
+ << quint8(QBluetoothDeviceInfo::CommonIsdnAccessPhone)
+ << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration;
QTest::newRow("0x000300 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x000300)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::LANAccessDevice
- << quint8(QBluetoothDeviceInfo::NetworkFullService);
+ << quint8(QBluetoothDeviceInfo::NetworkFullService)
+ << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration;
QTest::newRow("0x000320 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x000320)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::LANAccessDevice
- << quint8(QBluetoothDeviceInfo::NetworkLoadFactorOne);
+ << quint8(QBluetoothDeviceInfo::NetworkLoadFactorOne)
+ << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration;
QTest::newRow("0x0003E0 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x0003E0)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::LANAccessDevice
- << quint8(QBluetoothDeviceInfo::NetworkNoService);
+ << quint8(QBluetoothDeviceInfo::NetworkNoService)
+ << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration;
QTest::newRow("0x000400 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x000400)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::AudioVideoDevice
- << quint8(QBluetoothDeviceInfo::UncategorizedAudioVideoDevice);
+ << quint8(QBluetoothDeviceInfo::UncategorizedAudioVideoDevice)
+ << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration;
QTest::newRow("0x000448 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x000448)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::AudioVideoDevice
- << quint8(QBluetoothDeviceInfo::GamingDevice);
+ << quint8(QBluetoothDeviceInfo::GamingDevice)
+ << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration;
QTest::newRow("0x000500 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x000500)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::PeripheralDevice
- << quint8(QBluetoothDeviceInfo::UncategorizedPeripheral);
+ << quint8(QBluetoothDeviceInfo::UncategorizedPeripheral)
+ << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration;
QTest::newRow("0x0005D8 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x0005D8)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::PeripheralDevice
- << quint8(QBluetoothDeviceInfo::KeyboardWithPointingDevicePeripheral | QBluetoothDeviceInfo::CardReaderPeripheral);
+ << quint8(QBluetoothDeviceInfo::KeyboardWithPointingDevicePeripheral | QBluetoothDeviceInfo::CardReaderPeripheral)
+ << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration;
QTest::newRow("0x000600 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x000600)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::ImagingDevice
- << quint8(QBluetoothDeviceInfo::UncategorizedImagingDevice);
+ << quint8(QBluetoothDeviceInfo::UncategorizedImagingDevice)
+ << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration;
QTest::newRow("0x000680 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x000680)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::ImagingDevice
- << quint8(QBluetoothDeviceInfo::ImagePrinter);
+ << quint8(QBluetoothDeviceInfo::ImagePrinter)
+ << QBluetoothDeviceInfo::LowEnergyCoreConfiguration;
QTest::newRow("0x000700 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x000700)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::WearableDevice
- << quint8(QBluetoothDeviceInfo::UncategorizedWearableDevice);
+ << quint8(QBluetoothDeviceInfo::UncategorizedWearableDevice)
+ << QBluetoothDeviceInfo::LowEnergyCoreConfiguration;
QTest::newRow("0x000714 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x000714)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::WearableDevice
- << quint8(QBluetoothDeviceInfo::WearableGlasses);
+ << quint8(QBluetoothDeviceInfo::WearableGlasses)
+ << QBluetoothDeviceInfo::LowEnergyCoreConfiguration;
QTest::newRow("0x000800 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x000800)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::ToyDevice
- << quint8(QBluetoothDeviceInfo::UncategorizedToy);
+ << quint8(QBluetoothDeviceInfo::UncategorizedToy)
+ << QBluetoothDeviceInfo::LowEnergyCoreConfiguration;
QTest::newRow("0x000814 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x000814)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::ToyDevice
- << quint8(QBluetoothDeviceInfo::ToyGame);
+ << quint8(QBluetoothDeviceInfo::ToyGame)
+ << QBluetoothDeviceInfo::LowEnergyCoreConfiguration;
QTest::newRow("0x001f00 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x001f00)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::NoService)
<< QBluetoothDeviceInfo::UncategorizedDevice
- << quint8(0);
+ << quint8(0)
+ << QBluetoothDeviceInfo::LowEnergyCoreConfiguration;
QTest::newRow("0x002000 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x002000)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::PositioningService)
<< QBluetoothDeviceInfo::MiscellaneousDevice
- << quint8(QBluetoothDeviceInfo::UncategorizedMiscellaneous);
+ << quint8(QBluetoothDeviceInfo::UncategorizedMiscellaneous)
+ << QBluetoothDeviceInfo::LowEnergyCoreConfiguration;
QTest::newRow("0x100000 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0x100000)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::InformationService)
<< QBluetoothDeviceInfo::MiscellaneousDevice
- << quint8(QBluetoothDeviceInfo::UncategorizedMiscellaneous);
+ << quint8(QBluetoothDeviceInfo::UncategorizedMiscellaneous)
+ << QBluetoothDeviceInfo::LowEnergyCoreConfiguration;
QTest::newRow("0xFFE000 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
<< quint32(0xFFE000)
<< QBluetoothDeviceInfo::ServiceClasses(QBluetoothDeviceInfo::AllServices)
<< QBluetoothDeviceInfo::MiscellaneousDevice
- << quint8(QBluetoothDeviceInfo::UncategorizedMiscellaneous);
+ << quint8(QBluetoothDeviceInfo::UncategorizedMiscellaneous)
+ << QBluetoothDeviceInfo::LowEnergyCoreConfiguration;
}
void tst_QBluetoothDeviceInfo::tst_construction()
@@ -241,6 +259,7 @@ void tst_QBluetoothDeviceInfo::tst_construction()
QFETCH(QBluetoothDeviceInfo::ServiceClasses, serviceClasses);
QFETCH(QBluetoothDeviceInfo::MajorDeviceClass, majorDeviceClass);
QFETCH(quint8, minorDeviceClass);
+ QFETCH(QBluetoothDeviceInfo::CoreConfiguration, coreConfiguration);
QBluetoothDeviceInfo deviceInfo(address, name, classOfDevice);
@@ -251,9 +270,12 @@ void tst_QBluetoothDeviceInfo::tst_construction()
QCOMPARE(deviceInfo.serviceClasses(), serviceClasses);
QCOMPARE(deviceInfo.majorDeviceClass(), majorDeviceClass);
QCOMPARE(deviceInfo.minorDeviceClass(), minorDeviceClass);
+ QCOMPARE(deviceInfo.coreConfigurations(), QBluetoothDeviceInfo::BaseRateCoreConfiguration);
- QBluetoothDeviceInfo copyInfo(deviceInfo);
+ deviceInfo.setCoreConfigurations(coreConfiguration);
+ QCOMPARE(deviceInfo.coreConfigurations(), coreConfiguration);
+ QBluetoothDeviceInfo copyInfo(deviceInfo);
QVERIFY(copyInfo.isValid());
QCOMPARE(copyInfo.address(), address);
@@ -261,6 +283,7 @@ void tst_QBluetoothDeviceInfo::tst_construction()
QCOMPARE(copyInfo.serviceClasses(), serviceClasses);
QCOMPARE(copyInfo.majorDeviceClass(), majorDeviceClass);
QCOMPARE(copyInfo.minorDeviceClass(), minorDeviceClass);
+ QCOMPARE(copyInfo.coreConfigurations(), coreConfiguration);
}
}
@@ -277,8 +300,10 @@ void tst_QBluetoothDeviceInfo::tst_assignment()
QFETCH(QBluetoothDeviceInfo::ServiceClasses, serviceClasses);
QFETCH(QBluetoothDeviceInfo::MajorDeviceClass, majorDeviceClass);
QFETCH(quint8, minorDeviceClass);
+ QFETCH(QBluetoothDeviceInfo::CoreConfiguration, coreConfiguration);
QBluetoothDeviceInfo deviceInfo(address, name, classOfDevice);
+ deviceInfo.setCoreConfigurations(coreConfiguration);
QVERIFY(deviceInfo.isValid());
@@ -292,6 +317,7 @@ void tst_QBluetoothDeviceInfo::tst_assignment()
QCOMPARE(copyInfo.serviceClasses(), serviceClasses);
QCOMPARE(copyInfo.majorDeviceClass(), majorDeviceClass);
QCOMPARE(copyInfo.minorDeviceClass(), minorDeviceClass);
+ QCOMPARE(copyInfo.coreConfigurations(), coreConfiguration);
}
{
@@ -308,6 +334,7 @@ void tst_QBluetoothDeviceInfo::tst_assignment()
QCOMPARE(copyInfo.serviceClasses(), serviceClasses);
QCOMPARE(copyInfo.majorDeviceClass(), majorDeviceClass);
QCOMPARE(copyInfo.minorDeviceClass(), minorDeviceClass);
+ QCOMPARE(copyInfo.coreConfigurations(), coreConfiguration);
}
{
@@ -333,6 +360,8 @@ void tst_QBluetoothDeviceInfo::tst_assignment()
QCOMPARE(copyInfo2.majorDeviceClass(), majorDeviceClass);
QCOMPARE(copyInfo1.minorDeviceClass(), minorDeviceClass);
QCOMPARE(copyInfo2.minorDeviceClass(), minorDeviceClass);
+ QCOMPARE(copyInfo1.coreConfigurations(), coreConfiguration);
+ QCOMPARE(copyInfo2.coreConfigurations(), coreConfiguration);
}
{
diff --git a/tests/auto/qbluetoothhostinfo/tst_qbluetoothhostinfo.cpp b/tests/auto/qbluetoothhostinfo/tst_qbluetoothhostinfo.cpp
index be2cadbf..fea6bad3 100644
--- a/tests/auto/qbluetoothhostinfo/tst_qbluetoothhostinfo.cpp
+++ b/tests/auto/qbluetoothhostinfo/tst_qbluetoothhostinfo.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp
index 3285592e..30e009dd 100644
--- a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp
+++ b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -295,16 +287,18 @@ void tst_QBluetoothLocalDevice::tst_pairDevice_data()
QTest::newRow("UnPaired Device: DUMMY->unpaired") << QBluetoothAddress("11:00:00:00:00:00")
<< QBluetoothLocalDevice::Unpaired << 1000 << false;
+ //Bluez5 may have to do a device search which can take up to 20s
QTest::newRow("UnPaired Device: DUMMY->paired") << QBluetoothAddress("11:00:00:00:00:00")
- << QBluetoothLocalDevice::Paired << 1000 << true;
+ << QBluetoothLocalDevice::Paired << 21000 << true;
QTest::newRow("UnPaired Device: DUMMY") << QBluetoothAddress()
<< QBluetoothLocalDevice::Unpaired << 1000 << true;
if (!remoteDevice.isNull()) {
QTest::newRow("UnParing Test device 1") << QBluetoothAddress(remoteDevice)
<< QBluetoothLocalDevice::Unpaired << 1000 << false;
+ //Bluez5 may have to do a device search which can take up to 20s
QTest::newRow("Pairing Test Device") << QBluetoothAddress(remoteDevice)
- << QBluetoothLocalDevice::Paired << 10000 << false;
+ << QBluetoothLocalDevice::Paired << 21000 << false;
QTest::newRow("Pairing upgrade for Authorization") << QBluetoothAddress(remoteDevice)
<< QBluetoothLocalDevice::AuthorizedPaired << 1000 << false;
QTest::newRow("Unpairing Test device 2") << QBluetoothAddress(remoteDevice)
diff --git a/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp b/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp
index 347cddce..740ea05e 100644
--- a/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp
+++ b/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/qbluetoothservicediscoveryagent/qbluetoothservicediscoveryagent.pro b/tests/auto/qbluetoothservicediscoveryagent/qbluetoothservicediscoveryagent.pro
index 7b8ee74a..cdf8a78b 100644
--- a/tests/auto/qbluetoothservicediscoveryagent/qbluetoothservicediscoveryagent.pro
+++ b/tests/auto/qbluetoothservicediscoveryagent/qbluetoothservicediscoveryagent.pro
@@ -3,5 +3,8 @@ TARGET = tst_qbluetoothservicediscoveryagent
CONFIG += testcase
QT = core concurrent bluetooth testlib
+blackberry {
+ LIBS += -lbtapi
+}
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
index 791bff8d..253ca50a 100644
--- a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
+++ b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,11 +43,13 @@
#include <qbluetoothlocaldevice.h>
#include <qbluetoothserver.h>
#include <qbluetoothserviceinfo.h>
+#include <qlowenergyserviceinfo.h>
QT_USE_NAMESPACE
Q_DECLARE_METATYPE(QBluetoothDeviceInfo)
Q_DECLARE_METATYPE(QBluetoothServiceDiscoveryAgent::Error)
+Q_DECLARE_METATYPE(QLowEnergyServiceInfo)
// Maximum time to for bluetooth device scan
const int MaxScanTime = 5 * 60 * 1000; // 5 minutes in ms
@@ -71,6 +65,7 @@ public:
public slots:
void deviceDiscoveryDebug(const QBluetoothDeviceInfo &info);
void serviceDiscoveryDebug(const QBluetoothServiceInfo &info);
+ void leServiceDiscoveryDebug(const QLowEnergyServiceInfo &info);
void serviceError(const QBluetoothServiceDiscoveryAgent::Error err);
private slots:
@@ -100,6 +95,7 @@ tst_QBluetoothServiceDiscoveryAgent::tst_QBluetoothServiceDiscoveryAgent()
qRegisterMetaType<QBluetoothDeviceInfo>("QBluetoothDeviceInfo");
qRegisterMetaType<QBluetoothServiceInfo>("QBluetoothServiceInfo");
+ qRegisterMetaType<QLowEnergyServiceInfo>("QLowEnergyServiceInfo");
qRegisterMetaType<QList<QBluetoothUuid> >("QList<QBluetoothUuid>");
qRegisterMetaType<QBluetoothServiceDiscoveryAgent::Error>("QBluetoothServiceDiscoveryAgent::Error");
qRegisterMetaType<QBluetoothDeviceDiscoveryAgent::Error>("QBluetoothDeviceDiscoveryAgent::Error");
@@ -180,6 +176,14 @@ void tst_QBluetoothServiceDiscoveryAgent::serviceDiscoveryDebug(const QBluetooth
qDebug() << "\tRFCOMM server channel:" << info.serverChannel();
}
+void tst_QBluetoothServiceDiscoveryAgent::leServiceDiscoveryDebug(const QLowEnergyServiceInfo &info)
+{
+ qDebug() << "Discovered LE service on"
+ << info.device().name() << info.device().address().toString();
+ qDebug() << "\tService name:" << info.serviceName();
+ qDebug() << "\tUUID:" << info.serviceUuid();
+}
+
static void dumpAttributeVariant(const QVariant &var, const QString indent)
{
if (!var.isValid()) {
@@ -316,7 +320,7 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscoveryAdapters()
QVERIFY(serviceInfo.registerService());
QVERIFY(server.isListening());
- qDebug() << "Scanning address" << addresses[0].toString();
+ qDebug() << "Scanning address " << addresses[0].toString();
QBluetoothServiceDiscoveryAgent discoveryAgent(addresses[1]);
bool setAddress = discoveryAgent.setRemoteAddress(addresses[0]);
@@ -364,7 +368,6 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscovery()
QFETCH(QBluetoothServiceDiscoveryAgent::Error, serviceDiscoveryError);
QBluetoothLocalDevice localDevice;
-
qDebug() << "Scanning address" << deviceInfo.address().toString();
QBluetoothServiceDiscoveryAgent discoveryAgent(localDevice.address());
bool setAddress = discoveryAgent.setRemoteAddress(deviceInfo.address());
@@ -384,14 +387,21 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscovery()
QSignalSpy finishedSpy(&discoveryAgent, SIGNAL(finished()));
QSignalSpy errorSpy(&discoveryAgent, SIGNAL(error(QBluetoothServiceDiscoveryAgent::Error)));
QSignalSpy discoveredSpy(&discoveryAgent, SIGNAL(serviceDiscovered(QBluetoothServiceInfo)));
+ QSignalSpy leDiscoveredSpy(&discoveryAgent, SIGNAL(serviceDiscovered(QLowEnergyServiceInfo)));
// connect(&discoveryAgent, SIGNAL(serviceDiscovered(QBluetoothServiceInfo)),
// this, SLOT(serviceDiscoveryDebug(QBluetoothServiceInfo)));
+// connect(&discoveryAgent, SIGNAL(serviceDiscovered(QLowEnergyServiceInfo)),
+// this, SLOT(leServiceDiscoveryDebug(QLowEnergyServiceInfo)));
connect(&discoveryAgent, SIGNAL(error(QBluetoothServiceDiscoveryAgent::Error)),
this, SLOT(serviceError(QBluetoothServiceDiscoveryAgent::Error)));
discoveryAgent.start();
- QVERIFY(discoveryAgent.isActive());
+ /*
+ * Either we wait for discovery agent to run its course (e.g. Bluez 4) or
+ * we have an immediate result (e.g. Bluez 5)
+ */
+ QVERIFY(discoveryAgent.isActive() || !finishedSpy.isEmpty());
// Wait for up to MaxScanTime for the scan to finish
int scanTime = MaxScanTime;
@@ -447,6 +457,21 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscovery()
}
+ while (!leDiscoveredSpy.isEmpty()) {
+ const QVariant v = leDiscoveredSpy.takeFirst().at(0);
+ if (v.userType() == qMetaTypeId<QLowEnergyServiceInfo>())
+ {
+ const QLowEnergyServiceInfo info =
+ *reinterpret_cast<const QLowEnergyServiceInfo*>(v.constData());
+
+ QVERIFY(info.isValid());
+ QVERIFY(info.device().coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration);
+ } else {
+ QFAIL("Unknown type returned by service discovery");
+ }
+
+ }
+
QVERIFY(discoveryAgent.discoveredServices().count() != 0);
discoveryAgent.clear();
QVERIFY(discoveryAgent.discoveredServices().count() == 0);
diff --git a/tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp b/tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp
index 2195bc0e..cc51b007 100644
--- a/tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp
+++ b/tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp
index 766bbb48..3a577db1 100644
--- a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp
+++ b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -323,8 +315,8 @@ void tst_QBluetoothSocket::tst_clientCommunication_data()
{
QStringList data;
- data << QLatin1String("Echo: Test line one.\n");
- data << QLatin1String("Echo: Test line two, with longer data.\n");
+ data << QStringLiteral("Echo: Test line one.\n");
+ data << QStringLiteral("Echo: Test line two, with longer data.\n");
QTest::newRow("two line test") << data;
}
diff --git a/tests/auto/qbluetoothtransfermanager/tst_qbluetoothtransfermanager.cpp b/tests/auto/qbluetoothtransfermanager/tst_qbluetoothtransfermanager.cpp
index beac5b88..89c70854 100644
--- a/tests/auto/qbluetoothtransfermanager/tst_qbluetoothtransfermanager.cpp
+++ b/tests/auto/qbluetoothtransfermanager/tst_qbluetoothtransfermanager.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/qbluetoothtransferrequest/tst_qbluetoothtransferrequest.cpp b/tests/auto/qbluetoothtransferrequest/tst_qbluetoothtransferrequest.cpp
index 3de7aec0..a06e6ab3 100644
--- a/tests/auto/qbluetoothtransferrequest/tst_qbluetoothtransferrequest.cpp
+++ b/tests/auto/qbluetoothtransferrequest/tst_qbluetoothtransferrequest.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/qbluetoothuuid/tst_qbluetoothuuid.cpp b/tests/auto/qbluetoothuuid/tst_qbluetoothuuid.cpp
index 5aae3ba9..e905eb94 100644
--- a/tests/auto/qbluetoothuuid/tst_qbluetoothuuid.cpp
+++ b/tests/auto/qbluetoothuuid/tst_qbluetoothuuid.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -72,6 +64,7 @@ private slots:
void tst_conversion();
void tst_comparison_data();
void tst_comparison();
+ void tst_quint128ToUuid();
};
tst_QBluetoothUuid::tst_QBluetoothUuid()
@@ -252,7 +245,7 @@ void tst_QBluetoothUuid::tst_conversion_data()
QTest::newRow("00112233-4455-6677-8899-AABBCCDDEEFF")
<< false << quint16(0) << false << quint32(0) << true << uuid128
- << QString(QLatin1String("{00112233-4455-6677-8899-AABBCCDDEEFF}"));
+ << QStringLiteral("{00112233-4455-6677-8899-AABBCCDDEEFF}");
}
}
@@ -383,6 +376,18 @@ void tst_QBluetoothUuid::tst_comparison()
}
}
}
+
+void tst_QBluetoothUuid::tst_quint128ToUuid()
+{
+ QBluetoothUuid temp(QString("{67C8770B-44F1-410A-AB9A-F9B5446F13EE}"));
+ quint128 array = temp.toUInt128();
+ QBluetoothUuid u(array);
+ QVERIFY(temp == u);
+
+ QBENCHMARK {
+ QBluetoothUuid u(array);
+ }
+}
QTEST_MAIN(tst_QBluetoothUuid)
#include "tst_qbluetoothuuid.moc"
diff --git a/tests/auto/qlowenergycharacteristic/qlowenergycharacteristic.pro b/tests/auto/qlowenergycharacteristic/qlowenergycharacteristic.pro
new file mode 100644
index 00000000..33302d60
--- /dev/null
+++ b/tests/auto/qlowenergycharacteristic/qlowenergycharacteristic.pro
@@ -0,0 +1,9 @@
+SOURCES += tst_qlowenergycharacteristic.cpp
+TARGET = tst_qlowenergycharacteristic
+CONFIG += testcase
+
+QT = core bluetooth testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+blackberry {
+ LIBS += -lbtapi
+}
diff --git a/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp b/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp
new file mode 100644
index 00000000..a313d1f6
--- /dev/null
+++ b/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp
@@ -0,0 +1,350 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited all rights reserved
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QUuid>
+
+#include <QDebug>
+
+#include <QBluetoothDeviceDiscoveryAgent>
+#include <QLowEnergyCharacteristic>
+#include <QLowEnergyController>
+#include <QBluetoothLocalDevice>
+
+QT_USE_NAMESPACE
+
+class tst_QLowEnergyCharacteristic : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QLowEnergyCharacteristic();
+ ~tst_QLowEnergyCharacteristic();
+
+protected slots:
+ void deviceDiscovered(const QBluetoothDeviceInfo &info);
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void tst_constructionDefault();
+ void tst_assignCompare();
+
+private:
+ QSet<QString> remoteLeDevices;
+ QLowEnergyController *globalControl;
+ QLowEnergyService *globalService;
+};
+
+tst_QLowEnergyCharacteristic::tst_QLowEnergyCharacteristic() :
+ globalControl(0), globalService(0)
+{
+ QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
+}
+
+tst_QLowEnergyCharacteristic::~tst_QLowEnergyCharacteristic()
+{
+}
+
+void tst_QLowEnergyCharacteristic::initTestCase()
+{
+ if (QBluetoothLocalDevice::allDevices().isEmpty()) {
+ qWarning("No remote device discovered.");
+ return;
+ }
+
+ // start Bluetooth if not started
+ QBluetoothLocalDevice device;
+ device.powerOn();
+
+ // find an arbitrary low energy device in vincinity
+ // find an arbitrary service with characteristic
+ QBluetoothDeviceDiscoveryAgent *devAgent = new QBluetoothDeviceDiscoveryAgent(this);
+ connect(devAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)),
+ this, SLOT(deviceDiscovered(QBluetoothDeviceInfo)));
+
+ QSignalSpy errorSpy(devAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)));
+ QVERIFY(errorSpy.isValid());
+ QVERIFY(errorSpy.isEmpty());
+
+ QSignalSpy spy(devAgent, SIGNAL(finished()));
+ QVERIFY(spy.isValid());
+ QVERIFY(spy.isEmpty());
+
+ devAgent->start();
+ QTRY_VERIFY_WITH_TIMEOUT(spy.count() > 0, 50000);
+
+ // find first service with descriptor
+ QLowEnergyController *controller = 0;
+ foreach (const QString &remoteDevice, remoteLeDevices.toList()) {
+ controller = new QLowEnergyController(QBluetoothAddress(remoteDevice), this);
+ qDebug() << "Connecting to" << remoteDevice;
+ controller->connectToDevice();
+ QTRY_IMPL(controller->state() != QLowEnergyController::ConnectingState,
+ 10000);
+ if (controller->state() != QLowEnergyController::ConnectedState) {
+ // any error and we skip
+ delete controller;
+ qDebug() << "Skipping device";
+ continue;
+ }
+
+ QSignalSpy discoveryFinishedSpy(controller, SIGNAL(discoveryFinished()));
+ controller->discoverServices();
+ QTRY_VERIFY_WITH_TIMEOUT(discoveryFinishedSpy.count() == 1, 10000);
+ foreach (const QBluetoothUuid &leServiceUuid, controller->services()) {
+ QLowEnergyService *leService = controller->createServiceObject(leServiceUuid, this);
+ if (!leService)
+ continue;
+
+ leService->discoverDetails();
+ QTRY_VERIFY_WITH_TIMEOUT(
+ leService->state() == QLowEnergyService::ServiceDiscovered, 10000);
+
+ QList<QLowEnergyCharacteristic> chars = leService->characteristics();
+ foreach (const QLowEnergyCharacteristic &ch, chars) {
+ if (!ch.descriptors().isEmpty()) {
+ globalService = leService;
+ globalControl = controller;
+ qWarning() << "Found service with descriptor" << remoteDevice
+ << globalService->serviceName() << globalService->serviceUuid();
+ break;
+ }
+ }
+
+ if (globalControl)
+ break;
+ else
+ delete leService;
+ }
+
+ if (globalControl)
+ break;
+
+ delete controller;
+ }
+
+ if (!globalControl) {
+ qWarning() << "Test limited due to missing remote QLowEnergyDescriptor."
+ << "Please ensure the Bluetooth Low Energy device is advertising its services.";
+ }
+}
+
+void tst_QLowEnergyCharacteristic::cleanupTestCase()
+{
+ if (globalControl)
+ globalControl->disconnectFromDevice();
+}
+
+void tst_QLowEnergyCharacteristic::deviceDiscovered(const QBluetoothDeviceInfo &info)
+{
+ if (info.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration)
+ remoteLeDevices.insert(info.address().toString());
+}
+
+void tst_QLowEnergyCharacteristic::tst_constructionDefault()
+{
+ QLowEnergyCharacteristic characteristic;
+ QVERIFY(!characteristic.isValid());
+ QCOMPARE(characteristic.value(), QByteArray());
+ QVERIFY(characteristic.uuid().isNull());
+ QVERIFY(characteristic.handle() == 0);
+ QCOMPARE(characteristic.name(), QString());
+ QCOMPARE(characteristic.descriptors().count(), 0);
+ QCOMPARE(characteristic.descriptor(QBluetoothUuid()),
+ QLowEnergyDescriptor());
+ QCOMPARE(characteristic.descriptor(QBluetoothUuid(QBluetoothUuid::ClientCharacteristicConfiguration)),
+ QLowEnergyDescriptor());
+ QCOMPARE(characteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration),
+ QLowEnergyDescriptor());
+ QCOMPARE(characteristic.properties(), QLowEnergyCharacteristic::Unknown);
+
+ QLowEnergyCharacteristic copyConstructed(characteristic);
+ QVERIFY(!copyConstructed.isValid());
+ QCOMPARE(copyConstructed.value(), QByteArray());
+ QVERIFY(copyConstructed.uuid().isNull());
+ QVERIFY(copyConstructed.handle() == 0);
+ QCOMPARE(copyConstructed.name(), QString());
+ QCOMPARE(copyConstructed.descriptors().count(), 0);
+ QCOMPARE(copyConstructed.properties(), QLowEnergyCharacteristic::Unknown);
+
+ QVERIFY(copyConstructed == characteristic);
+ QVERIFY(characteristic == copyConstructed);
+ QVERIFY(!(copyConstructed != characteristic));
+ QVERIFY(!(characteristic != copyConstructed));
+
+ QLowEnergyCharacteristic assigned;
+
+ QVERIFY(assigned == characteristic);
+ QVERIFY(characteristic == assigned);
+ QVERIFY(!(assigned != characteristic));
+ QVERIFY(!(characteristic != assigned));
+
+ assigned = characteristic;
+ QVERIFY(!assigned.isValid());
+ QCOMPARE(assigned.value(), QByteArray());
+ QVERIFY(assigned.uuid().isNull());
+ QVERIFY(assigned.handle() == 0);
+ QCOMPARE(assigned.name(), QString());
+ QCOMPARE(assigned.descriptors().count(), 0);
+ QCOMPARE(assigned.properties(), QLowEnergyCharacteristic::Unknown);
+
+ QVERIFY(assigned == characteristic);
+ QVERIFY(characteristic == assigned);
+ QVERIFY(!(assigned != characteristic));
+ QVERIFY(!(characteristic != assigned));
+}
+
+void tst_QLowEnergyCharacteristic::tst_assignCompare()
+{
+ if (!globalService)
+ QSKIP("No characteristic found.");
+
+ QLowEnergyCharacteristic target;
+ QVERIFY(!target.isValid());
+ QCOMPARE(target.value(), QByteArray());
+ QVERIFY(target.uuid().isNull());
+ QVERIFY(target.handle() == 0);
+ QCOMPARE(target.name(), QString());
+ QCOMPARE(target.descriptors().count(), 0);
+ QCOMPARE(target.properties(), QLowEnergyCharacteristic::Unknown);
+
+ int indexWithDescriptor = -1;
+ const QList<QLowEnergyCharacteristic> chars = globalService->characteristics();
+ QVERIFY(!chars.isEmpty());
+ for (int i = 0; i < chars.count(); i++) {
+ const QLowEnergyCharacteristic specific =
+ globalService->characteristic(chars[i].uuid());
+ QVERIFY(specific.isValid());
+ QCOMPARE(specific, chars[i]);
+ if (chars[i].descriptors().count() > 0) {
+ indexWithDescriptor = i;
+ break;
+ }
+ }
+
+ if (chars.isEmpty())
+ QSKIP("No suitable characteristic found despite prior indication.");
+
+ bool noDescriptors = (indexWithDescriptor == -1);
+ if (noDescriptors)
+ indexWithDescriptor = 0; // just choose one
+
+ // test assignment operator
+ target = chars[indexWithDescriptor];
+ QVERIFY(target.isValid());
+ QVERIFY(!target.name().isEmpty());
+ QVERIFY(target.handle() > 0);
+ QVERIFY(!target.uuid().isNull());
+ QVERIFY(target.properties() != QLowEnergyCharacteristic::Unknown);
+ if (target.properties() & QLowEnergyCharacteristic::Read)
+ QVERIFY(!target.value().isEmpty());
+ if (!noDescriptors)
+ QVERIFY(target.descriptors().count() > 0);
+
+ QVERIFY(target == chars[indexWithDescriptor]);
+ QVERIFY(chars[indexWithDescriptor] == target);
+ QVERIFY(!(target != chars[indexWithDescriptor]));
+ QVERIFY(!(chars[indexWithDescriptor] != target));
+
+ QCOMPARE(target.isValid(), chars[indexWithDescriptor].isValid());
+ QCOMPARE(target.name(), chars[indexWithDescriptor].name());
+ QCOMPARE(target.handle(), chars[indexWithDescriptor].handle());
+ QCOMPARE(target.uuid(), chars[indexWithDescriptor].uuid());
+ QCOMPARE(target.value(), chars[indexWithDescriptor].value());
+ QCOMPARE(target.properties(), chars[indexWithDescriptor].properties());
+ QCOMPARE(target.descriptors().count(),
+ chars[indexWithDescriptor].descriptors().count());
+ for (int i = 0; i < target.descriptors().count(); i++) {
+ const QLowEnergyDescriptor ref = chars[indexWithDescriptor].descriptors()[i];
+ QCOMPARE(target.descriptors()[i].name(), ref.name());
+ QCOMPARE(target.descriptors()[i].isValid(), ref.isValid());
+ QCOMPARE(target.descriptors()[i].type(), ref.type());
+ QCOMPARE(target.descriptors()[i].handle(), ref.handle());
+ QCOMPARE(target.descriptors()[i].uuid(), ref.uuid());
+ QCOMPARE(target.descriptors()[i].value(), ref.value());
+
+ const QLowEnergyDescriptor ref2 = chars[indexWithDescriptor].descriptor(ref.uuid());
+ QCOMPARE(ref, ref2);
+ }
+
+ // test copy constructor
+ QLowEnergyCharacteristic copyConstructed(target);
+ QCOMPARE(copyConstructed.isValid(), chars[indexWithDescriptor].isValid());
+ QCOMPARE(copyConstructed.name(), chars[indexWithDescriptor].name());
+ QCOMPARE(copyConstructed.handle(), chars[indexWithDescriptor].handle());
+ QCOMPARE(copyConstructed.uuid(), chars[indexWithDescriptor].uuid());
+ QCOMPARE(copyConstructed.value(), chars[indexWithDescriptor].value());
+ QCOMPARE(copyConstructed.properties(), chars[indexWithDescriptor].properties());
+ QCOMPARE(copyConstructed.descriptors().count(),
+ chars[indexWithDescriptor].descriptors().count());
+
+ QVERIFY(copyConstructed == target);
+ QVERIFY(target == copyConstructed);
+ QVERIFY(!(copyConstructed != target));
+ QVERIFY(!(target != copyConstructed));
+
+ // test invalidation
+ QLowEnergyCharacteristic invalid;
+ target = invalid;
+ QVERIFY(!target.isValid());
+ QCOMPARE(target.value(), QByteArray());
+ QVERIFY(target.uuid().isNull());
+ QVERIFY(target.handle() == 0);
+ QCOMPARE(target.name(), QString());
+ QCOMPARE(target.descriptors().count(), 0);
+ QCOMPARE(target.properties(), QLowEnergyCharacteristic::Unknown);
+
+ QVERIFY(invalid == target);
+ QVERIFY(target == invalid);
+ QVERIFY(!(invalid != target));
+ QVERIFY(!(target != invalid));
+
+ QVERIFY(!(chars[indexWithDescriptor] == target));
+ QVERIFY(!(target == chars[indexWithDescriptor]));
+ QVERIFY(chars[indexWithDescriptor] != target);
+ QVERIFY(target != chars[indexWithDescriptor]);
+
+ if (chars.count() >= 2) {
+ // at least two characteristics
+ QVERIFY(!(chars[0] == chars[1]));
+ QVERIFY(!(chars[1] == chars[0]));
+ QVERIFY(chars[0] != chars[1]);
+ QVERIFY(chars[1] != chars[0]);
+ }
+}
+
+QTEST_MAIN(tst_QLowEnergyCharacteristic)
+
+#include "tst_qlowenergycharacteristic.moc"
diff --git a/tests/auto/qlowenergycontroller/qlowenergycontroller.pro b/tests/auto/qlowenergycontroller/qlowenergycontroller.pro
new file mode 100644
index 00000000..159f27bf
--- /dev/null
+++ b/tests/auto/qlowenergycontroller/qlowenergycontroller.pro
@@ -0,0 +1,6 @@
+QT = core bluetooth testlib
+TARGET = tst_qlowenergycontroller
+CONFIG += testcase
+
+SOURCES += tst_qlowenergycontroller.cpp
+
diff --git a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
new file mode 100644
index 00000000..cb5bbb07
--- /dev/null
+++ b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
@@ -0,0 +1,1799 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QBluetoothLocalDevice>
+#include <QBluetoothDeviceDiscoveryAgent>
+#include <QBluetoothUuid>
+#include <QLowEnergyController>
+#include <QLowEnergyCharacteristic>
+
+#include <QDebug>
+
+/*!
+ This test requires a TI sensor tag with Firmware version: 1.5 (Oct 23 2013).
+ Since revision updates change user strings and even shift handles around
+ other versions than the above are unlikely to succeed. Please update the
+ sensor tag before continuing.
+
+ The TI sensor can be updated using the related iOS app. The Android version
+ doesn't seem to update at this point in time.
+ */
+
+QT_USE_NAMESPACE
+
+class tst_QLowEnergyController : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QLowEnergyController();
+ ~tst_QLowEnergyController();
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void tst_connect();
+ void tst_concurrentDiscovery();
+ void tst_defaultBehavior();
+ void tst_writeCharacteristic();
+ void tst_writeDescriptor();
+
+private:
+ void verifyServiceProperties(const QLowEnergyService *info);
+
+ QBluetoothDeviceDiscoveryAgent *devAgent;
+ QBluetoothAddress remoteDevice;
+ QList<QBluetoothUuid> foundServices;
+};
+
+Q_DECLARE_METATYPE(QLowEnergyCharacteristic)
+Q_DECLARE_METATYPE(QLowEnergyDescriptor)
+Q_DECLARE_METATYPE(QLowEnergyService::ServiceError)
+
+tst_QLowEnergyController::tst_QLowEnergyController()
+{
+ qRegisterMetaType<QLowEnergyCharacteristic>();
+ qRegisterMetaType<QLowEnergyDescriptor>();
+
+ //QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
+ const QString remote = qgetenv("BT_TEST_DEVICE");
+ if (!remote.isEmpty()) {
+ remoteDevice = QBluetoothAddress(remote);
+ qWarning() << "Using remote device " << remote << " for testing. Ensure that the device is discoverable for pairing requests";
+ } else {
+ qWarning() << "Not using any remote device for testing. Set BT_TEST_DEVICE env to run manual tests involving a remote device";
+ }
+}
+
+tst_QLowEnergyController::~tst_QLowEnergyController()
+{
+
+}
+
+void tst_QLowEnergyController::initTestCase()
+{
+ if (remoteDevice.isNull()
+ || QBluetoothLocalDevice::allDevices().isEmpty()) {
+ qWarning("No remote device or local adapter found.");
+ return;
+ }
+
+ devAgent = new QBluetoothDeviceDiscoveryAgent(this);
+
+ QSignalSpy finishedSpy(devAgent, SIGNAL(finished()));
+ // there should be no changes yet
+ QVERIFY(finishedSpy.isValid());
+ QVERIFY(finishedSpy.isEmpty());
+
+ bool deviceFound = false;
+ devAgent->start();
+ QTRY_VERIFY_WITH_TIMEOUT(finishedSpy.count() > 0, 30000);
+ foreach (const QBluetoothDeviceInfo &info, devAgent->discoveredDevices()) {
+ if (info.address() == remoteDevice) {
+ deviceFound = true;
+ break;
+ }
+ }
+
+ QVERIFY2(deviceFound, "Cannot find remote device.");
+
+ // These are the services exported by the TI SensorTag
+ foundServices << QBluetoothUuid(QString("00001800-0000-1000-8000-00805f9b34fb"));
+ foundServices << QBluetoothUuid(QString("00001801-0000-1000-8000-00805f9b34fb"));
+ foundServices << QBluetoothUuid(QString("0000180a-0000-1000-8000-00805f9b34fb"));
+ foundServices << QBluetoothUuid(QString("0000ffe0-0000-1000-8000-00805f9b34fb"));
+ foundServices << QBluetoothUuid(QString("f000aa00-0451-4000-b000-000000000000"));
+ foundServices << QBluetoothUuid(QString("f000aa10-0451-4000-b000-000000000000"));
+ foundServices << QBluetoothUuid(QString("f000aa20-0451-4000-b000-000000000000"));
+ foundServices << QBluetoothUuid(QString("f000aa30-0451-4000-b000-000000000000"));
+ foundServices << QBluetoothUuid(QString("f000aa40-0451-4000-b000-000000000000"));
+ foundServices << QBluetoothUuid(QString("f000aa50-0451-4000-b000-000000000000"));
+ foundServices << QBluetoothUuid(QString("f000aa60-0451-4000-b000-000000000000"));
+ foundServices << QBluetoothUuid(QString("f000ccc0-0451-4000-b000-000000000000"));
+ foundServices << QBluetoothUuid(QString("f000ffc0-0451-4000-b000-000000000000"));
+}
+
+void tst_QLowEnergyController::cleanupTestCase()
+{
+
+}
+
+void tst_QLowEnergyController::tst_connect()
+{
+ QList<QBluetoothHostInfo> localAdapters = QBluetoothLocalDevice::allDevices();
+ if (localAdapters.isEmpty() || remoteDevice.isNull())
+ QSKIP("No local Bluetooth or remote BTLE device found. Skipping test.");
+
+ const QBluetoothAddress localAdapter = localAdapters.at(0).address();
+ QLowEnergyController control(remoteDevice);
+ QSignalSpy connectedSpy(&control, SIGNAL(connected()));
+ QSignalSpy disconnectedSpy(&control, SIGNAL(disconnected()));
+
+ QCOMPARE(control.localAddress(), localAdapter);
+ QVERIFY(!control.localAddress().isNull());
+ QCOMPARE(control.remoteAddress(), remoteDevice);
+ QCOMPARE(control.state(), QLowEnergyController::UnconnectedState);
+ QCOMPARE(control.error(), QLowEnergyController::NoError);
+ QVERIFY(control.errorString().isEmpty());
+ QCOMPARE(disconnectedSpy.count(), 0);
+ QCOMPARE(connectedSpy.count(), 0);
+ QVERIFY(control.services().isEmpty());
+
+ bool wasError = false;
+ control.connectToDevice();
+ QTRY_IMPL(control.state() != QLowEnergyController::ConnectingState,
+ 10000);
+
+ QCOMPARE(disconnectedSpy.count(), 0);
+ if (control.error() != QLowEnergyController::NoError) {
+ //error during connect
+ QCOMPARE(connectedSpy.count(), 0);
+ QCOMPARE(control.state(), QLowEnergyController::UnconnectedState);
+ wasError = true;
+ } else if (control.state() == QLowEnergyController::ConnectingState) {
+ //timeout
+ QCOMPARE(connectedSpy.count(), 0);
+ QVERIFY(control.errorString().isEmpty());
+ QCOMPARE(control.error(), QLowEnergyController::NoError);
+ QVERIFY(control.services().isEmpty());
+ QSKIP("Connection to LE device cannot be established. Skipping test.");
+ return;
+ } else {
+ QCOMPARE(control.state(), QLowEnergyController::ConnectedState);
+ QCOMPARE(connectedSpy.count(), 1);
+ QCOMPARE(control.error(), QLowEnergyController::NoError);
+ QVERIFY(control.errorString().isEmpty());
+ }
+
+ QVERIFY(control.services().isEmpty());
+
+ QList<QLowEnergyService *> savedReferences;
+
+ if (!wasError) {
+ QSignalSpy discoveryFinishedSpy(&control, SIGNAL(discoveryFinished()));
+ QSignalSpy serviceFoundSpy(&control, SIGNAL(serviceDiscovered(QBluetoothUuid)));
+ control.discoverServices();
+ QTRY_VERIFY_WITH_TIMEOUT(discoveryFinishedSpy.count() == 1, 10000);
+
+ QVERIFY(!serviceFoundSpy.isEmpty());
+ QVERIFY(serviceFoundSpy.count() >= foundServices.count());
+ QVERIFY(!serviceFoundSpy.isEmpty());
+ QList<QBluetoothUuid> listing;
+ for (int i = 0; i < serviceFoundSpy.count(); i++) {
+ const QVariant v = serviceFoundSpy[i].at(0);
+ listing.append(v.value<QBluetoothUuid>());
+ }
+
+ foreach (const QBluetoothUuid &uuid, foundServices) {
+ QVERIFY2(listing.contains(uuid),
+ uuid.toString().toLatin1());
+
+ QLowEnergyService *service = control.createServiceObject(uuid);
+ QVERIFY2(service, uuid.toString().toLatin1());
+ savedReferences.append(service);
+ QCOMPARE(service->type(), QLowEnergyService::PrimaryService);
+ QCOMPARE(service->state(), QLowEnergyService::DiscoveryRequired);
+ }
+
+ // unrelated uuids don't return valid service object
+ // invalid service uuid
+ QVERIFY(!control.createServiceObject(QBluetoothUuid()));
+ // some random uuid
+ QVERIFY(!control.createServiceObject(QBluetoothUuid(QBluetoothUuid::DeviceName)));
+
+ // initiate characteristic discovery
+ foreach (QLowEnergyService *service, savedReferences) {
+ qDebug() << "Discoverying" << service->serviceUuid();
+ QSignalSpy stateSpy(service,
+ SIGNAL(stateChanged(QLowEnergyService::ServiceState)));
+ QSignalSpy errorSpy(service, SIGNAL(error(QLowEnergyService::ServiceError)));
+ service->discoverDetails();
+
+ QTRY_VERIFY_WITH_TIMEOUT(
+ service->state() == QLowEnergyService::ServiceDiscovered, 10000);
+
+ QCOMPARE(errorSpy.count(), 0); //no error
+ QCOMPARE(stateSpy.count(), 2); //
+
+ verifyServiceProperties(service);
+ }
+
+ // ensure that related service objects share same state
+ foreach (QLowEnergyService* originalService, savedReferences) {
+ QLowEnergyService *newService = control.createServiceObject(
+ originalService->serviceUuid());
+ QVERIFY(newService);
+ QCOMPARE(newService->state(), QLowEnergyService::ServiceDiscovered);
+ delete newService;
+ }
+ }
+
+ // Finish off
+ control.disconnectFromDevice();
+ QTRY_VERIFY_WITH_TIMEOUT(
+ control.state() == QLowEnergyController::UnconnectedState,
+ 10000);
+
+ if (wasError) {
+ QCOMPARE(disconnectedSpy.count(), 0);
+ } else {
+ QCOMPARE(disconnectedSpy.count(), 1);
+ // after disconnect all service references must be invalid
+ foreach (const QLowEnergyService *entry, savedReferences) {
+ const QBluetoothUuid &uuid = entry->serviceUuid();
+ QVERIFY2(entry->state() == QLowEnergyService::InvalidService,
+ uuid.toString().toLatin1());
+
+ //after disconnect all related characteristics and descriptors are invalid
+ QList<QLowEnergyCharacteristic> chars = entry->characteristics();
+ for (int i = 0; i < chars.count(); i++) {
+ QCOMPARE(chars.at(i).isValid(), false);
+ QList<QLowEnergyDescriptor> descriptors = chars[i].descriptors();
+ for (int j = 0; j < descriptors.count(); j++)
+ QCOMPARE(descriptors[j].isValid(), false);
+ }
+ }
+ }
+
+ qDeleteAll(savedReferences);
+ savedReferences.clear();
+}
+
+void tst_QLowEnergyController::tst_concurrentDiscovery()
+{
+ QList<QBluetoothHostInfo> localAdapters = QBluetoothLocalDevice::allDevices();
+ if (localAdapters.isEmpty() || remoteDevice.isNull())
+ QSKIP("No local Bluetooth or remote BTLE device found. Skipping test.");
+
+ // quick setup - more elaborate test is done by connectNew()
+ QLowEnergyController control(remoteDevice);
+ QCOMPARE(control.state(), QLowEnergyController::UnconnectedState);
+ QCOMPARE(control.error(), QLowEnergyController::NoError);
+
+ control.connectToDevice();
+ {
+ QTRY_IMPL(control.state() != QLowEnergyController::ConnectingState,
+ 30000);
+ }
+
+ if (control.state() == QLowEnergyController::ConnectingState
+ || control.error() != QLowEnergyController::NoError) {
+ // default BTLE backend forever hangs in ConnectingState
+ QSKIP("Cannot connect to remote device");
+ }
+
+ QCOMPARE(control.state(), QLowEnergyController::ConnectedState);
+
+ // 2. new controller to same device fails
+ {
+ QLowEnergyController control2(remoteDevice);
+ control2.connectToDevice();
+ {
+ QTRY_IMPL(control2.state() != QLowEnergyController::ConnectingState,
+ 30000);
+ }
+
+ QVERIFY(control2.error() != QLowEnergyController::NoError);
+ }
+
+ /* We are testing that we can run service discovery on the same device
+ * for multiple services at the same time.
+ * */
+
+ QSignalSpy discoveryFinishedSpy(&control, SIGNAL(discoveryFinished()));
+ control.discoverServices();
+ QTRY_VERIFY_WITH_TIMEOUT(discoveryFinishedSpy.count() == 1, 10000);
+
+ // pick MAX_SERVICES_SAME_TIME_ACCESS services
+ // and discover them at the same time
+#define MAX_SERVICES_SAME_TIME_ACCESS 3
+ QLowEnergyService *services[MAX_SERVICES_SAME_TIME_ACCESS];
+
+ QVERIFY(control.services().count() >= MAX_SERVICES_SAME_TIME_ACCESS);
+
+ QList<QBluetoothUuid> uuids = control.services();
+
+ // initialize services
+ for (int i = 0; i<MAX_SERVICES_SAME_TIME_ACCESS; i++) {
+ services[i] = control.createServiceObject(uuids.at(i), this);
+ QVERIFY(services[i]);
+ }
+
+ // start complete discovery
+ for (int i = 0; i<MAX_SERVICES_SAME_TIME_ACCESS; i++)
+ services[i]->discoverDetails();
+
+ // wait until discovery done
+ for (int i = 0; i<MAX_SERVICES_SAME_TIME_ACCESS; i++) {
+ qWarning() << "Waiting for" << i << services[i]->serviceUuid();
+ QTRY_VERIFY_WITH_TIMEOUT(
+ services[i]->state() == QLowEnergyService::ServiceDiscovered,
+ 30000);
+ }
+
+ // verify discovered services
+ for (int i = 0; i<MAX_SERVICES_SAME_TIME_ACCESS; i++) {
+ verifyServiceProperties(services[i]);
+
+ QVERIFY(!services[i]->contains(QLowEnergyCharacteristic()));
+ QVERIFY(!services[i]->contains(QLowEnergyDescriptor()));
+ }
+
+ control.disconnectFromDevice();
+ QTRY_VERIFY_WITH_TIMEOUT(control.state() == QLowEnergyController::UnconnectedState,
+ 30000);
+ discoveryFinishedSpy.clear();
+
+ // redo the discovery with same controller
+ QLowEnergyService *services_second[MAX_SERVICES_SAME_TIME_ACCESS];
+ control.connectToDevice();
+ {
+ QTRY_IMPL(control.state() != QLowEnergyController::ConnectingState,
+ 30000);
+ }
+
+ QCOMPARE(control.state(), QLowEnergyController::ConnectedState);
+ control.discoverServices();
+ QTRY_VERIFY_WITH_TIMEOUT(discoveryFinishedSpy.count() == 1, 10000);
+
+ // get all details
+ for (int i = 0; i<MAX_SERVICES_SAME_TIME_ACCESS; i++) {
+ services_second[i] = control.createServiceObject(uuids.at(i), this);
+ QVERIFY(services_second[i]->parent() == this);
+ QVERIFY(services[i]);
+ QVERIFY(services_second[i]->state() == QLowEnergyService::DiscoveryRequired);
+ services_second[i]->discoverDetails();
+ }
+
+ // wait until discovery done
+ for (int i = 0; i<MAX_SERVICES_SAME_TIME_ACCESS; i++) {
+ qWarning() << "Waiting for" << i << services_second[i]->serviceUuid();
+ QTRY_VERIFY_WITH_TIMEOUT(
+ services_second[i]->state() == QLowEnergyService::ServiceDiscovered,
+ 30000);
+ QCOMPARE(services_second[i]->serviceName(), services[i]->serviceName());
+ QCOMPARE(services_second[i]->serviceUuid(), services[i]->serviceUuid());
+ }
+
+ // verify discovered services (1st and 2nd round)
+ for (int i = 0; i<MAX_SERVICES_SAME_TIME_ACCESS; i++) {
+ verifyServiceProperties(services_second[i]);
+ //after disconnect all related characteristics and descriptors are invalid
+ const QList<QLowEnergyCharacteristic> chars = services[i]->characteristics();
+ for (int j = 0; j < chars.count(); j++) {
+ QCOMPARE(chars.at(j).isValid(), false);
+ QVERIFY(services[i]->contains(chars[j]));
+ QVERIFY(!services_second[i]->contains(chars[j]));
+ const QList<QLowEnergyDescriptor> descriptors = chars[j].descriptors();
+ for (int k = 0; k < descriptors.count(); k++) {
+ QCOMPARE(descriptors[k].isValid(), false);
+ services[i]->contains(descriptors[k]);
+ QVERIFY(!services_second[i]->contains(chars[j]));
+ }
+ }
+
+ QCOMPARE(services[i]->serviceUuid(), services_second[i]->serviceUuid());
+ QCOMPARE(services[i]->serviceName(), services_second[i]->serviceName());
+ QCOMPARE(services[i]->type(), services_second[i]->type());
+ QVERIFY(services[i]->state() == QLowEnergyService::InvalidService);
+ QVERIFY(services_second[i]->state() == QLowEnergyService::ServiceDiscovered);
+ }
+
+ // cleanup
+ for (int i = 0; i<MAX_SERVICES_SAME_TIME_ACCESS; i++) {
+ delete services[i];
+ delete services_second[i];
+ }
+
+ control.disconnectFromDevice();
+}
+
+void tst_QLowEnergyController::verifyServiceProperties(
+ const QLowEnergyService *info)
+{
+ if (info->serviceUuid() ==
+ QBluetoothUuid(QString("00001800-0000-1000-8000-00805f9b34fb"))) {
+ qDebug() << "Verifying GAP Service";
+ QList<QLowEnergyCharacteristic> chars = info->characteristics();
+ QCOMPARE(chars.count(), 5);
+
+ // Device Name
+ QString temp("00002a00-0000-1000-8000-00805f9b34fb");
+ QCOMPARE(chars[0].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[0].handle(), QLowEnergyHandle(0x3));
+ QCOMPARE(chars[0].properties(), QLowEnergyCharacteristic::Read);
+ QCOMPARE(chars[0].value(), QByteArray::fromHex("544920424c452053656e736f7220546167"));
+ QVERIFY(chars[0].isValid());
+ QCOMPARE(chars[0].descriptors().count(), 0);
+ QVERIFY(info->contains(chars[0]));
+
+ // Appearance
+ temp = QString("00002a01-0000-1000-8000-00805f9b34fb");
+ QCOMPARE(chars[1].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[1].handle(), QLowEnergyHandle(0x5));
+ QCOMPARE(chars[1].properties(), QLowEnergyCharacteristic::Read);
+ QCOMPARE(chars[1].value(), QByteArray::fromHex("0000"));
+ QVERIFY(chars[1].isValid());
+ QCOMPARE(chars[1].descriptors().count(), 0);
+ QVERIFY(info->contains(chars[1]));
+
+ // Peripheral Privacy Flag
+ temp = QString("00002a02-0000-1000-8000-00805f9b34fb");
+ QCOMPARE(chars[2].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[2].handle(), QLowEnergyHandle(0x7));
+ QCOMPARE(chars[2].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
+ QCOMPARE(chars[2].value(), QByteArray::fromHex("00"));
+ QVERIFY(chars[2].isValid());
+ QCOMPARE(chars[2].descriptors().count(), 0);
+ QVERIFY(info->contains(chars[2]));
+
+ // Reconnection Address
+ temp = QString("00002a03-0000-1000-8000-00805f9b34fb");
+ QCOMPARE(chars[3].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[3].handle(), QLowEnergyHandle(0x9));
+ //Early firmware version had this characteristic as Read|Write and may fail
+ QCOMPARE(chars[3].properties(), QLowEnergyCharacteristic::Write);
+ if (chars[3].properties() & QLowEnergyCharacteristic::Read)
+ QCOMPARE(chars[3].value(), QByteArray::fromHex("000000000000"));
+ else
+ QCOMPARE(chars[3].value(), QByteArray());
+ QVERIFY(chars[3].isValid());
+ QCOMPARE(chars[3].descriptors().count(), 0);
+ QVERIFY(info->contains(chars[3]));
+
+ // Peripheral Preferred Connection Parameters
+ temp = QString("00002a04-0000-1000-8000-00805f9b34fb");
+ QCOMPARE(chars[4].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[4].handle(), QLowEnergyHandle(0xb));
+ QCOMPARE(chars[4].properties(), QLowEnergyCharacteristic::Read);
+ QCOMPARE(chars[4].value(), QByteArray::fromHex("5000a0000000e803"));
+ QVERIFY(chars[4].isValid());
+ QCOMPARE(chars[4].descriptors().count(), 0);
+ QVERIFY(info->contains(chars[4]));
+ } else if (info->serviceUuid() ==
+ QBluetoothUuid(QString("00001801-0000-1000-8000-00805f9b34fb"))) {
+ qDebug() << "Verifying GATT Service";
+ QList<QLowEnergyCharacteristic> chars = info->characteristics();
+ QCOMPARE(chars.count(), 1);
+
+ // Service Changed
+ QString temp("00002a05-0000-1000-8000-00805f9b34fb");
+ //this should really be readable according to GATT Service spec
+ QCOMPARE(chars[0].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[0].handle(), QLowEnergyHandle(0xe));
+ QCOMPARE(chars[0].properties(), QLowEnergyCharacteristic::Indicate);
+ QCOMPARE(chars[0].value(), QByteArray());
+ QVERIFY(chars[0].isValid());
+ QVERIFY(info->contains(chars[0]));
+
+ QCOMPARE(chars[0].descriptors().count(), 1);
+ QCOMPARE(chars[0].descriptors().at(0).isValid(), true);
+ QCOMPARE(chars[0].descriptors().at(0).handle(), QLowEnergyHandle(0xf));
+ QCOMPARE(chars[0].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::ClientCharacteristicConfiguration));
+ QCOMPARE(chars[0].descriptors().at(0).type(),
+ QBluetoothUuid::ClientCharacteristicConfiguration);
+ QCOMPARE(chars[0].descriptors().at(0).value(), QByteArray::fromHex("0000"));
+ QVERIFY(info->contains(chars[0].descriptors().at(0)));
+ } else if (info->serviceUuid() ==
+ QBluetoothUuid(QString("0000180a-0000-1000-8000-00805f9b34fb"))) {
+ qDebug() << "Verifying Device Information";
+ QList<QLowEnergyCharacteristic> chars = info->characteristics();
+ QCOMPARE(chars.count(), 9);
+
+ // System ID
+ QString temp("00002a23-0000-1000-8000-00805f9b34fb");
+ //this should really be readable according to GATT Service spec
+ QCOMPARE(chars[0].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[0].handle(), QLowEnergyHandle(0x12));
+ QCOMPARE(chars[0].properties(), QLowEnergyCharacteristic::Read);
+ QCOMPARE(chars[0].value(), QByteArray::fromHex("6e41ab0000296abc"));
+ QVERIFY(chars[0].isValid());
+ QVERIFY(info->contains(chars[0]));
+ QCOMPARE(chars[0].descriptors().count(), 0);
+
+ // Model Number
+ temp = QString("00002a24-0000-1000-8000-00805f9b34fb");
+ QCOMPARE(chars[1].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[1].handle(), QLowEnergyHandle(0x14));
+ QCOMPARE(chars[1].properties(), QLowEnergyCharacteristic::Read);
+ QCOMPARE(chars[1].value(), QByteArray::fromHex("4e2e412e00"));
+ QVERIFY(chars[1].isValid());
+ QVERIFY(info->contains(chars[1]));
+ QCOMPARE(chars[1].descriptors().count(), 0);
+
+ // Serial Number
+ temp = QString("00002a25-0000-1000-8000-00805f9b34fb");
+ QCOMPARE(chars[2].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[2].handle(), QLowEnergyHandle(0x16));
+ QCOMPARE(chars[2].properties(),
+ (QLowEnergyCharacteristic::Read));
+ QCOMPARE(chars[2].value(), QByteArray::fromHex("4e2e412e00"));
+ QVERIFY(chars[2].isValid());
+ QVERIFY(info->contains(chars[2]));
+ QCOMPARE(chars[2].descriptors().count(), 0);
+
+ // Firmware Revision
+ temp = QString("00002a26-0000-1000-8000-00805f9b34fb");
+ QCOMPARE(chars[3].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[3].handle(), QLowEnergyHandle(0x18));
+ QCOMPARE(chars[3].properties(),
+ (QLowEnergyCharacteristic::Read));
+ //FW rev. : 1.5 (Oct 23 2013)
+ // Other revisions will fail here
+ QCOMPARE(chars[3].value(), QByteArray::fromHex("312e3520284f637420323320323031332900"));
+ QVERIFY(chars[3].isValid());
+ QVERIFY(info->contains(chars[3]));
+ QCOMPARE(chars[3].descriptors().count(), 0);
+
+ // Hardware Revision
+ temp = QString("00002a27-0000-1000-8000-00805f9b34fb");
+ QCOMPARE(chars[4].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[4].handle(), QLowEnergyHandle(0x1a));
+ QCOMPARE(chars[4].properties(),
+ (QLowEnergyCharacteristic::Read));
+ QCOMPARE(chars[4].value(), QByteArray::fromHex("4e2e412e00"));
+ QVERIFY(chars[4].isValid());
+ QVERIFY(info->contains(chars[4]));
+ QCOMPARE(chars[4].descriptors().count(), 0);
+
+ // Software Revision
+ temp = QString("00002a28-0000-1000-8000-00805f9b34fb");
+ QCOMPARE(chars[5].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[5].handle(), QLowEnergyHandle(0x1c));
+ QCOMPARE(chars[5].properties(),
+ (QLowEnergyCharacteristic::Read));
+ QCOMPARE(chars[5].value(), QByteArray::fromHex("4e2e412e00"));
+ QVERIFY(chars[5].isValid());
+ QVERIFY(info->contains(chars[5]));
+ QCOMPARE(chars[5].descriptors().count(), 0);
+
+ // Manufacturer Name
+ temp = QString("00002a29-0000-1000-8000-00805f9b34fb");
+ QCOMPARE(chars[6].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[6].handle(), QLowEnergyHandle(0x1e));
+ QCOMPARE(chars[6].properties(),
+ (QLowEnergyCharacteristic::Read));
+ QCOMPARE(chars[6].value(), QByteArray::fromHex("546578617320496e737472756d656e747300"));
+ QVERIFY(chars[6].isValid());
+ QVERIFY(info->contains(chars[6]));
+ QCOMPARE(chars[6].descriptors().count(), 0);
+
+ // IEEE
+ temp = QString("00002a2a-0000-1000-8000-00805f9b34fb");
+ QCOMPARE(chars[7].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[7].handle(), QLowEnergyHandle(0x20));
+ QCOMPARE(chars[7].properties(),
+ (QLowEnergyCharacteristic::Read));
+ QCOMPARE(chars[7].value(), QByteArray::fromHex("fe006578706572696d656e74616c"));
+ QVERIFY(chars[7].isValid());
+ QVERIFY(info->contains(chars[7]));
+ QCOMPARE(chars[7].descriptors().count(), 0);
+
+ // PnP ID
+ temp = QString("00002a50-0000-1000-8000-00805f9b34fb");
+ QCOMPARE(chars[8].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[8].handle(), QLowEnergyHandle(0x22));
+ QCOMPARE(chars[8].properties(),
+ (QLowEnergyCharacteristic::Read));
+ QCOMPARE(chars[8].value(), QByteArray::fromHex("010d0000001001"));
+ QVERIFY(chars[8].isValid());
+ QVERIFY(info->contains(chars[8]));
+ QCOMPARE(chars[8].descriptors().count(), 0);
+ } else if (info->serviceUuid() ==
+ QBluetoothUuid(QString("f000aa00-0451-4000-b000-000000000000"))) {
+ qDebug() << "Verifying Temperature";
+ QList<QLowEnergyCharacteristic> chars = info->characteristics();
+ QVERIFY(chars.count() >= 2);
+
+ // Temp Data
+ QString temp("f000aa01-0451-4000-b000-000000000000");
+ QCOMPARE(chars[0].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[0].handle(), QLowEnergyHandle(0x25));
+ QCOMPARE(chars[0].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Notify));
+ QCOMPARE(chars[0].value(), QByteArray::fromHex("00000000"));
+ QVERIFY(chars[0].isValid());
+ QVERIFY(info->contains(chars[0]));
+
+ QCOMPARE(chars[0].descriptors().count(), 2);
+ //descriptor checks
+ QCOMPARE(chars[0].descriptors().at(0).isValid(), true);
+ QCOMPARE(chars[0].descriptors().at(0).handle(), QLowEnergyHandle(0x26));
+ QCOMPARE(chars[0].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::ClientCharacteristicConfiguration));
+ QCOMPARE(chars[0].descriptors().at(0).type(),
+ QBluetoothUuid::ClientCharacteristicConfiguration);
+ QCOMPARE(chars[0].descriptors().at(0).value(), QByteArray::fromHex("0000"));
+ QVERIFY(info->contains(chars[0].descriptors().at(0)));
+
+ QCOMPARE(chars[0].descriptors().at(1).isValid(), true);
+ QCOMPARE(chars[0].descriptors().at(1).handle(), QLowEnergyHandle(0x27));
+ QCOMPARE(chars[0].descriptors().at(1).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[0].descriptors().at(1).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(1).value(),
+ QByteArray::fromHex("54656d702e2044617461"));
+ QVERIFY(info->contains(chars[0].descriptors().at(1)));
+
+ // Temp Config
+ temp = QString("f000aa02-0451-4000-b000-000000000000");
+ QCOMPARE(chars[1].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[1].handle(), QLowEnergyHandle(0x29));
+ QCOMPARE(chars[1].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
+ QCOMPARE(chars[1].value(), QByteArray::fromHex("00"));
+ QVERIFY(chars[1].isValid());
+ QVERIFY(info->contains(chars[1]));
+
+ QCOMPARE(chars[1].descriptors().count(), 1);
+ //descriptor checks
+ QCOMPARE(chars[1].descriptors().at(0).isValid(), true);
+ QCOMPARE(chars[1].descriptors().at(0).handle(), QLowEnergyHandle(0x2a));
+ QCOMPARE(chars[1].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[1].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[1].descriptors().at(0).value(),
+ QByteArray::fromHex("54656d702e20436f6e662e"));
+ QVERIFY(info->contains(chars[1].descriptors().at(0)));
+
+
+ //Temp Period (introduced by later firmware versions)
+ if (chars.count() > 2) {
+ temp = QString("f000aa03-0451-4000-b000-000000000000");
+ QCOMPARE(chars[2].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[2].handle(), QLowEnergyHandle(0x2c));
+ QCOMPARE(chars[2].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
+ QCOMPARE(chars[2].value(), QByteArray::fromHex("64"));
+ QVERIFY(chars[2].isValid());
+ QVERIFY(info->contains(chars[2]));
+
+ QCOMPARE(chars[2].descriptors().count(), 1);
+ //descriptor checks
+ QCOMPARE(chars[2].descriptors().at(0).isValid(), true);
+ QCOMPARE(chars[2].descriptors().at(0).handle(), QLowEnergyHandle(0x2d));
+ QCOMPARE(chars[2].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[2].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(chars[2].descriptors().at(0).value(),
+ QByteArray::fromHex("54656d702e20506572696f64"));
+ QVERIFY(info->contains(chars[2].descriptors().at(0)));
+ }
+ } else if (info->serviceUuid() ==
+ QBluetoothUuid(QString("0000ffe0-0000-1000-8000-00805f9b34fb"))) {
+ qDebug() << "Verifying Simple Keys";
+ QList<QLowEnergyCharacteristic> chars = info->characteristics();
+ QCOMPARE(chars.count(), 1);
+
+ // Temp Data
+ QString temp("0000ffe1-0000-1000-8000-00805f9b34fb");
+ QCOMPARE(chars[0].uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].handle(), QLowEnergyHandle(0x6b));
+ QCOMPARE(chars[0].properties(),
+ (QLowEnergyCharacteristic::Notify));
+ QCOMPARE(chars[0].value(), QByteArray());
+ QVERIFY(chars[0].isValid());
+ QVERIFY(info->contains(chars[0]));
+
+ QCOMPARE(chars[0].descriptors().count(), 2);
+ //descriptor checks
+ QCOMPARE(chars[0].descriptors().at(0).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(0).handle(), QLowEnergyHandle(0x6c));
+ QCOMPARE(chars[0].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::ClientCharacteristicConfiguration));
+ QCOMPARE(chars[0].descriptors().at(0).type(),
+ QBluetoothUuid::ClientCharacteristicConfiguration);
+ QCOMPARE(chars[0].descriptors().at(0).value(), QByteArray::fromHex("0000"));
+ QVERIFY(info->contains(chars[0].descriptors().at(0)));
+
+ QCOMPARE(chars[0].descriptors().at(1).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(1).handle(), QLowEnergyHandle(0x6d));
+ QCOMPARE(chars[0].descriptors().at(1).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[0].descriptors().at(1).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(chars[0].descriptors().at(1).value(),
+ QByteArray::fromHex("4b6579205072657373205374617465"));
+ QVERIFY(info->contains(chars[0].descriptors().at(1)));
+
+ } else if (info->serviceUuid() ==
+ QBluetoothUuid(QString("f000aa10-0451-4000-b000-000000000000"))) {
+ qDebug() << "Verifying Accelerometer";
+ QList<QLowEnergyCharacteristic> chars = info->characteristics();
+ QCOMPARE(chars.count(), 3);
+
+ // Accel Data
+ QString temp("f000aa11-0451-4000-b000-000000000000");
+ QCOMPARE(chars[0].uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].handle(), QLowEnergyHandle(0x30));
+ QCOMPARE(chars[0].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Notify));
+ QCOMPARE(chars[0].value(), QByteArray::fromHex("000000"));
+ QVERIFY(chars[0].isValid());
+ QVERIFY(info->contains(chars[0]));
+
+ QCOMPARE(chars[0].descriptors().count(), 2);
+
+ QCOMPARE(chars[0].descriptors().at(0).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(0).handle(), QLowEnergyHandle(0x31));
+ QCOMPARE(chars[0].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::ClientCharacteristicConfiguration));
+ QCOMPARE(chars[0].descriptors().at(0).type(),
+ QBluetoothUuid::ClientCharacteristicConfiguration);
+ QCOMPARE(chars[0].descriptors().at(0).value(), QByteArray::fromHex("0000"));
+ QVERIFY(info->contains(chars[0].descriptors().at(0)));
+
+ QCOMPARE(chars[0].descriptors().at(1).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(1).handle(), QLowEnergyHandle(0x32));
+ QCOMPARE(chars[0].descriptors().at(1).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[0].descriptors().at(1).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(chars[0].descriptors().at(1).value(),
+ QByteArray::fromHex("416363656c2e2044617461"));
+ QVERIFY(info->contains(chars[0].descriptors().at(1)));
+
+ // Accel Config
+ temp = QString("f000aa12-0451-4000-b000-000000000000");
+ QCOMPARE(chars[1].uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[1].handle(), QLowEnergyHandle(0x34));
+ QCOMPARE(chars[1].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
+ QCOMPARE(chars[1].value(), QByteArray::fromHex("00"));
+ QVERIFY(chars[1].isValid());
+ QVERIFY(info->contains(chars[1]));
+ QCOMPARE(chars[1].descriptors().count(), 1);
+
+ QCOMPARE(chars[1].descriptors().at(0).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[1].descriptors().at(0).handle(), QLowEnergyHandle(0x35));
+ QCOMPARE(chars[1].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[1].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(chars[1].descriptors().at(0).value(),
+ QByteArray::fromHex("416363656c2e20436f6e662e"));
+ QVERIFY(info->contains(chars[1].descriptors().at(0)));
+
+ // Accel Period
+ temp = QString("f000aa13-0451-4000-b000-000000000000");
+ QCOMPARE(chars[2].uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[2].handle(), QLowEnergyHandle(0x37));
+ QCOMPARE(chars[2].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
+ QCOMPARE(chars[2].value(), QByteArray::fromHex("64")); // don't change it or set it to 0x64
+ QVERIFY(chars[2].isValid());
+ QVERIFY(info->contains(chars[2]));
+
+ QCOMPARE(chars[2].descriptors().count(), 1);
+ //descriptor checks
+ QCOMPARE(chars[2].descriptors().at(0).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[2].descriptors().at(0).handle(), QLowEnergyHandle(0x38));
+ QCOMPARE(chars[2].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[2].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[2].descriptors().at(0).value(),
+ QByteArray::fromHex("416363656c2e20506572696f64"));
+ QVERIFY(info->contains(chars[2].descriptors().at(0)));
+ } else if (info->serviceUuid() ==
+ QBluetoothUuid(QString("f000aa20-0451-4000-b000-000000000000"))) {
+ qDebug() << "Verifying Humidity";
+ QList<QLowEnergyCharacteristic> chars = info->characteristics();
+ QVERIFY(chars.count() >= 2); //new firmware has more chars
+
+ // Humidity Data
+ QString temp("f000aa21-0451-4000-b000-000000000000");
+ QCOMPARE(chars[0].uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].handle(), QLowEnergyHandle(0x3b));
+ QCOMPARE(chars[0].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Notify));
+ QCOMPARE(chars[0].value(), QByteArray::fromHex("00000000"));
+ QVERIFY(chars[0].isValid());
+ QVERIFY(info->contains(chars[0]));
+
+ QCOMPARE(chars[0].descriptors().count(), 2);
+ //descriptor checks
+ QCOMPARE(chars[0].descriptors().at(0).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(0).handle(), QLowEnergyHandle(0x3c));
+ QCOMPARE(chars[0].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::ClientCharacteristicConfiguration));
+ QCOMPARE(chars[0].descriptors().at(0).type(),
+ QBluetoothUuid::ClientCharacteristicConfiguration);
+ QCOMPARE(chars[0].descriptors().at(0).value(), QByteArray::fromHex("0000"));
+ QVERIFY(info->contains(chars[0].descriptors().at(0)));
+
+ QCOMPARE(chars[0].descriptors().at(1).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(1).handle(), QLowEnergyHandle(0x3d));
+ QCOMPARE(chars[0].descriptors().at(1).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[0].descriptors().at(1).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(chars[0].descriptors().at(1).value(),
+ QByteArray::fromHex("48756d69642e2044617461"));
+ QVERIFY(info->contains(chars[0].descriptors().at(1)));
+
+ // Humidity Config
+ temp = QString("f000aa22-0451-4000-b000-000000000000");
+ QCOMPARE(chars[1].uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[1].handle(), QLowEnergyHandle(0x3f));
+ QCOMPARE(chars[1].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
+ QCOMPARE(chars[1].value(), QByteArray::fromHex("00"));
+ QVERIFY(chars[1].isValid());
+ QVERIFY(info->contains(chars[1]));
+
+ QCOMPARE(chars[1].descriptors().count(), 1);
+ //descriptor checks
+ QCOMPARE(chars[1].descriptors().at(0).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[1].descriptors().at(0).handle(), QLowEnergyHandle(0x40));
+ QCOMPARE(chars[1].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[1].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(chars[1].descriptors().at(0).value(),
+ QByteArray::fromHex("48756d69642e20436f6e662e"));
+ QVERIFY(info->contains(chars[1].descriptors().at(0)));
+
+ if (chars.count() >= 3) {
+ // New firmware new characteristic
+ // Humidity Period
+ temp = QString("f000aa23-0451-4000-b000-000000000000");
+ QCOMPARE(chars[2].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[2].handle(), QLowEnergyHandle(0x42));
+ QCOMPARE(chars[2].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
+ QCOMPARE(chars[2].value(), QByteArray::fromHex("64"));
+ QVERIFY(chars[2].isValid());
+ QVERIFY(info->contains(chars[2]));
+
+ QCOMPARE(chars[2].descriptors().count(), 1);
+ //descriptor checks
+ QCOMPARE(chars[2].descriptors().at(0).isValid(), true);
+ QCOMPARE(chars[2].descriptors().at(0).handle(), QLowEnergyHandle(0x43));
+ QCOMPARE(chars[2].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[2].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(chars[2].descriptors().at(0).value(),
+ QByteArray::fromHex("48756d69642e20506572696f64"));
+ QVERIFY(info->contains(chars[2].descriptors().at(0)));
+ }
+ } else if (info->serviceUuid() ==
+ QBluetoothUuid(QString("f000aa30-0451-4000-b000-000000000000"))) {
+ qDebug() << "Verifying Magnetometer";
+ QList<QLowEnergyCharacteristic> chars = info->characteristics();
+ QCOMPARE(chars.count(), 3);
+
+ // Magnetometer Data
+ QString temp("f000aa31-0451-4000-b000-000000000000");
+ QCOMPARE(chars[0].uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].handle(), QLowEnergyHandle(0x46));
+ QCOMPARE(chars[0].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Notify));
+ QCOMPARE(chars[0].value(), QByteArray::fromHex("000000000000"));
+ QVERIFY(chars[0].isValid());
+ QVERIFY(info->contains(chars[0]));
+
+ QCOMPARE(chars[0].descriptors().count(), 2);
+
+ QCOMPARE(chars[0].descriptors().at(0).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(0).handle(), QLowEnergyHandle(0x47));
+ QCOMPARE(chars[0].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::ClientCharacteristicConfiguration));
+ QCOMPARE(chars[0].descriptors().at(0).type(),
+ QBluetoothUuid::ClientCharacteristicConfiguration);
+ QCOMPARE(chars[0].descriptors().at(0).value(), QByteArray::fromHex("0000"));
+ QVERIFY(info->contains(chars[0].descriptors().at(0)));
+
+ QCOMPARE(chars[0].descriptors().at(1).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(1).handle(), QLowEnergyHandle(0x48));
+ QCOMPARE(chars[0].descriptors().at(1).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[0].descriptors().at(1).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(chars[0].descriptors().at(1).value(),
+ QByteArray::fromHex("4d61676e2e2044617461"));
+ QVERIFY(info->contains(chars[0].descriptors().at(1)));
+
+ // Magnetometer Config
+ temp = QString("f000aa32-0451-4000-b000-000000000000");
+ QCOMPARE(chars[1].uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[1].handle(), QLowEnergyHandle(0x4a));
+ QCOMPARE(chars[1].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
+ QCOMPARE(chars[1].value(), QByteArray::fromHex("00"));
+ QVERIFY(chars[1].isValid());
+ QVERIFY(info->contains(chars[1]));
+
+ QCOMPARE(chars[1].descriptors().count(), 1);
+ QCOMPARE(chars[1].descriptors().at(0).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[1].descriptors().at(0).handle(), QLowEnergyHandle(0x4b));
+ QCOMPARE(chars[1].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[1].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[1].descriptors().at(0).value(),
+ QByteArray::fromHex("4d61676e2e20436f6e662e"));
+ QVERIFY(info->contains(chars[1].descriptors().at(0)));
+
+ // Magnetometer Period
+ temp = QString("f000aa33-0451-4000-b000-000000000000");
+ QCOMPARE(chars[2].uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[2].handle(), QLowEnergyHandle(0x4d));
+ QCOMPARE(chars[2].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
+ QCOMPARE(chars[2].value(), QByteArray::fromHex("c8")); // don't change it or set it to 0xc8
+ QVERIFY(chars[2].isValid());
+ QVERIFY(info->contains(chars[2]));
+
+ QCOMPARE(chars[2].descriptors().count(), 1);
+ QCOMPARE(chars[2].descriptors().at(0).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[2].descriptors().at(0).handle(), QLowEnergyHandle(0x4e));
+ QCOMPARE(chars[2].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[2].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[2].descriptors().at(0).value(),
+ QByteArray::fromHex("4d61676e2e20506572696f64"));
+ QVERIFY(info->contains(chars[2].descriptors().at(0)));
+ } else if (info->serviceUuid() ==
+ QBluetoothUuid(QString("f000aa40-0451-4000-b000-000000000000"))) {
+ qDebug() << "Verifying Pressure";
+ QList<QLowEnergyCharacteristic> chars = info->characteristics();
+ QVERIFY(chars.count() >= 3);
+
+ // Pressure Data
+ QString temp("f000aa41-0451-4000-b000-000000000000");
+ QCOMPARE(chars[0].uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].handle(), QLowEnergyHandle(0x51));
+ QCOMPARE(chars[0].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Notify));
+ QCOMPARE(chars[0].value(), QByteArray::fromHex("00000000"));
+ QVERIFY(chars[0].isValid());
+ QVERIFY(info->contains(chars[0]));
+
+ QCOMPARE(chars[0].descriptors().count(), 2);
+ //descriptor checks
+ QCOMPARE(chars[0].descriptors().at(0).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(0).handle(), QLowEnergyHandle(0x52));
+ QCOMPARE(chars[0].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::ClientCharacteristicConfiguration));
+ QCOMPARE(chars[0].descriptors().at(0).type(),
+ QBluetoothUuid::ClientCharacteristicConfiguration);
+ QCOMPARE(chars[0].descriptors().at(0).value(), QByteArray::fromHex("0000"));
+ QVERIFY(info->contains(chars[0].descriptors().at(0)));
+
+ QCOMPARE(chars[0].descriptors().at(1).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(1).handle(), QLowEnergyHandle(0x53));
+ QCOMPARE(chars[0].descriptors().at(1).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[0].descriptors().at(1).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(1).value(),
+ QByteArray::fromHex("4261726f6d2e2044617461"));
+ QVERIFY(info->contains(chars[0].descriptors().at(1)));
+
+ // Pressure Config
+ temp = QString("f000aa42-0451-4000-b000-000000000000");
+ QCOMPARE(chars[1].uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[1].handle(), QLowEnergyHandle(0x55));
+ QCOMPARE(chars[1].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
+ QCOMPARE(chars[1].value(), QByteArray::fromHex("00"));
+ QVERIFY(chars[1].isValid());
+ QVERIFY(info->contains(chars[1]));
+
+ QCOMPARE(chars[1].descriptors().count(), 1);
+ QCOMPARE(chars[1].descriptors().at(0).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[1].descriptors().at(0).handle(), QLowEnergyHandle(0x56));
+ QCOMPARE(chars[1].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[1].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(chars[1].descriptors().at(0).value(),
+ QByteArray::fromHex("4261726f6d2e20436f6e662e"));
+ QVERIFY(info->contains(chars[1].descriptors().at(0)));
+
+ //calibration and period characteristic are swapped, ensure we don't depend on their order
+ QLowEnergyCharacteristic calibration, period;
+ foreach (const QLowEnergyCharacteristic &ch, chars) {
+ //find calibration characteristic
+ if (ch.uuid() == QBluetoothUuid(QString("f000aa43-0451-4000-b000-000000000000")))
+ calibration = ch;
+ else if (ch.uuid() == QBluetoothUuid(QString("f000aa44-0451-4000-b000-000000000000")))
+ period = ch;
+ }
+
+ if (calibration.isValid()) {
+ // Pressure Calibration
+ temp = QString("f000aa43-0451-4000-b000-000000000000");
+ QCOMPARE(calibration.uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(calibration.handle(), QLowEnergyHandle(0x5b));
+ QCOMPARE(calibration.properties(),
+ (QLowEnergyCharacteristic::Read));
+ QCOMPARE(calibration.value(), QByteArray::fromHex("00000000000000000000000000000000")); // don't change it
+ QVERIFY(calibration.isValid());
+ QVERIFY(info->contains(calibration));
+
+ QCOMPARE(calibration.descriptors().count(), 2);
+ //descriptor checks
+ QCOMPARE(calibration.descriptors().at(0).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(calibration.descriptors().at(0).handle(), QLowEnergyHandle(0x5c));
+ QCOMPARE(calibration.descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::ClientCharacteristicConfiguration));
+ QCOMPARE(calibration.descriptors().at(0).type(),
+ QBluetoothUuid::ClientCharacteristicConfiguration);
+ QCOMPARE(calibration.descriptors().at(0).value(), QByteArray::fromHex("0000"));
+ QVERIFY(info->contains(calibration.descriptors().at(0)));
+
+ QCOMPARE(calibration.descriptors().at(1).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(calibration.descriptors().at(1).handle(), QLowEnergyHandle(0x5d));
+ QCOMPARE(calibration.descriptors().at(1).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(calibration.descriptors().at(1).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(calibration.descriptors().at(1).value(),
+ QByteArray::fromHex("4261726f6d2e2043616c6962722e"));
+ QVERIFY(info->contains(calibration.descriptors().at(1)));
+ }
+
+ if (period.isValid()) {
+ // Period Calibration
+ temp = QString("f000aa44-0451-4000-b000-000000000000");
+ QCOMPARE(period.uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(period.handle(), QLowEnergyHandle(0x58));
+ QCOMPARE(period.properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
+ QCOMPARE(period.value(), QByteArray::fromHex("64"));
+ QVERIFY(period.isValid());
+ QVERIFY(info->contains(period));
+
+ QCOMPARE(period.descriptors().count(), 1);
+ //descriptor checks
+ QCOMPARE(period.descriptors().at(0).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(period.descriptors().at(0).handle(), QLowEnergyHandle(0x59));
+ QCOMPARE(period.descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(period.descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(period.descriptors().at(0).value(),
+ QByteArray::fromHex("4261726f6d2e20506572696f64"));
+ QVERIFY(info->contains(period.descriptors().at(0)));
+ }
+ } else if (info->serviceUuid() ==
+ QBluetoothUuid(QString("f000aa50-0451-4000-b000-000000000000"))) {
+ qDebug() << "Verifying Gyroscope";
+ QList<QLowEnergyCharacteristic> chars = info->characteristics();
+ QVERIFY(chars.count() >= 2);
+
+ // Gyroscope Data
+ QString temp("f000aa51-0451-4000-b000-000000000000");
+ QCOMPARE(chars[0].uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].handle(), QLowEnergyHandle(0x60));
+ QCOMPARE(chars[0].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Notify));
+ QCOMPARE(chars[0].value(), QByteArray::fromHex("000000000000"));
+ QVERIFY(chars[0].isValid());
+ QVERIFY(info->contains(chars[0]));
+
+ QCOMPARE(chars[0].descriptors().count(), 2);
+ //descriptor checks
+ QCOMPARE(chars[0].descriptors().at(0).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(0).handle(), QLowEnergyHandle(0x61));
+ QCOMPARE(chars[0].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::ClientCharacteristicConfiguration));
+ QCOMPARE(chars[0].descriptors().at(0).type(),
+ QBluetoothUuid::ClientCharacteristicConfiguration);
+ QCOMPARE(chars[0].descriptors().at(0).value(), QByteArray::fromHex("0000"));
+ QVERIFY(info->contains(chars[0].descriptors().at(0)));
+
+ QCOMPARE(chars[0].descriptors().at(1).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(1).handle(), QLowEnergyHandle(0x62));
+ QCOMPARE(chars[0].descriptors().at(1).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[0].descriptors().at(1).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(1).value(),
+ QByteArray::fromHex("4779726f2044617461"));
+ QVERIFY(info->contains(chars[0].descriptors().at(1)));
+
+ // Gyroscope Config
+ temp = QString("f000aa52-0451-4000-b000-000000000000");
+ QCOMPARE(chars[1].uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[1].handle(), QLowEnergyHandle(0x64));
+ QCOMPARE(chars[1].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
+ QCOMPARE(chars[1].value(), QByteArray::fromHex("00"));
+ QVERIFY(chars[1].isValid());
+ QVERIFY(info->contains(chars[1]));
+
+ QCOMPARE(chars[1].descriptors().count(), 1);
+ //descriptor checks
+ QCOMPARE(chars[1].descriptors().at(0).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[1].descriptors().at(0).handle(), QLowEnergyHandle(0x65));
+ QCOMPARE(chars[1].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[1].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(chars[1].descriptors().at(0).value(),
+ QByteArray::fromHex("4779726f20436f6e662e"));
+ QVERIFY(info->contains(chars[1].descriptors().at(0)));
+
+ // Gyroscope Period
+ temp = QString("f000aa53-0451-4000-b000-000000000000");
+ QCOMPARE(chars[2].uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[2].handle(), QLowEnergyHandle(0x67));
+ QCOMPARE(chars[2].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
+ QCOMPARE(chars[2].value(), QByteArray::fromHex("64"));
+ QVERIFY(chars[2].isValid());
+ QVERIFY(info->contains(chars[2]));
+
+ QCOMPARE(chars[2].descriptors().count(), 1);
+ //descriptor checks
+ QCOMPARE(chars[2].descriptors().at(0).isValid(), true);
+ QCOMPARE(chars[2].descriptors().at(0).handle(), QLowEnergyHandle(0x68));
+ QCOMPARE(chars[2].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[2].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(chars[2].descriptors().at(0).value(),
+ QByteArray::fromHex("4779726f20506572696f64"));
+ QVERIFY(info->contains(chars[2].descriptors().at(0)));
+ } else if (info->serviceUuid() ==
+ QBluetoothUuid(QString("f000aa60-0451-4000-b000-000000000000"))) {
+ qDebug() << "Verifying Test Service";
+ QList<QLowEnergyCharacteristic> chars = info->characteristics();
+ QCOMPARE(chars.count(), 2);
+
+ // Test Data
+ QString temp("f000aa61-0451-4000-b000-000000000000");
+ QCOMPARE(chars[0].uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].handle(), QLowEnergyHandle(0x70));
+ QCOMPARE(chars[0].properties(),
+ (QLowEnergyCharacteristic::Read));
+ QCOMPARE(chars[0].value(), QByteArray::fromHex("3f00"));
+ QVERIFY(chars[0].isValid());
+ QVERIFY(info->contains(chars[0]));
+
+ QCOMPARE(chars[0].descriptors().count(), 1);
+ QCOMPARE(chars[0].descriptors().at(0).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(0).handle(), QLowEnergyHandle(0x71));
+ QCOMPARE(chars[0].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[0].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(chars[0].descriptors().at(0).value(),
+ QByteArray::fromHex("546573742044617461"));
+ QVERIFY(info->contains(chars[0].descriptors().at(0)));
+
+ // Test Config
+ temp = QString("f000aa62-0451-4000-b000-000000000000");
+ QCOMPARE(chars[1].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[1].handle(), QLowEnergyHandle(0x73));
+ QCOMPARE(chars[1].properties(),
+ (QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
+ QCOMPARE(chars[1].value(), QByteArray::fromHex("00"));
+ QVERIFY(chars[1].isValid());
+ QVERIFY(info->contains(chars[1]));
+
+ QCOMPARE(chars[1].descriptors().count(), 1);
+ //descriptor checks
+ QCOMPARE(chars[1].descriptors().at(0).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[1].descriptors().at(0).handle(), QLowEnergyHandle(0x74));
+ QCOMPARE(chars[1].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[1].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(chars[1].descriptors().at(0).value(),
+ QByteArray::fromHex("5465737420436f6e666967"));
+ QVERIFY(info->contains(chars[1].descriptors().at(0)));
+ } else if (info->serviceUuid() ==
+ QBluetoothUuid(QString("f000ccc0-0451-4000-b000-000000000000"))) {
+ qDebug() << "Connection Control Service";
+ QList<QLowEnergyCharacteristic> chars = info->characteristics();
+ QCOMPARE(chars.count(), 3);
+
+ //first characteristic
+ QString temp("f000ccc1-0451-4000-b000-000000000000");
+ QCOMPARE(chars[0].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[0].handle(), QLowEnergyHandle(0x77));
+ QCOMPARE(chars[0].properties(),
+ (QLowEnergyCharacteristic::Notify|QLowEnergyCharacteristic::Read));
+ QCOMPARE(chars[0].value(), QByteArray::fromHex("000000000000"));
+ QVERIFY(chars[0].isValid());
+ QVERIFY(info->contains(chars[0]));
+
+ QCOMPARE(chars[0].descriptors().count(), 2);
+ //descriptor checks
+ QCOMPARE(chars[0].descriptors().at(0).isValid(), true);
+ QCOMPARE(chars[0].descriptors().at(0).handle(), QLowEnergyHandle(0x78));
+ QCOMPARE(chars[0].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::ClientCharacteristicConfiguration));
+ QCOMPARE(chars[0].descriptors().at(0).type(),
+ QBluetoothUuid::ClientCharacteristicConfiguration);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(0).value(), QByteArray::fromHex("0100"));
+ QVERIFY(info->contains(chars[0].descriptors().at(0)));
+
+ QCOMPARE(chars[0].descriptors().at(1).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(1).handle(), QLowEnergyHandle(0x79));
+ QCOMPARE(chars[0].descriptors().at(1).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[0].descriptors().at(1).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(chars[0].descriptors().at(1).value(),
+ QByteArray::fromHex("436f6e6e2e20506172616d73"));
+ QVERIFY(info->contains(chars[0].descriptors().at(1)));
+
+ //second characteristic
+ temp = QString("f000ccc2-0451-4000-b000-000000000000");
+ QCOMPARE(chars[1].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[1].handle(), QLowEnergyHandle(0x7b));
+ QCOMPARE(chars[1].properties(), QLowEnergyCharacteristic::Write);
+ QCOMPARE(chars[1].value(), QByteArray());
+ QVERIFY(chars[1].isValid());
+ QVERIFY(info->contains(chars[1]));
+
+ QCOMPARE(chars[1].descriptors().count(), 1);
+ QCOMPARE(chars[1].descriptors().at(0).isValid(), true);
+ QCOMPARE(chars[1].descriptors().at(0).handle(), QLowEnergyHandle(0x7c));
+ QCOMPARE(chars[1].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[1].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(chars[1].descriptors().at(0).value(),
+ QByteArray::fromHex("436f6e6e2e20506172616d7320526571"));
+ QVERIFY(info->contains(chars[1].descriptors().at(0)));
+
+ //third characteristic
+ temp = QString("f000ccc3-0451-4000-b000-000000000000");
+ QCOMPARE(chars[2].uuid(), QBluetoothUuid(temp));
+ QCOMPARE(chars[2].handle(), QLowEnergyHandle(0x7e));
+ QCOMPARE(chars[2].properties(), QLowEnergyCharacteristic::Write);
+ QCOMPARE(chars[2].value(), QByteArray());
+ QVERIFY(chars[2].isValid());
+ QVERIFY(info->contains(chars[2]));
+
+ QCOMPARE(chars[2].descriptors().count(), 1);
+ QCOMPARE(chars[2].descriptors().at(0).isValid(), true);
+ QCOMPARE(chars[2].descriptors().at(0).handle(), QLowEnergyHandle(0x7f));
+ QCOMPARE(chars[2].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[2].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(chars[2].descriptors().at(0).value(),
+ QByteArray::fromHex("446973636f6e6e65637420526571"));
+ QVERIFY(info->contains(chars[2].descriptors().at(0)));
+ } else if (info->serviceUuid() ==
+ QBluetoothUuid(QString("f000ffc0-0451-4000-b000-000000000000"))) {
+ qDebug() << "Verifying OID Service";
+ QList<QLowEnergyCharacteristic> chars = info->characteristics();
+ QCOMPARE(chars.count(), 2);
+
+ // first characteristic
+ QString temp("f000ffc1-0451-4000-b000-000000000000");
+ QCOMPARE(chars[0].uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].handle(), QLowEnergyHandle(0x82));
+ QCOMPARE(chars[0].properties(),
+ (QLowEnergyCharacteristic::Notify|QLowEnergyCharacteristic::Write|QLowEnergyCharacteristic::WriteNoResponse));
+ QCOMPARE(chars[0].value(), QByteArray());
+ QVERIFY(chars[0].isValid());
+ QVERIFY(info->contains(chars[0]));
+
+ QCOMPARE(chars[0].descriptors().count(), 2);
+ //descriptor checks
+ QCOMPARE(chars[0].descriptors().at(0).isValid(), true);
+ QCOMPARE(chars[0].descriptors().at(0).handle(), QLowEnergyHandle(0x83));
+ QCOMPARE(chars[0].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::ClientCharacteristicConfiguration));
+ QCOMPARE(chars[0].descriptors().at(0).type(),
+ QBluetoothUuid::ClientCharacteristicConfiguration);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(0).value(), QByteArray::fromHex("0100"));
+ QVERIFY(info->contains(chars[0].descriptors().at(0)));
+
+ QCOMPARE(chars[0].descriptors().at(1).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[0].descriptors().at(1).handle(), QLowEnergyHandle(0x84));
+ QCOMPARE(chars[0].descriptors().at(1).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[0].descriptors().at(1).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(chars[0].descriptors().at(1).value(),
+ QByteArray::fromHex("496d67204964656e74696679"));
+ QVERIFY(info->contains(chars[0].descriptors().at(1)));
+
+ // second characteristic
+ temp = QString("f000ffc2-0451-4000-b000-000000000000");
+ QCOMPARE(chars[1].uuid(), QBluetoothUuid(temp));
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[1].handle(), QLowEnergyHandle(0x86));
+ QCOMPARE(chars[1].properties(),
+ (QLowEnergyCharacteristic::Notify|QLowEnergyCharacteristic::Write|QLowEnergyCharacteristic::WriteNoResponse));
+ QCOMPARE(chars[1].value(), QByteArray());
+ QVERIFY(chars[1].isValid());
+ QVERIFY(info->contains(chars[1]));
+
+ QCOMPARE(chars[1].descriptors().count(), 2);
+ //descriptor checks
+ QCOMPARE(chars[1].descriptors().at(0).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[1].descriptors().at(0).handle(), QLowEnergyHandle(0x87));
+ QCOMPARE(chars[1].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::ClientCharacteristicConfiguration));
+ QCOMPARE(chars[1].descriptors().at(0).type(),
+ QBluetoothUuid::ClientCharacteristicConfiguration);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[1].descriptors().at(0).value(), QByteArray::fromHex("0100"));
+ QVERIFY(info->contains(chars[1].descriptors().at(0)));
+
+ QCOMPARE(chars[1].descriptors().at(1).isValid(), true);
+ // value different in other revisions and test may fail
+ QCOMPARE(chars[1].descriptors().at(1).handle(), QLowEnergyHandle(0x88));
+ QCOMPARE(chars[1].descriptors().at(1).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[1].descriptors().at(1).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
+ QCOMPARE(chars[1].descriptors().at(1).value(),
+ QByteArray::fromHex("496d6720426c6f636b"));
+ QVERIFY(info->contains(chars[1].descriptors().at(1)));
+ } else {
+ QFAIL(QString("Service not found" + info->serviceUuid().toString()).toUtf8().constData());
+ }
+}
+
+void tst_QLowEnergyController::tst_defaultBehavior()
+{
+ QList<QBluetoothAddress> foundAddresses;
+ foreach (const QBluetoothHostInfo &info, QBluetoothLocalDevice::allDevices())
+ foundAddresses.append(info.address());
+ const QBluetoothAddress randomAddress("11:22:33:44:55:66");
+
+ // Test automatic detection of local adapter
+ QLowEnergyController controlDefaultAdapter(randomAddress);
+ QCOMPARE(controlDefaultAdapter.remoteAddress(), randomAddress);
+ QCOMPARE(controlDefaultAdapter.state(), QLowEnergyController::UnconnectedState);
+ if (foundAddresses.isEmpty()) {
+ QVERIFY(controlDefaultAdapter.localAddress().isNull());
+ } else {
+ QCOMPARE(controlDefaultAdapter.error(), QLowEnergyController::NoError);
+ QVERIFY(controlDefaultAdapter.errorString().isEmpty());
+ QVERIFY(foundAddresses.contains(controlDefaultAdapter.localAddress()));
+
+ // unrelated uuids don't return valid service object
+ // invalid service uuid
+ QVERIFY(!controlDefaultAdapter.createServiceObject(
+ QBluetoothUuid()));
+ // some random uuid
+ QVERIFY(!controlDefaultAdapter.createServiceObject(
+ QBluetoothUuid(QBluetoothUuid::DeviceName)));
+ }
+
+ QCOMPARE(controlDefaultAdapter.services().count(), 0);
+
+ // Test explicit local adapter
+ if (!foundAddresses.isEmpty()) {
+ QLowEnergyController controlExplicitAdapter(randomAddress,
+ foundAddresses[0]);
+ QCOMPARE(controlExplicitAdapter.remoteAddress(), randomAddress);
+ QCOMPARE(controlExplicitAdapter.localAddress(), foundAddresses[0]);
+ QCOMPARE(controlExplicitAdapter.state(),
+ QLowEnergyController::UnconnectedState);
+ QCOMPARE(controlExplicitAdapter.services().count(), 0);
+
+ // unrelated uuids don't return valid service object
+ // invalid service uuid
+ QVERIFY(!controlExplicitAdapter.createServiceObject(
+ QBluetoothUuid()));
+ // some random uuid
+ QVERIFY(!controlExplicitAdapter.createServiceObject(
+ QBluetoothUuid(QBluetoothUuid::DeviceName)));
+ }
+}
+
+void tst_QLowEnergyController::tst_writeCharacteristic()
+{
+ QList<QBluetoothHostInfo> localAdapters = QBluetoothLocalDevice::allDevices();
+ if (localAdapters.isEmpty() || remoteDevice.isNull())
+ QSKIP("No local Bluetooth or remote BTLE device found. Skipping test.");
+
+ // quick setup - more elaborate test is done by connect()
+ QLowEnergyController control(remoteDevice);
+ QCOMPARE(control.error(), QLowEnergyController::NoError);
+
+ control.connectToDevice();
+ {
+ QTRY_IMPL(control.state() != QLowEnergyController::ConnectingState,
+ 30000);
+ }
+
+ if (control.state() == QLowEnergyController::ConnectingState
+ || control.error() != QLowEnergyController::NoError) {
+ // default BTLE backend forever hangs in ConnectingState
+ QSKIP("Cannot connect to remote device");
+ }
+
+ QCOMPARE(control.state(), QLowEnergyController::ConnectedState);
+ QSignalSpy discoveryFinishedSpy(&control, SIGNAL(discoveryFinished()));
+ control.discoverServices();
+ QTRY_VERIFY_WITH_TIMEOUT(discoveryFinishedSpy.count() == 1, 10000);
+
+ const QBluetoothUuid testService(QString("f000aa60-0451-4000-b000-000000000000"));
+ QList<QBluetoothUuid> uuids = control.services();
+ QVERIFY(uuids.contains(testService));
+
+ QLowEnergyService *service = control.createServiceObject(testService, this);
+ QVERIFY(service);
+ service->discoverDetails();
+ QTRY_VERIFY_WITH_TIMEOUT(
+ service->state() == QLowEnergyService::ServiceDiscovered, 30000);
+
+ //test service described by http://processors.wiki.ti.com/index.php/SensorTag_User_Guide
+ const QList<QLowEnergyCharacteristic> chars = service->characteristics();
+
+ QLowEnergyCharacteristic dataChar;
+ QLowEnergyCharacteristic configChar;
+ for (int i = 0; i < chars.count(); i++) {
+ if (chars[i].uuid() == QBluetoothUuid(QString("f000aa61-0451-4000-b000-000000000000")))
+ dataChar = chars[i];
+ else if (chars[i].uuid() == QBluetoothUuid(QString("f000aa62-0451-4000-b000-000000000000")))
+ configChar = chars[i];
+ }
+
+ QVERIFY(dataChar.isValid());
+ QVERIFY(!(dataChar.properties() & ~QLowEnergyCharacteristic::Read)); // only a read char
+ QVERIFY(service->contains(dataChar));
+ QVERIFY(configChar.isValid());
+ QVERIFY(configChar.properties() & QLowEnergyCharacteristic::Write);
+ QVERIFY(service->contains(configChar));
+
+ QCOMPARE(dataChar.value(), QByteArray::fromHex("3f00"));
+ QVERIFY(configChar.value() == QByteArray::fromHex("00")
+ || configChar.value() == QByteArray::fromHex("81"));
+
+ QSignalSpy writeSpy(service,
+ SIGNAL(characteristicChanged(QLowEnergyCharacteristic,QByteArray)));
+
+ // *******************************************
+ // test writing of characteristic
+ // enable Blinking LED if not already enabled
+ if (configChar.value() != QByteArray("81")) {
+ service->writeCharacteristic(configChar, QByteArray::fromHex("81")); //0x81 blink LED D1
+ QTRY_VERIFY_WITH_TIMEOUT(!writeSpy.isEmpty(), 10000);
+ QCOMPARE(configChar.value(), QByteArray::fromHex("81"));
+ QList<QVariant> firstSignalData = writeSpy.first();
+ QLowEnergyCharacteristic signalChar = firstSignalData[0].value<QLowEnergyCharacteristic>();
+ QByteArray signalValue = firstSignalData[1].toByteArray();
+
+ QCOMPARE(signalValue, QByteArray::fromHex("81"));
+ QVERIFY(signalChar == configChar);
+
+ writeSpy.clear();
+ }
+
+ service->writeCharacteristic(configChar, QByteArray::fromHex("00")); //0x81 blink LED D1
+ QTRY_VERIFY_WITH_TIMEOUT(!writeSpy.isEmpty(), 10000);
+ QCOMPARE(configChar.value(), QByteArray::fromHex("00"));
+ QList<QVariant> firstSignalData = writeSpy.first();
+ QLowEnergyCharacteristic signalChar = firstSignalData[0].value<QLowEnergyCharacteristic>();
+ QByteArray signalValue = firstSignalData[1].toByteArray();
+
+ QCOMPARE(signalValue, QByteArray::fromHex("00"));
+ QVERIFY(signalChar == configChar);
+
+ // *******************************************
+ // write wrong value -> error response required
+ QSignalSpy errorSpy(service, SIGNAL(error(QLowEnergyService::ServiceError)));
+ writeSpy.clear();
+ QCOMPARE(errorSpy.count(), 0);
+ QCOMPARE(writeSpy.count(), 0);
+
+ // write 2 byte value to 1 byte characteristic
+ service->writeCharacteristic(configChar, QByteArray::fromHex("1111"));
+ QTRY_VERIFY_WITH_TIMEOUT(!errorSpy.isEmpty(), 10000);
+ QCOMPARE(errorSpy[0].at(0).value<QLowEnergyService::ServiceError>(),
+ QLowEnergyService::CharacteristicWriteError);
+ QCOMPARE(service->error(), QLowEnergyService::CharacteristicWriteError);
+ QCOMPARE(writeSpy.count(), 0);
+ QCOMPARE(configChar.value(), QByteArray::fromHex("00"));
+
+ // *******************************************
+ // write to read-only characteristic -> error
+ errorSpy.clear();
+ QCOMPARE(errorSpy.count(), 0);
+ service->writeCharacteristic(dataChar, QByteArray::fromHex("ffff"));
+
+ QTRY_VERIFY_WITH_TIMEOUT(!errorSpy.isEmpty(), 10000);
+ QCOMPARE(errorSpy[0].at(0).value<QLowEnergyService::ServiceError>(),
+ QLowEnergyService::OperationError);
+ QCOMPARE(service->error(), QLowEnergyService::OperationError);
+ QCOMPARE(writeSpy.count(), 0);
+ QCOMPARE(dataChar.value(), QByteArray::fromHex("3f00"));
+
+
+ control.disconnectFromDevice();
+
+ // *******************************************
+ // write value while disconnected -> error
+ errorSpy.clear();
+ QCOMPARE(errorSpy.count(), 0);
+ service->writeCharacteristic(configChar, QByteArray::fromHex("ffff"));
+ QTRY_VERIFY_WITH_TIMEOUT(!errorSpy.isEmpty(), 2000);
+ QCOMPARE(errorSpy[0].at(0).value<QLowEnergyService::ServiceError>(),
+ QLowEnergyService::OperationError);
+ QCOMPARE(service->error(), QLowEnergyService::OperationError);
+ QCOMPARE(writeSpy.count(), 0);
+ QCOMPARE(configChar.value(), QByteArray::fromHex("00"));
+
+ // invalid characteristics still belong to their respective service
+ QVERIFY(service->contains(configChar));
+ QVERIFY(service->contains(dataChar));
+
+ QVERIFY(!service->contains(QLowEnergyCharacteristic()));
+
+ delete service;
+}
+
+void tst_QLowEnergyController::tst_writeDescriptor()
+{
+ QList<QBluetoothHostInfo> localAdapters = QBluetoothLocalDevice::allDevices();
+ if (localAdapters.isEmpty() || remoteDevice.isNull())
+ QSKIP("No local Bluetooth or remote BTLE device found. Skipping test.");
+
+ // quick setup - more elaborate test is done by connect()
+ QLowEnergyController control(remoteDevice);
+ control.connectToDevice();
+ {
+ QTRY_IMPL(control.state() != QLowEnergyController::ConnectingState,
+ 30000);
+ }
+
+ if (control.state() == QLowEnergyController::ConnectingState
+ || control.error() != QLowEnergyController::NoError) {
+ // default BTLE backend forever hangs in ConnectingState
+ QSKIP("Cannot connect to remote device");
+ }
+
+ QCOMPARE(control.state(), QLowEnergyController::ConnectedState);
+ QSignalSpy discoveryFinishedSpy(&control, SIGNAL(discoveryFinished()));
+ control.discoverServices();
+ QTRY_VERIFY_WITH_TIMEOUT(discoveryFinishedSpy.count() == 1, 10000);
+
+ const QBluetoothUuid testService(QString("f000aa00-0451-4000-b000-000000000000"));
+ QList<QBluetoothUuid> uuids = control.services();
+ QVERIFY(uuids.contains(testService));
+
+ QLowEnergyService *service = control.createServiceObject(testService, this);
+ QVERIFY(service);
+ service->discoverDetails();
+ QTRY_VERIFY_WITH_TIMEOUT(
+ service->state() == QLowEnergyService::ServiceDiscovered, 30000);
+
+ // Temperature service described by
+ // http://processors.wiki.ti.com/index.php/SensorTag_User_Guide
+
+ // 1. Find temperature data characteristic
+ const QLowEnergyCharacteristic tempData = service->characteristic(
+ QBluetoothUuid(QStringLiteral("f000aa01-0451-4000-b000-000000000000")));
+ const QLowEnergyCharacteristic tempConfig = service->characteristic(
+ QBluetoothUuid(QStringLiteral("f000aa02-0451-4000-b000-000000000000")));
+
+ if (!tempData.isValid()) {
+ delete service;
+ control.disconnectFromDevice();
+ QSKIP("Cannot find temperature data characteristic of TI Sensor");
+ }
+
+ // 2. Find temperature data notification descriptor
+ const QLowEnergyDescriptor notification = tempData.descriptor(
+ QBluetoothUuid(QBluetoothUuid::ClientCharacteristicConfiguration));
+
+ if (!notification.isValid()) {
+ delete service;
+ control.disconnectFromDevice();
+ QSKIP("Cannot find temperature data notification of TI Sensor");
+ }
+
+ QCOMPARE(notification.value(), QByteArray::fromHex("0000"));
+ service->contains(notification);
+ service->contains(tempData);
+ if (tempConfig.isValid()) {
+ service->contains(tempConfig);
+ QCOMPARE(tempConfig.value(), QByteArray::fromHex("00"));
+ }
+
+ // 3. Test writing to descriptor -> activate notifications
+ QSignalSpy descChangedSpy(service,
+ SIGNAL(descriptorChanged(QLowEnergyDescriptor,QByteArray)));
+ QSignalSpy charChangedSpy(service,
+ SIGNAL(characteristicChanged(QLowEnergyCharacteristic,QByteArray)));
+ service->writeDescriptor(notification, QByteArray::fromHex("0100"));
+ // verify
+ QTRY_VERIFY_WITH_TIMEOUT(!descChangedSpy.isEmpty(), 3000);
+ QCOMPARE(notification.value(), QByteArray::fromHex("0100"));
+ QList<QVariant> firstSignalData = descChangedSpy.first();
+ QLowEnergyDescriptor signalDesc = firstSignalData[0].value<QLowEnergyDescriptor>();
+ QByteArray signalValue = firstSignalData[1].toByteArray();
+ QCOMPARE(signalValue, QByteArray::fromHex("0100"));
+ QVERIFY(notification == signalDesc);
+ descChangedSpy.clear();
+
+ // 4. Test reception of notifications
+ // activate the temperature sensor if available
+ if (tempConfig.isValid()) {
+ service->writeCharacteristic(tempConfig, QByteArray::fromHex("01"));
+
+ // first signal is confirmation of tempConfig write
+ // subsequent signals are temp data updates
+ QTRY_VERIFY_WITH_TIMEOUT(charChangedSpy.count() >= 5, 10000);
+ QList<QVariant> entry;
+ for (int i = 0; i < charChangedSpy.count(); i++) {
+ entry = charChangedSpy[i];
+ const QLowEnergyCharacteristic ch = entry[0].value<QLowEnergyCharacteristic>();
+ const QByteArray val = entry[1].toByteArray();
+
+ if (i == 0) {
+ QCOMPARE(tempConfig, ch);
+ } else {
+ qDebug() << "Temp update: " << hex << ch.handle() << val.toHex();
+ QCOMPARE(tempData, ch);
+ }
+ }
+
+ service->writeCharacteristic(tempConfig, QByteArray::fromHex("00"));
+ }
+
+ // 5. Test writing to descriptor -> deactivate notifications
+ service->writeDescriptor(notification, QByteArray::fromHex("0000"));
+ // verify
+ QTRY_VERIFY_WITH_TIMEOUT(!descChangedSpy.isEmpty(), 3000);
+ QCOMPARE(notification.value(), QByteArray::fromHex("0000"));
+ firstSignalData = descChangedSpy.first();
+ signalDesc = firstSignalData[0].value<QLowEnergyDescriptor>();
+ signalValue = firstSignalData[1].toByteArray();
+ QCOMPARE(signalValue, QByteArray::fromHex("0000"));
+ QVERIFY(notification == signalDesc);
+ descChangedSpy.clear();
+
+ // *******************************************
+ // write wrong value -> error response required
+ QSignalSpy errorSpy(service, SIGNAL(error(QLowEnergyService::ServiceError)));
+ descChangedSpy.clear();
+ QCOMPARE(errorSpy.count(), 0);
+ QCOMPARE(descChangedSpy.count(), 0);
+
+ // write 4 byte value to 2 byte characteristic
+ service->writeDescriptor(notification, QByteArray::fromHex("11112222"));
+ QTRY_VERIFY_WITH_TIMEOUT(!errorSpy.isEmpty(), 30000);
+ QCOMPARE(errorSpy[0].at(0).value<QLowEnergyService::ServiceError>(),
+ QLowEnergyService::DescriptorWriteError);
+ QCOMPARE(service->error(), QLowEnergyService::DescriptorWriteError);
+ QCOMPARE(descChangedSpy.count(), 0);
+ QCOMPARE(notification.value(), QByteArray::fromHex("0000"));
+
+ control.disconnectFromDevice();
+
+ // *******************************************
+ // write value while disconnected -> error
+ errorSpy.clear();
+ service->writeDescriptor(notification, QByteArray::fromHex("0100"));
+ QTRY_VERIFY_WITH_TIMEOUT(!errorSpy.isEmpty(), 2000);
+ QCOMPARE(errorSpy[0].at(0).value<QLowEnergyService::ServiceError>(),
+ QLowEnergyService::OperationError);
+ QCOMPARE(service->error(), QLowEnergyService::OperationError);
+ QCOMPARE(descChangedSpy.count(), 0);
+ QCOMPARE(notification.value(), QByteArray::fromHex("0000"));
+
+ delete service;
+}
+
+QTEST_MAIN(tst_QLowEnergyController)
+
+#include "tst_qlowenergycontroller.moc"
diff --git a/tests/auto/qlowenergydescriptor/qlowenergydescriptor.pro b/tests/auto/qlowenergydescriptor/qlowenergydescriptor.pro
new file mode 100644
index 00000000..60b5a740
--- /dev/null
+++ b/tests/auto/qlowenergydescriptor/qlowenergydescriptor.pro
@@ -0,0 +1,8 @@
+SOURCES += tst_qlowenergydescriptor.cpp
+TARGET = tst_qlowenergydescriptor
+CONFIG += testcase
+
+QT = core bluetooth testlib
+blackberry {
+ LIBS += -lbtapi
+}
diff --git a/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp b/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp
new file mode 100644
index 00000000..3b22d2e3
--- /dev/null
+++ b/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp
@@ -0,0 +1,318 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited all rights reserved
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QUuid>
+
+#include <QDebug>
+
+#include <QBluetoothDeviceDiscoveryAgent>
+#include <QLowEnergyDescriptor>
+#include <QLowEnergyController>
+#include <QBluetoothLocalDevice>
+
+QT_USE_NAMESPACE
+
+class tst_QLowEnergyDescriptor : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QLowEnergyDescriptor();
+ ~tst_QLowEnergyDescriptor();
+
+protected slots:
+ void deviceDiscovered(const QBluetoothDeviceInfo &info);
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void tst_constructionDefault();
+ void tst_assignCompare();
+
+private:
+ QSet<QString> remoteLeDevices;
+ QLowEnergyController *globalControl;
+ QLowEnergyService *globalService;
+};
+
+tst_QLowEnergyDescriptor::tst_QLowEnergyDescriptor() :
+ globalControl(0), globalService(0)
+{
+ QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
+}
+
+tst_QLowEnergyDescriptor::~tst_QLowEnergyDescriptor()
+{
+}
+
+void tst_QLowEnergyDescriptor::initTestCase()
+{
+ if (QBluetoothLocalDevice::allDevices().isEmpty()) {
+ qWarning("No remote device discovered.");
+
+ return;
+ }
+
+ // start Bluetooth if not started
+ QBluetoothLocalDevice device;
+ device.powerOn();
+
+ // find an arbitrary low energy device in vincinity
+ // find an arbitrary service with descriptor
+
+ QBluetoothDeviceDiscoveryAgent *devAgent = new QBluetoothDeviceDiscoveryAgent(this);
+ connect(devAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)),
+ this, SLOT(deviceDiscovered(QBluetoothDeviceInfo)));
+
+ QSignalSpy errorSpy(devAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)));
+ QVERIFY(errorSpy.isValid());
+ QVERIFY(errorSpy.isEmpty());
+
+ QSignalSpy spy(devAgent, SIGNAL(finished()));
+ // there should be no changes yet
+ QVERIFY(spy.isValid());
+ QVERIFY(spy.isEmpty());
+
+ devAgent->start();
+ QTRY_VERIFY_WITH_TIMEOUT(spy.count() > 0, 50000);
+
+ // find first service with descriptor
+ QLowEnergyController *controller = 0;
+ foreach (const QString &remoteDevice, remoteLeDevices.toList()) {
+ controller = new QLowEnergyController(QBluetoothAddress(remoteDevice), this);
+ qDebug() << "Connecting to" << remoteDevice;
+ controller->connectToDevice();
+ QTRY_IMPL(controller->state() != QLowEnergyController::ConnectingState,
+ 10000);
+ if (controller->state() != QLowEnergyController::ConnectedState) {
+ // any error and we skip
+ delete controller;
+ qDebug() << "Skipping device";
+ continue;
+ }
+
+ QSignalSpy discoveryFinishedSpy(controller, SIGNAL(discoveryFinished()));
+ controller->discoverServices();
+ QTRY_VERIFY_WITH_TIMEOUT(discoveryFinishedSpy.count() == 1, 10000);
+ foreach (const QBluetoothUuid &leServiceUuid, controller->services()) {
+ QLowEnergyService *leService = controller->createServiceObject(leServiceUuid, this);
+ if (!leService)
+ continue;
+
+ leService->discoverDetails();
+ QTRY_VERIFY_WITH_TIMEOUT(
+ leService->state() == QLowEnergyService::ServiceDiscovered, 10000);
+
+ QList<QLowEnergyCharacteristic> chars = leService->characteristics();
+ foreach (const QLowEnergyCharacteristic &ch, chars) {
+ if (!ch.descriptors().isEmpty()) {
+ globalService = leService;
+ globalControl = controller;
+ qWarning() << "Found service with descriptor" << remoteDevice
+ << globalService->serviceName() << globalService->serviceUuid();
+ break;
+ }
+ }
+
+ if (globalControl)
+ break;
+ else
+ delete leService;
+ }
+
+ if (globalControl)
+ break;
+
+ delete controller;
+ }
+
+ if (!globalControl) {
+ qWarning() << "Test limited due to missing remote QLowEnergyDescriptor."
+ << "Please ensure the Bluetooth Low Energy device is advertising its services.";
+ }
+}
+
+void tst_QLowEnergyDescriptor::cleanupTestCase()
+{
+ if (globalControl)
+ globalControl->disconnectFromDevice();
+}
+
+void tst_QLowEnergyDescriptor::deviceDiscovered(const QBluetoothDeviceInfo &info)
+{
+ if (info.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration)
+ remoteLeDevices.insert(info.address().toString());
+}
+
+void tst_QLowEnergyDescriptor::tst_constructionDefault()
+{
+ QLowEnergyDescriptor descriptor;
+ QVERIFY(!descriptor.isValid());
+ QCOMPARE(descriptor.value(), QByteArray());
+ QVERIFY(descriptor.uuid().isNull());
+ QVERIFY(descriptor.handle() == 0);
+ QCOMPARE(descriptor.name(), QString());
+ QCOMPARE(descriptor.type(), QBluetoothUuid::UnknownDescriptorType);
+
+ QLowEnergyDescriptor copyConstructed(descriptor);
+ QVERIFY(!copyConstructed.isValid());
+ QCOMPARE(copyConstructed.value(), QByteArray());
+ QVERIFY(copyConstructed.uuid().isNull());
+ QVERIFY(copyConstructed.handle() == 0);
+ QCOMPARE(copyConstructed.name(), QString());
+ QCOMPARE(copyConstructed.type(), QBluetoothUuid::UnknownDescriptorType);
+
+ QVERIFY(copyConstructed == descriptor);
+ QVERIFY(descriptor == copyConstructed);
+ QVERIFY(!(copyConstructed != descriptor));
+ QVERIFY(!(descriptor != copyConstructed));
+
+ QLowEnergyDescriptor assigned;
+
+ QVERIFY(assigned == descriptor);
+ QVERIFY(descriptor == assigned);
+ QVERIFY(!(assigned != descriptor));
+ QVERIFY(!(descriptor != assigned));
+
+ assigned = descriptor;
+ QVERIFY(!assigned.isValid());
+ QCOMPARE(assigned.value(), QByteArray());
+ QVERIFY(assigned.uuid().isNull());
+ QVERIFY(assigned.handle() == 0);
+ QCOMPARE(assigned.name(), QString());
+ QCOMPARE(assigned.type(), QBluetoothUuid::UnknownDescriptorType);
+
+ QVERIFY(assigned == descriptor);
+ QVERIFY(descriptor == assigned);
+ QVERIFY(!(assigned != descriptor));
+ QVERIFY(!(descriptor != assigned));
+}
+
+
+void tst_QLowEnergyDescriptor::tst_assignCompare()
+{
+ //find the descriptor
+ if (!globalService)
+ QSKIP("No descriptor found.");
+
+ QLowEnergyDescriptor target;
+ QVERIFY(!target.isValid());
+ QCOMPARE(target.type(), QBluetoothUuid::UnknownDescriptorType);
+ QCOMPARE(target.name(), QString());
+ QCOMPARE(target.handle(), QLowEnergyHandle(0));
+ QCOMPARE(target.uuid(), QBluetoothUuid());
+ QCOMPARE(target.value(), QByteArray());
+
+ QList<QLowEnergyDescriptor> targets;
+ const QList<QLowEnergyCharacteristic> chars = globalService->characteristics();
+ foreach (const QLowEnergyCharacteristic &ch, chars) {
+ if (!ch.descriptors().isEmpty()) {
+ targets = ch.descriptors();
+ break;
+ }
+ }
+
+ if (targets.isEmpty())
+ QSKIP("No descriptor found despite prior indication.");
+
+ // test assignment operator
+ target = targets.first();
+ QVERIFY(target.isValid());
+ QVERIFY(target.type() != QBluetoothUuid::UnknownDescriptorType);
+ QVERIFY(!target.name().isEmpty());
+ QVERIFY(target.handle() > 0);
+ QVERIFY(!target.uuid().isNull());
+ QVERIFY(!target.value().isEmpty());
+
+ QVERIFY(target == targets.first());
+ QVERIFY(targets.first() == target);
+ QVERIFY(!(target != targets.first()));
+ QVERIFY(!(targets.first() != target));
+
+ QCOMPARE(target.isValid(), targets.first().isValid());
+ QCOMPARE(target.type(), targets.first().type());
+ QCOMPARE(target.name(), targets.first().name());
+ QCOMPARE(target.handle(), targets.first().handle());
+ QCOMPARE(target.uuid(), targets.first().uuid());
+ QCOMPARE(target.value(), targets.first().value());
+
+ // test copy constructor
+ QLowEnergyDescriptor copyConstructed(target);
+ QCOMPARE(copyConstructed.isValid(), targets.first().isValid());
+ QCOMPARE(copyConstructed.type(), targets.first().type());
+ QCOMPARE(copyConstructed.name(), targets.first().name());
+ QCOMPARE(copyConstructed.handle(), targets.first().handle());
+ QCOMPARE(copyConstructed.uuid(), targets.first().uuid());
+ QCOMPARE(copyConstructed.value(), targets.first().value());
+
+ QVERIFY(copyConstructed == target);
+ QVERIFY(target == copyConstructed);
+ QVERIFY(!(copyConstructed != target));
+ QVERIFY(!(target != copyConstructed));
+
+ // test invalidation
+ QLowEnergyDescriptor invalid;
+ target = invalid;
+ QVERIFY(!target.isValid());
+ QCOMPARE(target.value(), QByteArray());
+ QVERIFY(target.uuid().isNull());
+ QVERIFY(target.handle() == 0);
+ QCOMPARE(target.name(), QString());
+ QCOMPARE(target.type(), QBluetoothUuid::UnknownDescriptorType);
+
+ QVERIFY(invalid == target);
+ QVERIFY(target == invalid);
+ QVERIFY(!(invalid != target));
+ QVERIFY(!(target != invalid));
+
+ QVERIFY(!(targets.first() == target));
+ QVERIFY(!(target == targets.first()));
+ QVERIFY(targets.first() != target);
+ QVERIFY(target != targets.first());
+
+ if (targets.count() >= 2) {
+ QLowEnergyDescriptor second = targets[1];
+ // at least two descriptors
+ QVERIFY(!(targets.first() == second));
+ QVERIFY(!(second == targets.first()));
+ QVERIFY(targets.first() != second);
+ QVERIFY(second != targets.first());
+ }
+}
+
+QTEST_MAIN(tst_QLowEnergyDescriptor)
+
+#include "tst_qlowenergydescriptor.moc"
+
diff --git a/tests/auto/qlowenergyserviceinfo/qlowenergyserviceinfo.pro b/tests/auto/qlowenergyserviceinfo/qlowenergyserviceinfo.pro
new file mode 100644
index 00000000..1dd24a97
--- /dev/null
+++ b/tests/auto/qlowenergyserviceinfo/qlowenergyserviceinfo.pro
@@ -0,0 +1,9 @@
+SOURCES += tst_qlowenergyserviceinfo.cpp
+TARGET = tst_qlowenergyserviceinfo
+CONFIG += testcase
+
+QT = core bluetooth testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+blackberry {
+ LIBS += -lbtapi
+}
diff --git a/tests/auto/qlowenergyserviceinfo/tst_qlowenergyserviceinfo.cpp b/tests/auto/qlowenergyserviceinfo/tst_qlowenergyserviceinfo.cpp
new file mode 100644
index 00000000..23ea6dd2
--- /dev/null
+++ b/tests/auto/qlowenergyserviceinfo/tst_qlowenergyserviceinfo.cpp
@@ -0,0 +1,243 @@
+/***************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited all rights reserved
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QUuid>
+
+#include <QDebug>
+
+#include <qbluetoothdeviceinfo.h>
+#include <qlowenergyserviceinfo.h>
+#include <qbluetoothaddress.h>
+#include <qbluetoothlocaldevice.h>
+#include <qbluetoothuuid.h>
+
+QT_USE_NAMESPACE
+
+Q_DECLARE_METATYPE(QUuid)
+Q_DECLARE_METATYPE(QBluetoothDeviceInfo::CoreConfiguration)
+Q_DECLARE_METATYPE(QLowEnergyServiceInfo)
+Q_DECLARE_METATYPE(QBluetoothUuid::ServiceClassUuid)
+
+class tst_QLowEnergyServiceInfo : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QLowEnergyServiceInfo();
+ ~tst_QLowEnergyServiceInfo();
+
+private slots:
+ void initTestCase();
+ void tst_construction();
+ void tst_assignment_data();
+ void tst_assignment();
+};
+
+tst_QLowEnergyServiceInfo::tst_QLowEnergyServiceInfo()
+{
+}
+
+tst_QLowEnergyServiceInfo::~tst_QLowEnergyServiceInfo()
+{
+}
+
+void tst_QLowEnergyServiceInfo::initTestCase()
+{
+ // start Bluetooth if not started
+ QBluetoothLocalDevice *device = new QBluetoothLocalDevice();
+ device->powerOn();
+ delete device;
+}
+
+void tst_QLowEnergyServiceInfo::tst_construction()
+{
+ const QBluetoothUuid serviceUuid(QBluetoothUuid::HeartRate);
+ const QBluetoothUuid alternateServiceUuid(QBluetoothUuid::BatteryService);
+ const QBluetoothDeviceInfo deviceInfo(QBluetoothAddress("001122334455"), "Test Device", 0);
+ const QBluetoothDeviceInfo alternatedeviceInfo(QBluetoothAddress("554433221100"), "Test Device2", 0);
+
+ {
+ QLowEnergyServiceInfo serviceInfo;
+
+ QVERIFY(!serviceInfo.isValid());
+ QCOMPARE(serviceInfo.serviceName(), QStringLiteral("Unknown Service"));
+ QCOMPARE(serviceInfo.serviceUuid().toString(), QBluetoothUuid().toString());
+ QCOMPARE(serviceInfo.device(), QBluetoothDeviceInfo());
+ }
+
+ {
+ QLowEnergyServiceInfo serviceInfo(serviceUuid);
+ serviceInfo.setDevice(deviceInfo);
+
+ QVERIFY(serviceInfo.isValid());
+
+ QCOMPARE(serviceInfo.serviceUuid().toString(), serviceUuid.toString());
+ QCOMPARE(serviceInfo.device().address(), deviceInfo.address());
+
+ QLowEnergyServiceInfo copyInfo(serviceInfo);
+
+ QVERIFY(copyInfo.isValid());
+
+ QCOMPARE(copyInfo.serviceUuid().toString(), serviceUuid.toString());
+ QCOMPARE(copyInfo.device().address(), deviceInfo.address());
+
+
+ copyInfo = QLowEnergyServiceInfo(alternateServiceUuid);
+ copyInfo.setDevice(alternatedeviceInfo);
+ QCOMPARE(copyInfo.serviceUuid(), alternateServiceUuid);
+
+ QCOMPARE(copyInfo.device().address(), alternatedeviceInfo.address());
+
+ }
+}
+
+void tst_QLowEnergyServiceInfo::tst_assignment_data()
+{
+ QTest::addColumn<QBluetoothAddress>("address");
+ QTest::addColumn<QString>("name");
+ QTest::addColumn<quint32>("classOfDevice");
+ QTest::addColumn<QBluetoothUuid>("serviceClassUuid");
+ QTest::addColumn<QBluetoothDeviceInfo::CoreConfiguration>("coreConfiguration");
+
+ // bits 12-8 Major
+ // bits 7-2 Minor
+ // bits 1-0 0
+
+ QTest::newRow("0x000000 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
+ << quint32(0x000000)
+ << QBluetoothUuid(QBluetoothUuid::GenericAccess)
+ << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration;
+ QTest::newRow("0x000100 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
+ << quint32(0x000100)
+ << QBluetoothUuid(QBluetoothUuid::GenericAttribute)
+ << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration;
+ QTest::newRow("0x000104 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
+ << quint32(0x000104)
+ << QBluetoothUuid(QBluetoothUuid::HeartRate)
+ << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration;
+ QTest::newRow("0x000118 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
+ << quint32(0x000118)
+ << QBluetoothUuid(QBluetoothUuid::CyclingSpeedAndCadence)
+ << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration;
+ QTest::newRow("0x000200 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
+ << quint32(0x000200)
+ << QBluetoothUuid(QBluetoothUuid::CyclingPower)
+ << QBluetoothDeviceInfo::LowEnergyCoreConfiguration;
+ QTest::newRow("0x000204 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
+ << quint32(0x000204)
+ << QBluetoothUuid(QBluetoothUuid::ScanParameters)
+ << QBluetoothDeviceInfo::LowEnergyCoreConfiguration;
+ QTest::newRow("0x000214 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
+ << quint32(0x000214)
+ << QBluetoothUuid(QBluetoothUuid::DeviceInformation)
+ << QBluetoothDeviceInfo::LowEnergyCoreConfiguration;
+ QTest::newRow("0x000300 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
+ << quint32(0x000300)
+ << QBluetoothUuid(QBluetoothUuid::CurrentTimeService)
+ << QBluetoothDeviceInfo::LowEnergyCoreConfiguration;
+ QTest::newRow("0x000320 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device"
+ << quint32(0x000320)
+ << QBluetoothUuid(QBluetoothUuid::LocationAndNavigation)
+ << QBluetoothDeviceInfo::LowEnergyCoreConfiguration;
+}
+
+void tst_QLowEnergyServiceInfo::tst_assignment()
+{
+ QFETCH(QBluetoothAddress, address);
+ QFETCH(QString, name);
+ QFETCH(quint32, classOfDevice);
+ QFETCH(QBluetoothUuid, serviceClassUuid);
+ QFETCH(QBluetoothDeviceInfo::CoreConfiguration, coreConfiguration);
+
+ QBluetoothDeviceInfo deviceInfo(address, name, classOfDevice);
+ deviceInfo.setCoreConfigurations(coreConfiguration);
+ QCOMPARE(deviceInfo.coreConfigurations(), coreConfiguration);
+
+ QLowEnergyServiceInfo serviceInfo(serviceClassUuid);
+ serviceInfo.setDevice(deviceInfo);
+ QCOMPARE(serviceInfo.device(), deviceInfo);
+
+ QVERIFY(serviceInfo.isValid());
+
+ {
+ QLowEnergyServiceInfo copyInfo = serviceInfo;
+
+ QVERIFY(copyInfo.isValid());
+
+ QCOMPARE(copyInfo.device().address(), address);
+ QCOMPARE(copyInfo.serviceUuid(), serviceClassUuid);
+ QCOMPARE(copyInfo.device().coreConfigurations(), coreConfiguration);
+ QCOMPARE(copyInfo.device(), deviceInfo);
+ }
+
+ {
+ QLowEnergyServiceInfo copyInfo;
+
+ QVERIFY(!copyInfo.isValid());
+
+ copyInfo = serviceInfo;
+
+ QVERIFY(copyInfo.isValid());
+
+ QCOMPARE(copyInfo.device().address(), address);
+ QCOMPARE(copyInfo.serviceUuid(), serviceClassUuid);
+ QCOMPARE(copyInfo.device().coreConfigurations(), coreConfiguration);
+ }
+
+ {
+ QLowEnergyServiceInfo copyInfo1;
+ QLowEnergyServiceInfo copyInfo2;
+
+ QVERIFY(!copyInfo1.isValid());
+ QVERIFY(!copyInfo2.isValid());
+
+ copyInfo1 = copyInfo2 = serviceInfo;
+
+ QVERIFY(copyInfo1.isValid());
+ QVERIFY(copyInfo2.isValid());
+
+ QCOMPARE(copyInfo1.device().address(), address);
+ QCOMPARE(copyInfo2.device().address(), address);
+ QCOMPARE(copyInfo1.serviceUuid(), serviceClassUuid);
+ QCOMPARE(copyInfo2.serviceUuid(), serviceClassUuid);
+ QCOMPARE(copyInfo1.device().coreConfigurations(), coreConfiguration);
+ QCOMPARE(copyInfo2.device().coreConfigurations(), coreConfiguration);
+ QCOMPARE(copyInfo1.device(), deviceInfo);
+ QCOMPARE(copyInfo2.device(), deviceInfo);
+ }
+}
+
+QTEST_MAIN(tst_QLowEnergyServiceInfo)
+
+#include "tst_qlowenergyserviceinfo.moc"
diff --git a/tests/auto/qndefmessage/tst_qndefmessage.cpp b/tests/auto/qndefmessage/tst_qndefmessage.cpp
index 5813d0cd..c697a5e5 100644
--- a/tests/auto/qndefmessage/tst_qndefmessage.cpp
+++ b/tests/auto/qndefmessage/tst_qndefmessage.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -174,7 +166,10 @@ void tst_QNdefMessage::tst_parse_data()
QList<QNdefRecord> recordList;
recordList.append(record);
QTest::newRow("chunked") << data << QNdefMessage(recordList) << QVariantList();
- QCOMPARE(qHash(record), 1887494681LL);
+
+ const QByteArray recordContent = record.type() + record.id()
+ + record.payload();
+ QCOMPARE(recordContent, QByteArray::fromHex(QByteArray("7479706569647061796c6f6164")));
}
// NFC-RTD Text
@@ -202,9 +197,13 @@ void tst_QNdefMessage::tst_parse_data()
QList<QNdefRecord> recordList;
recordList.append(record);
QTest::newRow("nfc-rtd text") << data << QNdefMessage(recordList)
- << (QVariantList() << QLatin1String("Test String")
- << QLatin1String("en"));
- QCOMPARE(qHash(record), 3247259560LL);
+ << (QVariantList() << QStringLiteral("Test String")
+ << QStringLiteral("en"));
+
+ const QByteArray recordContent = record.type() + record.id()
+ + record.payload();
+ QCOMPARE(recordContent,
+ QByteArray::fromHex(QByteArray("5402656e5465737420537472696e67")));
}
// NFC-RTD Text
@@ -235,8 +234,12 @@ void tst_QNdefMessage::tst_parse_data()
<< data << QNdefMessage(recordList)
<< (QVariantList() << QString::fromUtf8("\343\203\206\343\202\271\343\203\210\346\226"
"\207\345\255\227\345\210\227")
- << QLatin1String("ja"));
- QCOMPARE(qHash(record), 3407917933LL);
+ << QStringLiteral("ja"));
+
+ const QByteArray recordContent = record.type() + record.id()
+ + record.payload();
+ QCOMPARE(recordContent,
+ QByteArray::fromHex(QByteArray("54026a61e38386e382b9e38388e69687e5ad97e58897")));
}
// NFC-RTD URI
@@ -244,7 +247,7 @@ void tst_QNdefMessage::tst_parse_data()
QByteArray type("U");
QByteArray payload;
payload.append(char(0x00));
- payload.append("http://qt.nokia.com/");
+ payload.append("http://qt-project.org/");
QByteArray data;
data.append(char(0xc1));
@@ -259,13 +262,17 @@ void tst_QNdefMessage::tst_parse_data()
QNdefRecord record;
record.setTypeNameFormat(QNdefRecord::NfcRtd);
record.setType("U");
- record.setPayload(QByteArray("\000http://qt.nokia.com/", 21));
+ record.setPayload(QByteArray("\000http://qt-project.org/", 23));
QList<QNdefRecord> recordList;
recordList.append(record);
- QTest::newRow("nfc-rtd uri http://qt.nokia.com/")
+ QTest::newRow("nfc-rtd uri http://qt-project.org/")
<< data << QNdefMessage(recordList)
- << (QVariantList() << QUrl(QLatin1String("http://qt.nokia.com/")));
- QCOMPARE(qHash(record), 4030951038LL);
+ << (QVariantList() << QUrl(QStringLiteral("http://qt-project.org/")));
+
+ const QByteArray recordContent = record.type() + record.id()
+ + record.payload();
+ QCOMPARE(recordContent,
+ QByteArray::fromHex(QByteArray("5500687474703a2f2f71742d70726f6a6563742e6f72672f")));
}
// NFC-RTD URI
@@ -273,7 +280,7 @@ void tst_QNdefMessage::tst_parse_data()
QByteArray type("U");
QByteArray payload;
payload.append(char(0x03));
- payload.append("qt.nokia.com/");
+ payload.append("qt-project.org/");
QByteArray data;
data.append(char(0xc1));
@@ -288,13 +295,17 @@ void tst_QNdefMessage::tst_parse_data()
QNdefRecord record;
record.setTypeNameFormat(QNdefRecord::NfcRtd);
record.setType("U");
- record.setPayload(QByteArray("\003qt.nokia.com/", 14));
+ record.setPayload(QByteArray("\003qt-project.org/", 16));
QList<QNdefRecord> recordList;
recordList.append(record);
- QTest::newRow("nfc-rtd uri abbrev http://qt.nokia.com/")
+ QTest::newRow("nfc-rtd uri abbrev http://qt-project.org/")
<< data << QNdefMessage(recordList)
- << (QVariantList() << QUrl(QLatin1String("http://qt.nokia.com/")));
- QCOMPARE(qHash(record), 132405495LL);
+ << (QVariantList() << QUrl(QStringLiteral("http://qt-project.org/")));
+
+ const QByteArray recordContent = record.type() + record.id()
+ + record.payload();
+ QCOMPARE(recordContent,
+ QByteArray::fromHex(QByteArray("550371742d70726f6a6563742e6f72672f")));
}
// NFC-RTD URI
@@ -322,8 +333,12 @@ void tst_QNdefMessage::tst_parse_data()
recordList.append(record);
QTest::newRow("nfc-rtd uri tel:+1234567890")
<< data << QNdefMessage(recordList)
- << (QVariantList() << QUrl(QLatin1String("tel:+1234567890")));
- QCOMPARE(qHash(record), 3757269174LL);
+ << (QVariantList() << QUrl(QStringLiteral("tel:+1234567890")));
+
+ const QByteArray recordContent = record.type() + record.id()
+ + record.payload();
+ QCOMPARE(recordContent,
+ QByteArray::fromHex(QByteArray("55052b31323334353637383930")));
}
// Truncated message
@@ -332,7 +347,7 @@ void tst_QNdefMessage::tst_parse_data()
QByteArray id("Test ID");
QByteArray payload;
payload.append(char(0x00));
- payload.append("http://qt.nokia.com/");
+ payload.append("http://qt-project.org/");
QByteArray data;
data.append(char(0xc9)); // MB=1, ME=1, IL=1
diff --git a/tests/auto/qndefnfcsmartposterrecord/tst_qndefnfcsmartposterrecord.cpp b/tests/auto/qndefnfcsmartposterrecord/tst_qndefnfcsmartposterrecord.cpp
index c16fb211..f5b51710 100644
--- a/tests/auto/qndefnfcsmartposterrecord/tst_qndefnfcsmartposterrecord.cpp
+++ b/tests/auto/qndefnfcsmartposterrecord/tst_qndefnfcsmartposterrecord.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/qndefrecord/tst_qndefrecord.cpp b/tests/auto/qndefrecord/tst_qndefrecord.cpp
index 000ff017..5e776423 100644
--- a/tests/auto/qndefrecord/tst_qndefrecord.cpp
+++ b/tests/auto/qndefrecord/tst_qndefrecord.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -164,7 +156,7 @@ void tst_QNdefRecord::tst_record()
{
QNdefRecord record;
record.setTypeNameFormat(QNdefRecord::ExternalRtd);
- record.setType("qt.nokia.com:test-rtd");
+ record.setType("qt-project.org:test-rtd");
record.setId("test id");
record.setPayload("test payload");
@@ -196,13 +188,13 @@ void tst_QNdefRecord::tst_record()
{
QNdefRecord record;
record.setTypeNameFormat(QNdefRecord::ExternalRtd);
- record.setType("qt.nokia.com:test-rtd");
+ record.setType("qt-project.org:test-rtd");
record.setId("test id");
record.setPayload("test payload");
QNdefRecord other;
other.setTypeNameFormat(QNdefRecord::ExternalRtd);
- other.setType("qt.nokia.com:test-other-rtd");
+ other.setType("qt-project.org:test-other-rtd");
other.setId("test other id");
other.setPayload("test other payload");
@@ -301,14 +293,14 @@ void tst_QNdefRecord::tst_uriRecord_data()
QTest::addColumn<QByteArray>("payload");
- QTest::newRow("http") << QString::fromLatin1("http://qt.nokia.com/")
- << QByteArray::fromHex("0371742E6E6F6B69612E636F6D2F");
+ QTest::newRow("http") << QString::fromLatin1("http://qt-project.org/")
+ << QByteArray::fromHex("0371742d70726f6a6563742e6f72672f");
QTest::newRow("tel") << QString::fromLatin1("tel:+1234567890")
<< QByteArray::fromHex("052B31323334353637383930");
QTest::newRow("mailto") << QString::fromLatin1("mailto:test@example.com")
<< QByteArray::fromHex("0674657374406578616D706C652E636F6D");
- QTest::newRow("urn") << QString::fromLatin1("urn:nfc:ext:qt.nokia.com:test")
- << QByteArray::fromHex("136E66633A6578743A71742E6E6F6B69612E636F6D3A74657374");
+ QTest::newRow("urn") << QString::fromLatin1("urn:nfc:ext:qt-project.org:test")
+ << QByteArray::fromHex("136E66633A6578743A71742D70726F6A6563742E6F72673A74657374");
}
void tst_QNdefRecord::tst_uriRecord()
diff --git a/tests/auto/qnearfieldmanager/tst_qnearfieldmanager.cpp b/tests/auto/qnearfieldmanager/tst_qnearfieldmanager.cpp
index f431ce6f..694b6b1b 100644
--- a/tests/auto/qnearfieldmanager/tst_qnearfieldmanager.cpp
+++ b/tests/auto/qnearfieldmanager/tst_qnearfieldmanager.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/qnearfieldtagtype1/tst_qnearfieldtagtype1.cpp b/tests/auto/qnearfieldtagtype1/tst_qnearfieldtagtype1.cpp
index bbe72e5a..0d733e1d 100644
--- a/tests/auto/qnearfieldtagtype1/tst_qnearfieldtagtype1.cpp
+++ b/tests/auto/qnearfieldtagtype1/tst_qnearfieldtagtype1.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -421,7 +413,7 @@ void tst_QNearFieldTagType1::ndefMessages()
QList<QNdefMessage> messages;
QNdefNfcTextRecord textRecord;
- textRecord.setText(QLatin1String("tst_QNearFieldTagType1::ndefMessages"));
+ textRecord.setText(QStringLiteral("tst_QNearFieldTagType1::ndefMessages"));
QNdefMessage message;
message.append(textRecord);
@@ -429,7 +421,7 @@ void tst_QNearFieldTagType1::ndefMessages()
if (target->memorySize() > 120) {
QNdefRecord record;
record.setTypeNameFormat(QNdefRecord::ExternalRtd);
- record.setType("com.nokia.qt:ndefMessagesTest");
+ record.setType("org.qt-project:ndefMessagesTest");
record.setPayload(QByteArray(120, quint8(0x55)));
message.append(record);
}
diff --git a/tests/auto/qnearfieldtagtype2/tst_qnearfieldtagtype2.cpp b/tests/auto/qnearfieldtagtype2/tst_qnearfieldtagtype2.cpp
index 6fac6571..39a2c68b 100644
--- a/tests/auto/qnearfieldtagtype2/tst_qnearfieldtagtype2.cpp
+++ b/tests/auto/qnearfieldtagtype2/tst_qnearfieldtagtype2.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -313,7 +305,7 @@ void tst_QNearFieldTagType2::ndefMessages()
QList<QNdefMessage> messages;
QNdefNfcTextRecord textRecord;
- textRecord.setText(QLatin1String("tst_QNearFieldTagType2::ndefMessages"));
+ textRecord.setText(QStringLiteral("tst_QNearFieldTagType2::ndefMessages"));
QNdefMessage message;
message.append(textRecord);
@@ -321,7 +313,7 @@ void tst_QNearFieldTagType2::ndefMessages()
if (target->memorySize() > 120) {
QNdefRecord record;
record.setTypeNameFormat(QNdefRecord::ExternalRtd);
- record.setType("com.nokia.qt:ndefMessagesTest");
+ record.setType("org.qt-project:ndefMessagesTest");
record.setPayload(QByteArray(120, quint8(0x55)));
message.append(record);
}
diff --git a/tests/bttestui/Button.qml b/tests/bttestui/Button.qml
index 25cffb43..03903fd0 100644
--- a/tests/bttestui/Button.qml
+++ b/tests/bttestui/Button.qml
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/bttestui/btlocaldevice.cpp b/tests/bttestui/btlocaldevice.cpp
index a14709ee..247c00e6 100644
--- a/tests/bttestui/btlocaldevice.cpp
+++ b/tests/bttestui/btlocaldevice.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -83,6 +75,8 @@ BtLocalDevice::BtLocalDevice(QObject *parent) :
serviceAgent = new QBluetoothServiceDiscoveryAgent(this);
connect(serviceAgent, SIGNAL(serviceDiscovered(QBluetoothServiceInfo)),
this, SLOT(serviceDiscovered(QBluetoothServiceInfo)));
+ connect(serviceAgent, SIGNAL(serviceDiscovered(QLowEnergyServiceInfo)),
+ this, SLOT(leServiceDiscovered(QLowEnergyServiceInfo)));
connect(serviceAgent, SIGNAL(finished()),
this, SLOT(serviceDiscoveryFinished()));
connect(serviceAgent, SIGNAL(canceled()),
@@ -149,10 +143,20 @@ void BtLocalDevice::requestPairingUpdate(bool isPairing)
if (baddr.isNull())
return;
- if (isPairing)
- localDevice->requestPairing(baddr, QBluetoothLocalDevice::Paired);
- else
+
+
+ if (isPairing) {
+ //toggle between authorized and non-authorized pairing to achieve better
+ //level of testing
+ static short pairing = 0;
+ if ((pairing%2) == 1)
+ localDevice->requestPairing(baddr, QBluetoothLocalDevice::Paired);
+ else
+ localDevice->requestPairing(baddr, QBluetoothLocalDevice::AuthorizedPaired);
+ pairing++;
+ } else {
localDevice->requestPairing(baddr, QBluetoothLocalDevice::Unpaired);
+ }
for (int i = 0; i < foundTestServers.count(); i++) {
if (isPairing)
@@ -296,11 +300,11 @@ void BtLocalDevice::stopServiceDiscovery()
void BtLocalDevice::serviceDiscovered(const QBluetoothServiceInfo &info)
{
- QString classIds;
- foreach (const QBluetoothUuid uuid, info.serviceClassUuids())
- classIds += uuid.toString() + QLatin1Char(' ');
+ QStringList classIds;
+ foreach (const QBluetoothUuid &uuid, info.serviceClassUuids())
+ classIds.append(uuid.toString());
qDebug() << "$$ Found new service" << info.device().address().toString()
- << info.serviceUuid() << info.serviceName() << classIds;
+ << info.serviceUuid() << info.serviceName() << info.serviceDescription() << classIds;
if (info.serviceUuid() == QBluetoothUuid(QString(TEST_SERVICE_UUID))
|| info.serviceClassUuids().contains(QBluetoothUuid(QString(TEST_SERVICE_UUID))))
@@ -321,6 +325,12 @@ void BtLocalDevice::serviceDiscovered(const QBluetoothServiceInfo &info)
}
}
+void BtLocalDevice::leServiceDiscovered(const QLowEnergyServiceInfo &info)
+{
+ qDebug() << "$$ Found new BTLE service" << info.device().address().toString()
+ << info.serviceUuid() << info.serviceName();
+}
+
void BtLocalDevice::serviceDiscoveryFinished()
{
qDebug() << "###### Service Discovery Finished";
@@ -348,7 +358,7 @@ void BtLocalDevice::dumpServiceDiscovery()
qDebug() << "Discovered Devices:" << list.count();
foreach (const QBluetoothDeviceInfo &info, list)
- qDebug() << info.name() << info.address().toString();
+ qDebug() << info.name() << info.address().toString() << info.rssi();
}
if (serviceAgent) {
qDebug() << "Service Discovery active:" << serviceAgent->isActive();
@@ -490,7 +500,10 @@ void BtLocalDevice::readData()
if (socket) {
while (socket->canReadLine()) {
QByteArray line = socket->readLine().trimmed();
- qDebug() << ">>>>" << QString::fromUtf8(line.constData(), line.length());
+ qDebug() << ">> peer(" << socket->peerName() << socket->peerAddress()
+ << socket->peerPort() << ") local("
+ << socket->localName() << socket->localAddress() << socket->localPort()
+ << ")>>" << QString::fromUtf8(line.constData(), line.length());
}
}
}
@@ -633,7 +646,7 @@ void BtLocalDevice::clientSocketReadyRead()
while (socket->canReadLine()) {
const QByteArray line = socket->readLine().trimmed();
QString lineString = QString::fromUtf8(line.constData(), line.length());
- qDebug() << ">>(" << socket->peerName() << ")>>"
+ qDebug() << ">>(" << server->serverAddress() << server->serverPort() <<")>>"
<< lineString;
//when using the tst_QBluetoothSocket we echo received text back
diff --git a/tests/bttestui/btlocaldevice.h b/tests/bttestui/btlocaldevice.h
index 01d9b0df..53e4797b 100644
--- a/tests/bttestui/btlocaldevice.h
+++ b/tests/bttestui/btlocaldevice.h
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -90,6 +82,7 @@ public slots:
void startTargettedServiceDiscovery();
void stopServiceDiscovery();
void serviceDiscovered(const QBluetoothServiceInfo &info);
+ void leServiceDiscovered(const QLowEnergyServiceInfo &leInfo);
void serviceDiscoveryFinished();
void serviceDiscoveryCanceled();
void serviceDiscoveryError(QBluetoothServiceDiscoveryAgent::Error error);
diff --git a/tests/bttestui/main.cpp b/tests/bttestui/main.cpp
index 964eec59..6543bd7b 100644
--- a/tests/bttestui/main.cpp
+++ b/tests/bttestui/main.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/bttestui/main.qml b/tests/bttestui/main.qml
index 93d943f2..caae54fa 100644
--- a/tests/bttestui/main.qml
+++ b/tests/bttestui/main.qml
@@ -5,36 +5,28 @@
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/nfctestserver/main.cpp b/tests/nfctestserver/main.cpp
index 8f9eca3e..19c7eed8 100644
--- a/tests/nfctestserver/main.cpp
+++ b/tests/nfctestserver/main.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/nfctestserver/servercontroller.cpp b/tests/nfctestserver/servercontroller.cpp
index 2a6dcce9..32337b58 100644
--- a/tests/nfctestserver/servercontroller.cpp
+++ b/tests/nfctestserver/servercontroller.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/nfctestserver/servercontroller.h b/tests/nfctestserver/servercontroller.h
index 1104d2a7..7f18dd47 100644
--- a/tests/nfctestserver/servercontroller.h
+++ b/tests/nfctestserver/servercontroller.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/nfctestserver/servicenames.h b/tests/nfctestserver/servicenames.h
index f09f9b9b..d8ad5088 100644
--- a/tests/nfctestserver/servicenames.h
+++ b/tests/nfctestserver/servicenames.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/nfctestserver/socketcontroller.cpp b/tests/nfctestserver/socketcontroller.cpp
index e568d7d7..3b9567c2 100644
--- a/tests/nfctestserver/socketcontroller.cpp
+++ b/tests/nfctestserver/socketcontroller.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -97,7 +89,7 @@ SocketController::~SocketController()
void SocketController::connected()
{
qDebug() << "Client connected";
- const QString data = QLatin1String("HELLO ") + m_service;
+ const QString data = QStringLiteral("HELLO ") + m_service;
switch (m_connectionType) {
case StreamConnection:
m_socket->write(data.toUtf8() + '\n');
diff --git a/tests/nfctestserver/socketcontroller.h b/tests/nfctestserver/socketcontroller.h
index 04583547..02fc3e4f 100644
--- a/tests/nfctestserver/socketcontroller.h
+++ b/tests/nfctestserver/socketcontroller.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNfc module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/