summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothserver_bluez.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use SPDX license identifiersLucie Gérard2022-06-101-38/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: Ifc22d8ae24532e9a1093ca613ed6590a1992bc39 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Remove unnecessary variable inits in bluetooth serversJuha Vuolle2022-03-251-4/+2
| | | | | | | | | | | Since 6.2 there are in-class initializations for many of the variables. In addition the Windows backend does not use the socket that is created. Pick-to: 6.2 6.3 Change-Id: I371b9b23aee54c49aa8fc71f86c2e8ecbbbfc407 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Rename QBluetoothSocketPrivate to QBluetoothSocketPrivateDarwinAndreas Buhr2021-09-011-1/+1
| | | | | | | | | | | | The macOS implementation of the private class of QBluetoothSocket was named "QBluetoothSocketPrivate" with no hint in the name that it is the macOS implementation. This patch renames it to "QBluetoothSocketPrivateDarwin". We have chosen "Darwin" as suffix as most macOS specific classes have "Darwin" in their name. Change-Id: I888f3e447a9bbbd00f55fe126cd3cc14211faa58 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Change QBluetooth::Security and AttAcc. to be a scoped enumsAndreas Buhr2021-03-301-12/+15
| | | | | | | | | | This patch changes QBluetooth::Security and QBluetooth::AttAccessConstraint to be scoped enums for improved type safety. Fixes: QTBUG-91906 Change-Id: Ife4797aa8e106690a10e4fcb7f623877023fbb3c Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* rename error signals to errorOccurredAndreas Buhr2021-03-221-7/+7
| | | | | | | | | | | Currently, there is a name clash between the error getter and the error signal. This leads to extensive use of qOverload or similar. This patch renames all error signals to errorOccurred to resolve this. Task-number: QTBUG-62877 Change-Id: I615e2405f855433b6e142d820072c4d3f35ae28f Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Decouple QBluetoothSocket and QAbstractSocket, introduce scoped enumsAndreas Buhr2021-03-121-5/+5
| | | | | | | | | | | QBluetoothSocket enum values were tied to QAbstractSocket enum values. But there is no dependency, the coupling is not required. This patch removes the coupling and changes to scoped enums for improved type safety. Task-number: QTBUG-62877 Change-Id: I206b1d438d74b976d3e0d32da5713d22b597dd90 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix warning in QBluetoothServer on LinuxAlex Blasche2019-12-051-1/+1
| | | | | | | | | | | | | | | | | In file included from qbluetoothserver_bluez.cpp:41:0: qbluetoothserver_p.h: In constructor ‘QBluetoothServerPrivate::QBluetoothServerPrivate(QBluetoothServiceInfo::Protocol, QBluetoothServer*)’: qbluetoothserver_p.h:128:29: warning: ‘QBluetoothServerPrivate::m_lastError’ will be initialized after [-Wreorder] QBluetoothServer::Error m_lastError; ^~~~~~~~~~~ qbluetoothserver_p.h:125:23: warning: ‘QBluetoothServer* QBluetoothServerPrivate::q_ptr’ [-Wreorder] QBluetoothServer *q_ptr; ^~~~~ qbluetoothserver_bluez.cpp:69:1: warning: when initialized here [-Wreorder] QBluetoothServerPrivate::QBluetoothServerPrivate(QBluetoothServiceInfo::Protocol sType, ^~~~~~~~~~~~~~~~~~~~~~~ Change-Id: I4fca28f8f2974cb6a336b6fac1e06469edceb80c Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Enable the use of the Win32 Bluetooth backendAndre de la Rocha2019-08-051-2/+3
| | | | | | | | | | | | This change enables the optional use of the Win32-based Bluetooth backend on Windows. By default, the WinRT backend is used, if supported by the platform. The use of the Win32 backend must be selected by the -native-win32-bluetooth configuration option. Task-number: QTBUG-40698 Change-Id: I6904bf077467d826e3ff5ad026ebae5f955f2e37 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Ensure QObject context is retained to avoid crashesv5.12.0-beta4Alex Blasche2018-10-311-1/+1
| | | | | | | | | | | If the public class is deleted pending lambda invocation can cause crashes unless QObject context is provided. This fixes a regression introduced by 819bb06c2cb3372cb1bb9ddd7f3a504f78d3452d. This was discovered while investigating QTBUG-71479. Change-Id: I3a49916ce6d9425c684863bb0b04a10bd3e652b9 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Normalize QObject::connect() statementsAlex Blasche2018-08-291-1/+4
| | | | | | | | | | | | | | Some cases use the Q_PRIVATE_SLOT logic which does not require QObject inheritance. Those cases were converted to lambda logic to avoid need for QObject inheritance. The Q_PRIVATE_SLOT macro was removed from qbluetoothdevicediscoveryagent.h. This is not a BC problem because the macro expands to nothing. Only moc recognizes the pattern. Change-Id: Ic7cb4cde397f9b230b6fd0b4046e59e504583e58 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Code cleanup: Use nullptr wherever possibleAlex Blasche2018-08-241-5/+5
| | | | | Change-Id: I7dd2d055c8d667f049d7cb2c371619137bf76030 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Ensure that QBluetoothServer works with new DBus based socketsAlex Blasche2018-08-161-12/+16
| | | | | | | | | | | | | | | | | | | or better ensure that the DBus based socket is not used for QBluetoothServer. The server implementation will continue to use the raw socket implementation for the foreseeable future. The reason being the DBus version not yet working. convertAddress() in the server cpp was removed because it was a duplicate implementation. Including qbluetoothsocket_bluez_p.h pulls in the qbluetoothsocketbase_p.h which provides the official convertAddress() implementations. Unfortunately this requires a new ctor for QBluetoothSocket which is only specified for BlueZ builds. It is used to permit QBluetoothServer to set the correct dptr for QBluetoothSocket. Task-number: QTBUG-68550 Change-Id: I19298f75e9bc2ab93322d9f34e1816ad733ac6d9 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Updated license headersAntti Kokko2016-01-201-14/+20
| | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I856c13e2a6d4d12c46e1286b0ca1c092ee4608f8 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Bluez: Improve security flag handling in QBluetoothServerAlex Blasche2015-07-071-82/+71
| | | | | | | | | | | | | | | | | | | | | | | | 1.) Remove the usage SOL_RFCOMM & SOL_L2CAP. They were replaced by SOL_BLUEOOTH. The same applies to RFCOMM_LM & L2CAP_LM which were replaced by BT_SECURITY. 2.) Fix securityFlags() when socket was closed already. It always triggered undesirable error messages as the code assumed a valid socket fd. 3.) Fix setSecurityFlags() when calling after the server socket was closed. The docs state that this function shall be called before listen is called. However after the socket was closed for the first time the security level could not be set anymore because the server socket is invalid until the next call to listen(). To solve this problem the initial security level is stored and applied during listen(). These changes imply a slightly different runtime behavior of securityFlags(). While the socket is closed it returns the stored value and during runtime the actual runtime level is returned. Change-Id: I720e6ac94a569397c4fec0058a1d388a1f35ecae Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Merge remote-tracking branch 'origin/5.4' into 5.5Frederik Gladhorn2015-02-241-2/+4
|\ | | | | | | Change-Id: Ie5ce761b77cc5c02647a9f7d52f427401b85d6b0
| * Set QBluetoothServer::ServiceAlreadyRegisteredError where possibleAlex Blasche2015-02-171-2/+4
| | | | | | | | | | | | | | | | | | This affects Bluez 4 & 5. Task-number: QTBUG-44452 Change-Id: Ifa9f6c56499bece3d99dba65a0afeed6c2ed60ac Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Update copyright headersJani Heikkinen2015-02-161-7/+7
|/ | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I3822a6484e8f7a420330de1cb1aeb0c3d1cf41b7 Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
* Update license headers and add new licensesJani Heikkinen2014-08-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I7a8b8b787fcae9a178794364efdefe1021d10b1b Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Reduce system header dependenciesAlex Blasche2014-07-161-4/+1
| | | | | Change-Id: I52ac33b4864d6bfca248ff3fad5a069154a9c756 Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Fix not working listen() on Bluez with default Bluetooth addressesAlex Blasche2014-03-031-1/+1
| | | | | | | | Binding to the address 0 does not work. Change-Id: Ie2e9bfc64729e6bf82556c3384d2e72117fc39ab Reviewed-by: Nedim Hadzic <nedimhadzija@gmail.com> Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Fix qrfcomm unit testAlex Blasche2014-03-011-0/+18
| | | | | | | | | | The patch also aligns the error behavior of QBluetoothServer::listen() across the various platforms. Task-number: QTBUG-22017 Change-Id: Ic81808c94d060ca07bd125afa842452e53efaec7 Reviewed-by: Nedim Hadzic <nedimhadzija@gmail.com> Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Fix namespaced buildsAlex Blasche2014-02-141-1/+1
| | | | | | | | It seems the logging frameworks function pointer creates errors on some compilers. Change-Id: I35d9b2bbc9817789bfd1eafa9c62d19ca72eda8c Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Port QtBluetooth to AndroidAlex Blasche2014-02-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | This is a feature merge to dev targeting Qt 5.3. Known issues: -QTBUG-36754: QBluetoothServer::close() crashes -QTBUG-36763: QBluetothTransferManager port to Android not possible -QTBUG-36764: Improve QBluetoothLocalDevice::connectedDevices() -QTBUG-36810: Remove direct use of Android action strings The above issues and some other minor TODO's will be addressed until final release time. Task-number: QTBUG-33792 [ChangeLog][QtBluetooth][Android] QtBluetooth has been ported to Android. Change-Id: I31ba83e3b7d6aa68e7258b7e43235de7d1a6e68a Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* QBluetoothServer fixesAlex Blasche2014-02-071-3/+24
| | | | | | | | | | | | | | | | | | | 1.) If QBluetoothServer::listen(QBluetoothUuid,QString) fails during service registration we have to ensure that the Server doesn't remain in listening state. 2.) 29de876f55dc96748fdca8dd3fef0c873791796f sets the socket descriptor to -1 when closing the QBluetoothSocket. QBluetothServer treats a value of -1 as error and aborts any call to listen(). This implies that any call to listen() after the first close() would always fail. This patch adds some redundancy and first tries to recreate the socket and only if the re-creation failed exists with an error. 3.) Catch case when user calls listen() on an already listening server. Documentation has been updated to document the behavior. Change-Id: I2df13500e74a9741017f7404f0e0c477c96d5356 Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com>
* Use qt_error_string rather than strerror.Alex Blasche2014-01-301-4/+4
| | | | | Change-Id: Ide3f00cacd7a42e99823441a45609f8e50063fce Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Use QLoggingCategory to categorize the various debug output streamsAlex Blasche2013-12-201-9/+10
| | | | | | | Task-number: QTBUG-32253 Change-Id: I193162407d0fc7eca83689e31f03e1641a494ab0 Reviewed-by: Fabian Bumberger <fbumberger@rim.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Fixing small QBluetoothServer issuesAlex Blasche2013-09-251-0/+1
| | | | | | | | | | -extending documentation -emit error signal when setting a new error Task-number: QTBUG-32669 Change-Id: I16b8a149792ed5068a7bd76af874477084802aea Reviewed-by: Fabian Bumberger <fbumberger@rim.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Error handling for QBluetoothServerFabian Bumberger2013-09-201-6/+22
| | | | | | Task-number: QTBUG-32669 Change-Id: I0f12b19f7989972b7c8305f6e11a95f7f25a281d Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Unify QBluetoothSoket, QBluetoothServer and QBluetoothServiceInfo protocol enumFabian Bumberger2013-09-201-11/+11
| | | | | Change-Id: I6e66196a599e2cceabc7d93d728ba97361d8999f Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Lower the verbosity of bluetoothFabian Bumberger2013-09-181-1/+1
| | | | | | | | | Remove some qDebug statements and change qDebugs to qWarning in case of an error. Task-number: QTBUG-32253 Change-Id: Ia647d3f485cae56cc9f9c6725400f5b4617b7bf7 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Fix compiler warningsAlex Blasche2013-09-101-1/+1
| | | | | | | Change-Id: I5d5eca4af0faa392defcec8ac50c7026eaeba2b1 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com> Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Remove QtBluetooth and QtNfc namespace.Alex Blasche2013-09-091-2/+2
| | | | | | | | This is based on namespace discussions on the Qt project dev mailing list. We continue to use the Qt namespace. Change-Id: I6119d06662f7682c11f42d759f3218be1f5a7d6c Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Merge QRfcommServer and QL2capServer to QBluetoothServerFabian Bumberger2013-08-291-0/+315
Task-number: QTBUG-32722 Change-Id: Ia75ad5af2f81b737a8cca09dba919a7dc0fa0f8a Reviewed-by: Alex Blasche <alexander.blasche@digia.com>