2014-10-27 4:16 GMT+01:00 Dirk Hohndel <[email protected]>:

>
> > 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".
>
> Why is this (and the following comments) in "we" form? Did you collaborate
> with someone on these patches?
>

I didn't, but, when  writing english I tend to use "we" to avoid the
constat repetition I,I,I,me,me,me ...
I know, I know, I'm too shy  ;-)   We (spanish) don't have that problem as
our verb forms includes
the person in most situations.


> > 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.
>
> Have you found others who have old divelogs from this software?
>

No.  The divers I know  who are still using Aladin  (Air X/Z, Pro, ...) nor
even download the
info from their DCs  (and probably never did).  Said this, I still see a
number of those devices in use,
but don't know  all those guys.  My son (16 y.o. and recently certified
OWD) has just inherited his
uncle's Aladin Pro;  now he only needs his father to build an interface to
download the data (which
can be very, very, long time as I'm a real moron with the soldering iron).

> +
> +
> +static int two_bytes_to_int(unsigned char x, unsigned char y) {
> +
> +     return (x << 8) + y;
> +}

Take a look at the coding style. The opening '{' on a function should be
> in column 1 of the folowing line. This seems to be wrong everywhere.
>
>
Unforgivable.  Never did like this before. When I noticed, I thought it was
because of the
settings in QT-Creator taken from the CodingStyle file and didn't paid more
attention.
Corrected in the whole file.

Also, this function will get you in trouble on systems where int is only
> 16 bits (admittedly, not a major concern these days, but on principle...
> why is the result signed?)
>
> > +static long four_bytes_to_long(unsigned char x, unsigned char y,
> unsigned char z, unsigned char t) {
> > +
> > +     return (((long)x << 24) + ((long)y << 16) + ((long)z << 8) +
> ((long)t));
> > +}
>
> Same comments again. If long is 32 bit you are in trouble. Can this be
> unsigned, please?
>
> > +static unsigned char* byte_to_bits(unsigned char byte) {
> > +
> > +     unsigned char i, *bits = (unsigned char*) malloc(8 *
> sizeof(unsigned char));
>
> sizeof(unsigned char) is always 1. Well, technically that's only
> guaranteed in C++, I guess. But I'm not aware of any C compiler today
> (certainly not on Windows, Mac, Linux) that does anything else.
>
> Changed to unsigned both of them. You are right, off course.


> > +
> > +     for (i = 0; i < 8; i++) {
> > +             bits[i] = (byte & (unsigned char) pow(2,i))/pow(2,i);
>
> Yikes... this can be done much easier with shifts...
>

Sure.  Also, bits[i] don't needs to be 0 or 1, just  != 0 so changed to
                            bits[i] = (byte & (1 << i));

>
> > +static time_t date_time_to_ssrfc(long date, int time) {
> > +
> > +     time_t tmp;
> > +     tmp = ((date -135140)*86400)+(time*60);
> > +     return tmp;
> > +}
>
> Fascinating formula - seriously, this is in days since Jan 1st, 1600?
> This really deserves a comment, don't you think?
>
>
Seriously.  It don't seems to come from aladin data, probably is a datatrak
"feature".
May be those guys were remembering Giordano Bruno burnt to death in the
pyre of
the Inquisition.  Don't know.
Commented on the code.


This also deserves some comments
> > +
> > +/*
> > + * Shameless copy paste from dive.c add_sample() with ligth changes
>
> ligth?
>
> I meant "slight".  add_sample() seems excessively complex for its job. I
thik we don't
really need to pass the pointer to the predefined sample structure, just to
catch the
returned one.  This said add_sample() is working fine from long, so I've
moved the
code to it, removing add_dt_sample().


> > + */
> > +static struct sample *add_dt_sample(int time, struct divecomputer *dc)
> > +{
> > +     struct sample *p = prepare_sample(dc);
> > +
> > +     if (p) {
> > +             p->time.seconds = time;
> > +             finish_sample(dc);
> > +     }
> > +     return p;
> > +}
>


> > +     if (two_bytes_to_int (lector_bytes[0],lector_bytes[1]) != 0xA000) {
>
> more whitespace issues.....^^^
>

> +             printf("ERROR, Byte = %4x\n", two_bytes_to_int
> (lector_bytes[0],lector_bytes[1]));
>
> and more of the same.........................................^^^^
>
> Hmmmm, this kind issues are difficult to completely avoid.   Re-readed the
full code and found some
more, all  fixed, but may be there are more here and there.

> +     switch (tmp_1byte) {
> > +             case 1:
> > +                     dt_dive->dc.surface_pressure.mbar = 1013;
> > +                     break;
> > +             case 2:
> > +                     dt_dive->dc.surface_pressure.mbar = 928;
> > +                     break;
> > +             case 3:
> > +                     dt_dive->dc.surface_pressure.mbar = 806;
> > +                     break;
> > +             case 4:
> > +                     dt_dive->dc.surface_pressure.mbar = 684;
> > +                     break;
>
> It would be nice to have the altitude ranges in comments.
> 735m, 1888m, 3194m seem very odd thresholds. Or maybe you used a different
> conversion formula?
>
> Those values were a bold approximation to be recalculated, just forgot to
do it.  I 've changed them
to more accurate values.  Included the ranges and the formula in the code
comments.


> > +                     dt_dive->suit =
> strdup(QT_TRANSLATE_NOOP("gettextFromC","No suit"));
>
> Again, whitespace... you want a space between comma and double
> quote..........^^^
>

There were a lot of these   (copy/paste).  Cleaned all of them  (I think).


> > +     if (tmp_2bytes != 0x7fff) {
> > +             dt_dive->watertemp.mkelvin = dt_dive->dc.watertemp.mkelvin
> = C_to_mkelvin((double)(tmp_2bytes/100));
> > +     } else {
> > +             dt_dive->watertemp.mkelvin = 0;
> > +     }
>
> You don't really need the curly braces here...
>

No, really not.  Just a personal taste, but its aginst the CodingStyle.
Removed all I've seen.


> Not a lot of issues, but enough for me to ask you to resubmit.
>
> /D
>

Attached is the improved patch.  It merges against git-  4fa3f89  and seems
to break nothing, although
really adds some strings to translate.

Regards.

Salva.
From 4a33ff82c393256279c4287d63b66e488b7f4962 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Salvador=20Cu=C3=B1at?= <[email protected]>
Date: Fri, 31 Oct 2014 19:09:16 +0100
Subject: [PATCH] Import Datatrak/WLog files
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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 an 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.

Signed-off-by: Salvador Cuñat <[email protected]>
---
 datatrak.c           |  688 ++++++++++++++++++++++++++++++++++++++++++++++++++
 datatrak.h           |   34 +++
 dive.c               |    2 +-
 dives/Example.log    |  Bin 0 -> 26340 bytes
 file.c               |    7 +
 qt-ui/mainwindow.cpp |    4 +-
 subsurface.pro       |    6 +-
 7 files changed, 737 insertions(+), 4 deletions(-)
 create mode 100644 datatrak.c
 create mode 100644 datatrak.h
 create mode 100644 dives/Example.log

diff --git a/datatrak.c b/datatrak.c
new file mode 100644
index 0000000..731bbbc
--- /dev/null
+++ b/datatrak.c
@@ -0,0 +1,688 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+
+#include "datatrak.h"
+#include "dive.h"
+#include "units.h"
+#include "device.h"
+#include "gettext.h"
+
+extern struct sample *add_sample(struct sample *sample, int time, struct divecomputer *dc);
+
+unsigned char lector_bytes[2], lector_word[4], tmp_1byte, *byte;
+unsigned int tmp_2bytes;
+char is_nitrox, is_O2, is_SCR;
+unsigned long tmp_4bytes;
+
+
+static unsigned int two_bytes_to_int(unsigned char x, unsigned char y)
+{
+	return (x << 8) + y;
+}
+
+static unsigned long four_bytes_to_long(unsigned char x, unsigned char y, unsigned char z, unsigned char t)
+{
+	return (((long)x << 24) + ((long)y << 16) + ((long)z << 8) + ((long)t));
+}
+
+static unsigned char* byte_to_bits(unsigned char byte)
+{
+	unsigned char i, *bits = (unsigned char*) malloc(8 * sizeof(unsigned char));
+
+	for (i = 0; i < 8; i++) {
+		bits[i] = (byte & (1 << i));
+	}
+	return bits;
+}
+
+/*
+ * Datatrak stores the date in days since 01-01-1600, while Subsurface uses
+ * time_t (seconds since 00:00 01-01-1970). Function substracts
+ * (1970 - 1600) * 365,2425 = 135139,725  to our date variable, getting the
+ * days since Epoch.
+ */
+static time_t date_time_to_ssrfc(unsigned long date, int time)
+{
+	time_t tmp;
+	tmp = ((date - 135140) * 86400) + (time * 60);
+	return tmp;
+}
+
+static unsigned char to_8859(unsigned char char_cp850)
+{
+	unsigned char outchar;
+	unsigned char char_8859[46] = {0xc7, 0xfc, 0xe9, 0xe2, 0xe4, 0xe0, 0xe5, 0xe7,
+				      0xea, 0xeb, 0xe8, 0xef, 0xee, 0xec, 0xc4, 0xc5,
+				      0xc9, 0xe6, 0xc6, 0xf4, 0xf6, 0xf2, 0xfb, 0xf9,
+				      0xff, 0xd6, 0xdc, 0xf8, 0xa3, 0xd8, 0xd7, 0x66,
+				      0xe1, 0xed, 0xf3, 0xfa, 0xf1, 0xd1, 0xaa, 0xba,
+				      0xbf, 0xae, 0xac, 0xbd, 0xbc, 0xa1};
+	outchar = char_8859[char_cp850 - 0x80];
+	return (outchar);
+}
+
+static char *to_utf8(unsigned char *in_string)
+{
+	int outlen, inlen, i=0, j=0;
+	inlen = strlen(in_string);
+	outlen = (inlen * 2) + 1;
+
+	char *out_string = calloc(outlen, sizeof(char));
+	for (i = 0; i < inlen; i++) {
+		if (in_string[i] < 127)
+			out_string[j] = in_string[i];
+		else {
+			if (in_string[i] > 127 && in_string[i] <= 173)
+				in_string[i] = to_8859(in_string[i]);
+			out_string[j] = (in_string[i] >> 6) | 0xC0;
+			j++;
+			out_string[j] = (in_string[i] & 0x3F) | 0x80;
+		}
+		j++;
+	}
+	out_string[j+1] = '\0';
+	return(out_string);
+}
+
+/*
+ * Subsurface sample structure doesn't support the flags and alarms in the dt .log
+ * so will treat them as dc events.
+ */
+static struct sample *dtrak_profile(struct dive *dt_dive, FILE* archivo)
+{
+	int i, j = 1, interval, o2percent = dt_dive->cylinder[0].gasmix.o2.permille / 10;
+	struct sample *sample = dt_dive->dc.sample;
+	struct divecomputer *dc = &dt_dive->dc;
+
+	for (i = 1; i <= dt_dive->dc.alloc_samples; i++) {
+		fread(&lector_bytes, sizeof(unsigned char), 2, archivo);
+		interval= 20 * (i + 1);
+		sample = add_sample(sample, interval, dc);
+		sample->depth.mm = ((two_bytes_to_int(lector_bytes[0], lector_bytes[1]) & 0xFFC0) * 1000 / 410);
+		byte = byte_to_bits(two_bytes_to_int(lector_bytes[0], lector_bytes[1]) & 0x003F);
+		if (byte[0] != 0)
+			sample->in_deco = true;
+		if (byte[1] != 0)
+			add_event(dc, sample->time.seconds, 0, 0, 0, "rbt");
+		if (byte[2] != 0)
+			add_event(dc, sample->time.seconds, 0, 0, 0, "ascent");
+		if (byte[3] != 0)
+			add_event(dc, sample->time.seconds, 0, 0, 0, "ceiling");
+		if (byte[4] != 0)
+			add_event(dc, sample->time.seconds, 0, 0, 0, "workload");
+		if (byte[5] != 0)
+			add_event(dc, sample->time.seconds, 0, 0, 0, "transmitter");
+		if (j == 3) {
+			read_bytes(1);
+			if (is_O2) {
+				read_bytes(1);
+				o2percent = tmp_1byte;
+			}
+			j = 0;
+		}
+		if (is_O2)
+			// In commit 5f44fdd setpoint replaced po2, so although this is not necesarily CCR dive ...
+			sample->setpoint.mbar = calculate_depth_to_mbar(sample->depth.mm, dt_dive->surface_pressure, 0) * o2percent / 100;
+		j++;
+	}
+	return(sample);
+}
+
+/*
+ * Reads the header of a file and returns the header struct
+ * If it's not a DATATRAK file returns header zero initalized
+ */
+static dtrakheader read_file_header(FILE* archivo)
+{
+	dtrakheader fileheader = {0,0,0,0};
+	const short headerbytes = 12;
+	unsigned char *lector = (unsigned char *) malloc(headerbytes * sizeof(unsigned char));
+
+	fread(lector, sizeof(unsigned char), headerbytes, archivo);
+	if (two_bytes_to_int(lector[0], lector[1]) != 0xA100) {
+		puts("Error, el archivo no parece un divelog DATATRAK");
+		return(fileheader);
+	}
+	fileheader.header = (lector[0] << 8) + lector[1];
+	fileheader.dc_serial_1 = two_bytes_to_int(lector[2], lector[3]);
+	fileheader.dc_serial_2 = two_bytes_to_int(lector[4], lector[5]);
+	fileheader.divesNum = two_bytes_to_int (lector[7], lector[6]);
+	free(lector);
+	return(fileheader);
+}
+
+
+/*
+ * Parses the dive extracting its data and filling a subsurface's dive structure
+ */
+static struct dive dt_dive_parser(FILE* archivo, struct dive *dt_dive)
+{
+	unsigned char n;
+	int  profile_length;
+	char *tmp_notes_str = NULL;
+	unsigned char	*tmp_string1 = NULL,
+			*locality = NULL,
+			*dive_point = NULL,
+			buffer[1024];
+	struct divecomputer *dc = &dt_dive->dc;
+
+	is_nitrox = is_O2 = is_SCR = 0;
+
+	/*
+	 * Parse byte to byte till next dive entry
+	 */
+	n = 0;
+	fread(&lector_bytes[n], sizeof(char), 1, archivo);
+	while (lector_bytes[n] != 0xA0) {
+		fread(&lector_bytes[n], sizeof(char), 1, archivo);
+	}
+
+	/*
+	 * Found dive header 0xA000, verify second byte
+	 */
+	fread(&lector_bytes[n+1], sizeof(char), 1, archivo);
+	if (two_bytes_to_int(lector_bytes[0], lector_bytes[1]) != 0xA000) {
+		printf("ERROR, Byte = %4x\n", two_bytes_to_int(lector_bytes[0], lector_bytes[1]));
+		dt_dive = NULL;
+		return(*dt_dive);
+	}
+
+	/*
+	 * Begin parsing
+	 * First, Date of dive, 4 bytes
+	 */
+	read_bytes(4);
+
+
+	/*
+	 * Next, Time in minutes since 00:00
+	 */
+	read_bytes(2);
+
+	dt_dive->dc.when = dt_dive->when = (timestamp_t) date_time_to_ssrfc(tmp_4bytes, tmp_2bytes);
+
+	/*
+	 * Now, Locality, 1st byte is long of string, rest is string
+	 */
+	read_bytes(1);
+	read_string(locality);
+
+	/*
+	 * Next, Dive point, defined as Locality
+	 */
+	read_bytes(1);
+	read_string(dive_point);
+
+	/*
+	 * Subsurface only have a location variable, so we have to merge DTrak's
+	 * Locality and Dive points.
+	 */
+	snprintf(buffer, sizeof(buffer), "%s, %s", locality, dive_point);
+	dt_dive->location = strdup(buffer);
+	memset(dive_point, 0, sizeof(dive_point));
+	memset(locality, 0, sizeof(locality));
+	free(locality);
+	free(dive_point);
+
+	/*
+	 * Altitude. Don't exist in Subsurface, the equivalent would be
+	 * surface air pressure which can, be calculated from altitude.
+	 * As dtrak registers altitude intervals, we, arbitrarily, choose
+	 * the lower altitude/pressure equivalence for each segment. So
+	 *
+	 * Datatrak table            *  Conversion formula:
+	 *                           *
+	 * byte = 1   0 - 700 m      *  P = P0 * exp(-(g * M * h ) / (R * T0))
+	 * byte = 2   700 - 1700m    *  P0 = sealevel pressure = 101325 Pa
+	 * byte = 3   1700 - 2700 m  *  g = grav. acceleration = 9,80665 m/s²
+	 * byte = 4   2700 -  *   m  *  M = molar mass (dry air) = 0,0289644 Kg/mol
+	 *                           *  h = altitude over sea level (m)
+	 *                           *  R = Universal gas constant = 8,31447 J/(mol*K)
+	 *                           *  T0 = sea level standard temperature = 288,15 K
+	 */
+	read_bytes(1);
+	switch (tmp_1byte) {
+		case 1:
+			dt_dive->dc.surface_pressure.mbar = 1013;
+			break;
+		case 2:
+			dt_dive->dc.surface_pressure.mbar = 932;
+			break;
+		case 3:
+			dt_dive->dc.surface_pressure.mbar = 828;
+			break;
+		case 4:
+			dt_dive->dc.surface_pressure.mbar = 735;
+			break;
+		default:
+			dt_dive->dc.surface_pressure.mbar = 1013;
+	}
+
+	/*
+	 * Interval (minutes)
+	 */
+	read_bytes(2);
+	if (tmp_2bytes != 0x7FFF)
+		dt_dive->dc.surfacetime.seconds = (uint32_t) tmp_2bytes * 60;
+
+	/*
+	 * Weather, values table, 0 to 6
+	 * Subsurface don't have this record but we can use tags
+	 */
+	dt_dive->tag_list = NULL;
+	read_bytes(1);
+	switch (tmp_1byte) {
+		case 1:
+			taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "clear")));
+			break;
+		case 2:
+			taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "misty")));
+			break;
+		case 3:
+			taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "fog")));
+			break;
+		case 4:
+			taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "rain")));
+			break;
+		case 5:
+			taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "storm")));
+			break;
+		case 6:
+			taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "snow")));
+			break;
+		default:
+			// unknown, do nothing
+			break;
+	}
+
+	/*
+	 * Air Temperature
+	 */
+	read_bytes(2);
+	if (tmp_2bytes != 0x7FFF)
+		dt_dive->dc.airtemp.mkelvin = C_to_mkelvin((double)(tmp_2bytes / 100));
+
+	/*
+	 * Dive suit, values table, 0 to 6
+	 */
+	read_bytes(1);
+	switch (tmp_1byte) {
+		case 1:
+			dt_dive->suit = strdup(QT_TRANSLATE_NOOP("gettextFromC", "No suit"));
+			break;
+		case 2:
+			dt_dive->suit = strdup(QT_TRANSLATE_NOOP("gettextFromC", "Shorty"));
+			break;
+		case 3:
+			dt_dive->suit = strdup(QT_TRANSLATE_NOOP("gettextFromC", "Combi"));
+			break;
+		case 4:
+			dt_dive->suit = strdup(QT_TRANSLATE_NOOP("gettextFromC", "Wet suit"));
+			break;
+		case 5:
+			dt_dive->suit = strdup(QT_TRANSLATE_NOOP("gettextFromC", "Semidry suit"));
+			break;
+		case 6:
+			dt_dive->suit = strdup(QT_TRANSLATE_NOOP("gettextFromC", "Dry suit"));
+			break;
+		default:
+			// unknown, do nothing
+			break;
+	}
+
+	/*
+	 * Tank, volume size in liter*100. And initialize gasmix to air (default).
+	 * Dtrak don't record init and end pressures, but consumed bar, so let's
+	 * init a default pressure of 200 bar.
+	 */
+	read_bytes(2);
+	if (tmp_2bytes != 0x7FFF) {
+		dt_dive->cylinder[0].type.size.mliter = tmp_2bytes * 10;
+		dt_dive->cylinder[0].type.description = strdup("");
+		dt_dive->cylinder[0].start.mbar = 200000;
+		dt_dive->cylinder[0].gasmix.he.permille = 0;
+		dt_dive->cylinder[0].gasmix.o2.permille = 210;
+		dt_dive->cylinder[0].manually_added = true;
+	}
+
+	/*
+	 * Maximum depth, in cm.
+	 */
+	read_bytes(2);
+	if (tmp_2bytes != 0x7FFF)
+		dt_dive->maxdepth.mm = dt_dive->dc.maxdepth.mm = (int32_t) tmp_2bytes * 10;
+
+	/*
+	 * Dive time in minutes.
+	 */
+	read_bytes(2);
+	if (tmp_2bytes != 0x7FFF)
+		dt_dive->duration.seconds = dt_dive->dc.duration.seconds = (uint32_t) tmp_2bytes * 60;
+
+	/*
+	 * Minimum water temperature in C*100. If unknown, set it to 0K which
+	 * is subsurface's value for "unknown"
+	 */
+	read_bytes(2);
+	if (tmp_2bytes != 0x7fff)
+		dt_dive->watertemp.mkelvin = dt_dive->dc.watertemp.mkelvin = C_to_mkelvin((double)(tmp_2bytes / 100));
+	else
+		dt_dive->watertemp.mkelvin = 0;
+
+	/*
+	 * Air used in bar*100.
+	 */
+	read_bytes(2);
+	if ((tmp_2bytes != 0x7FFF) && (dt_dive->cylinder[0].type.size.mliter))
+		dt_dive->cylinder[0].gas_used.mliter = dt_dive->cylinder[0].type.size.mliter * (tmp_2bytes / 100.0);
+
+	/*
+	 * Dive Type 1 -  Bit table. Subsurface don't have this record, but
+	 * will use tags. Bits 0 and 1 are not used. Reuse coincident tags.
+	 */
+	read_bytes(1);
+	byte = byte_to_bits(tmp_1byte);
+	if (byte[2] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "no stop")));
+	if (byte[3] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "deco")));
+	if (byte[4] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "single ascent")));
+	if (byte[5] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "multiple ascent")));
+	if (byte[6] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "fresh")));
+	if (byte[7] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "salt water")));
+
+	/*
+	 * Dive Type 2 - Bit table, use tags again
+	 */
+	read_bytes (1);
+	byte = byte_to_bits(tmp_1byte);
+	if (byte[0] != 0) {
+		taglist_add_tag(&dt_dive->tag_list, strdup("nitrox"));
+		is_nitrox = 1;
+	}
+	if (byte[1] != 0) {
+		taglist_add_tag(&dt_dive->tag_list, strdup("rebreather"));
+		is_SCR = 1;
+	}
+
+	/*
+	 *  Dive Activity 1 - Bit table, use tags again
+	 */
+	read_bytes(1);
+	byte = byte_to_bits(tmp_1byte);
+	if (byte[0] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "sight seeing")));
+	if (byte[1] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "club dive")));
+	if (byte[2] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "instructor")));
+	if (byte[3] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "instruction")));
+	if (byte[4] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "night")));
+	if (byte[5] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "cave")));
+	if (byte[6] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "ice")));
+	if (byte[7] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "search")));
+
+
+	/*
+	 * Dive Activity 2 - Bit table, use tags again
+	 */
+	read_bytes(1);
+	byte = byte_to_bits(tmp_1byte);
+	if (byte[0] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "wreck")));
+	if (byte[1] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "river")));
+	if (byte[2] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "drift")));
+	if (byte[3] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "photo")));
+	if (byte[4] != 0)
+		taglist_add_tag(&dt_dive->tag_list, strdup(QT_TRANSLATE_NOOP("gettextFromC", "other")));
+
+	/*
+	 * Other activities - String  1st byte = long
+	 * Will put this in dive notes before the true notes
+	 */
+	read_bytes(1);
+	if (tmp_1byte != 0) {
+		read_string(tmp_string1);
+		snprintf(buffer, sizeof(buffer), "%s: %s\n",
+				QT_TRANSLATE_NOOP("gettextFromC", "Other activities"),
+				tmp_string1);
+		tmp_notes_str = strdup(buffer);
+		memset(tmp_string1, 0, sizeof(tmp_string1));
+		free(tmp_string1);
+	}
+
+	/*
+	 * Dive buddies
+	 */
+	read_bytes(1);
+	if (tmp_1byte != 0) {
+		read_string(tmp_string1);
+		dt_dive->buddy = strdup(tmp_string1);
+		memset(tmp_string1, 0, sizeof(tmp_string1));
+		free(tmp_string1);
+	}
+
+	/*
+	 * Dive notes
+	 */
+	read_bytes(1);
+	if (tmp_1byte != 0) {
+		read_string(tmp_string1);
+		int len = snprintf(buffer, sizeof(buffer), "%s%s:\n%s",
+				tmp_notes_str ? tmp_notes_str : "",
+				QT_TRANSLATE_NOOP("gettextFromC", "Datatrak/Wlog notes"),
+				tmp_string1);
+		dt_dive->notes = calloc((len +1), sizeof(char));
+		dt_dive->notes = memcpy(dt_dive->notes, buffer, len);
+		memset(tmp_string1, 0, sizeof(tmp_string1));
+		free(tmp_string1);
+		if (tmp_notes_str != NULL) {
+			memset(tmp_notes_str, 0, sizeof(tmp_notes_str));
+			free(tmp_notes_str);
+		}
+	}
+
+	/*
+	 * Alarms 1 - Bit table - Not in Subsurface, we use the profile
+	 */
+	read_bytes(1);
+
+	/*
+	 * Alarms 2 - Bit table - Not in Subsurface, we use the profile
+	 */
+	read_bytes(1);
+
+	/*
+	 * Dive number  (in datatrak, after import user has to renumber)
+	 */
+	read_bytes(2);
+	dt_dive->number = tmp_2bytes;
+
+	/*
+	 * Computer timestamp - Useless for Subsurface
+	 */
+	read_bytes(4);
+
+	/*
+	 * Model - table - Not included 0x14, 0x24, 0x41, and 0x73
+	 * known to exist, but not its model name - To add in the future.
+	 * Strangely 0x00 serves for manually added dives and a dc too, at
+	 * least in EXAMPLE.LOG file, shipped with the software.
+	 */
+	read_bytes(1);
+	switch(tmp_1byte) {
+		case (0x00):
+			dt_dive->dc.model = strdup(QT_TRANSLATE_NOOP("gettextFromC", "Manually entered dive"));
+			break;
+		case (0x1C):
+			dt_dive->dc.model = strdup("Aladin Air");
+			break;
+		case (0x1D):
+			dt_dive->dc.model = strdup("Spiro Monitor 2 plus");
+			break;
+		case (0x1E):
+			dt_dive->dc.model = strdup("Aladin Sport");
+			break;
+		case (0x1F):
+			dt_dive->dc.model = strdup("Aladin Pro");
+			break;
+		case (0x34):
+			dt_dive->dc.model = strdup("Aladin Air X");
+			break;
+		case (0x3D):
+			dt_dive->dc.model = strdup("Spiro Monitor 2 plus");
+			break;
+		case (0x3F):
+			dt_dive->dc.model = strdup("Mares Genius");
+			break;
+		case (0x44):
+			dt_dive->dc.model = strdup("Aladin Air X");
+			break;
+		case (0x48):
+			dt_dive->dc.model = strdup("Spiro Monitor 3 Air");
+			break;
+		case (0xA4):
+			dt_dive->dc.model = strdup("Aladin Air X O2");
+			break;
+		case (0xB1):
+			dt_dive->dc.model = strdup("Citizen Hyper Aqualand");
+			break;
+		case (0xB2):
+			dt_dive->dc.model = strdup("Citizen ProMaster");
+			break;
+		case (0xB3):
+			dt_dive->dc.model = strdup("Mares Guardian");
+			break;
+		case (0xBC):
+			dt_dive->dc.model = strdup("Aladin Air X Nitrox");
+			break;
+		case (0xF4):
+			dt_dive->dc.model = strdup("Aladin Air X Nitrox");
+			break;
+		case (0xFF):
+			dt_dive->dc.model = strdup("Aladin Pro Nitrox");
+			break;
+		default:
+			dt_dive->dc.model = strdup(QT_TRANSLATE_NOOP("gettextFromC", "Unknown"));
+			break;
+	}
+	if ((tmp_1byte & 0xF0) == 0xF0)
+		is_nitrox = 1;
+	if ((tmp_1byte & 0xF0) == 0xA0)
+		is_O2 = 1;
+
+	/*
+	 * Air usage, unknown use. Probably allows or deny manually entering gas
+	 * comsumption based on dc model - Useless for Subsurface
+	 */
+	read_bytes(1);
+	fseek(archivo, 6, 1);	// jump over 6 bytes whitout known use
+
+	/*
+	 * Profile data length
+	 */
+	read_bytes(2);
+	profile_length = tmp_2bytes;
+	if (profile_length != 0) {
+
+		/*
+		 * 8 x 2 bytes for the tissues saturation useless for subsurface
+		 * and other 6 bytes without known use
+		 */
+		fseek(archivo, 22, 1);
+		if (is_nitrox || is_O2) {
+
+			/*
+			 * CNS  % (unsure) values table (only nitrox computers)
+			 */
+			read_bytes(1);
+
+			/*
+			 * % O2 in nitrox mix - (only nitrox and O2 computers but differents)
+			 */
+			read_bytes(1);
+			if (is_nitrox) {
+				dt_dive->cylinder[0].gasmix.o2.permille =
+						(tmp_1byte & 0x0F ? 20.0 + 2 * (tmp_1byte & 0x0F) : 21.0) * 10;
+			} else {
+				dt_dive->cylinder[0].gasmix.o2.permille = tmp_1byte * 10;
+				read_bytes(1)  // Jump over one byte, unknown use
+			}
+		}
+		/*
+		 * profileLength = Nº bytes, need to know how many samples are there.
+		 * 2bytes per sample plus another one each three samples. Also includes the
+		 * bytes jumped over (22) and the nitrox (2) or O2 (3).
+		 */
+		int samplenum = is_O2 ? ((profile_length - 25) * 3 / 8) : ((profile_length - 24) * 3 / 7);
+
+		dc->events = calloc(samplenum, sizeof(struct event));
+		dc->alloc_samples = samplenum;
+		dc->samples = 0;
+		dc->sample = calloc(samplenum, sizeof(struct sample));
+
+		dtrak_profile(dt_dive, archivo);
+	}
+	/*
+	 * Initialize some dive data not supported by Datatrak/WLog
+	 */
+	if (!strcmp(dt_dive->dc.model, "Manually entered dive"))
+		dt_dive->dc.deviceid = 0;
+	else
+		dt_dive->dc.deviceid = 0xffffffff;
+	create_device_node(dt_dive->dc.model, dt_dive->dc.deviceid, "", "", dt_dive->dc.model);
+	dt_dive->dc.next = NULL;
+	if (!is_SCR) {
+		dt_dive->cylinder[0].end.mbar = dt_dive->cylinder[0].start.mbar -
+			((dt_dive->cylinder[0].gas_used.mliter / dt_dive->cylinder[0].type.size.mliter) * 1000);
+	} else
+		dt_dive->dc.dctype = CCR;	// Well, actually false but necesary for correct po2 display on
+						// profile and info box as result of commit 5f44fdd
+	return(*dt_dive);
+}
+
+void datatrak_import(const char *file, struct dive_table *table)
+{
+	FILE* archivo;
+	dtrakheader *fileheader = (dtrakheader *) malloc(sizeof(dtrakheader));
+	int i = 0;
+
+	if ((archivo = fopen(file, "rb")) == NULL) {
+		puts("Error, couldn't open the file");
+		return;
+	}
+
+	/*
+	 * Verify fileheader,  get number of dives in datatrak divelog
+	 */
+	*fileheader = read_file_header(archivo);
+
+	if (fileheader->header == 0)
+		puts("Error. Not a DATATRAK/WLOG file\n");
+	while (i < fileheader->divesNum) {
+		struct dive *ptdive = alloc_dive();
+		*ptdive = dt_dive_parser(archivo, ptdive);
+		if (!ptdive)
+			puts("Error, no dive\n");
+		i++;
+		record_dive(ptdive);
+	}
+	taglist_cleanup(&g_tag_list);
+	fclose(archivo);
+	sort_table(table);
+	free (fileheader);
+}
diff --git a/datatrak.h b/datatrak.h
new file mode 100644
index 0000000..b3b244f
--- /dev/null
+++ b/datatrak.h
@@ -0,0 +1,34 @@
+#ifndef DATATRAK_HEADER_H
+#define DATATRAK_HEADER_H
+
+#include <string.h>
+
+typedef struct dtrakheader_ {
+	int header;			//Must be 0xA100;
+	int divesNum;
+	int dc_serial_1;
+	int dc_serial_2;
+} dtrakheader;
+
+#define read_bytes(_n) \
+	switch (_n) {\
+		case 1:\
+			fread (&lector_bytes, sizeof(char), _n, archivo);\
+			tmp_1byte = lector_bytes[0];\
+			break;\
+		case 2:\
+			fread (&lector_bytes, sizeof(char), _n, archivo);\
+			tmp_2bytes = two_bytes_to_int (lector_bytes[1], lector_bytes[0]);\
+			break;\
+		default:\
+			fread (&lector_word, sizeof(char), _n, archivo);\
+			tmp_4bytes = four_bytes_to_long (lector_word[3],lector_word[2],lector_word[1],lector_word[0]);\
+			break;\
+	}
+
+#define read_string(_property)\
+	_property = (unsigned char *) calloc((tmp_1byte + 1), sizeof(unsigned char));\
+	fread (_property, sizeof(unsigned char), tmp_1byte, archivo);\
+	_property = strcat(to_utf8(_property), "");\
+
+#endif // DATATRAK_HEADER_H
diff --git a/dive.c b/dive.c
index 9f4df56..700c7fb 100644
--- a/dive.c
+++ b/dive.c
@@ -1276,7 +1276,7 @@ struct dive *fixup_dive(struct dive *dive)
 #define MERGE_TXT(res, a, b, n) res->n = merge_text(a->n, b->n)
 #define MERGE_NONZERO(res, a, b, n) res->n = a->n ? a->n : b->n
 
