Commit graph

11980 commits

Author SHA1 Message Date
Dirk Hohndel
345e063eb5 Rewrite the matching code for BT devices
This should be much more robust in getting us the correct Bluetooth address
and the correct vendor / product for our selection.

When we pick a paired device, we extract the address right from its name.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-03 21:58:26 -07:00
Dirk Hohndel
bc864c3bce Don't add all discovered BT devices
This really doesn't help us as we can't associate a vendor/product with
devices we don't recognize, so we can't download from them, anyway.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-03 21:58:26 -07:00
Dirk Hohndel
016b19ef0c Subsurface-mobile version jump to 2.0
The beginning of download (plus the UI overhaul) definitely deserve
a major version bump.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-03 21:58:26 -07:00
Seamus Boyle
252dfaf6d1 TestPreferences: Fix update manager test date
QDate::addDays() returns a copy with the changed date, calling it and
ignoring the return value does nothing.

Signed-off-by: Seamus Boyle <seamus@beantrader.com.au>
2017-07-04 11:54:54 +09:00
Robert C. Helling
d17bb6318e Don't try to dereference empty product/vendor list
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-07-04 07:06:20 +09:00
Dirk Hohndel
8467e53f11 Android: add Suunto EON Steel as device
This way plugging in an EON Steel should pop up a question if the
user wants to open Subsurface-mobile. Unfortunately, the download
doesn't work, yet, and worse, if the phone goes to sleep while an
EON Steel is plugged in, this appears to trigger a hard crash on
the EON Steel.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-03 15:05:45 -07:00
Robert C. Helling
bdd1a35c01 Add new sources to ios .pro file
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-07-04 06:12:09 +09:00
Jan Mulder
d7b8ad7a44 BT discovery Android: Allow BT/LE devices connect both ways
For DCs that support both BT and LE, allow the user to connect to both
interface layers. Maybe not usefull in the end (as BT is faster
than LE), but as long as BT on Android is WIP is it very useful
to be able to connect to the interface layer we like.

Just add it to the Paired Devices list twice. The normal way, and
the LE: prepend way.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-07-04 05:49:52 +09:00
Dirk Hohndel
096682cd94 Whitespace
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-03 13:48:54 -07:00
Dirk Hohndel
60123515b6 Fix '-L-lcurl' linker warning
This would happen if we don't have a specific directory in LIBSSH2_LIBRARY_DIRS.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-03 13:47:23 -07:00
Dirk Hohndel
7a6cc12da2 Mac packaging - don't move Grantlee plugins
I don't know why we moved them from the 5.0 subdirectory, but that
seems to break things now. Odd.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-03 13:30:10 -07:00
Dirk Hohndel
65f6db6e2c Don't warn about missing en-US translation for Qt
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-03 13:29:25 -07:00
Dirk Hohndel
20254a43c0 Mac packaging: don't lose minimum version
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-04 03:56:51 +09:00
Dirk Hohndel
bd18b6b88f build.sh: add option to build all dependencies
Using the Homebrew dependencies is much easier and faster, but then
we run into the problem that Homebrew always builds against your current
OSX version. This instead allows us to build the dependencies ourselves
and set the SDK / minimum OSX version. This is mainly important for
binaries that we want to distribute.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-04 01:45:55 +09:00
Dirk Hohndel
acee6f4bec build.sh: build against older SDK / minimum OSX version
On Mac we want to make sure that we don't only run on the OS that
we were built on, but all the way back to 10.10 (that's the oldest
that Qt supports).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-04 01:45:55 +09:00
Dirk Hohndel
36d462e0f9 build.sh: don't override existing CMAKE_PREFIX_PATH
If we already explicitly point at one Qt installation, don't override
with another one.

