If the cylinder size seems to be in the form of ALxx, LPxx, or HPxx use
that as cylinder description.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This will read duration from CSV in minutes if the dive would be less
than 10 minutes when treating the duration as seconds.
In practice, this means that free-divers cannot import dive duration
properly from CSV, but this should be sensible for scuba divers.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds support for importing multi-line notes field on CSV import.
Naturally the notes filed must be quoted with " in this case.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch uses pre-defined working pressures on cylinders to roughly
calculate the size in liters. Imperial selection is ignored here as we
can use the prefix to detect if the value seems like imperial unit (and
the type of cylinder varies based on location, not divers preference in
unit).
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If specific value is not available, we need to have an empty value
instead.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Try to grab pressure information from first DC if it is not manually
entered.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We need to limit the DCs from which we grab the depths. Otherwise, we
end up with too many depth values.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If temperature is recorded by a DC it must be taken from under the
divecomputer tag. However, this will prefer the manually written value
if such exists.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is intended to export all the details that someone might copy from a
paper logbook. We need a matching import template to make this simple.
This hasn't been well tested, I'm sure it will break when elements and
attributes are missing.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds support for importing cylinder information from manually kept
dive logs. However, this cannot be used before GUI counterpart is added.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds support for importing temperatures from manually kept dive logs.
However, this cannot be used before GUI counterpart is added.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The existence of location information was tested incorrectly resulting
in erroneously adding these fields if they were not present.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Having the mix name like EANX34 as cylinder description was apparently
confusing, so switching to 'unknown' instead.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds support for importing cylinder information from at least Xdeep
and Diving Log v 5.0.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
UDDF only supports a specific set of alarms. Some events also don't map
to alarms but map to other types of elements in UDDF.
This patch adds a map of the accepted types. Where a map doesn't exist
the type will not be mapped to an alarm, the option then remains to
map it to another kind of element, in the same way that happened with
headings and gas switches.
This removes the need for the specific exclusion of heading and
gas switch, as they are now simply not included in the map.
Signed-off-by: Martin Long <martin@longhome.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Using node() along with the node-set seems to grab the weights properly
for me.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Seems that our UDDF export is adding time after the event name. Thus we
need to add reading the following time as well.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Adjust to UDDF 3.2 specification and use proper tag name for air
temperature.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The switchmix values must be concatenated properly.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This attempts to export only used cylinders to divelogs.de. The
detection is based only on o2 percentage as per our test dives. However,
the new cylinder id would be better, but that does not exist on old
dives.
Fixes#757
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There was a bug when the first sample doesn't contain pressure info.
This fixes that by selecting the first with pressure info.
Signed-off-by: Martin Long <martin@longhome.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The XDS schema for UDDF is very sensitive to ordering of elements
so I've rearranged many of them to match. Elements in:
- informationbeforedive
- waypoint
Adjusted namespace of export to correct UDDF namespace.
Updated remaining references to mixes it include prefix 'mix'
Moved equipment from informationbeforedive to informationafterdive *
Change trip ids to generated IDs and updated tripmembership to use
the trip id instead of the name *
* These constitutes a difference in XSD and the documentation. I will
raise these issues with the author.
Signed-off-by: Martin Long <martin@longhome.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Removed underscore from buddy name elements
Added 'mix' prefix to gas ids. Ids must not start with a number.
Added mandatory profile data with empty tags.
Signed-off-by: Martin Long <martin@longhome.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
XPath was incorrect for parsing divecomputers into the equipment
section, meaning they dont get inserted.
Signed-off-by: Martin Long <martin@longhome.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
As with buddies, sites could contain characters which are not valid
in Ids. Also, it is very possible to have duplicate site names.
This uses an XSL generated id to prevent any issues.
Signed-off-by: Martin Long <martin@longhome.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is instead of using their names, which may contain illegal
characters.
Signed-off-by: Martin Long <martin@longhome.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add name at <generator> level, and add additional <homepage> in
contact tag.
Signed-off-by: Martin Long <martin@longhome.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Currently repetition groups are used to group dives into trips. This
is not really correct. Repetition groups should really represent a
group of dives where tissue loading needs to be preserved between
dives (typically the same day).
UDDF has support for trips, using the <divetrip> tags. This is a
bidirectional link between the dives and the trips.
This patch adds support for these trips. However, it leaves in the
repetition groups. Repetition groups may need further consideration.
Signed-off-by: Martin Long <martin@longhome.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Sum together all of the weights recored on a dive to use in the
<leadquantity> tag in UDDF export.
Signed-off-by: Martin Long <martin@longhome.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>