The only remaining use of the tripflag was to mark dives that
were removed explicitly from a trip, i.e. shouldn't be autogrouped.
Therefore replace the enum by a simple boolean.
Currently, there is no way of unsetting the notrip flag. But this
shouldn't result in a user-visible change.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Since upgrading to gcc 8.2 it produces noisy warnings about
potentially truncated strings. It doesn't recognize that
filenr can never become >4000. So clamp it down explicitly.
Do this by adding a function that does the assembly of the
filename path. Adding unnecessary code to silence compiler warnings
is dubious, but in this case it might be reasonable.
Fix a second instance by increasing the stack-allocated buffer
to 32 bytes. Hopefully nobody has more divespots than would
fit in a 9-decimal digit number!
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Replace the UUID reference of struct dive by a pointer to dive_site.
This commit is rather large in lines, but nevertheless quite simple
since most of the UUID->pointer work was done in previous commits.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Another small step in removing dive-site UUIDs: use a pointer
instead of a UUID in the "uemis_helper" structure.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of passing a uuid, pass a pointer to the dive site.
This is small step in an effort to remove uuids.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This changes more of the dive-site interface to return pointers
instead of UUIDs. Currently, most call sites directly extract
UUIDs afterwards. Ultimately, the UUIDs will be generally replaced
by pointers, which will then simplify these callers.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The uemis downloader uses a cache for location to divesite id.
Trivially, the divesite-uuid can be replaced by a pointer. This
is a tiny step to remove divesite UUIDs.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
As a first step in removing dive-site uuids, change the interface
of the get_dive_site_*() functions to return pointers instead
of uuids. This makes code a bit more complicated in places where
the uuid is extracted afterwards (needed NULL check). Nevertheless,
these places should disappear once pointers instead of uuids are
stored in the dive-structures.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This flag had two distinct uses:
- signal that dives were downloaded, not imported
- use to mark imported dives
Both are not used anymore, therefore remove the flag.
The uemis downloaded misused the flag to mark deleted
dives. Instead misuse the "hidden_by_filter" flag.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The Uemis downloader determines the dive-number to be downloaded
by either checking the download-table [interrupted connection] or
the global dive table [fresh download].
The downloadTable is passed in the device data structure, but
in the function to determine the latest dive, the global
downloadTable is accessed directly [thus supposing that this
table was passed in device data].
Instead, use the table from device data to avoid funny surprises
should we change to a non-global download table.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
- Variable max_deleted_seen had no effect and is removed.
- Results of read/write operations are evaluated to assert success
and to prevent compiler warnings.
Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
When performing a factory reset to an uemis, the object_ids within the divelog
will not be reset. Nevertheless, the dive numbers are reset to 1.
So, the first log will have a positive offset n to the first dive number.
The uemis-downloader used the object_id from the logs as a start point for
getDive, if dives were already synced before. This causes the sync to stall.
I prevent this by subtracting the lowest object_id from the requested before
using it as dive number.
Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
uemis-downloader downloads the dive spot for each dive, even if the same
location was already downloaded before within the ongoing synchronization run.
I modified the function "get_uemis_divespot" to remember all requested
divespot_ids and their mapping to uuids.
New helper functions:
- static void erase_divespot_mapping()
- static void add_to_divespot_mapping(int divespot_id,
uint32_t dive_site_uuid)
- static bool is_divespot_mappable(int divespot_id)
- static uint32_t get_dive_site_uuid_by_divespot_id(int divespot_id)
The memory leak is removed through the call of erade_divespot_mapping().
Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
get_matching_dive does not check if the DC wrote an acknowledgement for the requested dive.
As result, the sync stalls if dive number 0 is not available.
Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
downloadTable was declared twice in "dive.h". Remove one occurence.
Moreover, "uemis-downloader.c" also declared downloadTable. This can
likewise be removed, because "uemis-downloader.c" indirectly includes
"dive.h".
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
No idea why this now shows up as an error in the iOS build.
We need to refer to the typedef, not the underlying struct.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
This is important to not duplicate code for the Qml
view. Now the DownloadFromDiveComputer widget is mostly
free from important code (that has been upgraded to the
core folder), and I can start coding the QML interface.
There are still a few functions on the desktop widget
that will die so I can call them via the QML code later.
I also touched the location of a few globals (please, let's
stop using those) - because it was declared on the
desktop code and being used in the core.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Not using lrint(f) when converting double/float to int
creates rounding errors.
This error was detected by TestParse::testParseDM4 failure
on Windows. It was creating rounding inconsistencies
on Linux too, see change in TestDiveDM4.xml.
Enable -Wfloat-conversion for gcc version greater than 4.9.0
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
Using gcc option "-Wfloat-conversion" is useful to catch
potential conversion errors (where lrint should be used).
rint returns double and still raises the same warning,
this is why this change updates all rint calls to lrint.
In few places, where input type is a float, corresponding
lrinf is used.
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
It turns out that we are starting to have users that have logs that go
back that far. It won't be common, but let's get it right anyway.
NOTE! With us now supporting dates earlier in 1900, this also makes
"utc_mktime()" always add the "1900" to the year field. That way we
avoid ever using the fairly ambiguous two-digit shorthand.
It didn't use to be all that ambiguous when we knew that any two-digit
number less than 70 had to be 2000+. Now that we support going back to
earlier in the last centiry, that certainty is eroding.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Having subsurface-core as a directory name really messes with
autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an
autocomplete conflict and also was inconsistent with the desktop-widget
name for the directory containing the "other" UI.
And while cleaning up the resulting change in the path name for include
files, I decided to clean up those even more to make them consistent
overall.
This could have been handled in more commits, but since this requires a
make clean before the build, it seemed more sensible to do it all in one.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04 22:33:58 -07:00
Renamed from subsurface-core/uemis-downloader.c (Browse further)