summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothsocket_osx.mm
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/tqtc/lts-5.15.10' into ↵Tarja Sundqvist2023-04-241-2/+0
|\ | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I19a002f2b52eb02d4bfdf32c336811a71d42e9f2
| * Remove QBluetoothSocket::connected double-emit on macOSJuha Vuolle2022-03-211-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The private macOS socket class first calls QBluetoothSocket::setSocketState(Connected) which emits the "connected" signal, and after that call the private class emits another "connected" signal. The latter signal seems extra, causing tst_qbluetoothsocket test to fail when run against a real device. Fixes: QTBUG-101721 Change-Id: Ibf9cddcab65286c5decb920b7998086d18a13e18 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 3282843229e4a2b7945ec707a5a4fa9ccade9ecd)
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.4' into ↵v5.15.4-lts-lgplTarja Sundqvist2022-04-071-3/+2
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I86f7492c32a43094f37cfb9b21ad1066aa49ba68
| * Always call setOpenMode before setSocketStateAndreas Buhr2021-03-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | setSocketState emits signals and should thus be called last. I most code, setOpenMode is called before setSocketState. But in some occasions, setSocketState was called before setOpenMode. This patch introduces a consistent call order: setOpenMode before setSocketState. Change-Id: I07f33511c76fbd08c79050a3fcbc1e1dd72fff04 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 62da7abae76b78fdc9385a0d997f3483057cf37c)
| * Fix bug: Let QBluetoothsocket::close emit disconnected only onceAndreas Buhr2021-03-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QBluetoothSocket::close emitted "disconnected" twice on macOS. The first emit is by setSocketState(UnconnectedState). This patch fixes the behavior to only emit it once. Fixes: QTBUG-91164 Change-Id: I7147a28b40c49db947ee97a4f1a14f319da341d1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 2a6ab855c2a4ffc5253126d53bc667b0076dd9c9) Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Revert "Update commercial license headers"v5.15.3-lts-lgplTarja Sundqvist2021-03-241-20/+20
|/ | | | | | | | | | | This reverts commit 0db3b38521e11147cb802798a2cb7811a96029a9. Revert of commercial license headers is required for Qt 5.15.3 opensource release. Task-number: QTBUG-91108 Change-Id: Ie82dac4e6a4e2e0e1207d17a10c09701871d6875 Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
* Update commercial license headersTarja Sundqvist2021-02-021-20/+20
| | | | | | | | | | | | | | | Updated header.COMM to the files in tqtc-qtconnectivity. Examples, tests or documentation files are not updated. The commercial license header may contain some additional lines so that its line count equals with the earlier license header. Reason for this is that some autotests use hard coded line numbers and a change in the line count causes failures in test. Task-number: QTQAINFRA-4159 Change-Id: Icf450df25282ffadf5bcd0950753d17ba6ab57e3 Reviewed-by: Antti Kokko <antti.kokko@qt.io>
* QBluetoothSocket(macOS) - fix _q_writeNotify's invocationTimur Pocheptsov2019-10-241-1/+1
| | | | | | | After the recent refactoring the writing ability was severed. Change-Id: Ib9f116cdbbbfd87593381cb62675cab4930a2ef1 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* QBluetoothSocket - deduplicate the code (macOS)Timur Pocheptsov2019-07-151-547/+292
| | | | | | | | | | | | Implement the proper interface from QBluetoothSocketBasePrivate, remove a dummy base class. Remove all public API from qbluetoothsocket_osx.mm and re-use the code in qbluetoothsocket.cpp. The code generally is the same, a bit of re-hashin/deletion. Task-number: QTBUG-75348 Change-Id: I0034dfd283daf9d51775d8f9551b85d2d436aa85 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-07-311-7/+9
|\ | | | | | | | | | | | | | | Conflicts: .qmake.conf src/bluetooth/qbluetoothsocket.cpp Change-Id: If622e4915a9c5f6711978ef8c0fa88f4c5084270
| * fix use of default constructed QBluetoothSocketEric Lemanissier2018-07-231-7/+9
| | | | | | | | | | | | | | | | | | | | by checking the service passed to QBluetoothSocket::connectToService, instead of the previous protocol of the socket fixes up 21e7cb1bafdfc06c263e10067d02f9b103ff660f Change-Id: I2aa30cdd618f834e718508c5f492fc211d328565 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Add runtime polymorphism for QBluetoothSocketPrivateAlex Blasche2018-07-251-5/+3
|/ | | | | | | | | | | | | | | | | | | | | | 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>
* Add missing emission of readChannelFinished()Alex Blasche2018-05-041-0/+3
| | | | | | | | | 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>
* Merge remote-tracking branch 'gerrit/5.10' into devAlex Blasche2017-10-171-0/+8
|\ | | | | | | Change-Id: I3bf7130a204aebd6a52dfe68bfea57767ba1b70e
| * Merge remote-tracking branch 'gerrit/5.9' into 5.10v5.10.0-beta3Alex Blasche2017-10-171-0/+8
| |\ | | | | | | | | | Change-Id: I84bfe86751c27eabb4e75912ae3c0b4d3781faf1
| | * IOBluetooth: warn about incorrent thread/runloopTimur Pocheptsov2017-10-111-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IOBluetooth is heavily based on CFRunLoops. An attempt to use it on a thread, that does not properly run CFRunLoop results in callbacks never firing and thus QBluetooth classes never finishing their jobs, including: - device discovery - service discovery - RFCOMM/LCAP2 - Bluetooth server - Bluetooth socket etc. While we cannot fix the core problem until we have a properly working CoreFoundation event dispatcher, we can at least issue a warning so that people do not waste their time debugging this well-known limitation. Task-number: QTBUG-63630 Change-Id: Iefa4d675ea0962167bdfede640d2087dbdf37b18 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | | Replace Q_NULLPTR with nullptrKevin Funk2017-09-291-1/+1
|/ / | | | | | | | | Change-Id: Ica194c2568465a94d851ddeaf62ca71b33fe4464 Reviewed-by: Lars Knoll <lars.knoll@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/+3
|/ | | | | | | | | | [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>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-09-191-4/+24
|\ | | | | | | Change-Id: Ia2ce8bf47d9156c550f5360b1422b50313854338
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-09-161-4/+24
| |\ | | | | | | | | | Change-Id: I3eec9a22565585d4fc40831d609a3083ce99a52c
| | * QBluetoothSocket::connectToService - check a socket type firstTimur Pocheptsov2016-08-261-4/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | QtBluetooth - get rid of outdated Q_FUNC_INFO use patternTimur Pocheptsov2016-06-031-6/+6
|/ / | | | | | | | | | | | | No Q_FUNC_INFO in qCDebug/Warning/Critical needed anymore. Change-Id: I0e47ccc7ffa971b8277b8d742e00319f4acef2f7 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* / 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>
* Add preferredSecurityFlags to QBluetoothSocketAlex Blasche2015-07-031-0/+12
| | | | | | | | | 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>
* Bluetooth socket - fix invalid invokeMethod call on OS XTimur Pocheptsov2015-03-231-1/+1
| | | | | | | | | | While removing hand-written signatures from warnings/errors, the correct name in invokeMethod was accidentally replaced with Q_FUNC_INFO - must be '_q_writeNotify' instead, now fixed. Change-Id: I65225de7cd6e2fdce0cdd8b7c9f09609feb49ae3 Task-number: QTBUG-45177 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* OSX: Minor signal and readability fix for QBluetoothSocketAlex Blasche2015-03-191-5/+3
| | | | | | | | | | | | 1.) QBluetoothSocketPrivate::close() is always called after the socket state has changed to ClosingState. The removed check was meaningless. 2.) Ensure socket is set to NotOpen and ClosingState before we start the socket's abort() process. Change-Id: Idf693be2068f77020113f38612b03565a2a89ca4 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* OSX: Ensure service discovery is stopped when socket disconnectsAlex Blasche2015-03-191-0/+13
| | | | | | Task-number: QTBUG-44930 Change-Id: Iffdbe5d85a0c8b0168d6a196ffbe848e07535950 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Shift all OSX & iOS translations into C++ filev5.5.0-alpha1Alex Blasche2015-03-061-8/+9
| | | | | | | | | | | lupdate cannot parse .mm files. Therefore tr markup must be inside of C++ files. Some error strings where slightly modified to make use of already existing translations for other backends such as Bluez and QNX. Change-Id: I97fe6cfe2227e32fdbc61edd253080a1cd68edc9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-161-22/+14
| | | | | | | | | 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>
* QBluetoothSocket - cleanup (OS X)Timur Pocheptsov2014-12-181-24/+24
| | | | | | | Use Q_FUNC_INFO instead of handwritten 'signatures' in asserts/messages. Change-Id: I639b4293b86120ddc260d3c9e85fd50340afbf60 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QBluetoothSocket - fix open mode on OS XTimur Pocheptsov2014-10-271-0/+2
| | | | | | | | | When a socket created (by server) from a notification (channel) - set d_ptr's openMode (even with a given channel it happens that we receive channel open callback asynchronously). Change-Id: Ia2c461d4146645c661e25245871501012102f541 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* OSX: Set openMode() when the QBluetoothSocket connection is establishedAlex Blasche2014-10-171-15/+18
| | | | | | | Also, set openMode to NotOpen in close/abort and in error handlers. Change-Id: Ia9b9d4896efbc7b4059fb4339ba2dc83cd8d2f8d Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* QBluetoothSocket - bugfix and mods for OS X.Timur Pocheptsov2014-10-011-17/+45
| | | | | | | | | | | - Emit disconnected if a channel was closed by IOBluetooth (== closed externally, not by Qt). - Trick to enable invokeMethod to work with a private class (not parseable by moc). - Fix inclusion guards _OSX_P_H, not _P_H (already in use). - QBluetoothServer - update include + reset a port to 0 in 'close'. Change-Id: Iaa35d6ca3ae1e8013b74d93a238d1afa4292a583 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Port QBluetoothSocket to OS X.Timur Pocheptsov2014-09-261-0/+735
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>