summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qlowenergycontroller_osx.mm
Commit message (Collapse)AuthorAgeFilesLines
* Don't register meta types during static init time5.5Alex Blasche2015-11-301-7/+9
| | | | | | | | | | The QMetaType register my not be up and running by the time we attempt these meta type registration. Change-Id: I1a857a936a24b4b00a49574fac311c08c09b3d5a Task-number: QTBUG-49455 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* add remoteName() method to QLowEnergyControllerKevron Rees2015-05-121-0/+8
| | | | | | Task-number: QTBUG-45435 Change-Id: I3ded6bf88d3980481e386073ce160d5d54520034 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Bluetooth LE - add readCharacteristic/readDescriptor (OS X/iOS)Timur Pocheptsov2015-04-201-0/+74
| | | | | | | Add read descriptor/characteristic support for iOS and OS X. Change-Id: If7547f3756dc37930052c9cefd243d6063bcab1c Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Shift all OSX & iOS translations into C++ filev5.5.0-alpha1Alex Blasche2015-03-061-4/+5
| | | | | | | | | | | 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-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>
* Bluetooth - check OS X/iOS version in runtimeTimur Pocheptsov2015-02-061-4/+8
| | | | | | | Add runtime version checks, compile time can be not enough. Change-Id: If59131b3a9039a7fe15ccba0346fa71d58f36736 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QLowEnergyController/CentralManager - cleanup (OS X/iOS)Timur Pocheptsov2014-12-091-76/+62
| | | | | | | | | Get rid of all 'hand-written' function/method signatures in qCWarnings and Q_ASSERTS, use Q_FUNC_INFO instead. Fix error function for characteristic/descriptor write errors - remove unused parameter. Change-Id: I4f3f7c6c6a06802135f47a4b5cbb7c4313af4f34 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QLowEnergyController - bug fixes (OS X, iOS)Timur Pocheptsov2014-12-081-0/+12
| | | | | | | | | | | | | | | | | | | | | | Several problems found by qlowenergycontroller auto test: - Core Bluetooth in its didWriteCharacteristicValue callback does not have this new updated value, but the old one, to avoid additional characteristic read I have to cache this value in writeCharacteristic and report it later from the callback as it's already done for client characteristic configuration. - writeDescriptor with state != ServiceDiscovered (can happen after disconnectFromDevice) should set an error. - setNotifyValue did not check that value has the wrong length ( > 2 bytes) - this also should be an error. - Fix a key mismatch - in setNotifyValue remember descrptor's handle, not the characteristic's handle. - Remove annoying qCWarnings from didUpdateNotifyValue - it happens very often that we set this value in 'automatic' mode, without 'writeDescriptor' request. Change-Id: If3955f0e1364587b96403d23f2f8da28e6723e87 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QLowEnergyController - localAddress (OS X)Timur Pocheptsov2014-12-051-2/+7
| | | | | | | | On OS X QLowEnergyController can return the valid local address, even if it was constructed without this parameter. Change-Id: I40252a9f1f64506ae23d6dfe1e61fc786e895860 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Client characteristic configuration (OS X and iOS)Timur Pocheptsov2014-12-051-2/+5
| | | | | | | | If client characteristic configuration descriptor has an indication/notification bit set - enable ("automatically" == no explicit user's request) notifications. Change-Id: I839aabd6f5513141f66c8e4467618b3edd523350 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QLowEnergyCharacteristic - cached values (OS X and iOS)Timur Pocheptsov2014-12-041-2/+6
| | | | | | | | Cache a characteristic's value in update/write notification only if characteristic has a 'Read' property. Change-Id: Idc705e0c4f2ee704a80bf37b4e59e1dd09ca9e4f Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QLowEnergyService - ClientCharacteristicConfigurationTimur Pocheptsov2014-12-031-16/+47
| | | | | | | | | Core Bluetooth has a special method to enable/disable char update notifications and even more - Core Bluetooth does not allow to use writeValue:forDescriptor: with ClientCharacteristicConfiguration - that's why need this 'workaround'. Change-Id: I4a01690a76aabf62397321ca6ba22c4abb1c420c Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QLowEnergyController - service state (OS X/iOS)Timur Pocheptsov2014-12-011-4/+4
| | | | | | | | Fix a bug - call setState on a service instead of stateChanged (which is just a signal not actually chanding the service's state). Change-Id: I243f1f6c6775a5592357a443a2f180e4afcf8219 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QLowEnergyController - concurrent characteristic writesTimur Pocheptsov2014-12-011-58/+12
| | | | | | | | | | Qt's API assumes that several write operations must be serialized (this is not guaranteed with Core Bluetooth AFAIK). I can enqueu only write with response operations, otherwise I never know when to do the next write. Change-Id: Iaa83514748358437e2c39335ab142d084ff197e3 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QLowEnergyController - writeDescriptor (OS X/iOS)Timur Pocheptsov2014-12-011-14/+75
| | | | | | | Core Bluetooth - based implementation. Change-Id: Ie642a13ae9a4d75401dd10648fac6eeee4123a3b Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Bluetooth LE - handles/chars/descriptors/services (OS X and iOS)Timur Pocheptsov2014-12-011-48/+19
| | | | | | | | | | | | | In Qt we work with handles (real for Bluez, emulated for Android/iOS/OS X). Core Bluetooth has its own (quite primitive and inconvenient) data structures (arrays of objects, containing nested arrays). To make things not so ugly I'm adding several maps to be able to find a characteristic/descriptor/service using a handle from Qt's layer. Also modify writeCharacteristic to use this new 'addressing scheme'. Change-Id: Ic822c9aa82a4df1e9c4cf4c673451cac8006b9ba Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QLowEnergyService::writeCharacteristic - implementation for OS X and iOSTimur Pocheptsov2014-11-261-0/+186
| | | | | | | writeCharacteristic - implemented with Core Bluetooth for OS X and iOS. Change-Id: Ia228ff451e1e6d7b6fb7de6cad29198aa9257602 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QLowEnergyController - service details discovery (OS X and iOS)Timur Pocheptsov2014-11-251-5/+97
| | | | | | | | | | Implement details discovery: characteristics, their values (if any), descriptors. We have to emulate handles (QLowEnergyHandle) - while Core Bluetooth internally has the notion of handles, it never exposes them as a public API. Change-Id: I09158433ce6835dd34fe8ad47d047212dab59e8e Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QLowEnergyService - primary/secondary (OS X and iOS)Timur Pocheptsov2014-11-251-0/+2
| | | | | | | | It looks like isPrimary property is always 'NO' on CBService objects discovered making this property ... hmm, TOTALLY USELESS? Change-Id: Ia38323c204e6cf1c3def3bbb3deb08bb8cdf90e4 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QLowEnergyController - service discovery (OS X and iOS)Timur Pocheptsov2014-11-241-52/+195
| | | | | | | | | | | The initial version of service discovery failed to discover included services correctly, actually this discovery requires some kind of 'graph traversal' on the services tree. This patch re-implements the service discovery, discovering included services also and avoiding ... loops in services referencing each other (if it ever happens :) ) Change-Id: I60c6122fa5ddb922c21c99dd12024879cffad334 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QLowEnergyController - connectTo/disconnectFromDevice (OS X, iOS)Timur Pocheptsov2014-11-241-1/+12
| | | | | | | | | | | | | | | | | | | | Fix for disconnectFromDevice. It can happen that connect requesting is pending forever and not reporting any error: there is no timeout in Core Bluetooth (quite reasonable), a device (after it was found by LE scan) can be turned off or move out of range before connected. If a user calls disconnectFromDevice on a controller during this time: - we still have to call cancelPeripheralConnection to make sure the pending connection never succeeds - we have to set the controller's state to unconnected, since, unfortunately, delegate's callback is not guaranteed to work (descipe of Apple's docs promising this behavior). Fix for connectToDevice - small typo was breaking connectToDevice's logic. Change-Id: I4040c79a37ff31ecb5fb2296fa0d39b81d26393d Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QLowEnergyController - service discovery (OS X, iOS)Timur Pocheptsov2014-11-131-6/+54
| | | | | | | | | | | Implement discoverServices and delegate's methods to work with a service discovery on a peripheral. - CBUUID (it's internal data) can be only 2 bytes long (16-bit shortened UUID) despite of the docs saying 'CBUUID is a 16-bit UUID'. - property 'isPrimary' did not exist prior to 10.9 SDK (OS X). Change-Id: If692d147c0479ed69a331514617e3ef2a986cdf4 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QLowEnergyController - connectTo/disconnectFrom/Device (OS X, iOS)Timur Pocheptsov2014-11-121-5/+174
| | | | | | | | | | | | | Implement connect to device/disconnect from device methods, add CentralManager class dealing with CBCentralManager (with additional external logic). - Improve error handling while in 'connecting' state. - Use the proper error (ConnectionError) instead of UnknownError + make the error handling more uniform while isConnecting == true. - Use isNull on QBluetoothUuid, no need in ugly 'hasUuid'. Change-Id: I84a704a746b4677ccb870b9c132db5f7359030c6 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QLowEnergyController - version for OS X and iOSTimur Pocheptsov2014-11-121-0/+210
QLowEnergyController/Private for OS X and iOS. This patch contains dummy empty classes required. While LE controller is not fully implemented, I have to disable (marking as insignificant) auto test on this class, otherwise changing the (empty) class to pass the test adds more problem. Change-Id: I54f764f7f6468b1acf58e80555ae454922de9f3b Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>