Commit graph

15197 commits

Author SHA1 Message Date
Miika Turkia
ddac55a3f1 Use state structure for sample rate info
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2019-01-22 13:04:36 +13:00
Miika Turkia
5a9a7f005f Shearwater Cloud mentioned in changelog
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2019-01-22 13:04:36 +13:00
Miika Turkia
39d5860602 Use correct value for PO2
averagePPO2 appears to be correct value instead of currentPPO2SetPoint.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2019-01-22 13:04:36 +13:00
Miika Turkia
6aa51c6232 Grab correct setpoint on Shearwater cloud import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2019-01-22 13:04:36 +13:00
Miika Turkia
f78f3075c4 Use different time field as it seems to be more correct
The starTimestamp is 4 hours apart on 2 different DCs within the sample
log. DiveDate on the dive_logs table seems to be correct, but must be
converted from human readable format.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2019-01-22 13:04:36 +13:00
Miika Turkia
4aac746bf0 Sample rate varies between dives
Seems that Shearwater cloud stores sample rate into the database and
it is not constant within the log.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2019-01-22 13:04:36 +13:00
Miika Turkia
f5ef586c72 Initial support for Shearwater Cloud
This works to some extent to part of a sample log I received. However,
still quite a bit more work is needed.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2019-01-22 13:04:36 +13:00
Miika Turkia
536017f42e Shearwater import: dive id might be large than int
I encountered this while implementing Shearwater Cloud import, but it
makes sense to increase the size for dive id for Shearwater Desktop as
well.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2019-01-22 13:04:13 +13:00
Lubomir I. Ivanov
9b0b5fd489 update year to 2019 in about screens
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2019-01-22 13:03:25 +13:00
Dirk Hohndel
4935f07c9a Desktop: change preferences dialog name to 'Preferences'
Fixes #1912

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 13:03:13 +13:00
Dirk Hohndel
9e83106ff7 Travis: use 5.12.03 Docker image for Android
With this we have working arm and arm64 images (except that the arm64
image crashes when using Bluetooth).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 13:02:39 +13:00
Dirk Hohndel
ee53639306 Android Dockerfile: add latest cmake 3.13.2
cmake 3.10 (which comes with Ubuntu 18.04) in combination with Qt 5.12
and the current qt-android-cmake causes an odd bug. Paths are set with a
double slash at the start '//' and later in the process this causes
garbled path names for some of the objects which in return causes the
APKs built in the container to fail.

Upgrading the cmake inside the container to 3.13.2 fixes that problem.

All the credit for identifying the problem and figuring out a solution
goes to Jan Mulder.

The resulting container was pushed to Docker hub as version to 5.12.03.

Reported-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 13:02:39 +13:00
Jan Mulder
e964bae5b9 Android Docker: give the docker build its own output tree
Again, this is relevant for developers that do local docker android
builds, and normal android builds. A normal build uses the directory
subsurface-mobile-build-arm(64), and when doing a docker android build
this directory is shared between host and container. That sharing is
good, as it nicely exposes the build tree to the host (for easy compare,
inspection, etc.). But reusing the same tree as the local one is
inconvenient (and possibly dangerous due to all kinds of caching
issues).

So, give the docker build its own output tree for the shared
subsurface-mobile-build-arm(64) build output.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-22 13:02:39 +13:00
Jan Mulder
968b7c1f7c Android Docker: give the android builder its own name
Users that use docker locally for Windows style build and Android style
builds will (probably) not like that we use the same name for both
docker containers. So, give the android builder its own name.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-22 13:02:39 +13:00
Jan Mulder
a875fd0d44 Android build: always reconfigure libdivecomputer
This fix makes no difference from usage of this script in Travis
context, as every build starts from a clean VM, but the very few
developers that build for Android locally, and that want to use the new
style docker container builds as well, things are broken.

libdivecomputer has build artifacts in its source tree (and that source
tree is shared between local and docker run). So it happens that
libdivecomputer is configured locally, and afterwards fails to build
in docker build as its already configured, but not for the docker
image its now running in.

