summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/osx
Commit message (Collapse)AuthorAgeFilesLines
* SDP records: handle ServiceID and ServiceClassIDList correctly (IOBluetooth)v5.12.0-beta2Timur Pocheptsov2018-10-111-5/+74
| | | | | | | | | | | | We previously failed to correctly extract service ID and service class ID list. As a result, service discovery agent working with uuid filter and in MinimalDiscovery mode would fail to find anything, without filtering - would probably end up in services not having any valid service ID or ID list. Task-number: QTBUG-71052 Change-Id: I6b5a36399abfaf66297abe4a38efa7659cbb2aa0 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add manufacturer data to QBluetoothDeviceInfoAlex Blasche2018-08-171-0/+12
| | | | | | | The initial patch was contributed by Thiemo van Engelen. Change-Id: I45fad793ba092ab2820e606d8bf8807afa3e911e Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Replace foreach with for loop and set QT_NO_FOREACHOliver Wolff2018-08-153-6/+6
| | | | | | | | To avoid unnecessary copies, const is used wherever possible. Change-Id: Ic743716512751cfd24fad5bd37c244b115dd26fe Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* QtBluetooth - handle timeous in characteristic writes (Darwin OS)Timur Pocheptsov2018-06-192-1/+10
| | | | | | | | | | | This can allegedly happen when executing write with notification. While never observed so far, can easily be predicted/emulated, resulting in QLEC stuck in queued write/read requests and not progressing any futher. Task-number: QTBUG-68707 Change-Id: I3321257bb84a83a8ea25f9ae4e8acbdb95568cfa Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* LE controller (CoreBluetooth) - handle timeoutsTimur Pocheptsov2018-06-042-36/+199
| | | | | | | | | | | | | | | | | While we're discovering service's details (included services, characteristics, descriptors, etc.) some operations can result in timeout, without CoreBluetooth reporting any error back. To cope with this we need an additional logic - all such operations must be guarded with a 'watchdog' timer (OSXBTGCDTimer). Fortunately enough, we can re-use CBPeripheralDelegate's callbacks to handle these timeouts. As a micro-bonus - a couple of bugs in callbacks: whenever we are in service details discovery, after having some error we have to finish with discovery anyway, not to stick in 'discovering' state forever. Task-number: QTBUG-68422 Change-Id: I13a377ebec3983ac48a33d6b89b67223d5ec412f Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Reimplement scan/manager state timeouts using GCD timerTimur Pocheptsov2018-05-313-99/+34
| | | | | | | | And remove some essentially duplicated code. Task-number: QTBUG-68422 Change-Id: I677581ebb0998d64a0081f568479efb7e8156474 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add G(rand)C(entral)D(ispatch) timeout handlerTimur Pocheptsov2018-05-313-1/+208
| | | | | | | | | | | | | | | | QtBluetooth is using its own dispatch queue in CoreBluetooth back-end - this is where CoreBluetooth is executing all callbacks we're providing in delegate classes. Some operations like service discovery/characteristic or descriptor read(s) amd write(s) e.t.c. may sometimes fail to finish - no value read, no error reported (so delegate's method - callback - is never called). To deal with this we introduce the class OSXBTGCDTimer and GCDTimerDelegate protocol; GCDTimer periodically inserts blocks into the serial LE queue and checks for timeouts upon their execution. Task-number: QTBUG-68422 Change-Id: Ic17bf91d4223ad1ffc7b9808da36c902a4158227 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-201-1/+1
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I6e93fc7435a49b601a5c10519ed86d2a15125074
| * Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2018-01-181-1/+1
| |\ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I6d2140aa8692bc7ce56f4366275fd02d008900f0
| | * Disable compiler flag using proper qmake comment styleAlex Blasche2018-01-161-1/+1
| | | | | | | | | | | | | | | Change-Id: I041606473b333500da29c821d7dc089313856f65 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-213-0/+15
|\| | | | | | | | | | | | | | | | | | | | Conflicts: src/bluetooth/bluetooth.pro Change-Id: Ibccccc974b545696ae053f1fbffcc973d8be43cc
| * | CoreBluetooth - fix compilation errorsTimur Pocheptsov2017-11-023-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apple keeps breaking things, we keep fixing their usless diagnostic, until they fix their framework for good. https://openradar.appspot.com/33375728 https://openradar.appspot.com/33375690 etc. Change-Id: I0051b4636c6082ac4d0a7d76fc8aebb952394626 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | | Merge remote-tracking branch 'gerrit/5.10' into devAlex Blasche2017-10-175-11/+44
|\| | | | | | | | | | | Change-Id: I3bf7130a204aebd6a52dfe68bfea57767ba1b70e
| * | Merge remote-tracking branch 'gerrit/5.9' into 5.10v5.10.0-beta3Alex Blasche2017-10-175-11/+25
| |\| | | | | | | | | | Change-Id: I84bfe86751c27eabb4e75912ae3c0b4d3781faf1
| | * IOBluetooth: warn about incorrent thread/runloopTimur Pocheptsov2017-10-112-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * CoreBluetooth - use the right enumerators/constants with SDK 10.13Timur Pocheptsov2017-09-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Like it was done for central manager - use the correct enumerators (types) - with 10.13 SDK they also use 'generic' CBManagerXXX constants on macOS instead of CBCentral/PeripheralManagerXXX constants. Task-number: QTBUG-62658 Change-Id: I4b4de239930f5e731dc4977ff3353512290ff3b2 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | * Enable macOS 10.13 in QtBluetoothAlex Blasche2017-08-312-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | A similar change was done earlier for iOS already. This is due to deprecated API. Task-number: QTBUG-62658 Change-Id: If1d4a0eae382e46e3224a6bd4a6e75309ff87cac Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| | * BTLE (CoreBluetooth) - prospective fixTimur Pocheptsov2017-07-162-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The type of manage.state has changed on macOS (like on iOS before), making an declataion invalid. (cherry-picked from qtconnectivity/0c3cc5374d2703fde6a99d301fcff974122d057d) Change-Id: I55caa32fa9f0a85090506cfbd788c1a80d41e8ce Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * | CoreBluetooth - fix compilation errors for 10.13 SDKv5.10.0-beta2v5.10.0-beta1Timur Pocheptsov2017-10-041-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apple broke source code compatibility by moving 'identifier' properties from CBPeripheral and CBCentral classes into the new CBPeer class and marking it as "since 10.13". As a result we have compilation errors in the code that was valid since 10.7. To workaround this issue, we introduce a category with 'identifier' property declarations for SDK >= 10.13 and target < 10.13. Change-Id: Id7c9d33a9c8ae7627a06b4c1930e70cede1e5b07 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | | Replace Q_NULLPTR with nullptrKevin Funk2017-09-294-20/+20
| | | | | | | | | | | | | | | Change-Id: Ica194c2568465a94d851ddeaf62ca71b33fe4464 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Simplify system frameworks includesJake Petroules2017-09-041-15/+2
| | | | | | | | | | | | | | | | | | | | | | | | The previous version was doing exactly this, but in a far more complicated manner. Change-Id: Ia8f6a418a7fc6eab03207ced099288b8d4e5f3a7 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | | Remove 10.9 SDK workaroundJake Petroules2017-09-041-24/+0
|/ / | | | | | | | | | | | | Qt can no longer be built with the 10.9 SDK. Change-Id: I51da5a48b9985255bb1015c2b401906100d497bd Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | BTLE (CoreBluetooth) - prospective fixTimur Pocheptsov2017-07-112-8/+2
| | | | | | | | | | | | | | | | The type of manage.state has changed on macOS (like on iOS before), making an declataion invalid. Change-Id: I55caa32fa9f0a85090506cfbd788c1a80d41e8ce Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | Register additional meta typesLars Schmertmann2017-03-301-2/+0
|/ | | | | | | | | | | | | | | Register QLowEnergyCharacteristic and QLowEnergyDescriptor as meta types because they are used in signals. [ChangeLog][QtBluetooth] Register QLowEnergyCharacteristic and QLowEnergyDescriptor as meta types. It is therefore necessary to declare them as meta types in the header files. This commit will cause conflicts with existing meta type declarations in applications using Qt. These declarations need to be removed. Change-Id: I18f33b1b2f159cffd6efbacc37178286b86a06e0 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* BTLE - prefer advertised name (CoreBluetooth)Timur Pocheptsov2017-01-131-6/+3
| | | | | | | | | | | | Invert CoreBluetooth's naming priorities: CoreBluetooth prefers the device's GAP name over advertised name; we instead give the higher priority to advertisement data (CBAdvertisementDataLocalNameKey). [ChangeLog][QtBluetooth] Prefer advertised name if set Task-number: QTBUG-58080 Change-Id: If40687c9c1de50986f61d5e6134001621bc5030b Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add "We mean it." comments to private headerFriedemann Kleint2016-12-021-0/+10
| | | | | | | | Fix syncqt warning: QtNfc: WARNING: qtconnectivity/src/osx/osxbtperipheralmanager_p.h does not have the "We mean it." warning Change-Id: I439515eac2a19b351d1bad18f783e448224d0918 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* LE peripheral manager - warn about value length limit (iOS)Timur Pocheptsov2016-11-154-2/+34
| | | | | | | | | Apparently, it cannot exceed the 512-octets limit on iOS. Also, warn about notifications - the value is truncated for a connected peripheral, we are limited by a central.maximumUpdateValueLength. Change-Id: Ia3d09fe0306a2514cf2c6f391cc57e6d300b75fd Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* LE peripheral - fix a characteristic's lengthTimur Pocheptsov2016-11-111-7/+10
| | | | | | | | | | | | | | | | | | | | | | | With Qt's Bluetooth API it's possible to write values with different lengths into the same characteristic. Imagine this scenario: service->writeCharacteristic(handle, QByteArray("abcd")); and then service->writeCharacteristic(handle, QByteArray(2, 0)); If we read from the characteristic later, we get: 00cd. A write request in CoreBluetooth is presented as an array of CBATTRequest, each of them has its offset and value with length. After processing these requests we truncate a characteristic's length if needed. Task-number: QTBUG-56898 Change-Id: I674637eb78c806364d1a89a1db8ab3f31a8800ce Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Emit descriptorWritten for notification/indication enabled/disabledTimur Pocheptsov2016-11-092-1/+14
| | | | | | | | | | | | From CoreBluetooth's point of view - this is just a callback, not a descriptor write request (they even consider all descriptors immutable in peripheral), but for Qt it should be a descriptor write operation, and we must emit a signal. Oh, and set endHandle correctly on a LE service object! Change-Id: I71922507a6ece987ad8b5c317ef618301ae240c2 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* LE device scan - use advertisement data (iOS/macOS)Timur Pocheptsov2016-11-082-12/+50
| | | | | | | | | | Things like services uuids can be quite useful and we should extract them. Also, do not ignore the device discovered the second time as it was done in the past, the logic updating QBluetoothDeviceInfo with new info (if needed) is already in the device discovery agent. Change-Id: I89e735dae26848eb95395cf96099efd5b56b18b3 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* OSXBTPeripheralManager - fix characteristic writeTimur Pocheptsov2016-11-072-17/+80
| | | | | | | | | | | | | - Use request.value.bytes instead of data.bytes to write into ... data.bytes. - Report offset and invalid length on characteristic write as separate errors. - Check minimal/maximalValueLength. - Allow characteristic writes within min/maxValueLength. Task-number: QTBUG-56898 Change-Id: I624e55fe964e86b5bbf246ce2ee053dd247f7761 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* CoreBluetooth - fix compilation warningsTimur Pocheptsov2016-11-041-0/+9
| | | | | | | | With the latest SDK on iOS we have to use CBManagerStateXXX, not CBPeripheralManagerStateXXX/CBCentralManagerStateXXX. Change-Id: I5be7f55c9ee64afe6a6260573fe9e939ac7440fb Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* LE peripheral: fix a crash with unrecognized selector (iOS/macOS)Timur Pocheptsov2016-11-044-8/+23
| | | | | | | | | | | | It's nice to re-use some generic functions, but it's not so if they are actually not generic: data_from_bytearray returns NSData, not NSMutableData and NSData (or whatever type they have under the hood) obviously does not have replaceBytesInRange:withBytes: method and we get 'unrecognized selector' exception as a result. Task-number: QTBUG-56898 Change-Id: I8fcaaf2a020c6f5caa8a171b7ac6e534fcb070cd Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'gerrit/5.7' into 5.8v5.8.0-beta1Alex Blasche2016-10-1226-106/+97
|\ | | | | | | | | | | | | | | Conflicts: src/bluetooth/osx/osxbtledeviceinquiry.mm src/bluetooth/qbluetoothdevicediscoveryagent_osx.mm Change-Id: I7dc75c187af73917f31c28b9edfaf8bcf9652a3e
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-10-0524-103/+59
| |\ | | | | | | | | | Change-Id: Iff285e35cdca30fee28c7927bc01498d70f9de9e
| | * CoreBluetooth - fix broken builds (macOS, iOS, tvOS, watchOS)Timur Pocheptsov2016-10-0423-116/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - With recent SDK changes CoreBluetooth is not in IOBluetooth anymore. This makes corebluetoothwrapper_p.h even uglier, now we have to care about v != 10.9 && v < 10.12; v == 10.9; v >= 10.12. - Using osxbluetooth_p.h we can get rid of forward declarations (for Obj-C classes) and weird includes like <IOBluetooth/IOBluetoothRFCOMChannel.h> - use osxbluetooth_p.h instead (and it will correctly include IOBluetooth/IOBluetooth.h etc.). Change-Id: Ia85ef2e2cc1ac7b15a58864ed25d85a0772e5c86 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | * Fixed build with MaxOSX10.12 SDKSamuel Gaist2016-10-033-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds missing includes that allows to build the module with the 10.12 SDK and Xcode 8. Change-Id: Ieab48f6a0582b916ceecbbb9a01a4169d6ba53f5 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-10-012-0/+34
| |\| | | | | | | | | | Change-Id: Ie9b0ebf1c5e925107e90b5d01b112916a8d1d83d
| | * Handle iOS 10 deprecated data structuresMike Krus2016-09-282-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | iOS 10 (and tvOS 10) deprecates CBCentralManagerState enum (and associated values). Replaced by CBManagerState enum. Change-Id: I1c1bb0691403deaa6330949516846961c76865f5 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | | Merge remote-tracking branch 'gerrit/dev' into btleAlex Blasche2016-07-135-88/+117
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Adds the minimum compile requirements for the new QBluetoothDeviceDiscoveryAgent API. Change-Id: Idfe07bee63de9d2849ab68eb455d0be470591795
| * | | QtBluetooth - add LE device discovery timeout (OS X/iOS)Timur Pocheptsov2016-06-165-88/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Instead of hardcoded 10 second timeout use the latest Qt API enabling arbitrary or infinite length for LE device discovery. - Since now scan can take long or unlimited time, the previous approach with detached CBCentralManager and DDA is not working anymore - we can not report devices only at the end of scan. Re-use LENotifier and signals/slots instead. - Remove DDA timer, timeout logic is completely inside osxbtledeviceinquiry object now. Change-Id: I07735581ac175d1d5e5d788aaf697dcb41429e31 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | | | Merge remote-tracking branch 'gerrit/dev' into btleAlex Blasche2016-06-108-244/+97
|\| | | | | | | | | | | | | | | Change-Id: Ie6cc29263dd8d9d58bdbd14fb0d3b57d7abea9c7
| * | | QtBluetooth - get rid of Q_FUNC_INFO (OS X/iOS)Timur Pocheptsov2016-06-028-88/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since now the use of Q_FUNC_INFO is not recommended (and indeed can mix ugly with QT_MESSAGE_PATTERN), remove it (it now stays only in 3-parameter Q_ASSERTs and NSLogs. The next patch will do the same kind of cleanup in C++ part. Change-Id: Ief8bd7c90ea2ff2a99f246885691102062aa5e54 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
| * | | QtBluetooth: remove outdate code (OS X/iOS)Timur Pocheptsov2016-06-023-158/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we now have OS X 10.9 and iOS 7.0 as the minimal required (SDK and deployment target) - get rid of outdated code-branches in _SDK_EQUAL_OR_ABOVE etc. Change-Id: I5f546e8bb746f6b94f26a40460b3caa0af6a531c Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | | | Merge remote-tracking branch 'gerrit/dev' into btleAlex Blasche2016-05-271-4/+8
|\| | | | | | | | | | | | | | | Change-Id: I533ed177193b4c7a9a1b6110612103e40a24a597
| * | | QtBluetooth (BTLE) - fix build on tvOSTimur Pocheptsov2016-05-231-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CoreBluetooth for tvOS does not support peripheral role. Change-Id: I82e7a61abfd907ea53faf33264951727f3cbe5a2 Reviewed-by: Mike Krus <mike.krus@kdab.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | | | Merge branch 'dev' into btleAlex Blasche2016-05-1334-843/+2291
|\| | | | | | | | | | | | | | | Change-Id: I073f6c45696fe28b83335fb65cca6270c458851d
| * | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-04-081-1/+1
| |\| | | | | | | | | | | | | | Change-Id: I858ee0b39b7a488f08fc045635d2a39053f32d99
| | * | Merge remote-tracking branch 'origin/5.6' into 5.7v5.7.0-beta1Liang Qi2016-04-081-1/+1
| | |\| | | | | | | | | | | | | Change-Id: I77d7b5877ce36057c3882a0b397ff27d5c35ad53
| | | * OSXBTCentralManager - fix details discovery (iOS/OS X)Timur Pocheptsov2016-04-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -serviceForUUID: fails to find included service and returns a nil for a valid service previously discovered. Task-number: QTBUG-52324 Change-Id: I9f4f8b1f3d3a78879344ace0170e23c03921d648 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>