summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2017-05-07 21:22:00 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-05-07 21:36:50 -0700
commitccf916344b7f91934cf5fa2aaf949b786fe1f3c1 (patch)
tree122258a2e49f6f47a9ae088700201793211798d1
parentd7cf3408e5d2f8c7f5ce25fa2b330cc3e75ff489 (diff)
downloadsubsurface-ccf916344b7f91934cf5fa2aaf949b786fe1f3c1.tar.gz
Include some extradata info on Seabear import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
-rw-r--r--core/qthelper.cpp31
-rw-r--r--dives/TestDiveSeabearNewFormat.xml23
-rw-r--r--xslt/csv2xml.xslt27
3 files changed, 81 insertions, 0 deletions
diff --git a/core/qthelper.cpp b/core/qthelper.cpp
index 45e402fc7..238a0bc11 100644
--- a/core/qthelper.cpp
+++ b/core/qthelper.cpp
@@ -1582,6 +1582,37 @@ int parse_seabear_header(const char *filename, char **params, int pnr)
}
f.seek(0);
+ /*
+ * Grabbing some fields for the extradata
+ */
+
+ while ((parseLine = f.readLine().trimmed()).length() > 0 && !f.atEnd()) {
+ QString needle = "//Firmware Version: ";
+ if (parseLine.contains(needle)) {
+ params[pnr++] = strdup("Firmware");
+ params[pnr++] = strdup(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\"").toUtf8().data());
+ }
+ }
+ f.seek(0);
+
+ while ((parseLine = f.readLine().trimmed()).length() > 0 && !f.atEnd()) {
+ QString needle = "//Serial number: ";
+ if (parseLine.contains(needle)) {
+ params[pnr++] = strdup("Serial");
+ params[pnr++] = strdup(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\"").toUtf8().data());
+ }
+ }
+ f.seek(0);
+
+ while ((parseLine = f.readLine().trimmed()).length() > 0 && !f.atEnd()) {
+ QString needle = "//GF: ";
+ if (parseLine.contains(needle)) {
+ params[pnr++] = strdup("GF");
+ params[pnr++] = strdup(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\"").toUtf8().data());
+ }
+ }
+ f.seek(0);
+
while ((parseLine = f.readLine().trimmed()).length() > 0 && !f.atEnd()) {
}
diff --git a/dives/TestDiveSeabearNewFormat.xml b/dives/TestDiveSeabearNewFormat.xml
index 626f07ed6..12585a3f2 100644
--- a/dives/TestDiveSeabearNewFormat.xml
+++ b/dives/TestDiveSeabearNewFormat.xml
@@ -9,6 +9,9 @@
<divecomputer model='Seabear H3' deviceid='ffffffff' dctype='CCR'>
<depth max='69.9 m' mean='32.928 m' />
<temperature water='25.0 C' />
+ <extradata key='Firmware version' value='1.31' />
+ <extradata key='Serial number' value='0' />
+ <extradata key='Gradient factors' value='30/70' />
<sample time='0:05 min' depth='1.0 m' temp='29.0 C' />
<sample time='0:10 min' depth='2.5 m' />
<sample time='0:15 min' depth='4.0 m' />
@@ -213,6 +216,9 @@
<divecomputer model='Seabear H3' deviceid='ffffffff'>
<depth max='69.9 m' mean='32.928 m' />
<temperature water='25.0 C' />
+ <extradata key='Firmware version' value='1.31' />
+ <extradata key='Serial number' value='0' />
+ <extradata key='Gradient factors' value='30/70' />
<sample time='0:05 min' depth='1.0 m' temp='26.0 C' />
<sample time='0:10 min' depth='2.5 m' />
<sample time='0:15 min' depth='4.0 m' />
@@ -417,6 +423,8 @@
<divecomputer model='Seabear H3' deviceid='ffffffff' dctype='Freedive'>
<depth max='70.1 m' mean='33.197 m' />
<temperature water='25.0 C' />
+ <extradata key='Firmware version' value='1.31' />
+ <extradata key='Serial number' value='0' />
<sample time='0:01 min' depth='1.2 m' temp='25.0 C' />
<sample time='0:02 min' depth='1.5 m' />
<sample time='0:03 min' depth='1.8 m' />
@@ -1348,6 +1356,8 @@
<divecomputer model='Seabear H3' deviceid='ffffffff'>
<depth max='69.9 m' mean='32.928 m' />
<temperature water='25.0 C' />
+ <extradata key='Firmware version' value='1.31' />
+ <extradata key='Serial number' value='0' />
<sample time='0:05 min' depth='1.0 m' temp='25.0 C' />
<sample time='0:10 min' depth='2.5 m' />
<sample time='0:15 min' depth='4.0 m' />
@@ -1554,6 +1564,9 @@
<divecomputer model='Seabear T1' deviceid='ffffffff' dctype='CCR' no_o2sensors='3'>
<depth max='69.9 m' mean='32.928 m' />
<temperature water='25.0 C' />
+ <extradata key='Firmware version' value='1.31' />
+ <extradata key='Serial number' value='0' />
+ <extradata key='Gradient factors' value='30/70' />
<sample time='0:05 min' depth='1.0 m' temp='26.0 C' sensor1='0.96 bar' sensor2='0.99 bar' sensor3='0.96 bar' />
<sample time='0:10 min' depth='2.5 m' />
<sample time='0:15 min' depth='4.0 m' />
@@ -1758,6 +1771,9 @@
<divecomputer model='Seabear T1' deviceid='ffffffff' dctype='CCR'>
<depth max='69.9 m' mean='32.928 m' />
<temperature water='25.0 C' />
+ <extradata key='Firmware version' value='1.31' />
+ <extradata key='Serial number' value='0' />
+ <extradata key='Gradient factors' value='30/70' />
<sample time='0:05 min' depth='1.0 m' temp='29.0 C' />
<sample time='0:10 min' depth='2.5 m' />
<sample time='0:15 min' depth='4.0 m' />
@@ -1962,6 +1978,9 @@
<divecomputer model='Seabear T1' deviceid='ffffffff'>
<depth max='69.9 m' mean='32.928 m' />
<temperature water='25.0 C' />
+ <extradata key='Firmware version' value='1.31' />
+ <extradata key='Serial number' value='0' />
+ <extradata key='Gradient factors' value='30/70' />
<sample time='0:05 min' depth='1.0 m' temp='26.0 C' />
<sample time='0:10 min' depth='2.5 m' />
<sample time='0:15 min' depth='4.0 m' />
@@ -2166,6 +2185,8 @@
<divecomputer model='Seabear T1' deviceid='ffffffff' dctype='Freedive'>
<depth max='70.1 m' mean='33.197 m' />
<temperature water='24.0 C' />
+ <extradata key='Firmware version' value='1.31' />
+ <extradata key='Serial number' value='0' />
<sample time='0:01 min' depth='1.2 m' temp='25.0 C' />
<sample time='0:02 min' depth='1.5 m' />
<sample time='0:03 min' depth='1.8 m' />
@@ -3097,6 +3118,8 @@
<divecomputer model='Seabear T1' deviceid='ffffffff'>
<depth max='69.9 m' mean='32.928 m' />
<temperature water='25.0 C' />
+ <extradata key='Firmware version' value='1.31' />
+ <extradata key='Serial number' value='0' />
<sample time='0:05 min' depth='1.0 m' temp='25.0 C' />
<sample time='0:10 min' depth='2.5 m' />
<sample time='0:15 min' depth='4.0 m' />
diff --git a/xslt/csv2xml.xslt b/xslt/csv2xml.xslt
index efe7c37ef..e3864025e 100644
--- a/xslt/csv2xml.xslt
+++ b/xslt/csv2xml.xslt
@@ -28,6 +28,9 @@
<xsl:param name="hw" select="hw"/>
<xsl:param name="diveNro" select="diveNro"/>
<xsl:param name="diveMode" select="diveMode"/>
+ <xsl:param name="Firmware" select="Firmware"/>
+ <xsl:param name="Serial" select="Serial"/>
+ <xsl:param name="GF" select="GF"/>
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="lf"><xsl:text>
@@ -162,6 +165,30 @@
</xsl:if>
</xsl:if>
+ <xsl:if test="string-length($Firmware) &gt; 0">
+ <extradata key="Firmware version">
+ <xsl:attribute name="Value">
+ <xsl:value-of select="$Firmware"/>
+ </xsl:attribute>
+ </extradata>
+ </xsl:if>
+
+ <xsl:if test="string-length($Serial) &gt; 0">
+ <extradata key="Serial number">
+ <xsl:attribute name="Value">
+ <xsl:value-of select="$Serial"/>
+ </xsl:attribute>
+ </extradata>
+ </xsl:if>
+
+ <xsl:if test="string-length($GF) &gt; 0">
+ <extradata key="Gradient factors">
+ <xsl:attribute name="Value">
+ <xsl:value-of select="$GF"/>
+ </xsl:attribute>
+ </extradata>
+ </xsl:if>
+
<xsl:call-template name="printLine">
<xsl:with-param name="line" select="substring-before(//csv, $lf)"/>
<xsl:with-param name="lineno" select="'1'"/>