The fix is simple. Always reconfigure libdivecomputer when using this
script.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-22 13:02:39 +13:00
Dirk Hohndel
86d3e59d70 Android: build both 32 and 64 bit binaries
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 13:02:39 +13:00
Dirk Hohndel
55a0bed59f Travis: find the Android apk in the right spot
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 13:02:39 +13:00
Dirk Hohndel
2153b95bf6 Travis: Android build wrapper now runs inside our container
So we don't need the pre-built binaries anymore, and we don't need the
travis_wait hack anymore for potentially slow downloads as that is all
installed in the container already.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 13:02:39 +13:00
Dirk Hohndel
071bce0fd1 Android Dockerfile: ugly hack to deal with current NDK compile problems
As explained in commit 449d4ee33d ("Android build: add explanation for
huge hack").

It seems reasonable to add this to our Travis image as that is custom
made just to build our Android binaries.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 13:02:39 +13:00
Dirk Hohndel
af6da3090a Android Dockerfile: add comments and try to shrink the image more
This image is downloaded on every Travis run. Making it smaller is important.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 13:02:39 +13:00
Dirk Hohndel
8628567e31 Travis: build against the Qt 5.12 Android image
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 13:02:39 +13:00
Dirk Hohndel
247513ad08 Android: update for Qt 5.12.0
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 13:02:39 +13:00
Jan Mulder
94fa935818 Android build: add explanation for huge hack
This had to be embedded in the build process (or better, solved for
real).

Using Cmake, Clang, NDK 18b, Qt 5.12 beta 4, some Subsurface code does
not compile. At this point in time, its fully unclear to me why we see the
error as it is.

Thing fail deep down in Qt and NDK headers on #include <cmath>. Error like
"::signbit is not in the global namespace". The most logic reason is an
improper order in which include paths are constructed in the build process.
Any attempt to find the real reason failed. Even very similar command lines
from a qmake build that succeed fail with a cmake style build.

The very very dirty hack is commenting out some lines in NDK 18b:

"./android-ndk-r18b/sources/cxx-stl/llvm-libc++/include/cmath

Comment lines 313-325, and all build, links and runs with no errors
related to this known at this point.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-22 13:02:39 +13:00
Jan Mulder
1e0ac92dd7 Android build: always use -fPIC
make sure that all lib code is compiled with -fPIC as things will not
link due to error "requires unsupported dynamic reloc R_ARM_REL32" (for
arm build).

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-22 13:02:39 +13:00
Jan Mulder
5f0ce37559 Android build: build openssl before libzip
On very clean builds not using the wrapper script, the compile of libzip
simply fails because it depend on openssl include files. Simply swap them
around.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-22 13:02:39 +13:00
Jan Mulder
7f4180a777 Android build: fix openssl build, no_asm
Mysteriously, openssl does not compile with clang with a
sha256-armv4.S:2638:2: error: invalid instruction, did you mean: adr?
The easiest way out is compiling without no_asm. This obviously lowers
the bandwidth on the SSL link (as the asm code is there for performance
reasons), but it has no visible performance loss in my tests.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-22 13:02:39 +13:00
Jan Mulder
b29a6e4cd2 Android build: add arm64 target and compile with clang
With a preparation done in the 4 commits before, now add the arm64 and
use clang instead of gcc as compiler infrastructure.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-22 13:02:39 +13:00
Jan Mulder
cd75fff054 Android build: openssl, do not move source tree
Very annoyingly, openssl is re-build and downloaded numerous times
when doing partial builds. Reason for this, is that the original checked
out git repo is moved away, and build in source (as openssl does ...).

So, this simple change leaves the checked out repo in place, and
copies the tree to build in.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-22 13:02:39 +13:00
Jan Mulder
c4aefc0d29 Android build: always install libzip.a in lib directory
A subtle one. When compiling for arm64, libzip is the only package we
use in mobile that installs its product in lib64. There is no reason for
this given the way our build process is. So, simply force the library to
reside in lib, independent if we are building arm or arm64
architectures.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-22 13:02:39 +13:00
Jan Mulder
a2fb9fde07 Android build: do not hard code armv7
Simple cleanup. Do not hard code armv7 as we have QT_ARCH. This
allows, in the future, for arm64 builds as well.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-22 13:02:39 +13:00
Jan Mulder
78d11ed687 Android build: set newer versions and parameterize ANDROID_PLATFORM
Hard coding desired ANDROID_PLATFORM on multiple places is simply bad.
Fix this. Further, set the variables to a much newer state.

CAVEAT: this will likely break android build, so be careful on
bisecting. All fixed in next, related commits.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-22 13:02:39 +13:00
Dirk Hohndel
1219225729 Travis: use Android docker image for build
This should make it easier to make changes to our build environment.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 13:02:39 +13:00
Dirk Hohndel
64528cd378 Android: cleanup build wrapper script
This way it can be run both to create the docker container or
independently for a full build.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 13:02:39 +13:00
Dirk Hohndel
295c323d51 Android: create docker container
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 13:02:39 +13:00
Dirk Hohndel
c8c6035d79 Android: add Dockerfile for build environment
We'll use that on Travis, but anyone can use that on their system.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 13:02:39 +13:00
Dirk Hohndel
e46fea155d Android: allow running android-build-wrapper without building
This way we can use it to fetch dependencies we need up front.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 13:02:39 +13:00
Berthold Stoeger
5819076130 Mobile: fix editing dive site
Commit 68961a169e made it impossible
to edit a dive site on mobile if a dive-site was already set: If
divesite was non-null, no actions were taken. Remove the conditional.

Reported-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-22 13:00:25 +13:00
Lubomir I. Ivanov
b0afca5815 windows.c: fix wrong usage of wcslen() for utf8 conversation
wcslen() returns the number of characters in a wchar_t string.
In the case of WideCharToMultiByte() an estimate for the size of
the utf8 buffer is needed. Using wcslen() is incorrect for such a buffer,
because for any non-ASCII character the estimate will be off by 1 byte.

Call the following instead to obtain the proper UTF8 buffer size
for the conversation:
  WideCharToMultiByte(CP_UTF8, 0, utf16, -1, NULL, 0, NULL, NULL);

Also fix some missing "\n" in fprintf() calls.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2019-01-22 12:59:23 +13:00
Jan Mulder
a5a191e850 Core: fix BT on Linux, workaround Qt bug on 5.12.0
After upgrading to Qt 5.12.0, download over BT from a DC did not work
any more. On the console the message "Connecting to port is not
supported (Uuid required)". Linus noticed earlier that we do rather
strange processing in this part of the code related to selecting port 1
or port 5. This all seems not needed (any more), but broader testing is
advised. This being stripped from the code, the mentioned error from Qt
persisted. That is strange in itself, as we did not reference port
numbers any more.

Step 2 in this commit is actually using an uuid to the call to
connectToService. Choosing an uuid seems relatively straightforward as
we can use the same one we already use for Android. That is the default
BT RFCOMM Serial Port Profile uuid. Interestingly, when changing to this
uuid we run immediately in a Qt runtime error telling us "QDBusPendingReply:
type ManagedObjectList is not registered with QtDBus.". For these 2
unexpected Qt messages, QTBUG-72742 was made. Studying the Qt source
code at this point reveals a possible workaround. Simply create a local
QBluetoothLocalDevice object, which, behind the scenes registers the Qt
internal ManagedObjectList with QtDBus.

In the meantime, Qt agrees that QTBUG-72742 is valid, and that a fix is
to be expected in a future version. At that point in time, the
declaration of the QBluetoothLocalDevice can be deleted again.

In the end, interfacing over BT works again.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-22 12:59:05 +13:00
Jan Mulder
873a4c8f07 Bluetooth: all states other than HostPoweredOff qualify as valid
This is an attempt to fix issue #1896. While this seems a Qt issue in
combination with very specific Android devices, this might be a fix. Do
not check for a very specific state of the local BT controller, but just
check if it is powered on.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-22 12:58:52 +13:00
John Plaxco
3865c1ec0a Improve error reporting when exporting a selection of 0 dives.
If no dives are selected when trying to export a selection, a message
is shown that no dives were selected, but it's immediately hidden
behind a message saying that a temporary file could not be created.
In fact, the creation of the temporary file wasn't never attempted,
so the message that the user actually sees is misleading.

The solution chosen here is to duplicate the check that at least some
dives are selected, and abort early if that case is detected, rather
than continuing on to show the additional misleading message. Not
elegant, but it gets the job done.

Better solutions to this include refactoring prepare_dives_for_divelogs
to return something more descriptive than a bool, remove that check
from prepare_dives_for_divelogs entirely since it doesn't seem to be
a good fit there, or switch to exceptions for handling these problems
rather than return values. I don't have sufficient familiarity with
the codebase to attempt these more invasive changes, but they
should be considered in the future.

On a final note, some of the other error messages in this file start
with a capital letter, but the one relevant to this particular PR
does not. Again, I'm not familiar enough with the codebase (or
translations) to know if that's safe to change, so I'll leave that
for another time or another developer.

