From 1aa6bd9904f48ab08cf39dff66d81839f17b9f75 Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Fri, 27 May 2016 22:50:58 +0300 Subject: [PATCH] Set model on Shearwater import For starters, let's just state that this dive was downloaded from Shearwater. However, once we have information how model numbers map to names, we can use that info for the models we know about. Signed-off-by: Miika Turkia Signed-off-by: Dirk Hohndel --- core/parse-xml.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/core/parse-xml.c b/core/parse-xml.c index 5eccbb9a7..e22881b0f 100644 --- a/core/parse-xml.c +++ b/core/parse-xml.c @@ -2721,14 +2721,27 @@ extern int shearwater_dive(void *param, int columns, char **data, char **column) dc_settings_start(); if (data[9]) utf8_string(data[9], &cur_settings.dc.serial_nr); - if (data[10]) - utf8_string(data[10], &cur_settings.dc.model); + if (data[10]) { + switch (atoi(data[10])) { + default: + cur_settings.dc.model = strdup("Shearwater import"); + break; + } + } cur_settings.dc.deviceid = atoi(data[9]); dc_settings_end(); settings_end(); + if (data[10]) { + switch (atoi(data[10])) { + default: + cur_dive->dc.model = strdup("Shearwater import"); + break; + } + } + snprintf(get_buffer, sizeof(get_buffer) - 1, get_cylinder_template, cur_dive->number); retval = sqlite3_exec(handle, get_buffer, &shearwater_cylinders, 0, &err); if (retval != SQLITE_OK) {