subsurface/dives
Salvador Cuñat 44b55bd1a2 Import Datatrak/WLog files
Sequentially parses a file, expected to be a Datatrak/WLog divelog, and
converts the dive info into Subsurface's dive structure.

As my first DC, back in 90s, was an Aladin Air X, the obvious choice of log
software was DTrak (Win version). After using it for some time we moved to WLog
(shareware software more user friendly than Dtrak, printing capable, and still
better, it runs under wine, which, as linux user, was definitive for me). Then,
some years later, my last Aladin died and I moved to an OSTC, forcing me to
look for a software that support this DC.
I found JDivelog which was capable of import Dtrak logs and used it for some
time until discovered Subsurface existence and devoted to it.

The fact was that importing Dtrak dives in JDivelog and then re-importing them
in Subsurface caused a significant data loss (mainly in the profile events and
alarms) and weird location of some other info in the dive notes (mostly tag
items in the original Dtrak software). This situation can't actually be solved
with tools like divelogs.de which causes similar if no greater data loss.

Although this won't be a core feature for Subsurface, I expect it can be useful
for some other divers as has been for me.

Comments and issues:

Datatrak/Wlog files include a lot of diving data which are not directly
supported in Subsurface, in these cases we choose mostly to use "tags".

The lack of some important info in Datatrak archives (e.g. tank's initial
pressure) forces us to do some arbitrary assumptions (e.g. initial pressure =
200 bar).

There might be archives coming directly from old DOS days, as first versions
of Datatrak run on that OS; they were coded CP437 or CP850, while dive logs
coming from Win versions seems to be coded CP1252. Finally, Wlog seems to use a
mixed confusing style. Program directly converts some of the old encoded chars
to iso8859 but is expected there be some issues with non alphabetic chars, e.g.
"ª".

There are two text fields: "Other activities" and "Dive notes", both limited to
256 char size. We have merged them in Subsurface's "Dive Notes" although the
first one could be "tagged", but we're unsure that the user had filled it in
a tag friendly way.

WLog adds some information to the dive and lets the user to write more than
256 chars notes. This is achieved, while keeping compatibility with DTrak
divelogs, by adding a complementary file named equally as the .log file and
with .add extension where all this info is stored.  We have, still, not worked
with this complementary files.

This work is based on the paper referenced in butracker #194 which has some
errors (e.g. beginning of log and beginning of dive are changed) and a lot of
bytes of unknown meaning. Example.log shows, at least, one more byte than those
referred in the paper for the O2 Aladin computer, this could be a byte referred
to the use of SCR but the lack of an OC dive with O2 computer makes impossible
for us to compare.

The only way we have figured out to distinguish a priori between SCR and non
SCR dives with O2 computers is that the dives are tagged with a "rebreather"
tag. Obviously this is not a very trusty way of doing things. In SCR dives,
the O2% in mix means, probably, the maximum O2% in the circuit, not the O2%
of the EAN mix in the tanks, which would be unknown in this case.

The list of DCs related in bug #194 paper seems incomplete, we have added
one or two from WLog and discarded those which are known to exist but whose
model is unknown, grouping them under the imaginative name of "unknown". The
list can easily be increased in the future if we ever know the models
identifiers.
BTW, in Example.log, 0x00 identifier is used for some DC dives and from my own
divelogs is inferred that 0x00 is used for manually entered dives, this could
easily be an error in Example.log coming from a preproduction DC model.

Example.log which is shipped in datatrak package is included in dives
directory for testing pourposes.

