summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Update Bluetooth docs to mention Win32 backendwip/winAndre de la Rocha2019-08-173-7/+21
| | | | | | | | | This change updates the Bluetooth documentation to reflect the addition of the native Win32 backend. Task-number: QTBUG-40698 Change-Id: I8d2bc2146527a17f1f47fff541730b94f58286fb Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/dev' into wip/winOliver Wolff2019-08-0794-4282/+3576
|\ | | | | | | Change-Id: I83175151c0eef1a11d2f21648cc04c86e46777c1
| * Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-183-2/+4
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/bluetooth/qlowenergycontroller_darwin.mm src/bluetooth/qbluetoothdevicediscoveryagent_ios.mm The latter was auto-resolved by keeping, but is in fact removed on dev, so reremoved. Change-Id: Ifa47f61836450d59ea8e47a92b84f57ab06863f7
| | * Merge "Merge remote-tracking branch 'origin/5.12' into 5.13"Qt Forward Merge Bot2019-07-113-8/+8
| | |\
| | | * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-07-113-8/+8
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I48ae70ffcb475ced4a05619310f496527cdd4166
| | | | * Core/IO/Bluetooth - fix ambiguous conversionsTimur Pocheptsov2019-07-053-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... somewhat prospective fix (I do not have the new iOS yet), so far build never failed with my current SDK. Fixes: QTBUG-76847 Change-Id: Iab75c3cd47144cd83b679b1dbf82339e29c07bd1 Reviewed-by: André Klitzing <aklitzing@gmail.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| | * | | Doc: Replace example file lists with links to code.qt.ioTopi Reinio2019-07-092-0/+2
| | |/ / | | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-74391 Change-Id: I4e66d50a4b98a728956e351d1603e26933dd02c7 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
| * | | Service discovery agent - remove the public API implementation (macOS)Timur Pocheptsov2019-07-156-402/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead, use the shared implementation (and the declaration from the *_p.h) Fixes: QTBUG-75348 Change-Id: Icbcbb752df1a9b8865ea4f4ef06f2b59dda577cd Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
| * | | QBluetoothServiceInfo - remove the code-duplicate (macOS)Timur Pocheptsov2019-07-154-321/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-75348 Change-Id: I5e2e08291cd17c1f1ef8639d422f4421520ed371 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * | | QBluetoothSocket - deduplicate the code (macOS)Timur Pocheptsov2019-07-1514-773/+367
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | | LE/OSX: better use of recently introduced AuthorizationErrorKonstantin Ritt2019-07-081-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | handle and GATT_INSUFFICIENT_AUTHENTICATION and GATT_INSUFFICIENT_ENCRYPTION statuses explicitly to close the established connection with AuthorizationError Change-Id: I6077d2b4e90daaac527fff7145bc71d7a4e032a3 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * | | LE/Android: better use of recently introduced AuthorizationErrorKonstantin Ritt2019-07-081-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when Android receives GATT_INSUFFICIENT_AUTHORIZATION or GATT_INSUFFICIENT_ENCRYPTION, it breaks connection with fair reason GATT_CONN_TERMINATE_LOCAL_HOST, which shadows the original GATT_INSUFFICIENT_ENCRYPTION from the user. As we didn't see Android closing connection with GATT_CONN_TERMINATE_LOCAL_HOST in cases other than described above, naively treat it like AuthorizationError Change-Id: I43a19c9eaf793a595765850938d757a09324a545 Reviewed-by: Evgeniy Gagarin <eeiaao@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * | | QLowEnergyController: Introduce AuthorizationErrorKonstantin Ritt2019-07-053-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | intended to distinguish an arbitrary disconnection from disconnection due to insufficient authorization/encryption Change-Id: Ifcf73d0444fe6fd3a8d5d90155f3db572d6e23d1 Reviewed-by: Evgeniy Gagarin <eeiaao@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * | | QBluetoothServer - cleanup and de-duplicate codeTimur Pocheptsov2019-07-058-315/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some code can be re-used from the shared public implementation. *_osx_p.h is not needed either. Task-number: QTBUG-75348 Change-Id: If373b74edebe9a9db90e820016cf779a1726baed Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-06-296-33/+111
| |\| | | | | | | | | | | | | | Change-Id: I13eb1c8ad1e507e0dc2e70404fcf383dc2bacdd9
| | * | winrt: Add service thread loggingOliver Wolff2019-06-183-1/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can run into problems if the list of low energy services is changed from threads other than the main thread. Make it possible to log this information in order to debug these problems more easily. Task-number: QTBUG-75907 Change-Id: Icda8dff45b8c1a72291ade0b1d6f734ab485a241 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | * | winrt: Avoid threading issues when handling characteristic changesOliver Wolff2019-06-244-14/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As callbacks do not necessarily happen on Qt's main thread, it is possible that we access the service list while it is being changed if we access it from the callback directly. Doing this can cause application crashes. Thus we hand back the information about a changed characteristic to the main thread via signal/slot and handle it from the main thread. With QLowEnergyControllerPrivateWinRTNew having the Q_OBJECT macro, we can no longer use forward declares for the GATT classes as moc chokes on these. Thus an include is used. Fixes: QTBUG-75907 Change-Id: I063794eecf904921ff55fab76a5bdde3a9aebf44 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | * | qbluetoothsocket_winrt: Fix clang warningsOliver Wolff2019-06-181-18/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I71eafba9e7ff47dbfd89e3a650b83b55d1196693 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * | | Eradicate Java-style iterators and mark the module free of themMarc Mutz2019-06-183-13/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Java-style iterators are scheduled for deprecation, or at the very least banned from use in Qt code. Change-Id: If50aade7e5a57f247ec8c0e77103dfd2d2160c3c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-06-226-226/+567
| |\| | | | | | | | | | | | | | Change-Id: Iad2cfc593f6a9d3b554a2d4f7c16d6173071f7c8
| | * | qlowenergycontroller_winrt_new_p.h: Use forward declarations instead of ↵Oliver Wolff2019-04-252-4/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | includes when possible Change-Id: Ic995631dfc15e34c7f2902bfa850c97671c52367 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | * | winrt: Try "connectToDevice" indefinitelyOliver Wolff2019-05-132-103/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | connectToDevice should not fail after a timeout, but try to connect to the device indefinitely. Unfortunately the behavior depends on the device's pairing status so two connectToDevice functions are needed. But the current implementations potentially wait indefinitely until the connection can be established. Change-Id: Iacb81e2c995974020b14d297528e54c326eb0453 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | * | qlowenergycontroller_winrt_new: Avoid late callbacks that lead to crashesOliver Wolff2019-04-252-83/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Users may run into crashes on device disconnects in case that we run into a callback while the disconnects happen. Thus we have to avoid calling functions on deleted objects by avoiding lambdas if possible or using QPointers in lambda captures. Change-Id: Idcd3781bd396d4ef785191e4c65bae20e5149c04 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | * | qlowenergycontroller_winrt_new: Add registerStatusChanges and onStatusChange ↵Oliver Wolff2019-05-092-29/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | functions In preparation for following patches, functionality related to status changes was moved into dedicated functions. That makes code more readable and avoids late callbacks which can happen when lambdas are used. Change-Id: Ie699adef238013bb5391b57a1794e0b3d6bf8312 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | * | winrt: Add QBluetoothLocalDevice::pairingStatusOliver Wolff2019-06-182-3/+95
| | | | | | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-62294 Change-Id: I61ee7dc30996c8e12c0fa75f7c85931a61c12554 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | * | Create qbluetoothlocaldevice_winrtOliver Wolff2019-06-184-15/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In preparation for the followup patches. Change-Id: I9b1f6c181adb847f6aafdaf60fcef7139a12b638 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * | | LE controller/service remove code duplication (Darwin)Timur Pocheptsov2019-06-1711-1052/+437
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make our private controller class to inherit the shared base as other platforms do. Rename it into PrivateDarwin. Remove QLowEnergyController's code duplicate on Darwin. Get rid of Darwin's copy of QLowEnergyService. As a bonus, a number of bugs/inconsistencies were fixed in setting the state and not emitting stateChanged. Reduced the usage of 'isValid'. Task-number: QTBUG-75348 Change-Id: I77495870597b61fecae8bca1617590fd9ad2def4 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * | | De-duplicate device discovery code (Darwin)Timur Pocheptsov2019-06-1410-764/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - use the shared *._p.h file/class declaration for the private class - use the shared *.cpp with the public class implementation - get rid of *_ios.mm - iOS/tvOS/watchOS specific implementation and use the shared (by macOS, iOS, tvOS, watchOS) *_darwin.mm source. - get rid of somewhat weird 'isValid' in the private class, it is is not taken care of in the public API anyway and today its whole concept/usage looks (quite) buggy to me. I only have to check that the default controller is not nil and has the state 'ON'. Task-number: QTBUG-75348 Change-Id: I5383e4f8df02ac12f069c2f59e252cb8a200800b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * | | Convert uses of QTime as a timer to QElapsedTimerEdward Welbourne2019-06-121-2/+2
| | | | | | | | | | | | | | | | | | | | Change-Id: I9d59d4bbf5d17c7b45fb04d5cb131c7f44e4c3ae Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-06-036-17/+102
| |\| | | | | | | | | | | | | | Change-Id: I3996d42b34d1a0b3534d5673694914c97c4e8d8d
| | * | winrt: Make sure that ProtocolDescriptorList is always set for servicesOliver Wolff2019-05-271-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For some devices the attribute map does not have a protocol descriptor set which throws off Qt's logic. As Windows can only discover RFCOMM services, we can just add that protocol to the service ourselves if it is not found automatically. Task-number: QTBUG-62520 Change-Id: I6ce3948892699049b678b026840d346879b98269 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | * | qbluetoothsocket_winrt: Use recommended service connection approach if possibleOliver Wolff2019-05-274-17/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MSDN documentation states that the recommended way of RFCOMM service connection is via connectionHostName and connectionServiceName (see https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.rfcomm.rfcommdeviceservice). So whenever possible, we should use this information from the native device service when connecting directly to the discovered service. As QBluetoothServiceInfo is basically just a wrapper for the attributes map this information is stored in its private pendant and extracted when a connection attempt is being made. Task-number: QTBUG-62520 Change-Id: I95be5df89a722531393b45fd136d37f302393ca8 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-05-262-0/+11
| | |\| | | | | | | | | | | | | Change-Id: I0d7c92be8609cb7ec46b1895e1f270678ad681ae
| | | * BlueZ: Fix leaking client socket when running QLEController Peripheral modeAlex Blasche2019-05-082-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In fact there are two socket leaks. The first is the socket for the incoming l2cp connection from the central device and the second one is allocated in the ctor of QBluetoothSocket. When QBluetoothSocket::setSocketDescriptor is called the previously ctor allocated socket was simply ignorred. This patch closes both socket. Fixes: QTBUG-75278 Change-Id: Ia483e3c2a04bec3a53ddf744c22b794941edf848 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
| * | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-05-141-1/+2
| |\| | | | | | | | | | | | | | Change-Id: I77de4f58db88f827b006d1e6501b3a1a836347bc
| | * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-05-111-1/+2
| | |\| | | | | | | | | | | | | Change-Id: Ieb05b1eb0fa8247726f5f5de771496a9b50b9f55
| | | * Bluetooth: Compare the server channel when checking for duplicatesAndy Shaw2019-05-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is possible that the service will appear to be the same but have different server channels. So these services should not be seen as duplicates as a result. Change-Id: I36f9c376fcfd9378f4f18c639e87e1a7aad1815b Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
| * | | IO/CoreBluetooth - refactor the code a bitTimur Pocheptsov2019-05-086-3/+474
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... to simplify future code de-duplication. In this patch we: - For simplicity move all C++ delegate classes into their own header. Since we have to hide Objective-C from C++ compiler (while compiling *.cpp files), these updated delegates have to use void * instead of Objective-C classes. - Introduce a new RAII classes, that work with Objective-C instances but have a header that can be included into the *.cpp files, thus making it possible to share *_p.h files with all back-ends. I'm also switching to a new naming convention, which will later propagate to the pre-existing code - given files are already in a sub-directory 'osx', having a prefix 'osxbt' in a name is excessive. Now it's becoming 'bt' (include "osx/btsomething.h"). Later 'osx' dir is to be renamed into 'darwin', which is what it is these days. Namespace OSXBluetooth is to become DarwinBluetooth. Task-number: QTBUG-75348 Change-Id: Iebaeab7d0c5e672efebab8218debdec761353633 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * | | Remove usage of deprecated QBluetoothServiceInfo::DataCompleteAlex Blasche2019-05-072-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The related functions were deprecated by fac56a229b45395488f3e41bf178361c72b3ee1e. Change-Id: Ia94b1824bb6ea7d1a8e3bb8eb5e82074e9facb7a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * | | Remove use of deprecated btle device scan API on AndroidAlex Blasche2019-05-032-15/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new API requires Android SDK v21 or higher and Qt 5.13 just raised the minimum API version to 21. The PendingIntent version of the same API cannot be used yet as it requires v24+. Fixes: QTBUG-67482 Change-Id: Ided02e36796ef66f0244934ef67262f1e6f69b8c Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Andrew Dolby <andrewdolby@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-04-275-8/+55
| |\| | | | | | | | | | | | | | Change-Id: Ie3b3c4f031c843dd6debdae09a902e55ad255b8e
| | * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-205-8/+55
| | |\| | | | | | | | | | | | | Change-Id: Ifa3782b009430df67ef2e7ba78ea7d14cc053aa8
| | | * CoreBluetooth: add a missing -peripheral:didModifyServices: methodTimur Pocheptsov2019-04-164-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With some peculiar device we suddenly (during the service details discovery) got a crash with CBDescriptor suddenly becoming something else - NSString, NSMutableArray etc. - meaning the object was deleted and its memory re-used. It would appear, CBPeripheral can suddenly change it's services tree and it informs its delegate (aka 'us') about this change using the (previously) missing method. In this method we cannot do much, due to the specificity of our public API that allows concurrent discoveries, it's 'non-monolitic' (in several steps) discoveries etc. etc. So the only thing we can do - stop everything, remove all services, transition to QLowEnergyController::ConnectedState and wait for a user to re-discover services. Fixes: QTBUG-75043 Change-Id: Ie98d90aea112e40b4c6771e3f7315772dfd92b39 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | | * winrt: Fix reading of descriptor valuesOliver Wolff2019-04-151-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have to access the service data instead of relying on passed references as these references might have run out of scope and thus might not be valid any more. Fixes: QTBUG-75070 Change-Id: I02ad0fef2337488c926fb950ddf2da6eda56a396 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-04-1613-512/+778
| |\| | | | | | | | | | | | | | Change-Id: Ie63057b5773415a566e801731741006cf8626310
| | * | winrt: Remove unused functionv5.13.0-beta3Oliver Wolff2019-04-151-28/+0
| | | | | | | | | | | | | | | | | | | | Change-Id: I795c9b60454c350c56a4dd362b5b359b12a3a8f9 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | * | winrt: Move byteArrayFromBuffer into qbluetoothutils_winrtOliver Wolff2019-04-156-82/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | That code has been (unneededly) duplicated several times. We should have that helper function just once. Change-Id: I28fc9c5f7f7218b7870dc30bec228c9af8c6b090 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | * | winrt: Avoid asserts in helper functionsOliver Wolff2019-04-151-8/+24
| | | | | | | | | | | | | | | | | | | | Change-Id: I1759d7507d778ee60c6727621a3f58a7c7509718 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-134-44/+78
| | |\| | | | | | | | | | | | | Change-Id: I92b7c4a2948ddb8bdf7fead0a3351379138b0905
| | | * Don't create QBluetoothServiceInfo when uuid is nullAlex Blasche2019-04-121-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes Android returns a null uuid as SDP result. There is no point processing them further. Change-Id: I07b52e79a31becda72452e3446aca9ea4933968b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>