-static struct sample *add_sample(struct sample *sample, int time, struct divecomputer *dc)
+struct sample *add_sample(struct sample *sample, int time, struct divecomputer *dc)
 {
 	struct sample *p = prepare_sample(dc);
 
diff --git a/dives/Example.log b/dives/Example.log
new file mode 100644
index 0000000000000000000000000000000000000000..3cc8cd3f8fbef7bdef12822d110641ddceb1ed70
GIT binary patch
literal 26340
zcmajI3w&MoRp-0*(b>{@>wk3gIC^irB}<lM%d+M7f6H>}wrQ&*F3s(5!AjyL{=~I|
zY&WGB$o~|F`E=ld87M8!5km&b%zU6Tbf7?i|IRo-hXRJu4g;l#ONVDWWrhxq5^nBy
z?IX)}>Tu7F&(eOLz1Ld*wSMdI-}zw)&Sm65`Aqm_*^-a%%gFIe_VmTaHj1Y<p1B-7
zF%@q<emQvMxy&oiW#1h>WhUfS+t&1lBqtKCpTBy3Qv&%&_-kJ^Cs#It>z9j{<#g~C
z$UTdQ*c+h@Z9z;;2K^pymfW&E;LJW*u=CD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HR>mlgc
z<FzS1;`k98xk1k7|Fj`}QlF;*)Ah2y?$Qp-c~S?`!*N}XIG9qpCLX$=ydBGfIOkIX
z$-3tE%S3&OJB!ZDYYGhevR7vt=D03c$hTRukao#HQ9}<HSwI;r?3~AR3eNfV>+a{b
z<o99cU%rN-Wm0|~DA!Yd-chtWzWM(R&;9k!DMP!Ip<j?wcZa;YFKCmQGg?!|a85v7
z7T>Go52fVw`K!6!g3ZtPz_nO2nf1I;9s^pEidUbZ0wA|C*>8C(4abkz37K?eVhT(%
ziw_6BvY7EDp{tJlOi{B3#f)o60Gu6PYWlG81vjfceqz#&$uQ>+2<2JUYis0QM1N1;
zy1~2MoHiS9AC~)LU3)V!-b|%tQgT!JxV&r@=Kc9=FfZs-pJOUryQ5TEU$=Sw$;+FZ
z`bxO?nLkv%wd;jGCHDUIagW+ZEQuN4v4az7h$Lo$)?hp270XQ68P?}zzdy)x9JI_&
z;&|;QT=7u9OMSZTR_tLgi1rsAw$o$G)N?BmjW4-*I0FU}8iu*<kQ+c%%>)R>wmUOX
j_G$sm1nTA5oEZoGacA(w>5}rtwn%+4aQZ;N0Y3j9NZ_NG

literal 0
HcmV?d00001

diff --git a/file.c b/file.c
index 42f8ef6..daa91f6 100644
--- a/file.c
+++ b/file.c
@@ -16,6 +16,8 @@
 #define O_BINARY 0
 #endif
 
+extern void datatrak_import(const char *file, struct dive_table *table);
+
 int readfile(const char *filename, struct memblock *mem)
 {
 	int ret, fd;
@@ -404,6 +406,11 @@ int parse_file(const char *filename)
 		}
 	}
 
+	if (fmt && (!strcasecmp(fmt + 1, "LOG"))) {
+		datatrak_import(filename, &dive_table);
+		return 0;
+	}
+
 	parse_file_buffer(filename, &mem);
 	free(mem.buffer);
 	return 0;
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 1d4b22a..686af7a 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -1228,7 +1228,9 @@ void MainWindow::on_actionImportDiveLog_triggered()
 	QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Open dive log file"), lastUsedDir(),
 		tr("Dive log files (*.xml *.uddf *.udcf *.csv *.jlb *.dld *.sde *.db *.can);;"
 			"XML files (*.xml);;UDDF/UDCF files(*.uddf *.udcf);;JDiveLog files(*.jlb);;"
-			"Suunto Files(*.sde *.db);;CSV Files(*.csv);;MkVI Files(*.txt);;All Files(*)"));
+			"Suunto Files(*.sde *.db);;CSV Files(*.csv);;"
+			"Datatrak/WLog Files(*.log);;"
+			"All Files(*)"));
 
 	if (fileNames.isEmpty())
 		return;
diff --git a/subsurface.pro b/subsurface.pro
index b7e5ec9..b035a8d 100644
--- a/subsurface.pro
+++ b/subsurface.pro
@@ -102,7 +102,8 @@ HEADERS = \
 	qt-ui/statistics/statisticswidget.h \
 	qt-ui/statistics/statisticsbar.h \
 	qt-ui/statistics/yearstatistics.h \
-	qt-ui/diveshareexportdialog.h
+	qt-ui/diveshareexportdialog.h \
+	datatrak.h
 
 android: HEADERS -= \
 	qt-ui/usermanual.h \
@@ -194,7 +195,8 @@ SOURCES =  \
 	qt-ui/statistics/yearstatistics.cpp \
 	qt-ui/statistics/statisticsbar.cpp \
 	qt-ui/statistics/monthstatistics.cpp \
-	qt-ui/diveshareexportdialog.cpp
+	qt-ui/diveshareexportdialog.cpp \
+	datatrak.c
 
 android: SOURCES += android.cpp
 else: win32: SOURCES += windows.c
-- 
1.7.10.4

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to