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 <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Miika Turkia 2016-05-27 22:50:58 +03:00 committed by Dirk Hohndel
parent 1e5fe4f3fe
commit 1aa6bd9904

View file

@ -2721,14 +2721,27 @@ extern int shearwater_dive(void *param, int columns, char **data, char **column)
dc_settings_start(); dc_settings_start();
if (data[9]) if (data[9])
utf8_string(data[9], &cur_settings.dc.serial_nr); utf8_string(data[9], &cur_settings.dc.serial_nr);
if (data[10]) if (data[10]) {
utf8_string(data[10], &cur_settings.dc.model); switch (atoi(data[10])) {
default:
cur_settings.dc.model = strdup("Shearwater import");
break;
}
}
cur_settings.dc.deviceid = atoi(data[9]); cur_settings.dc.deviceid = atoi(data[9]);
dc_settings_end(); dc_settings_end();
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); snprintf(get_buffer, sizeof(get_buffer) - 1, get_cylinder_template, cur_dive->number);
retval = sqlite3_exec(handle, get_buffer, &shearwater_cylinders, 0, &err); retval = sqlite3_exec(handle, get_buffer, &shearwater_cylinders, 0, &err);
if (retval != SQLITE_OK) { if (retval != SQLITE_OK) {