Also, support all the way up to Qt 5.9.1

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-04 01:45:55 +09:00
Dirk Hohndel
6bba524288 Mac package build: adjust handling of libgit2
Apparently it now is a different dependency that causes problems.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-04 01:45:55 +09:00
Dirk Hohndel
9c0cc53175 Mac package build: remove obsolete hack
And also add some additional comments.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-04 01:45:55 +09:00
Dirk Hohndel
0482f054a7 QML UI: add more dive computers
This really needs to be done differently - we need a structured way
to associate a transport mechanism with each of the dive computers
we support.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-02 21:57:08 -07:00
Dirk Hohndel
1e895095cf Update SupportedDivecomputers
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-02 20:57:54 -07:00
Dirk Hohndel
339f128cdc MXE cross build: allow to specify mxe directory
This should make it easier to test different mxe versions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-02 18:56:18 -07:00
Dirk Hohndel
7199ad33e2 BT discovery: detect Scubapro G2
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-02 18:32:16 -07:00
Dirk Hohndel
6451adfec1 Android build: switch to Qt 5.9.1
It seems that the Qt team deviated from their previous practice to keep
the Qt/x.y directory structure the same for all minor releases - so now
it is indeed Qt/5.9.1
Oh well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-30 17:21:07 -07:00
Dirk Hohndel
4604b6a8de BLE: require Qt 5.6 and suggest Qt 5.9.1
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-30 16:55:53 -07:00
Dirk Hohndel
61fff71391 Android: mark BLE only paired devices
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-30 13:13:38 -07:00
Dirk Hohndel
c145cbd754 QML UI: save BT address as string
And do the same LE: prefix marking as in the desktop version.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-30 13:12:53 -07:00
Dirk Hohndel
6837120bb1 BLE handling: create helper function to add the LE: prefix
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-30 13:12:07 -07:00
Dirk Hohndel
a4d4d1c83b Better colors for BT pairing dialog
Linus had complained about these colors for a while. I think
this is a massive improvement.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-29 15:19:33 -07:00
Dirk Hohndel
f4f42a0b97 Don't crash trying to record zero dives
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-29 15:10:42 -07:00
Dirk Hohndel
282698e5d2 QML UI: disable reachability mode
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-29 15:10:42 -07:00
Robert C. Helling
81362e6441 BT address 0 is bogus
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-30 07:10:32 +09:00
Jan Mulder
d6446569af QML UI: only drag a pull down sync, and not flick it
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-29 23:21:55 +09:00
Dirk Hohndel
b459ccbff7 QML UI: DiveList: make download from DC main action
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-27 22:18:26 -07:00
Dirk Hohndel
344b9e3234 Fix one call site that hadn't been updated
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-27 21:24:00 -07:00
Dirk Hohndel
ea8e3006db Whitespace
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-27 20:53:21 -07:00
Dirk Hohndel
f98fa50c39 BLE code: address some compiler warnings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-27 20:53:11 -07:00
Dirk Hohndel
fbdba88dec Update Subsurface-branch of libdivecomputer check
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-27 20:52:12 -07:00
Linus Torvalds
526595644f Use SSRF_CUSTOM_IO v2 to implement device data quirks for BLE GATT
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-27 15:14:27 -07:00
Linus Torvalds
d01b7bf891 Switch over to SSRF_CUSTOM_IO v2
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-27 13:58:15 -07:00
Alex Blasche
e79bede0aa Use QLowEnergyController without QEventLoop
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-27 11:03:19 -07:00
Alex Blasche
57753321b0 Ensure all found BLE services are tracked
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-27 11:03:19 -07:00
Alex Blasche
81dabe5ace Fix incorrect uuid check due to temporary char* in QString::toUtf8()
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-27 11:03:19 -07:00
Linus Torvalds
4f3a9cdb35 BT serial: recognize LE-only devices, and fall back to emulated serial
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-26 22:21:14 -07:00
Linus Torvalds
d0c3ef4cf8 Bluetooth: make LE-only devices add "LE:" as an address prefix
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-26 22:20:01 -07:00
Jan Mulder
bbde0a1741 Two simple export UDDF fixes
This fixes issues #418 and $419.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-27 14:15:35 +09:00
Dirk Hohndel
f091b8b705 Fix Travis breakage (and overall breakage)
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-26 12:39:00 -07:00
Dirk Hohndel
77f545b38e QML UI: Download from DC: move accept button to the right
So it doesn't conflict with the hamburger menu button / opening the
global drawer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-25 16:12:45 -07:00
Dirk Hohndel
4963b27f52 QML UI: Download from DC: avoid assignments of undefined values
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-25 16:12:07 -07:00
Dirk Hohndel
fc2ca3a804 QML UI: DC Download progress indicator
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-25 15:52:07 -07:00
Dirk Hohndel
f5e1df0423 Add the EON Steel as support DC on Android
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-24 22:32:56 -07:00