As we now parse dives without profile, we get 2 more dives from the
sample log import (3 in total). And naturally also the resulting XML to
compare against needs to be updated.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
The code incorrectly divided the temperature by 10 as an integer,
causing unnecessary precision loss due to truncation.
Fix it, and update the test results for the now improved temperature
import.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It appears that we used to get additional tts=0:00min tags on Seabear
parsing. I would assume these to be incorrect as there other values
right before these that look more sensible. Also the resent change to
streamline the feature of not storing repeating values causes the test
to fail. Anyway, just grabbing the new result to compare with as it
seems sensible.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Add one more picture to the already existing test.
This new picture is a JPEG and has data after JFIF EOI tag.
Suggested-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
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>
We do some merging in a couple of the other tests as well, but the idea
is to have specific test cases that exercise our merge logic.
This one starts simple. Merge a dive with some valid info with a second
one that has less data filled. And then try it in both possible orders.
It shows a few potential problems.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This seems to work around the crazy QDateTime::fromTime_t() problem in Qt.
It is *very* lightly tested. In fact, the only test is that "test0.xml"
change that is part of this patch.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is the example divelog shipped with Subgear products (OEMs for
Scubapro/Uwatec), just changed the name to be meaningful for the reader
of the dives directory.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
With commit b26e516e2a ("Dive_sites-Notes shouldn't be stored as
attribute") our output format changed slightly. Adjust the expected output
to match that change to ensure that TestParse passes again.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This file contains imported dives from Seabear H3 and T1 dive computers.
It is used for validating Seaber import from new file format.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
These are test dives for Seabear H3 and T1 dive computers received from
Seabear Diving Technology.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This includes trips, dives outside trips, deco, gas changes, dives with
multiple dive computers, a really short dive, a rather long dive, a dive
with pictures, dive computers with very coarse sample rate, rather fine
sample rate, with gas integration, without...
Should touch a lot of different scenarios.
The file is in V2 format to also allow testing the importing / conversion
to dive sites.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Also fixed it to correctly parse the mean depth (duh, a test that had a
bug) and added a buddy field for good measure.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Adds two test dives for OSTCTools.
I've kept the original naming.
Num 173 selected because it implies using EAN32.
Num 80, provided in forum by Philippe Tescari, selected because involves
gas changes (although user don't seems to have set different gas mixes).
Sadly, both dives seems to be from 2N/C devices.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When loading an image by filename and by hash fails, try to interpret
the filename as URL and download the image.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
With no V2 question shown
- parsing fails when a V2 file is loaded
- parsing succeeds when a V3 file is loaded
- import of CSV file succeeds
With V2 question shown
- parsing succeeds when a V2 file is loaded
Finally compare the output of reading in the various files with reference
output included in the sources.
My guess is that this test might be a bit fragile, but hey, it's a start.
(reminder: the tests only get built when using cmake)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
The conflicting GPS is somewhat artificial. Since the GPS gets parsed
first in our syntax, the different GPS location would create a new dive
site and we'd end up with two dive sites of the same name with different
coordinates. By having a location tag with just the name and no
coordinates we make sure that this gets identified with the existing dive
site and THEN add the GPS coordinates in the second location tag.
This would never happen in a XML file created by Subsurface, but it does a
good job in testing the different code paths.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The CSV/TXT import is working well now, the XML file is just causing
confusion.
Suggested-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Change the meaning that _the_ cylinder (as we treat it in OC dives) is the
diluent cylinder (rather than the O2 cylinder). This eliminates special
cases. Now, for CCR, we have to handle the O2 cylinder in addition
(rather than the diluent in addition).
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is an anonymized version of a real dive. With the latest changes the
SAC calculations now make "mostly sense".
What's clearly still broken is the tank pressure graph.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The Poseidon xml dive log in the /dives folder is faulty. This patch
replace it with a fully working one.
Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The present example files have dives with some unusual
characteristics due to the fact that the dive pushes the
limits of the Poseidon recreational rebreather.
Replace these example files with a dive that does not have
any unusual characteristics. This facilitates debugging of the
Poseidon code. The xml file represents the same dive as the two
text files. The xml file will ultimately be removed.
Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Two files are added to the dived directory.
Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch allows the importing of oxygen sensor and setpoint data from
Poseidon CCR dive logs.
1) Change parse-xml.c to read up to three oxygen sensor values from xml.
and to store the information in sample structures
2) Change parse-xml.c to read o2 setpoint values fro xml and to store
it in sample structures
3) Change dive.c to delete all sensor and setpoint values where
subsequent samples have sensor/setpoint values that are the same.
4) Change profile.c to store the sensor/setpoint values from the samples
into plotinfo.
5) Change the sample Poseidon xml log in the dives directory to ensure
the correct order and hierarchy of the dive and divecomputer nodes.
[Dirk Hohndel: minor cleanup, removed debug code, whitespace]
Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This file is not in the original unformatted style of Posedon
but in an intermediate XML for developing the Qt interface.
At the end of development this file will be replaced by the
original unformatted dive log.
Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>