summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/osx
Commit message (Collapse)AuthorAgeFilesLines
* 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>
| * | | Add peripheral role (iOS/OS X).Timur Pocheptsov2016-03-138-39/+977
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | CoreBluetooth has CBPeripheralManager/CBMutableService both on iOS (since 6.0) and OS X (>= 10.9). This lets me implement the Qt's BTLE 'advertisement' API and peripheral role for both iOS and OS X. Change-Id: I3e69a5870535a45bc16bbd9862ca84300b01daca Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
| * | Updated license headersAntti Kokko2016-01-2030-420/+600
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | Merge remote-tracking branch 'gerrit/5.6' into devAlex Blasche2016-01-052-3/+1
| |\| | | | | | | | | | Change-Id: I97b51eb3fe2040711c00da67bbb1954fc2e65c1f
| | * Remove yet another implementation of AutoreleasePool's RAIITimur Pocheptsov2016-01-051-2/+1
| | | | | | | | | | | | | | | | | | | | | Now we have this class in QtCore, no need in my "home-made" version anymore. Change-Id: Id26944dd6970cc2a8ac9d02675f8af9adecc3d44 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
| | * Fix namespaced build on OSX.Erik Verbruggen2015-12-231-2/+2
| | | | | | | | | | | | | | | Change-Id: I0baa4bbbc5d398f388a1e0aff9ba88f82a23c1cc Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * | tvOS supportMike Krus2016-01-051-2/+2
| |/ | | | | | | | | | | | | | | | | | | Builds but not tested Moved Q_DECLARE_METATYPE outside of namespace to fix namespaced builds Change-Id: I19c1dba904da8fad155f0f612b863e8f5e0c422e Reviewed-by: James Turner <james.turner@kdab.com> Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
| * Add "we mean it header statement" to osx private headerAlex Blasche2015-12-151-0/+11
| | | | | | | | | | Change-Id: I4005833edebd10b778ac06ded49a88e633e5f435 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
| * qlowenergycontroller_osx - move delegate to the qt_LE_queueTimur Pocheptsov2015-12-105-245/+344
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ATM CBCentralManager's delegate does its work on the main queue. With CoreFoundation event dispatcher it's now possible to use QtBluetooth from non-gui thread (more generally - from a thread other than main). This makes main queue useless - and we have to move to a dedicated dispatch queue. Also, we have to make sure we do not have race conditioins/dead-locks. This patch: 1. decouples OSXBTLECentralManager and QLowEnergyController so that these two objects working (potentially) on different threads do not share any data and do not have to use locks, removes the explicit 'delegate' interface/inheritance and replaces them with LECentralNotifier class - to be able to use Qt's signal/slot mechanics for inter-thread communication. 2. all OSXBTLECentralManager's are now executed on qt_LE_queue queue to avoid any race-conditions (since they potentially update manager's internal state). 3. Results/errors are now reported using LECentralNotifier's object (QLowEnergyController has corresponding slots connected to the notifier) Task-number: QTBUG-49476 Change-Id: Ie07cdc13ad559c96a7d2ff010843fb7bcce07c99 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
| * Bluetooth LE scan - move to its own dispatch queue (iOS/OS X)Timur Pocheptsov2015-11-274-219/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | Move CBCentralManager's delegate to its own dispatch queue, not the main one, so that even if somebody _blocks_ the main thread somehow, waiting for discovery to finish, the discovery can, indeed, finish. Also, make DDA aware of the fact that now actual scan and 'this' are working on different threads, thus we must be thread-safe. Task-number: QTBUG-49476 Change-Id: I9bcc74131f51389c8a014577c65e0943bbc8da42 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
| * CoreBluetooth - simplify osxbledeviceinquiry's code.Timur Pocheptsov2015-10-292-42/+43
| | | | | | | | | | | | | | | | Replace pendingStart and isActive + all places they have to be modified with scanPhase and enum {startingScan, activeScan, noActivity}. Change-Id: I29edff3b99fc877d0d52a5974aa64c9ff2faa584 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
| * Core Bluetooth - give a user the second chance to enable BluetoothTimur Pocheptsov2015-10-291-11/+52
| | | | | | | | | | | | | | | | | | | | | | On iOS when we receive centralManagerDidUpdateState with the state == PoweredOff, iOS also shows an alert on screen, asking to enable Bluetooth via the "Settings" app. If we do not report an error and a user indeed enables BT, we can continue to work. Change-Id: Ic1f63f205b56fc356bc7fa645359b583c00195a6 Task-number: QTBUG-48713 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
| * Add missing "We mean it" comments to private headers.Friedemann Kleint2015-10-0914-0/+154
| | | | | | | | | | Change-Id: I4e78a2b263fb779253556201fd20fe47a2afc58e Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
| * CoreBluetooth - update for iOS 9.0Timur Pocheptsov2015-10-082-10/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | New SDK removed deprecated properties/methods and we have a compilation error as a result. Use performSelector instead of direct calls to make sure: 1. it compiles 2. it calls an existing method. Task-number:QTBUG-48518 Change-Id: I10a2d062f9e71229a1e218d9d167a4132b97b6ab Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Merge remote-tracking branch 'gerrit/dev' into btleAlex Blasche2015-06-0132-979/+2823
|\| | | | | | | | | | | | | | | Conflicts: src/bluetooth/osx/osxbtdeviceinquiry.mm src/bluetooth/qbluetoothdevicediscoveryagent_osx.mm Change-Id: Iaba26c6affe194eafbb666c7474b566d4980298b
| * Bluetooth LE - add readCharacteristic/readDescriptor (OS X/iOS)Timur Pocheptsov2015-04-202-64/+219
| | | | | | | | | | | | | | Add read descriptor/characteristic support for iOS and OS X. Change-Id: If7547f3756dc37930052c9cefd243d6063bcab1c Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
| * Bluetooth device discovery agent - minor cleanup (OS X)Timur Pocheptsov2015-03-241-1/+0
| | | | | | | | | | | | | | Use d_ptr; test inquiryLE in 'isValid' also (just to be consistent). Change-Id: If5a8977cfc7adfb06150a2bf8a2e14d0613e26c7 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
| * Bluetooth - LE device discovery agent, timer bug (OS X)Timur Pocheptsov2015-03-243-13/+26
| | | | | | | | | | | | | | | | | | | | | | | | CBCentralManager does not have a timeout while scanning and we had to use a delayed selector (via performSelector) to interrupt the scan. This is a bug in the case we're in NSModalPanelRunLoopMode mode (for example) - selector never gets performed (it waits for the default mode) or performed too late. Found in our btchat example. Now we use external QTimer instead to check if it's time to stop a scan. Change-Id: I159bf5821398f3aa76f03a52a8334dea97cbf688 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
| * Shift all OSX & iOS translations into C++ filev5.5.0-alpha1Alex Blasche2015-03-063-0/+176
| | | | | | | | | | | | | | | | | | | | | | 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-1627-567/+367
| | | | | | | | | | | | | | | | | | 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>
| * Bluetooth - check OS X version in runtimeTimur Pocheptsov2015-02-061-2/+6
| | | | | | | | | | | | | | | | Add OS X version check, compile time check is not enough if Qt is built for older versions. Change-Id: Ieebd3f05f0fd9942516ea1d9b40ee929905cb799 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
| * Bluetooth - runtime OS X/iOS version checkTimur Pocheptsov2015-02-061-15/+14
| | | | | | | | | | | | | | Add runtime checks, compile time is not enough. Change-Id: I1821c9718d4e4af1e2d7989bd1ee7a1f11d5c051 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
| * Qt Bluetooth - add runtime OS version check (OS X, iOS)Timur Pocheptsov2015-02-062-25/+41
| | | | | | | | | | | | | | | | Compile time check of SDK version is not sufficient if Qt is build for older device. Change-Id: I0e4d0baf903c6291e67462890107b0e5cc30e7c4 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>