Import dive number from Seabear CSV file

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
Miika Turkia 2017-05-07 14:19:58 +03:00
parent 0dfa448d8c
commit cef56c6290
2 changed files with 20 additions and 0 deletions

View file

@ -1517,6 +1517,19 @@ int parse_seabear_header(const char *filename, char **params, int pnr)
f.open(QFile::ReadOnly);
QString parseLine = f.readLine();
/*
* Parse dive number from Seabear CSV header
*/
while ((parseLine = f.readLine().trimmed()).length() > 0 && !f.atEnd()) {
if (parseLine.contains("//DIVE NR: ")) {
qDebug() << "DEBGU: " << parseLine;
params[pnr++] = strdup("diveNro");
params[pnr++] = strdup(parseLine.replace(QString::fromLatin1("//DIVE NR: "), QString::fromLatin1("")).toUtf8().data());
break;
}
}
/*
* Parse header - currently only interested in sample
* interval and hardware version. If we have old format

View file

@ -26,6 +26,7 @@
<xsl:param name="separatorIndex" select="separatorIndex"/>
<xsl:param name="delta" select="delta"/>
<xsl:param name="hw" select="hw"/>
<xsl:param name="diveNro" select="diveNro"/>
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="lf"><xsl:text>
@ -111,6 +112,12 @@
</xsl:attribute>
</xsl:if>
<xsl:if test="string-length($diveNro) > 0">
<xsl:attribute name="number">
<xsl:value-of select="$diveNro"/>
</xsl:attribute>
</xsl:if>
<!-- If the dive is CCR, create oxygen and diluent cylinders -->
<xsl:if test="$po2Field >= 0 or $setpointField >= 0 or $o2sensor1Field >= 0 or $o2sensor2Field >= 0 or $o2sensor3Field >= 0">