aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2017-06-29Don't crash trying to record zero divesGravatar Dirk Hohndel
If the user clicks "Accept" when no dives were downloaded we would otherwise dereference unitialized memory. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-29QML UI: disable reachability modeGravatar Dirk Hohndel
Latest Kirigami master allows us to turn off reachability mode. In general this had been rather confusing to our users and it seems to somewhat conflict with the pull down to refresh of the dive list. Latest Kirigami also changes the behavior of refresh slightly, you now need to pull "down" for at least 500ms before it triggers. So, with this change and the latest Kirigami, hopefully the user experience for refresh is good enough that we can consider keeping it enabled and use it as an equivalent to manual sync (even in offline mode). See #454 See #456 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-30BT address 0 is bogusGravatar Robert C. Helling
Grey out those devices in the scanning list and prevent the user from selecting those. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-06-29QML UI: only drag a pull down sync, and not flick itGravatar Jan Mulder
Fast flicking to the top of the divelist triggers almost certainly a pull down sync, as the default boundBehavior is DragAndOvershootBounds. Despite being the default QML action, this leads to unwanted pull down syncs (even in offline mode). Setting the boundBehavior to DragOverBounds solves this issue. Now, the user has to explicitly drag the top down to force a pull down sync, and a accidental fast flick is stopped at the upper bound. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-27QML UI: DiveList: make download from DC main actionGravatar Dirk Hohndel
Now that we support this for many dive computers, that seem reasonable. I'm not happy with the icon, but couldn't figure out a better one in the breeze icon set. See #426 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-27Fix one call site that hadn't been updatedGravatar Dirk Hohndel
When updating to the new dc_custom_io_t, this one spot had been missed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-27WhitespaceGravatar Dirk Hohndel
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-27Update Subsurface-branch of libdivecomputer checkGravatar Dirk Hohndel
We now require the Subsurface-branch, and at least version 2 of the Subsurface API of libdivecomputer. 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-27Switch over to SSRF_CUSTOM_IO v2Gravatar Linus Torvalds
I hate changing the IO interfaces this often, but when I converted the custom serial interface to the more generic custom IO interface, I intentionally left the legacy serial operations alone, because I didn't want to change something I didn't care about. But it turns out that leaving them with the old calling convention caused extra problems when converting the bluetooth serial code to have the BLE GATT packet fall-back, which requires mixing two kinds of operations. Also, the packet_open() routine was passed a copy of the 'dc_context_t', which makes it possible to update the 'dc_custom_io_t' field on the fly at open time. That makes a lot of chaining operations much simpler, since now you can chain the 'custom_io_t' at open time and then libdivecomputer will automatically call the new routines instead of the old ones. That dc_context_t availability gets rid of all the if (device && device->ops) return device->ops->serial_xyz(..); hackery inside the rfcomm routines - now we can just at open time do a simple dc_context_set_custom_io(context, &ble_serial_ops); to switch things over to the BLE version of the serial code instead. Finally, SSRF_CUSTOM_IO v2 added an opaque "dc_user_device_t" pointer argument to the custom_io descriptor, which gets filled in as the custom_io is registered with the download context. Note that unlike most opaque pointers, this one is opaque to *libdivecomputer*, and the type is supposed to be supplied by the user. We define the "dc_user_device_t" as our old "struct device_data_t", making it "struct user_device_t" instead. That means that the IO routines now get passed the device info showing what device they are supposed to download for. That, in turn, means that now our BLE GATT open code can take the device type it opens for into account if it wants to. And it will want to, since the rules for Shearwater are different from the rules for Suunto, for example. NOTE! Because of the interface change with libdivecomputer, this will need a flag-day again where libdivecomputer and subsurface are updated together. It may not be the last time, either. 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-26BT serial: recognize LE-only devices, and fall back to emulated serialGravatar Linus Torvalds
This is somewhat hacky, but it allows at least the Shearwater libdivecomputer backend to continue to treat even the BLE GATT model as just a serial protocol. What it does is create a special "emulate serial behavior over the packetized BLE protocol" helper layer, that qtserialbluetooth falls back on when rfcomm is not available. NOTE! This still requires some BLE packet code changes to work with the odd way that Shearwater sets up their BLE GATT communication. So note that no further patches are necessary to *libdivecomputer*, but some updates are needed for the subsurface qt-ble.cpp code. I have those updates in my tree, and this code is all tested on my Perdix AI, but those patches are currently too ugly to commit as-is. I've cleaned up this "fake serial" code sufficiently, that cleanup comes next. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.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-27Two simple export UDDF fixesGravatar Jan Mulder
This fixes issues #418 and $419. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-26Fix Travis breakage (and overall breakage)Gravatar Dirk Hohndel
I can't believe this slipped through my review. How embarrassing. Credit goes to Anton Lundin for spotting this. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-25QML UI: Download from DC: move accept button to the rightGravatar Dirk Hohndel
So it doesn't conflict with the hamburger menu button / opening the global drawer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-25QML UI: Download from DC: avoid assignments of undefined valuesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-25QML UI: DC Download progress indicatorGravatar Dirk Hohndel
For now just do an indeterminate busy indicator - we can get more fancy and use the libdivecomputer progress event, later. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-24Add the EON Steel as support DC on AndroidGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-24Enable BLE on AndroidGravatar Dirk Hohndel
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>
2017-06-25QML UI: make toast message translatableGravatar Jan Mulder
Restyle construction of toast message and enable translation for it. Further, removed newline characters as they break the lines at non-logical positions. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-24QML UI: DiveList: add date box to trip headerGravatar Dirk Hohndel
This way you can tell when a trip happened. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-24Avoid Q_ASSERT with debug build of QtGravatar Dirk Hohndel
I don't know why we are setting lastIndex to -1. That seems odd. But for now this workaround will have to do. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-24QML UI: set opacity of 1 for dive listGravatar Dirk Hohndel
Hopefully with this we get exactly the right colors. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-24QML UI: Davide's colors for the blue themeGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-23QML UI: Theme colors: fix bad typoGravatar Dirk Hohndel
Here I confused myself with "dark" theme and the "darkerPrimary" colorls... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-23QML UI: remember the themeGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-23QML UI: show a small color palette previewGravatar Dirk Hohndel
When picking which color theme to use, show the user how things will look. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-23QML UI: use textColor instead of diveListTextColorGravatar Dirk Hohndel
This color is used for more than just the dive list. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-23QML UI: move theme setting into preferencesGravatar Dirk Hohndel
And reorganize settings and preferences a bit. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-23QML UI: clean up the setting of theme colorsGravatar Dirk Hohndel
Let's have names for the colors in each theme and assign those named values to the theme colors when switching themes. This way other pages can access the colors that are not in the current theme (for example for a theme switcher). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-23QML UI: set color of the action buttonGravatar Dirk Hohndel
This requires Kirigami master past 2.2.0 (which explains commit 001ff1b9 "QML UI: switch to Kirigami master"). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-23QML UI: color the status bar on AndroidGravatar Dirk Hohndel
This code is based on code from Marco Martin from the Kirigami Android sample app. In order to simplify the QML code the QMLManager function is there for all OSs, but it's a no-op on anything but Android. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-23Translate "more than n days" for surface intervalGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-06-22Warn when not compiling against the matching libdc versionGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-22Merge branch 'master' of git://github.com/torvalds/subsurface-for-dirkGravatar Dirk Hohndel
2017-06-22Update translation source stringsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-23Typo of translated stringGravatar Jan Mulder
Trivial typo. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-22QML UI: switch to Kirigami masterGravatar Dirk Hohndel
That way we'll get access to the colored Action Button. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-22QML UI: add missing go-up iconGravatar Dirk Hohndel
Now the 'Reachability' feature should be more obvious. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-22Convert to new libdivecomputer custom IO modelGravatar Linus Torvalds
Instead of being "custom serial", it's a IO model that allows serial or packet modes, independently of each other (ie you can have a bluetooth device that does serial over BT rfcomm and packet-based communication over BLE GATT with the same serial operations that describe both cases). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-06-22Update plural translationsGravatar Dirk Hohndel
Including the fake en_US translation. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-22Latest translationsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-22Update translation source stringsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>