Commit graph

388 commits

Author SHA1 Message Date
Miika Turkia
1bea48f9bd Fix bit shift on Suunto DB import
Let's do the bit shift properly and not by block size.

Fixes #906

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-09 23:55:03 -07:00
Miika Turkia
abbebef997 Divinglog import: ignore unsupported cylinders
Subsurface supports currently 8 cylinders, thus we should not attempt to
add more.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-03 22:21:19 -07:00
Salvador Cuñat
25f3038d40 RBT - Add save/load in xml file support
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-30 07:43:16 -07:00
Miika Turkia
76fe262a0f Allow creating new dive site with specific uuid
Test cases require deterministic results and thus we should allow uuid
to be specified when needed.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-24 13:20:57 -07:00
Miika Turkia
0d2d91a28c Cobalt import: use find or create divesite
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-24 13:20:40 -07:00
Miika Turkia
c2b45ab1e2 Divinglog import: find or create divesite
We obviously should lookup if the dive site already exist before
creating a new one.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-24 13:20:31 -07:00
Miika Turkia
aa4ed491fd Divinglog import: fix maximum depth
Max depth is recorded in floating point in metadata.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-23 06:30:39 -07:00
Miika Turkia
5d12723656 Divinglog import: update O2sensors and dive mode
This is my best guess, and I have no sample logs that would prove my
assumption.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-17 08:51:04 -07:00
Miika Turkia
6e109a2129 Divinglog import: added setpoint
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-17 08:51:01 -07:00
Miika Turkia
5e439cef63 Divinglog import: add cns value
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-17 08:50:57 -07:00
Miika Turkia
70198ef11b Divinglog import: ppo2 sensor readings
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-17 08:50:49 -07:00
Miika Turkia
2ace3195f4 Divinglog import: stop (deco) time added
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-13 15:21:30 -07:00
Miika Turkia
2ec9002beb Divinglog import: include NDL information
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-13 15:21:30 -07:00
Miika Turkia
5dd0b1bad5 Divinglog import: show stop depth / ceiling
This shows the ceiling as stored by Divinglog. (I am not sure if it is
DC reported ceiling, or just a calculated one.)

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-13 15:21:30 -07:00
Miika Turkia
669a8085d9 Divinglog import: include heartbeat info
Note, that this patch is not tested with real data as I do not have log
that would include heartbeat available.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-13 15:21:30 -07:00
Dirk Hohndel
3478943f2f Fix memory handling for taxonomy data
The way we freed things and cleared out the variables potentially left
dangling data behind and could end up calling free on garbage data,
leading to random crashes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-13 07:09:55 -07:00
Miika Turkia
c41fd91261 Divinglog import: generate gaschange events
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-12 13:58:17 -07:00
Miika Turkia
7fffe8aba0 Divinglog import: adding pressure samples
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-12 13:58:17 -07:00
Miika Turkia
e53897cd15 Divinglog import: grab information for cylinder 0
Cylinder 0 is stored on the Logbook table along with other dive metadata
(not in Tank table).

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-12 13:58:17 -07:00
Miika Turkia
c91ee860f2 Divinglog import: use dive ID as identifier
Since mapping cylinders requires use of dive ID, we might as well use
the ID to map the profile also.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-12 13:58:17 -07:00
Miika Turkia
a52fc86a1c Divinglog import: get cylinder information
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-12 13:58:17 -07:00
Miika Turkia
22b665cc14 Divinglog import: import temperature graph
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-12 13:58:17 -07:00
Miika Turkia
17bc868531 Divinglog import: add workload warning
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-12 13:58:17 -07:00
Miika Turkia
5bc4f974c5 Divinglog import: deco stop ignored event added
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-12 13:58:17 -07:00
Miika Turkia
0011d43711 Divinglog import: ascent warning added
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-12 13:58:16 -07:00
Miika Turkia
c91ecb62af Divinglog import: RBT warning event added
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-12 13:58:16 -07:00
Miika Turkia
495aab8f20 Divinglog import: in deco?
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-12 13:58:16 -07:00
Miika Turkia
90f7a6930a Divinglog import: parse depth from database
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-12 13:58:16 -07:00
Miika Turkia
c87d7d96b5 Divinglog import: import a bit more data from DB
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-12 13:58:16 -07:00
Miika Turkia
e98cbdf020 Divinglog import: basic dive info for DB import
This parses the basic metadata of a dive when importing Divinglog
database. (Discarding deleted dives is my best guess as I do not have
that in my sample dive.)

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-12 13:58:16 -07:00
Dirk Hohndel
08a451d24a More debug message cleanup
Remove several very noise messages on dive site handling (this seems to
work well now, so I think we can remove most of them - a couple were left
that indicate actual issues).