Reported-by: John Plaxco
Signed-off-by: John Plaxco <john@johnplaxco.com>
2019-01-22 12:58:03 +13:00
Dirk Hohndel
db29fb4e68 Mobile: deal with BT name and address when tapping Download
Instead of trying to update this whenever the connection text changes,
instead deal with it right before it actually gets used.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 12:57:37 +13:00
Dirk Hohndel
0f350bef98 Mobile: add helper function to fill in the BT name
For some devices the BT device name is different from the product name.
Make sure that name is available to the mobile UI. This helper fills it
in from the scan data (based on the device address).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 12:57:26 +13:00
Dirk Hohndel
f7a4327cd4 core: recognize Oceanic Pro Plus X over BLE
Just like with the Aqualung i770R in 7697003498 this name follows the
pattern of a model number in ASCII encoding, followed by the serial
number of the device.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 12:57:13 +13:00
Jan Mulder
cfc4fca6ad core: shift dive time in correct direction
Unsure where this bug got introduced, but when asking for the dive
time to be shifted 1 hour later, the divelist and the dive details
showed 1 our earlier.

Fixes: #1893

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-22 12:56:49 +13:00
Jan Mulder
fa4dd05dfd Android build: use our own gradle build spec
At this point in time there seems something wrong with jcenter that
is used to download all Android build artifacts from. It simply does
not find the needed stuff on there and our build fails. Its unclear
if this is a temporary issue at jcenter, or its just an intended change.

This fix is a bit of a hack. It provides our own gradle build spec
instead of the one that is provided from Qt (which is pulled in using
androiddeployqt). Added is a working download link to maven, and a
newer com.android.tools.build:gradle is used compared to Qt.

All this makes Travis happy again.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-22 12:55:03 +13:00
Dirk Hohndel
0d69b420a4 Travis: fix the windows-container build
Call apt update before trying to install things.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22 12:54:44 +13:00
Jan Mulder
18c9db16a5 Android build: explicitly install using sdkmanager
Make sure all required Android SDK components are explicitly installed
before starting the actual build.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-22 12:54:30 +13:00
Jan Mulder
97178896d1 Android build: buildtools version is automatically detected
With commit 0d8fc7ef970e of qt-android-cmake, the buildtools version
is automatically detected. So do not try to pass it any more, as
this breaks the build.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-22 12:54:18 +13:00
Daniel Krupp
ad7f4e8656 Fix Cressi interface ftdi opening bug
The Cressi specific PID was not used
when  serial_ftdi_open_device tried
to open the device.

Reported-by: Daniel Krupp
Signed-off-by: Daniel Krupp <daniel.krupp@gmail.com>
2019-01-22 12:52:06 +13:00