summaryrefslogtreecommitdiffstats
path: root/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2015-07-12 23:16:57 +0530
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-12 13:58:17 -0700
commit22b665cc14b637a5c1692f2877f14bcf5fb51590 (patch)
tree741dc4c9a4853eb9f8ec8560b54ffee2df8116b3 /parse-xml.c
parent17bc86853171675a553030d61e3e7a7d4797a74a (diff)
downloadsubsurface-22b665cc14b637a5c1692f2877f14bcf5fb51590.tar.gz
Divinglog import: import temperature graph
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'parse-xml.c')
-rw-r--r--parse-xml.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/parse-xml.c b/parse-xml.c
index 37f08ccec..7d1f31290 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -2846,8 +2846,8 @@ int parse_cobalt_buffer(sqlite3 *handle, const char *url, const char *buffer, in
extern int divinglog_profile(void *handle, int columns, char **data, char **column)
{
int sinterval = 0;
- unsigned long i, len;
- char *ptr;
+ unsigned long i, len, lenprofile2 = 0;
+ char *ptr, temp[4];
/* We do not have samples */
if (!data[1])
@@ -2870,9 +2870,26 @@ extern int divinglog_profile(void *handle, int columns, char **data, char **colu
*
* Example: 004500010000
* 4.5 m, no deco, no RBT warning, ascanding too fast, no decostop ignored, no work, no extra info
+ *
+ *
+ * Profile2
+ *
+ * TTTFFFFIRRR
+ *
+ * T: Temperature (in °C with one decimal)
+ * F: Tank pressure 1 (in bar with one decimal)
+ * I: Tank ID (0, 1, 2 ... 9)
+ * R: RBT (in min)
+ *
+ * Example: 25518051099
+ * 25.5 °C, 180.5 bar, Tank 1, 99 min RBT
*/
len = strlen(data[1]);
+
+ if (data[2])
+ lenprofile2 = strlen(data[2]);
+
for (i = 0, ptr = data[1]; i * 12 < len; ++i) {
sample_start();
@@ -2881,6 +2898,11 @@ extern int divinglog_profile(void *handle, int columns, char **data, char **colu
ptr[5] = 0;
cur_sample->depth.mm = atoi(ptr) * 10;
+ if (i * 11 < lenprofile2) {
+ memcpy(temp, &data[2][i * 11], 3);
+ cur_sample->temperature.mkelvin = C_to_mkelvin(atoi(temp) / 10);
+ }
+
ptr += 12;
sample_end();
}
@@ -2929,7 +2951,7 @@ extern int divinglog_dive(void *param, int columns, char **data, char **column)
int retval = 0;
sqlite3 *handle = (sqlite3 *)param;
char *err = NULL;
- char get_profile_template[] = "select ProfileInt,Profile from Logbook where Number = %d";
+ char get_profile_template[] = "select ProfileInt,Profile,Profile2 from Logbook where Number = %d";
char get_buffer[1024];
dive_start();