And also remove all the calls to "translate" when outputting data to
stderr. Error messages that indicate issues where the user will basically
have to come and ask the developers for help shouldn't be localized. They
should be in English to make it easier for us to figure out what's going
on.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02 11:22:22 -07:00
Dirk Hohndel
bc8c54f1ee Rename enum values for taxonomy
This avoids confusion and namespace collisions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02 10:22:31 -07:00
Dirk Hohndel
f7b7d4c2df Geo taxonomy: save and load the taxonomy data with XML
If taxonomy data are available we are switching a dive site entry from
single item with attributes to an item that has children. This is
backwards compatible and older versions will simply ignore the children.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 12:38:40 -07:00
Tomaz Canabrava
7071bf0e23 Do not mess with dive location automatically
This might be what the user wanted, but also might not
be it. So wait for the user to request it manually.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22 17:01:52 -07:00
Dirk Hohndel
2c0223fbb2 Fix missing curly braces that change control flow
Indentation thankfully is not the same as scope.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21 22:00:21 -07:00
Dirk Hohndel
66375689b8 Prevent null dereference
In each case there are scenarios where we would have dereferenced NULL.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21 21:53:53 -07:00
Dirk Hohndel
f5726c3d18 Fix a number of resource leaks
Free memory returned from parse_mkvi_value()
Free memory returned from printGPSCoords()
Free memory allocated in added_list and removed_list
Free memory allocated when adding suffix to dive site name
Free memory allocated in cache_deco_state()
Free memory allocated in build_filename()
Free memory allocated in get_utf8()
Free memory allocated in alloc_dive()
Free memory allocated as cache but never used

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21 21:13:32 -07:00
Dirk Hohndel
de35c88683 Track minimum datafile version
Add infrastructure and helper functions to track minimum datafile version.
To make this information useful we need to keep the XML and git data
format versions in track moving forward.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20 06:45:12 -07:00
Dirk Hohndel
c897b857fb We don't really need a long to count the dive sites
At least I hope not.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 11:42:15 -07:00
Dirk Hohndel
ccc9d80015 Remove all the no longer necessary code that aborts read of first V2 file
This was a poorly implemented hack when we executed the reverse geo lookup
in the main thread and opening a V2 file could take a very long time. We
need to do the "Welcome" message quite differently.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 14:41:56 -07:00
Dirk Hohndel
b0fc00694d Add "additional name" to the correct dive site
Adding the name to its own dive site was kind of silly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 13:03:37 -07:00
Dirk Hohndel
2c22b24ef6 When parsing V2 XML files try to be smarter when creating dive sites
Two "locations" from a V2 file are the same site if they have the same
name AND if their GPS coordinates are within 20 meters of each other.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 11:52:18 -07:00
Dirk Hohndel
53806c265c Create unique dive sites when downloading from webservice
The Subsurface Webservice (as backend for the companion app) will usually
send a lot of gps fixes encoded as dives, all with the same dive site
name. When parsing the XML file it sends we need to make the dive site
names unique so that we can then match them to the existing dives.

The fake dives with all the dives sites will all be discarded, but without
creating the unique dive sites we can't successfully add the GPS
coordinates to the existing dives.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 12:50:17 -07:00
Miika Turkia
16ac0bc45d Support for changed DM5 sample blob
Block size for sample is now variable, so detect the version and parse
proper blocks.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-02 10:48:46 -07:00
Robert C. Helling
22bfc4936f Add explicit casts to silence compiler warnings
clang complais when converting (char *) to (unsigned char *), so tell
it it's fine.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-28 08:16:37 -07:00
Paul-Erik Törrönen
cfa5403192 Fix typo
Loockup -> Lookup

Signed-off-by: Paul-Erik Törrönen <poltsi@777-team.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-21 16:05:09 -07:00
Miika Turkia
f7e86b5838 Import surface event from Suunto DB
This is actually relevant information when someone surfaces
accidentally, thus we should not ignore it.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-21 08:47:19 -07:00
Miika Turkia
21d1903656 Correct dive time in DLF import
Divesoft Freedom records the dive time in count of seconds since
1.1.2000 00:00:00, not noon.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 13:39:26 -07:00
Tomaz Canabrava
627de38c01 Get the location information in a separate thread
This makes Subsurface usable faster for those without a good internet
connection when they are opening an older data file.

While parsing, we are only feeding an vector of locations, after the
parsing is done, we traverse the vector searching for the information on
the web.

I need to also add a way to stop if there`s no internet connection - but
this will be another patch.

Also, fixed two small memory leaks from the old imp.

[Dirk Hohndel: cleaned up the whitespace mess]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-10 11:14:20 -07:00
Dirk Hohndel
6f7e3d04cb Handle XSLT based imports correctly
XSLT conversions create V2 XML files, but we shouldn't abort when we parse
those without having the user informed about the potential slowness - all
XSLT based imports are slow, anyway.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-22 13:20:27 -07:00