summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/qthelper.cpp16
-rw-r--r--xslt/csv2xml.xslt18
2 files changed, 33 insertions, 1 deletions
diff --git a/core/qthelper.cpp b/core/qthelper.cpp
index cbfbd2f72..41c9d310b 100644
--- a/core/qthelper.cpp
+++ b/core/qthelper.cpp
@@ -1545,13 +1545,27 @@ int parse_seabear_header(const char *filename, char **params, int pnr)
}
/*
- * Note that we scan over the "Log interval" on purpose
+ * Grab the sample interval
*/
while ((parseLine = f.readLine().trimmed()).length() > 0 && !f.atEnd()) {
if (parseLine.contains("//Log interval: ")) {
params[pnr++] = strdup("delta");
params[pnr++] = strdup(parseLine.remove(QString::fromLatin1("//Log interval: ")).trimmed().remove(QString::fromLatin1(" s")).toUtf8().data());
+ break;
+ }
+ }
+
+ /*
+ * Dive mode, can be: OC, APNEA, BOTTOM TIMER, CCR, CCR SENSORBOARD
+ * Note that we scan over the "Log interval" on purpose
+ */
+
+ while ((parseLine = f.readLine().trimmed()).length() > 0 && !f.atEnd()) {
+ QString needle = "//Mode: ";
+ if (parseLine.contains(needle)) {
+ params[pnr++] = strdup("diveMode");
+ params[pnr++] = strdup(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\"").toUtf8().data());
}
}
diff --git a/xslt/csv2xml.xslt b/xslt/csv2xml.xslt
index fadb5f443..efe7c37ef 100644
--- a/xslt/csv2xml.xslt
+++ b/xslt/csv2xml.xslt
@@ -27,6 +27,7 @@
<xsl:param name="delta" select="delta"/>
<xsl:param name="hw" select="hw"/>
<xsl:param name="diveNro" select="diveNro"/>
+ <xsl:param name="diveMode" select="diveMode"/>
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="lf"><xsl:text>
@@ -144,6 +145,23 @@
<xsl:copy-of select="number($o2sensor1Field >= 0) + number($o2sensor2Field >= 0) + number($o2sensor3Field >= 0)" />
</xsl:attribute>
</xsl:if>
+
+ <!-- Seabear specific dive modes -->
+ <xsl:if test="string-length($diveMode) > 0">
+ <xsl:if test="$diveMode = 'OC' or $diveMode = 'APNEA' or $diveMode = 'CCR' or $diveMode = 'CCR SENSORBOARD'">
+ <xsl:attribute name="dctype">
+ <xsl:choose>
+ <xsl:when test="$diveMode = 'APNEA'">
+ <xsl:value-of select="'Freedive'"/>
+ </xsl:when>
+ <xsl:when test="$diveMode = 'CCR' or $diveMode = 'CCR SENSORBOARD' ">
+ <xsl:value-of select="'CCR'"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+
<xsl:call-template name="printLine">
<xsl:with-param name="line" select="substring-before(//csv, $lf)"/>
<xsl:with-param name="lineno" select="'1'"/>