[Dirk Hohndel: some small cleanups, merged with latest master, support
               divesites, remove the pointless memset() before free() calls
	       add to cmake build]

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 10:03:08 -07:00
..
Dive_2013-02-02-1614.xml Suunto DM4 sample dive 2013-03-05 11:08:08 -08:00
Example.log Import Datatrak/WLog files 2015-03-10 10:03:08 -07:00
Poseidon_MkVILog.csv Replace Poseidon example dive log files in dives directory 2014-11-01 22:13:03 -07:00
Poseidon_MkVILog.txt Replace Poseidon example dive log files in dives directory 2014-11-01 22:13:03 -07:00
sac-test.xml Change gas in second cylinder in sac-test-dives 2013-12-02 12:33:47 -08:00
tank_pressure.xml Test dive for odd pressure profile 2014-01-01 09:48:15 -08:00
Test.csv Test dive for CSV import 2013-10-02 10:18:16 -07:00
test0.xml Change fake profile behavior 2014-01-08 21:54:29 +08:00
test0b.xml Change fake profile behavior 2014-01-08 21:54:29 +08:00
test1.xml
test2.xml
test3.xml
test4.xml
test5.xml
test6.xml
test7.xml
test8.xml
test9.xml
test9a.xml Prevent potential math overflow in new profile 2014-01-21 14:07:10 -08:00
test10.xml
test11.xml
test12.xml
test13.xml
test14.xml
test15.xml
test16.xml
test17.xml
test18.xml Fix the description of test dive cylinders 2014-07-15 20:46:02 -07:00
test19.xml Fix the description of test dive cylinders 2014-07-15 20:46:02 -07:00
test20.xml Fix the description of test dive cylinders 2014-07-15 20:46:02 -07:00
test21.xml Adjust test dives to comply with the current trip syntax 2013-05-16 00:36:34 -04:00
test22.xml Adjust test dives to comply with the current trip syntax 2013-05-16 00:36:34 -04:00
test23.xml Adjust test dives to comply with the current trip syntax 2013-05-16 00:36:34 -04:00
test24.xml
test25.xml
test26.xml
test27.xml Add test dive for constant temperature 2013-01-24 13:19:16 -08:00
test28.xml Different Icon for a Bookmark Event. 2013-12-04 19:41:29 -08:00
test29.xml Correctly parse multiple tags in the divelog 2013-12-12 16:29:06 -08:00
test30.xml Test dive for events 2013-12-28 07:40:54 -08:00
test31.xml Include images in profile 2014-02-06 11:29:23 -08:00
test32.xml Add test dive to show erroneous pp graphs 2014-03-15 15:01:08 -07:00
test33.xml Add test dive that has an unused cylinder 2014-04-05 16:12:16 -07:00
test34.xml Add test dive that shows heart rate 2014-04-07 14:20:01 -07:00
test35.xml Add beginning of pretend CCR XML file 2014-06-11 19:03:30 -07:00
test36.xml Add test dive with heart rate information 2014-07-29 15:43:52 -07:00
test38.xml Load and save extra data in Subsurface XML format 2014-11-07 12:59:15 -08:00
test40.xml CCR test dive 2014-11-17 00:24:33 +00:00
test50.xml Test dives for duplicate names and conflicting GPS 2015-02-14 18:13:35 -08:00
TestAPDLogViewer.csv Sample dive from APDLogViewer 2013-10-03 09:39:37 -07:00
TestComma.csv Allow comma separated CSV files 2013-12-04 15:27:09 -08:00
TestDiveDivelogsDE.DLD Add two more versions of this dive from divelogs.de 2013-02-25 22:07:05 -08:00
TestDiveDivelogsDE.udcf Add two more versions of this dive from divelogs.de 2013-02-25 22:07:05 -08:00
TestDiveDivingLog5.08.udcf Update DivingLog 5.08 export files 2013-02-26 08:39:09 -08:00
TestDiveDivingLog5.08.uddf Update DivingLog 5.08 export files 2013-02-26 08:39:09 -08:00
TestDiveDivingLog5.08allimperial.xml Update DivingLog 5.08 export files 2013-02-26 08:39:09 -08:00
TestDiveDivingLog5.08allmetric.xml Test dives 2013-02-26 08:50:05 -08:00
TestDiveDivingLog5.08allmetric.zip Update DivingLog 5.08 export files 2013-02-26 08:39:09 -08:00
TestDiveDM3.SDE Add the same test dive in a number of different formats 2013-02-25 20:28:58 -08:00
TestDiveDM4.db Suunto DM4 sample dive 2013-03-05 11:08:08 -08:00
TestDiveJDiveLog.jlb Removing MacRoman encoding from sample dive 2014-02-25 12:28:49 -08:00
TestDiveSeabearHUDC.csv Add test dive for Seabear HUDC 2014-10-28 07:25:34 -07:00
TestSensusSingle.csv Sample log from Sensus Ultra, exported in CSV 2014-01-17 05:57:29 +07:00
TestXP5_de.csv Sample dive from XP5 2013-12-24 10:43:29 -08:00