The previous patch would not fill the first name field if there was
no second name. This rectifies that.
Signed-Off-By: Martin Long <martin@longhome.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This theoretically allows one to use format like
1°36'11.711"N 124°46'00.368"E for GPS coordinates. However, in practice
this is not allowed without properly parsing this format in C/C++ side.
This patch changes the export format to UTF8 and improves the location
import by allowing either gps or location attributes to be imported.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The XSLT didn't expect the temperature tag to be within the
<divecomputer> element in the source, so the selection wasn't finding
it.
Signed-off-by: Marton Long <martin@longhome.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Selection of <cylinder> elements wasn't working where dives are
part of a trip. Change the selection so that it will select all
cylinders whether or not the dive is part of a trip.
Signed-off-by: Marton Long <martin@longhome.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Due to there being no xsl template for the userID, it ended up getting
inserted at the start of the output. This adds an empty template to
map the <settings> element, preventing this erronious insertion.
Signed-off-by: Marton Long <martin@longhome.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The dive site structure in the UDDF export was using an old structure
where each site is simply listed as a <dive_site>.
The new structure requires a single <divesite> containing at least one
<divebase> - a base location where you are diving from, and at least one
<site>.
As subsurface only tracks sites, I've created a single divebase to be
referenced by all of the sites.
Note: although profiles in Subsurface can be grouped into trips, these
are groupings of profiles, not sites, and the mapping may not be
simple. e.g. on different trips the sames sites may be visited but a
different base used. Or, different bases may be used on a single trip.
Signed-off-by: Marton Long <martin@longhome.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Part of a series bringing UDDF export closer to the UDDF standard, as
per www.uddf.org.
Currently when exporting to UDDF buddy entities are created
one-per-unique-combination. This means that a group of buddies on a dive
are exported as a single buddy, with the names comma separated.
This patch identifies all unique buddies, whether used independently or
along with other buddies on a dive. They are then linked independently
on each profile.
It also uses the UDDF standard <link ref=""> instead of
<buddy_ref ref="">
Signed-off-by: Marton Long <martin@longhome.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Data read from a divecomputer is moved inside the divecomputer tag
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This tries to grab the used cylinders when in open circuit mode.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Shearwater describes the current mode with tag currentCircuitSetting,
thus we should record the ppO2 only when in CCR mode.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If manual CSV import does not have any dive number, give a default one
so that the dives get import and not silently ignored.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The only place where I'm not sure if there are unintended sideeffects of
changing over to the new domain is QCoreApplication::setOrganizationDomain
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
All recorded cylinders are exported to divelogs.de. This potentially
includes cylinders that have not been used.
The start and end pressure for additional cylinders is taken from the
cylinder information. Main tank gets this information from first and
last pressure reading or from the cylinder information if samples are
not available. This should be ok when there is only one cylinder with
pressure sensor, but does not probably work for people having multiple
sensors.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds support for importing additional cylinders from
divelogs.de. This also adds support for He on the import.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Seems that Suunto stores temperature value of 0 when there is no
temperature reading (I guess). Thus this patch ignores temperature
samples that are zero. Otherwise, Subsurface looks into the samples and
grabs the lowest number as water temperature.
See #720
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the cylinder description starts with D%d we test if the size in
description matches the cylinder size. If the cylinder size is double
compared to size in description, we mark the dive as double tank dive to
divelogs.de.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On CSV import the time can be represented with seconds, min:sec or
hour:min:sec. This patch adds support for the min:sec format that was
missing.
See #662
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Logic when to use default sample interval was mixed.
Fixes#657
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
At least in some cases the maximum sample depth can be more than
recorded maximum depth on DivingLog XML export. Thus the maximum depth
is doubled for unit detection.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use type 25 on UDDF import when the gas mix contains some helium.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The wrong O2 percentage was due to not referring to the correct cylinder
but grabbing any o2 value in any cylinder. While fixing this, I noticed
that also end pressure was missing the cylinder selection, so fixing
that as well.
Fixes#626
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Most dive computers start always with the first cylinder (and if not,
they give a gas switch in the first few seconds). Trying to follow this
principle on divelogs.de export.
The bug 626 sounds like a bit different case so a sample XML log would
be needed to ensure that use case gets fixed.
See #626
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Gas changes generated by Xdeep can contain mix information with decimal
comma instead of decimal point. Thus we need to convert the comma to
point before performing mathematical operations on it.
Fixes#612
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds image support to UDDF export. As far as I can tell from
the UDDF specification, the images can only be added to notes field, so
that is what we do here. (buddy and owner can also have image tags, but
that is irrelevant for Subsurface currently.)
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This speeds up Aquadivelog imports marginally by doing lookup to used
equipments only instead of all equipment ever used.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Writing the samples/waypoints to UDDF export in a totally new way.
Previously the preparations for approximating waypoints was done for
every sample, now only for the events.
A few days ago it took 36 seconds for my test set of 8 dives to export
to UDDF. This optimization round took it down from 0m4.745s to
0m0.253s.
Fixes#508
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Duration is better term than time for the length of the dive. Also
remove the repetitive word dive from some of the header fields.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
UDDF export used all samples in the export when detecting previous
sample. This resulted in a very slow processing as we had to go through
massive amount of data for each event that's time was to be
approximated. The detection of previous sample was also erroneous
resulting in incorrect depth samples for the events in some occasions.
This patch should address these issues. And along with patch that
included pressure data on import this will fix the bug #499.
Well, the performance after the patch is still not stellar, but still
quite a difference with such a small change. The sample set of 8 dives
(with one event each) takes now less than 5 seconds instead of the
original 36 seconds (measured by doing the conversion with xsltproc).
Fixes#499
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Importing pressure samples on UDDF import was missing. This patch adds
that bit of information to our import.
See #499
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Let's make the export consistent by quoting the header line the same way
the sample rows are quoted.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Crafting depth samples produced a negative depth for the last sample.
This patch checks that negative last sample is ignored. (This occurred
when last manual sample is not full minutes.)
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch creates artificial depth samples for manually entered dives
every 60 seconds. This is used for export to divelogs.de.
Fixes#486
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Sensus dataloggers report depth in (absolute) millibar. This simple
fix corrects the CSV import. The depth is now computed correctly.
Signed-off-by: Jan Mulder <jlmulder@planet.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This implements divelog export into CSV format. This currently supports
only metric units and lacks user interface.
See #434
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Empty values included the rest of the line in the value, instead of
leaving it empty. This patch leaves empty values empty.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Sensus divides temperature in one or two fields (depending on locale),
so it cannot be parsed with our generic CSV import XSLT. And e.g. depth
is in millimeters.
This supports only importing of single dive at a time. Multiple dives
would be in same file with first column being dive number.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We want to skip duplicate lines on CSV import. For this we need to use
time field, that is not necessarily the first field of the input. This
patch uses the configured time field instead of first one.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Nowadays cylinder tags are generated based on actual usage. This
includes all the required information on cylinders. Therefore generating
incomplete cylinder tags from all listed cylinders is not needed
anymore.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds support for cylinders for UDDF version 3.2.1.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Adding support for multiple cylinders on UDDF export. This also adds a
cylinder reference to the tankdata to enable mix lookups.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch generates a waypoint for events occurring between profile
samples. It approximates the depth of the crafted waypoint linearly
between the recorded sample depths.
Fixes#385
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
UDDF export saved events only if they occurred at exactly same time as a
profile sample. This patch will include events between samples as well.
This assumes that profile samples are recorded in even intervals.
Fixes#385
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Seems there is a different way to state O2 percentage in DivingLog.
This patch includes that format along with the previously seen one.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Seems that we can detect the unit of samples from DivingLog import when
comparing the maximum dive depth to the maximum recorded sample depth.
If sample is bigger, it is recorded in imperial. Of course this relies
on the assumption that the max depth of dive is recorded in metric unit,
but that seems to be the case, at least in the sample received.
It really does not make any sense to have both units in use for one dive
without any info on the unit used. But since that is the case, let's try
to cope with it.
Fixes#316
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
After change to include XSLT files in resources, the import quit
working (even though the files and templates were found properly). This
patch uses include statement instead as it seems to work in our case.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The separator selector in the CSV import dialog was unused. This passes
the value into the xslt and adds ',' as possible value.
I'm sure this could be done much better (pass the actual character instead
of the index), but I couldn't get that to work and this does seem to do
the trick.
Also added a test dive to test this feature.
Fixes#321
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use if around the attribute, instead if a choose inside. Its less
horrible on the eyes.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I managed to mess up and grab parts of my unfinished otu field code and
squash it into the wrong patch. Here is the code for stopdepth, and now
the code sets the in_deco flag to.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds a checkbox to be able to import csv files without temperature.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Basic information like buddy, location and visibility is included in
UDDF export. Also attempt to grab temperature information from both
temperature and divetemperature tags.
This partially fixes bug #224. However, at least divemaster and tags are
not exported (as the UDDF spec either does not have these or has hidden
the information of these fields somewhere between so many seemingly
unnecessary other fields).
See #224
Signed-off-by: Miika Turkia <miika.turkia@nixu.fi>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Some improvements on importing different versions of UDDF logs. Also
include rating, gps coordinates and gas mixture in the import.
Signed-off-by: Miika Turkia <miika.turkia@nixu.fi>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since CSV import does not include date/time stamp, we need to generate
one for ourselves. This patch uses current time of the import as dive
time.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
As some CSV log files seem to contain multiple sample lines for a single
time, we'll just grab the first one of them to avoid duplicates.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Field variables for the CSV XSLT import have disappeared at some point
during developing GUI for the CSV import. So adding them to the XSLT for
the field selections to have effect.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When we convert time in seconds to mm:ss format, we do not want to round
but get floor instead.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
"Weight" was misspelled "weigth" in several places in the code
and comments.
Signed-off-by: Benjamin Fogel <nystire@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch implements basic functionality to import CSV formatted log
profiles to Subsurface. The import includes time, depth and temperature
from AP Logviewer based on one sample log file I have received. It is
assumed that dive time is the first parameter and depth second.
Temperature is given as a parameter from C source (hard coded currently
to field 15) but we should have a GUI implemented for selecting the
wanted fields.
The two different sample logs of CSV dive log export I have received use
tabulator as field separator. I assume the possible GUI should have
option for the FS as well to be given as parameter to the XSLT.
[Dirk Hohndel: small fix to the error string malloc]
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Visibility is defined in meters in UDDF and we use scale up to 5 stars.
Thus the meters are scaled to our star rating using one-size-fits all
method.
< 1m => 1 star
<= 3m => 2 star
<= 5m => 3 star
<= 10m => 4 star
> 10m => 5 star
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds information on cylinders and gas changes and some other basic
stuff like buddy, dive site, weights.
Visibility should probably be ignored as UDDF specifies it as meters and
we have a scale of 0-5. But currently it is copied as is to the
visibility field in Subsurface.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This implements limited support for importing dives from a Palm divelog
software called aquadivelog. Basic depth graph is imported but most of
the metadata is currently discarded.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The check if both location and site exist was flawed causing an extra
slash on location name when the SITE was empty. Thus resulting in
multiple location candidates when exporting to divelogs.de and
re-importing to Subsurface.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This XSLT can be used when exporting single dives from DM4 and importing
them to Subsurface.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Let's use the shiny new UTF-8 encoding on divelogs.de export.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
While working on UDDF export I noticed that the grabbing of last
sample pressure was not working properly. This will fix it for DLD
export.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Examples on UDDF specification indicate that pressures are reported in
Pascal. Also prefer the sample data from first dive computer for start
and end tank pressures.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch generates a gases section on UDDF export. The section
consists of all the unique gas mixes sawn on the dive log.
The latter part includes events to the export. Gas change and heading
events are properly translated to respective UDDF naming. Other events
are copied over as is. Some of the events are the same (ascent, deco,
rbt, surface) in UDDF some are not available.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch implements exporting dives from Subsurface to UDDF format.
Events and cylinder info are the most remarkable things still missing
from the export.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds support for UDDF version 3.1 as produced by at least
DiversDiary. Basically we have to include the different name space into
our selections.
This patch also checks if the temperature is zero on all samples and
skips temperature readings if it looks like the dive computer does not
record them.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The separator was printed if SITE had data, even if LOCATION was empty.
Now print the separator only if both of these contain data.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
divelogs.de sends us XML files that explicitly state that they are in
ISO-8859-1 encoding (which is true). These files contain the HTML encoded
Cyrillic characters. Once we decode those characters the resulting file is
actually UTF-8 encoded (which is a superset of ISO-8859-1). That seriously
confuses libxml when it tries to parse things.
So instead recognize divelogs.de files and skip the encoding declaration
for them before decoding the HTML encoded non-ISO-8859-1 characters.
This does show, however, that divelogs.de incorrectly truncates the
encoded strings (at least in some sample data that I created the parsing
throws errors because of that).
Reported-by: Sergey Starosek <sergey.starosek@gmail.com>
Based-on-code-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We grab the pressure information from samples, if available. Otherwise,
we use information from first cylinder.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We need to have CDATA around text fields to support e.g. Cyrillic
alphabet.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Summing up weights ended only when there was one parameter left. With no
parameters we ended up in an infinite loop. Now we end also in case of
no parameters.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This generates a .DLD file of selected dives to be uploaded to
divelogs.de. The actual upload functionality along with sensible user
interface is still to be implemented. However, the resulting file from
this patch is tested to work (as far as I can tell) using upload API of
divelogs.de.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The resulting divelogs.de formatted XML is then to be zipped and
uploaded to divelogs.de website.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>