summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothsocket_bluez.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'gerrit/dev' into neardAlex Blasche2016-01-261-14/+20
|\ | | | | | | Change-Id: If9cf6718cbd619dd7ce38db2da274fe9d0a41fb7
| * 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>
* | QBluetoothSocket: Do not report an error when the connection closes.Christian Kandeler2015-11-171-2/+2
|/ | | | | | | | Higher-level code should decide whether a remote device disconnecting constitutes an error or not. Change-Id: I50d7524d2684dbbbfc8df5667e227748fb31cee4 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Bluetooth socket: Simplify address conversion.Christian Kandeler2015-10-151-22/+10
| | | | | | | | In most cases, callers of convertAddress() feed the result into a QBluetoothAddress, so they have no need for the output parameter. Change-Id: I23b2e8d5d49ac300c35d141b75ffa8e398e22f19 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* [Bluetooth] Optimize loopsKonstantin Ritt2015-09-161-6/+10
| | | | | | | | | | | | Decrease complexity from O(N+N*logN) to just O(N) for cases like foreach (Key key, map.keys()) Value value = map.value(key); , by rewriting with use of iterators. Change-Id: I81f1334797f16b624293fcebdee885b2be3c89f1 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* bluez: peername: find a device before creating it.Robin Burchell2015-08-201-3/+3
| | | | | | | | | | | | | | | | To enable reading peername for known devices even if org.bluez.Adapter.CreateDevice has security restrictions, call org.bluez.Adapter.FindDevice first and CreateDevice only if the device isn't already known. The change is needed due to runtime security checks on Jolla devices, but reordering the calls does no harm when used with upstream bluetoothd. Change-Id: I4a86840487a8b4c90759044b7c995815c77a7609 Task-number: MER#1225 Done-by: Hannu Mallat <hannu.mallat@jollamobile.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Bluez: Apply QBluetoothSocket::preferredSecurityFlags during connectAlex Blasche2015-07-071-0/+21
| | | | | | | | | | | | | This permits Bluez clients to determine the security level before connecting to the server. Note that the server may change the sec level at runtime without the user noticing. If the user wants to detect such cases socketDescriptor() in compination with getsockopt() should be used. Task-number: QTBUG-46377 Change-Id: I3bc4fcd62dc44d9e2e14e5a6e7416e3bb8e0d50b Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Add preferredSecurityFlags to QBluetoothSocketAlex Blasche2015-07-031-0/+1
| | | | | | | | | This permits the API user to determine the security parameters for the connect attempt to the remote SPP service. Task-number: QTBUG-46377 Change-Id: I1ed5ea0f5a32aa08dcedc46a34b0377654e420b2 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Merge branch '5.4' into 5.5Alex Blasche2015-04-011-12/+2
|\ | | | | | | Change-Id: I177affc6c60fd3cc55e914a7ea2a9aeba260906f
| * Minor code optimizationAlex Blasche2015-03-191-12/+2
| | | | | | | | | | | | | | | | | | QBluetoothSocketPrivate::close() was always called when the internal socket state has been set to ClosingState. The removed checks were meaningless. Change-Id: Ia36808a21de7dd1076cdd47bca8fd6855ec957c3 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.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>
* Fix QBluetoothSocket::isReadable()/isOpen()/isWritable()Alex Blasche2014-10-131-1/+1
| | | | | | | Change-Id: Ifd6b5ed8176aa7959ed8da0edc762266aa2bd6fa Task-number: QTBUG-32704 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Add support for random vs public remote address connectionsAlex Blasche2014-09-021-3/+3
| | | | | | | | | | | | | | | | This is required to be able to connect to devices which use random device addresses. Some platforms can determine this flag based on their last device scan. The flag is likely to be provided as part of QBluetoothDeviceInfo once the information is available. Unfortunately non-le scan on BLuez doesn't inform about the flag. The LE device scan is currently not implemented and, even worse, requires root privileges on Linux. The new API element permits the selection of the correct type when the scan doesn't detect the type properly. Change-Id: I8e7118658a7c927e0ea07b0d639d57f9483cb33c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix failing L2CP socket's on high-endian systemsAlex Blasche2014-09-021-2/+2
| | | | | | | | Bluetooth byte order is little endian. htbos ensures the psm is converted to the required byte order. Change-Id: I22362d1f1fe3978df7855eab14154644a1d60a0d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make QBluetoothSocket's _q_writeNotify & _q_readNotify privateAlex Blasche2014-08-251-7/+5
| | | | | | | | | These two functions are really only needed by Linux style socket code. There is no need for other platforms to implement them as dummy too. It simplifies the code somewhat. Change-Id: I3e0aced8d9f7b590d1c6aaa60f97bd060ee8f4b4 Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com>
* 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>
* Merge remote-tracking branch 'gerrit/5.4' into btleAlex Blasche2014-08-131-4/+1
|\ | | | | | | Change-Id: I1e79c96602d0da2c2d36d6217bdfe7ff183e6df9
| * Merge branch '5.3' into devAlex Blasche2014-07-171-4/+1
| |\ | | | | | | | | | | | | | | | | | | | | | Conflicts: src/bluetooth/bluez/bluez.pri src/bluetooth/qbluetoothsocket_bluez.cpp Change-Id: Ieca8f2a327bf54b42403ddab88f8b9c3ff6b4a95
| | * Reduce system header dependenciesAlex Blasche2014-07-161-3/+1
| | | | | | | | | | | | | | | Change-Id: I52ac33b4864d6bfca248ff3fad5a069154a9c756 Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* | | Bind the BTLE socket to the local Bt deviceAlex Blasche2014-07-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This seems to be optional for Bluez4 but mandatory for Bluez5 to establish a connection at all. Change-Id: Ia99b6e6623fc63f3d0abe37a87808a59cbd889f1 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* | | Merge branch 'dev' into btleAlex Blasche2014-07-031-1/+1
|\| | | | | | | | | | | | | | | | | | | | Conflicts: src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp Change-Id: Ib960b9e8d8800af84d2094bdf26c2652d4c81dba
| * | Remove usage of QObject::tr() in qbluetoothsocket_bluez.cpp.Friedemann Kleint2014-06-301-1/+1
| | | | | | | | | | | | | | | Change-Id: I72703aac0676e6474f2c40ac37b8ee8b00830690 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | | Provide guarding against non-BTLE enabled versions of BluezAlex Blasche2014-06-161-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This disables the gatttool based controller as well. While it might compile on older systems they are likely to not have a gatttool and why would a Bluez version without BTLE symbols ever work anyway. Change-Id: I761e482d3dd1e99008c5d170053e19a1a3a51e6c Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* | | Discover all Bluetooth services and their handlesAlex Blasche2014-06-161-1/+3
| | | | | | | | | | | | | | | Change-Id: I83d88412319c34cf6c8cf0c6e841458226c9d073 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* | | Connect to BTLE deviceAlex Blasche2014-06-161-2/+11
|/ / | | | | | | | | | | Change-Id: Iaae61b6a872124d17855d80d106f2b10996501de Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | Port QBluetoothSocket/QBluetoothServer to Bluez 5Alex Blasche2014-05-261-40/+50
| | | | | | | | | | | | Task-number: QTBUG-32085 Change-Id: I9fe63f3291a10a195d460720cd1821913a63b25b Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com>
* | Utilize QStringLiteral where possibleAlex Blasche2014-05-151-8/+8
|/ | | | | | | | The only exception are generated files and cases where QLatin1String based overloads are used (e.g. during QString comparisons) Change-Id: I6f36789fb8acb3b30c1dc1f8a920b118a979d74f Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Fix a crash in QBluetoothSocket on reconnection attempt (BlueZ)Oleg Shparber2014-04-161-0/+6
| | | | | | | | | Ensure a native socket is obtained after QBluetoothSocket has been closed. [ChangeLog][QtBluetooth][QBluetoothSocket] Fixed a crash on reconnect. Change-Id: I9f470d23366250dc20ad3305ddec16300c1ad8ec Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Fix internal buffer corruption in QBluetoothSocket (BlueZ)Oleg Shparber2014-04-161-2/+1
| | | | | | | | | When _q_readNotify() is called and no data is available (e.g. in case of timeout), then the internal buffer grows indefinitely, causing a one time corruption of the following good data. Change-Id: I75929382db73953bbccdd86b9ae248329df879fa Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Refactor disconnection signals emittance in QBluetoothSocketOleg Shparber2014-04-151-15/+1
| | | | | | | | | | | This fixes duplicate switching to the unconnected state in case the disconnect() signal is used to reconnect. [ChangeLog][QtBluetooth][QBluetoothSocket] Fixed duplicate emission of unconnected state in the reconnection case. Change-Id: If449420d936c96e62518fc408e6a1e35b79988a8 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Fix a few TODOs around the source code and remove obsolete onesAlex Blasche2014-03-131-1/+2
| | | | | | Change-Id: I01e867cb5efb231e7c85b0d106897b2f31448977 Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Utilize new QBluetoothSocket::OperationError on QNX and BluezAlex Blasche2014-02-271-2/+17
| | | | | | | | Task-number: QTBUG-36817 Change-Id: I17f7d57537f7f1a5cedd01ce6043cfd6aac26db4 Reviewed-by: Nedim Hadzic <nedimhadzija@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Remove QBluetoothSocketPrivate::socketDescriptor()Alex Blasche2014-02-261-5/+0
| | | | | | | | | The function is not required as the public accessor function directly returns the socket descriptor. Change-Id: I6d64bec7b4f0542ce213dc90dcfe30c3885ed21d Reviewed-by: Nedim Hadzic <nedimhadzija@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Adjust strings for translationAlex Blasche2014-02-131-2/+2
| | | | | | | | This includes unification of error messages, fixes for spelling mistakes, hints for translators and other forms of simplifications. Change-Id: Idd0e01614b24ff2d19133f0d19d49649d59e3f57 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Merge remote-tracking branch 'gerrit/stable' into devAlex Blasche2014-02-031-25/+17
|\ | | | | | | | | | | | | Conflicts: src/bluetooth/qbluetoothservicediscoveryagent.cpp Change-Id: I52831fc8c69062e90c003836fd9402f19d6a0ba5
| * Use qt_error_string rather than strerror.Alex Blasche2014-01-301-3/+3
| | | | | | | | | | Change-Id: Ide3f00cacd7a42e99823441a45609f8e50063fce Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
| * Synchronize setting of QBluetoothSocket's error string, code and signalAlex Blasche2014-01-301-7/+7
| | | | | | | | | | | | | | | | | | | | | | This fixes a few cases where errorString, error signal and error code where out of sync because one was set but not the other. This was addressed by unifying the usage pattern for error activation to a pattern where errorString is set and setSocketError() is called afterwards. Change-Id: Ibfb04772cf560936aa4ce8ea9643d6a410cc9ee2 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
| * Don't cache the QBluetoothSocket::localName() & peerName()Alex Blasche2014-01-291-12/+2
| | | | | | | | | | | | | | | | | | | | | | | | This affects Bluez only. The other platforms don't use this feature. The problem was triggered when connecting, disconnecting and connecting again to another device. localName() might change due to a different local Bluetooth adapter being used and peerName() is different anyway in such cases. Change-Id: I8983a355832cf4f4d9a654971c54f5624be288e6 Reviewed-by: Fabian Bumberger <fbumberger@rim.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
| * Initialize QBluetoothSocket::socketError properly.Alex Blasche2014-01-281-0/+1
| | | | | | | | | | | | | | | | | | So far the initial value is compiler dependent. In most cases this meant it was set to 0. However 0 is not even a valid QBluetoothSocket::SocketError enum value. The NoSocketError value is -2. Change-Id: Ieee4f7bd1c97d758295f4d0cc1297f62c114f4f3 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
| * Fix crash in Bluez implementation for QBluetoothSocketAlex Blasche2014-01-281-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | The internal socket was closed but not reset to -1 after calling close() or abort(). As a consequence the subsequent connect() call crashed since internal socket notifier were invalid [ChangeLog][QtBluetooth][QBluetoothSocket] Fixed a crash in Bluez part of QBluetoothSocket() which was caused when triggered when calling the sequence connect() - abort() - connect(). Change-Id: I21b779c7808d0a5211df9e2481da28e2e9753ca9 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
| * Fix broken SDP discovery on QBluetoothSocketAlex Blasche2014-01-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ThHis is only used on Bluez at this stage. THe SDP agent was initialized with the local adapter being the remote address of the remote service. This could never work. The remote address is now properly set (being the handed over bt address to QBluetoothSocket::connectToService()). [ChangeLog][QtBluetooth][QtBluetoothSocket] Fixed incorrect invocation of QBluetoothDiscoveryAgent where the remote service address was incorrectly assumed to be the local Bt adapter address. This prevented the detection of the remote service. This bug only affects the Bluez backend. Change-Id: Ice2b9c351bfd42f1f4398b14ac68f76315f01fa8 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* | whitespace fixesOswald Buddenhagen2014-01-201-4/+4
|/ | | | | | | remove trailing whitespace, expand tab Change-Id: I3361c6c431231c7463bb1dc9b53268935b22a72b Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Use QLoggingCategory to categorize the various debug output streamsAlex Blasche2013-12-201-2/+5
| | | | | | | Task-number: QTBUG-32253 Change-Id: I193162407d0fc7eca83689e31f03e1641a494ab0 Reviewed-by: Fabian Bumberger <fbumberger@rim.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Fix peer to peer communication using two local adapters.Alex Blasche2013-09-251-4/+5
| | | | | | | | | | | | The code assumed to use the default adapter in a variety of places which caused wrong SDP registrations, device searches and peer names. The btchat examples was extended to cope with two local adapters. If there are more than two local adapters they will be ignored. Change-Id: I27d8bce65d943773e4e6cbd86982446fa79664a4 Reviewed-by: Fabian Bumberger <fbumberger@rim.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Unify QBluetoothSoket, QBluetoothServer and QBluetoothServiceInfo protocol enumFabian Bumberger2013-09-201-17/+17
| | | | | 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>
* 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>
* Update Copyright headersAlex Blasche2013-06-251-1/+1
| | | | | | | | | - Update Digia's copyright year - Add copyright to files without it - Convert old BSD to new LGPL license for auto test code Change-Id: I47f5c871c436f9c2731b235026434448719cc671 Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Rename NFC and Bluetooth namespace macros.Aaron McCarthy2013-02-141-2/+2
| | | | | | | | Renamed to the namespace macros to follow what syncqt expects. This fixes missing namespace macro warnings printed by syncqt. Change-Id: I7be5a700e8435a559cb4c2e74938851233095887 Reviewed-by: Lorn Potter <lorn.potter@jollamobile.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-231-24/+24
| | | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: I4f07028d0bf0b3ba4c4649897b80687ea5e51abc Reviewed-by: Janne Anttila <janne.anttila@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>