aboutsummaryrefslogtreecommitdiffstats
path: root/core/qt-ble.cpp
AgeCommit message (Collapse)Author
2017-07-04Use waitFor instead of timerGravatar Jan Mulder
See e79bede0aa5b3bd. We rather use wait in combination with spinning the event loop. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-07-04OSTC over BLE: Select the right serviceGravatar Jan Mulder
The current "select the correct BLE service to talk to" is flawed. It assumes that the first found non-standard UUID is the right one and apparently it is for some DCs. But not for the HW devices. The HW devices use a "standard" ie. approved by the Bluetooth SIG, controller, that comes with a UUID that our code currently considers standard so not to be the right one. This (simple) commit selects the right service for HW. The UUID is hard coded, and this is ok, because it is tied to the hardware used by HW. Futher, it does not change anything for other BLE devices. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-07-04OSTC over BLE: initialize Terminal I/O clientGravatar Jan Mulder
This initalizes the Terminal I/O client as described in paragraph 3 of http://www.telit.com/fileadmin/user_upload/products/Downloads/sr-rf/BlueMod/TIO_Implementation_Guide_r04.pdf This is for all Heinrichs Weikamp computers, that use referenced BT/BLE hardware module from Telit Wireless Solutions (Formerly Stollmann E+V GmbH). The 16 bit UUID 0xFEFB (or a derived 128 bit UUID starting with 0x0000FEFB is a clear indication that the OSTC is equipped with this BT/BLE hardware. Furthermore, most devices equipped with this BT/BLE hardware have BT addresses starting with 00:80:25:... Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-07-03Increase the BLE timeout to 12 secondsGravatar Dirk Hohndel
This seems really long, but one user appeared to get a response after almost 10 seconds. So going with 12 for some margin of error. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-27BLE code: address some compiler warningsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-27Use SSRF_CUSTOM_IO v2 to implement device data quirks for BLE GATTGravatar Linus Torvalds
Right now we have a quirk for Shearwater devices to set the random address flag, but also to handle the differences at read/write time. With this, I can finally download from both the Suunto EON Steel and the Shearwater Perdix AI with the same binary. It's not *pretty*, but it works. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-06-27Use QLowEnergyController without QEventLoopGravatar Alex Blasche
We rather use wait in combination with spinning the event loop. Signed-off-by: Alex Blasche <alexander.blasche@qt.io> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-06-27Ensure all found BLE services are trackedGravatar Alex Blasche
If a device has more than one service the order of service discovery determined the selection of the service that we intend to interact with. This assumption is not accurate and is even platform dependent. Thinking ahead, it is likely that some devices may require us to keep track and interact with multiple services at the time. The new logic still suffers from the fact that there is no way to select the correct service for interaction. This will require higher level stack changes. Signed-off-by: Alex Blasche <alexander.blasche@qt.io> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-06-27Fix incorrect uuid check due to temporary char* in QString::toUtf8()Gravatar Alex Blasche
toUtf8() creates a temporary char* representation which is assigned to uuid. As soon the object created by toUtf8() gets destroyed, the uuid pointer points to releases memory. The intention is to check that we don't have one of the standard 16bit Bluetooth uuids. That's the purpose of QBluetoothUuid::toUInt16(). Signed-off-by: Alex Blasche <alexander.blasche@qt.io> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-06-26Bluetooth: make LE-only devices add "LE:" as an address prefixGravatar Linus Torvalds
This seems a bit odd, but it actually has three different reasons for it: - It's a visual indication of BT LE mode for users - the rfcomm code only works with legacy BT support, and if we scan a device that only does LE, we want the custom serial code to instead automatically fall back on a "emulate serial over LE packets" model. - we want rfcomm to remain the default for devices that do both legacy BT _and_ LE, but we want people to have the ability to override the choice manually. They can now do so by just editing the address field and adding the "LE:" prefix manually, and it automatically gets saved for next time. So while a bit hacky, it's actually a very convenient model that not only works automatically, but allows the manual override. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-24BLE support: convert fprintf(stderr,...) to qDebug()Gravatar Dirk Hohndel
This way the output can be seen in the AppLog on Android. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-24BLE support: add SPDX headersGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-24Very early and likely quite broken BLE GATT codeGravatar Linus Torvalds
This is some very early and hacky code to be able to access BLE-enabled dive computers that use the GATT protocol to send packets back and forth (which seems to be pretty much all of them: a vendor-specific GATT service with a write characteristic and a notification characteristic for reading). For testing only. But it does successfully let me download dives from my EON Steel and my Scubapro G2. NOTE! There are several very hacky pieces in here, including just "knowing" that the write characteristic is the first one, and the notification characteristic is second. The code should actually check the properties rather than have those kinds of hardcoded assumptions. It also checks "vendor specific" by looking at the UUID string representation, and knowing that the standard ones start with zero. Crazily, there doesn't seem to be any normal way to test for this, although I guess that maybe the uuid.minimumSize() function could be used. There are other nasty corners. Don't complain, send me patches. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>