summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothsocket.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Android: Increase chance of establishing serial connection w/o SPP uuidAlex Blasche2019-04-101-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | SDP discovery on Android only returns a flat list of uuids. It mixes service class uuid and service uuids. Furthermore it is unable to detect whether a serial connection uses rfcomm or l2cp as base protocol. The last limitation is the fact that serial sockets can only be established using rfcomm (no l2cp). This poses a serious challenge because there is no way to say whether a given custom service uuid is indeed an SPP based service or whether it uses rfcomm. The only way to know for sure is to connect and check whether it succeeds. This also means QBluetoothServiceInfo instances returned by QBluetoothServiceDiscoveryAgent may or may not mark a serial service with SPP uuid or rfcomm protocol tag. Currently, it guess that that a custom uuid together with SPP uuid implies an rfcomm setup. If the SPP uuid was not found, rfcomm is never set (but is a requirement for QBluetoothSocket). This patch makes QBluetoothSocket on Android a bit more forgiving by assuming every given QBluetoothServiceInfo instance requires rfcomm. After all that's the only supported protocol on Android. Fixes: QTBUG-75035 Change-Id: I498ac5acd2a394b198a113fd23d750bbf17a7f7b Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Add missing dbus registrations and change documentationAlex Blasche2019-01-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | Qt DBus registration for Bluez specific types was done by isBluez5(). However Qt 5.12 introduced bluetoothdVersion() which is a bit more precise. It became necessary because runtime decisions based on exact minor release versions of Bluez became necessary. Therefore some code paths (depending on the user's use case) never called isBluez5() anymore. Subsequently the dbus registrations were missed out on. In the future isBLuez5() should be replaced by bluetoothdVersion(). QBluetoothSocket changed its underlying implementation when addressing QTBUG-68550. It uses dbus sockets to establish rfcomm socket connections to remote devices. The QBluetoothSocket::connectToService() overload that expects a port number is no longer possible as Bluez DBus API does not support connection establishment based on port numbers. Fixes: QTBUG-72742 Change-Id: If6adb391b0524cabc3a702d761e0cbd263508396 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Code cleanup: Use nullptr wherever possibleAlex Blasche2018-08-241-5/+5
| | | | | Change-Id: I7dd2d055c8d667f049d7cb2c371619137bf76030 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Enable new QBluetoothSocket backend for dbus sockets on Bluez 5.46+Alex Blasche2018-08-161-20/+22
| | | | | | | | | | | | | | | | | The API was introduced earlier than 5.46 already but so far it has not been tested. For now we use 5.46. There is another dependency to QLowEnergyController's GATT custom implementation. Custom GATT only works with the QBluetoothSocket raw socket implementation. By setting the minimal version for QBluetoothSocket slightly higher than the 5.42 version for custom gatt, we ensure that the new dbus socket code is never run together with the GATT custom stack. Task-number: QTBUG-68550 Change-Id: I240f7fc8acb116c71e7601df8baf82f61e53c33e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Ensure that QBluetoothServer works with new DBus based socketsAlex Blasche2018-08-161-0/+21
| | | | | | | | | | | | | | | | | | | 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>
* QBluetoothSocket: Move (dis-)connected logic into setSocketStateOliver Wolff2018-08-161-1/+11
| | | | | | | | | | | | Instead of duplicating that logic everywhere, it can be handled in one place. Additionally setOpenMode should be called before setSocketState so that every member variable is changed, before signals are emitted. Change-Id: Ic1d4317ba31046d78d97874ec00c59481a67bb50 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Shift close/abort signaling from QBluetoothSocket to private implementationsAlex Blasche2018-08-091-15/+0
| | | | | | | | | | | | | | | | The private implementation can much more easily determine whether the socket closure is already done or not. On Bluez DBus, this avoids disconnected() being emitted twice. Another platform that is still delayed is Android. The patch permits the removal of Android specific ifdefs. Last but not least the patch cleans up missing signals in WinRT. Task-number: QTBUG-68550 Change-Id: I189e1dbc9f6d410522da1a82113fdf4fe79a4cbd Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Implement QBluetoothSocket Client support for Bluez5 DBusAlex Blasche2018-08-091-1/+5
| | | | | | | | | | The new code is not yet enabled in QBluetoothSocket because the server side implementation is still missing. Task-number: QTBUG-68550 Change-Id: I2f94dac9f7665c8d4ba5d675e91c5ab81af8504a Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Rename qbluetoothsocket_p files to qbluetoothsocket_dummyAlex Blasche2018-07-251-1/+1
| | | | | | | | | The new name fits the class better. Task-number: QTBUG-68550 Change-Id: I7445f48134f8a9fe8b6b6291184f404b3b2faa89 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Lubomir I. Ivanov <neolit123@gmail.com>
* Move QBluetoothSocket::connectToService() to private implementationsAlex Blasche2018-07-251-134/+6
| | | | | | | | | | | This permits each platform to customize the implementations without the need for ifdefs. Upcoming changes such as the BLuez DBuS addition will increase the platform differences. Task-number: QTBUG-68550 Change-Id: I8fc9a74d3ce704466f0bf2c16287e32f222c4376 Reviewed-by: Lubomir I. Ivanov <neolit123@gmail.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Rename QBluetoothSocketBasePrivate::connectToService()Alex Blasche2018-07-251-5/+5
| | | | | | | | | | | | | | | | The goal is to move the various QBluetoothSocket::connectoService() implementations into the private classes. Common parts can be split into QBluetoothSocketBasePrivate and the platform specific code. The code becomes cleaner and has less ifdefs. However this creates a symbol clash with the currently existing private implementation as it has a function with the same signature but different purpose. This rename provides the foundation for future changes. Task-number: QTBUG-68550 Change-Id: I121f08d93e00790c1619c0449629f47bca8a964d Reviewed-by: Lubomir I. Ivanov <neolit123@gmail.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Rename the final interface for the QBluetoothSocketPrivate dummyAlex Blasche2018-07-251-2/+2
| | | | | | | | | | At the same time we reshuffle the inclusion of qbluetoothsocket_p.h in bluetooth.pro based on usage pattern. Task-number: QTBUG-68550 Change-Id: I3ae3f61c65e71a57d238f5c67289720ff63a1b0f Reviewed-by: Lubomir I. Ivanov <neolit123@gmail.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Add QBluetoothSocketPrivate interface for WinRTAlex Blasche2018-07-251-0/+6
| | | | | | Task-number: QTBUG-68550 Change-Id: I14fe43fcbbbdd6950f05feda900643f6899daa24 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Add QBluetoothSocketPrivate interface for AndroidAlex Blasche2018-07-251-0/+6
| | | | | | | Task-number: QTBUG-68550 Change-Id: Iac05cccd4f6e1b44a30568fb9b6c9171204b53fd Reviewed-by: Lubomir I. Ivanov <neolit123@gmail.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Add separate interfaces for QBluetoothSocketPrivate on LinuxAlex Blasche2018-07-251-0/+12
| | | | | | | | | | | | | | | | Uses the new QBluetoothSocketBasePrivate interface to separate the Linux implementations from other platforms. On Linux, there will be the existing raw socket implementation and a BlueZ5 DBus implementation. The DBus implementation is required for very recent Bluez5 deployments (v5.4x+) which restrict access to traditional SDP discovery means like sdptool. For now the DBus implementation is non-existing/dysfunctional. Task-number: QTBUG-68550 Change-Id: Idd248ecdb2a443a95cde521ced929218d40df3fe Reviewed-by: Lubomir I. Ivanov <neolit123@gmail.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Add runtime polymorphism for QBluetoothSocketPrivateAlex Blasche2018-07-251-32/+34
| | | | | | | | | | | | | | | | | | | | | | This patch introduces a generic interface towards QBluetoothSocketPrivate. Later on, the QBluetoothSocketPrivate class will be split into platform specific overloads/interfaces. Ultimately, this will be needed to support runtime selection of the QBluetootSocket d-pointer on Linux. The Linux Bluez5 implementation is significantly different from the Bluez4 (raw socket) implementation. Since recent Bluez5 releases the raw socket implementation is no longer functional and/or the user has to have root permission and enable bluetooth --compat mode. Therefore a second QBluetoothSocket for the dbus socket API is needed. QBLuetoothSocket has to choose at runtime (during its instanciation) which implementation to use. Task-number: QTBUG-68550 Change-Id: I5d0b8e24b8acd1b149b897f52f0d82eade7f3823 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Lubomir I. Ivanov <neolit123@gmail.com>
* QBluetoothSocket - fix info message (IOBluetooth)Timur Pocheptsov2018-07-231-1/+1
| | | | | Change-Id: If84041384b09a73c1da0277fef571f3ac37155e2 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add missing emission of readChannelFinished()Alex Blasche2018-05-041-0/+2
| | | | | | | | | This fixes the problem for all supported platforms. Task-number: QTBUG-67672 Change-Id: I9cecfbe8a73df46070293eba1870ea3bee738b7b Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix shadow warningAlex Blasche2018-03-211-1/+1
| | | | | | | | | qbluetoothsocket.h: In member function 'void QBluetoothSocket::connectToService( const QBluetoothAddress&, QBluetoothUuid::ServiceClassUuid, QIODevice::OpenMode)': qbluetoothsocket.h:111:5: error: declaration of 'openMode' shadows a member of 'this' [-Werror=shadow] Change-Id: Ib9478027799b287430721d99bebee4002a1e5896 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Avoid wrong implicit cast leading to wrong connectToService() callAlex Blasche2018-01-251-0/+8
| | | | | | | | | | | | | | | | Prior to this change passing a QBluetoothUuid::ServiceClassUuid to connectToService() caused the port overload to be called rather than the QBluetoothUuid version. This patch introduces a ServiceClassUuid overload that avoids relying on implicit type conversion. There is a remote chance that this patch breaks existing code if the remote port was in the same range as the ServiceClassUuid range. In general the Bluetooth ports are below 100 though. Task-number: QTBUG-65831 Change-Id: I6574291ae6fee284466d84ecb91f21e3be89f6b2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-201-0/+3
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I6e93fc7435a49b601a5c10519ed86d2a15125074
| * Improve documentation about missing iOS support in QtBluetoothAlex Blasche2018-01-041-0/+3
| | | | | | | | | | | | Task-number: QTBUG-65547 Change-Id: I472b354621db89a921eec01b1459d46dbaa15ac0 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Convert most old-style QObject::connect() to pointer syntaxAlex Blasche2017-11-131-2/+4
|/ | | | | | | | The remaining cases (e.g. in QBluetoothServiceDiscoveryAgent) are connected to Q_PRIVATE_SLOT usage which requires a redesign. Change-Id: I9227b5459b81228a7aa2660193d5b984c036b74f Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Add debug output for QBluetoothSocket::UnsupportedProtocolErrorAlex Blasche2017-07-101-0/+3
| | | | | | | Change-Id: Ia68da10c26ed0baff95a1f696b5a248595d23b1d Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Add error flag for use case when the remote peer closes the connectionAlex Blasche2017-07-101-0/+5
| | | | | | | | | | [ChangeLog][QtBluetooth][QBluetoothSocket] Added QBluetoothSocket::RemoteHostClosedError. Change-Id: Ic9d27f9188f66be0fad309e55f2904eaed2cf61a Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add indirection for QBluetoothSocket::bytesToWrite()Alex Blasche2017-06-291-1/+1
| | | | | | | | | | | | | | | | | | Not all platforms use txbuffer for writes. Fortunately those platforms who do not use it do not use any buffering at all. Hence bytesToWrite() returned the correct value as txbuffer always had size zero. Therefore this patch is effectively a NOP. Nevertheless this patch encourages the right implementation across the platform. This does not affect macOS as it has a separate implementation for QBluetoothSocket::bytesToWrite(). Task-number: QTBUG-58190 Change-Id: Ic05f4358b079f612ee7e0e4dbb7fb9aa78fd6556 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Fix concurrent access to QBluetoothSocket::canReadLine() on AndroidAlex Blasche2017-06-291-1/+1
| | | | | | | | | | | | | | | | | | | | | On Android, the socket's read buffer is managed in the Java thread. QBluetoothSocket::canReadLine() is public API (most likely) being called by in the main Qt thread though. The function directly called into the Java buffer instance without proper locking. This can create race conditions. Starting with this patch canReadLine() calls another QBluetoothSocketPrivate indirection to allow a platform specific implementation. This affects WinRT, BlueZ and the dummy backend too. This is not an issue on macOS as its implementation of QBluetoothSocket is separate and does not have to deal with multiple QBluetoothSocketPrivate implementations. Task-number: QTBUG-58190 Task-number: QTBUG-60830 Change-Id: Idae19f1aee6f809699d36519b01a3c68ad9c563d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* winrt: Add bluetooth socket supportOliver Wolff2017-01-201-3/+24
| | | | | | | Task-number: QTBUG-37779 Change-Id: I7fb49a6870768da956793b0d0681c371da939df9 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-09-161-3/+30
|\ | | | | | | Change-Id: I3eec9a22565585d4fc40831d609a3083ce99a52c
| * QBluetoothSocket::connectToService - check a socket type firstTimur Pocheptsov2016-08-261-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | Attempt to connect to a service using a socket with UnknownProtocol socket type will fail, but can result in an incorrect UnknownSocketError reported and also can start a device discovery (then finally failing to connect after all). Check this condition early before trying to actually connect/do device discovery and report error properly as UnsupportedProtocolError. Task-number: QTBUG-55073 Change-Id: Ib39e1ca7ad401e07d6387201a4664a1185d38d39 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * Doc: Change instances of 'OS X' to 'macOS'Topi Reinio2016-08-161-3/+3
| | | | | | | | | | | | | | | | | | | | As of version 10.12 (Sierra), the name of Apple's desktop operating system will be macOS. Change all occurrences where the platform is discussed to use the macro \macos (defined in the documentation configuration in qtbase). Change-Id: I97f7a0d6d2ca351395bed518f01d4365b986500a Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-05-061-5/+7
|\| | | | | | | | | | | | | Conflicts: examples/nfc/corkboard/corkboard.pro Change-Id: I5d1ea0a8e21a1b55dbf744c2f4b469bc51f05c7a
| * Bluez5: Fix serial service discovery inside QBluetoothSocketAlex Blasche2016-04-291-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QBluetoothSocket::connectToService() performs its own service discovery if the remote RFCOMM channel is not known. This may happen if the passed in BluetothServiceInfo object was obtained via a minimal service discovery (which does not perform a channel discovery) or if the connectToService(const QBluetoothAddress &address, const QBluetoothUuid &uuid, OpenMode openMode = ReadWrite); overload was called. This was not an issue with Bluez4 as every type of discovery provided the RFCOMM channel id. The internal discovery required at least the service's ServiceId to be known. However a lot of SerialPort profiles do not set a custom service uuid as ServiceId nor do they set the SerialPort UUID as ServiceId. Often they provide the SerialPort uuid via the ServiceClassIds only. This patch ensures that the internal service discovery is started if the ServiceId is known or if the ServiceClassIds contains the SerialPort uuid. Furthermore the internal discovery did not apply the complete uuid filter. If a ServiceClassId was added then the ServiceId was discarded which could lead to services not being found. Task-number: QTBUG-47593 Change-Id: Ia6e52d1a9def0f770080fd70e2b6deb40e69fa69 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Updated license headersAntti Kokko2016-01-201-15/+21
|/ | | | | | | | | | 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>
* Add comment that QBluetoothSocket only supports asynch read/writeAlex Blasche2015-11-021-0/+3
| | | | | | Task-number: QTBUG-38916 Change-Id: Ibd425ca24a1a98433f7b9d8b1fa11a7c287de871 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* QBluetoothSocket's securityFlag exists since Qt 5.6 and not 5.5Alex Blasche2015-09-151-2/+2
| | | | | Change-Id: I13c7ec6b588280f01ce13699199177c45040645e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* Add preferredSecurityFlags to QBluetoothSocketAlex Blasche2015-07-031-0/+54
| | | | | | | | | 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>
* Remove QNX/BlackBerry implementation for QtBluetoothAlex Blasche2015-06-171-11/+10
| | | | | | | | | [ChangeLog][QtBluetooth][Platform Specific Changes] Removed support for Blackberry 10. Change-Id: I431c4f34bb10aa3668542df7a8b3403b61bf4705 Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Merge branch '5.4' into 5.5Alex Blasche2015-04-011-0/+14
|\ | | | | | | Change-Id: I177affc6c60fd3cc55e914a7ea2a9aeba260906f
| * Fix crash in QBluetoothServiceDiscoveryAgent on Bluez 5.xAlex Blasche2015-03-231-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The list of internally discovered devices was already cleared. It should not be referenced anymore. Furthermore the QBluetoothSocket is killed while its internal QBluetoothServiceDiscoveryAgent is still running. This change stops the agent as well and thereby prevents more QBluetoothSocket slots froms being invoked and a more controlled termination of QBluetoothServiceDiscoveryAgent. [ChangeLog][QtBluetooth][Android] Fixed crash in QBluetoothServiceDiscoveryAgent on Bluez 5 when using single device discovery. Single device discovery is used during QBluetoothSocket::connectToService(). Task-number: QTBUG-44930 Change-Id: Ib3129c492151a3fe12b0c451cf5ffdddc62d001c 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>
* | Merge remote-tracking branch 'gerrit/5.4' into HEADAlex Blasche2014-10-161-5/+14
|\| | | | | | | Change-Id: Ic6549b3d728fbc9ad2425d0d6902aeac8c81e6be
| * Fix QBluetoothSocket::isReadable()/isOpen()/isWritable()Alex Blasche2014-10-131-5/+5
| | | | | | | | | | | | | | Change-Id: Ifd6b5ed8176aa7959ed8da0edc762266aa2bd6fa Task-number: QTBUG-32704 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
| * Improve QBluetoothSocket::close() documentationAlex Blasche2014-10-101-0/+9
| | | | | | | | | | | | | | | | | | | | The disconnected() and stateChanged() signals are delayed which may easily overlooked by API users. This change specifically points out this behavior difference. Change-Id: I3a9e9c656da50c9efe455cd2dbf903a2849e36da Task-number: QTBUG-41770 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
* | Merge branch '5.4' into btleAlex Blasche2014-10-011-0/+9
|\| | | | | | | Change-Id: I3c00855a33c1015d159a67e5548fd29164668929
| * Don't permit write of non-existing or empty data via socketAlex Blasche2014-09-261-0/+7
| | | | | | | | | | | | Change-Id: Ic8387dd411a9784b6163a15d423cdeaa5e63ea30 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
| * Add \since to all Qt Bluetooth classes which didn't have the tag yetAlex Blasche2014-09-261-0/+2
| | | | | | | | | | | | Change-Id: I50d818294cb53962bca2b08edbfdc4558890777c Task-number: QTBUG-36775 Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
* | Port QBluetoothSocket to OS X.Timur Pocheptsov2014-09-261-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement QBluetoothSocket using IOBluetooth framework on OS X (will implement Qt's API as close as possible with a given Apple's API). Update 0: add (empty for now) delegate classes (L2CAP/RFCOMM). Update 1: add service discovery (called doDeviceDiscovery though). Update 2: implement the public class' logic (QBluetoothSocket, connectToService). Update 3: more public logic implemented (since it's easy :) ) Update 4: L2CAP delegate - initial logic. Update 5: connectToService - L2CAP "socket". Update 6: fix pivate header files. Update 7: fix dependency after the previous patch was merged. Update 8: writeData - initial version for L2CAP. Update 9: since RFCOM/L2CAP delegates have the same interface, no need in duplicating the same class - add a "generic" ChannelDelegate instead. Update 10: more RFCOMM logic. Update 11: function to build a service description from QBluetoothServiceInfo (to be registered on SDP server). Update 12: QBluetoothSocket::close/abort. Update 13: Create a dictioinary out of QBluetoothServiceInfo to register a service. Update 14: Add service registration. Update 15: Convert attributes (sequences and 'scalars') from QBluetoothServiceInfor into NSDictionary. Update 16: Update QBluetoothServiceInfo with a real PSM/ChannelID after a service was registered. Update 17: Move a private class (bluetooth socket) into the separate private header file (to make it visible for bluetooth_server_osx) Update 18: Add an interface to create a bluetooth socket (private class) from a channel, reported by a notification (found by a listening server). Update 19: Fix an invalid assert - any state (Inactive/ServiceDiscovery/DeviceDiscovery) is possible, not only Inactive. Implement the missing 'readData' and 'writeData' for RFCOMM. Set SDP query as non-active after query finished. Temporary (!) workaround - can not invokeMethod on a private socket (d_ptr). Update 20: When creating a socket wrapper from an incoming notification/channel, set: socket type + channel's delegate. Change-Id: Idd6d5478597206ed759f49e282baed948d105ddf Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-08-281-1/+3
|\ | | | | | | | | | | | | Conflicts: src/bluetooth/qbluetoothdevicediscoveryagent_p.cpp Change-Id: Ie8bf1903f9c7c1ccd5b05a3f97049ae0882b88b8
| * Fix L2CP socket connectionsv5.3.2Alex Blasche2014-08-271-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | L2CP's psm (the RFCOMM port equivalent) was never published via SDP. Therefore the service client could not get the required information to connect to the server. After this patch Qt properly publishes the psm. Also, QBluetoothSocket::connect() initiated a service discovery to obtain the missing psm. Since the published SDP entry didn't contain one, protocolServiceMultiplexer() always returned 0 and another service discovery was initiated. This caused a crash inside QBluetoothSocket because the 1st QBluetoothServiceDiscoveryAgent instance was deleted in favor of the 2nd. The patch changes the client behavior such that it doesn't crash if the service discovery didn't turn up a valid psm/port. It improves the robustness in case of an error and avoids a second service discovery (which wouldn't turn up more information anyway). The bug only affected Bluez as it is the only platform supporting pure L2CP sockets. Last but not least a capability to test L2CP sockets was added to bttestui. Change-Id: I46c88a67c2baa4782ea908e645dcd4db9422dbba Reviewed-by: Fabian Bumberger <fbumberger@rim.com>