Include some extradata info on Seabear import

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
Miika Turkia 2017-05-07 21:22:00 +03:00 committed by Dirk Hohndel
parent d7cf3408e5
commit ccf916344b
3 changed files with 81 additions and 0 deletions

View file

@ -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()) {
}

View file

@ -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' />

View file

@ -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'"/>