mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-12 13:36:16 +00:00
DM5 import: Add dive mode support (OC and CCR)
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
parent
f1740358a7
commit
f8c794e11c
1 changed files with 16 additions and 1 deletions
|
@ -432,6 +432,21 @@ static int dm5_dive(void *param, int columns, char **data, char **column)
|
||||||
if (data[5])
|
if (data[5])
|
||||||
utf8_string(data[5], &state->cur_dive->dc.model);
|
utf8_string(data[5], &state->cur_dive->dc.model);
|
||||||
|
|
||||||
|
if (data[25]) {
|
||||||
|
//enum divemode_t {OC, CCR, PSCR, FREEDIVE, NUM_DIVEMODE, UNDEF_COMP_TYPE}; // Flags (Open-circuit and Closed-circuit-rebreather) for setting dive computer type
|
||||||
|
switch(atoi(data[25])) {
|
||||||
|
case 1:
|
||||||
|
state->cur_dive->dc.divemode = 0;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
state->cur_dive->dc.divemode = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
state->cur_dive->dc.divemode = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(get_events, sizeof(get_events) - 1, get_cylinders_template, state->cur_dive->number);
|
snprintf(get_events, sizeof(get_events) - 1, get_cylinders_template, state->cur_dive->number);
|
||||||
retval = sqlite3_exec(handle, get_events, &dm5_cylinders, state, NULL);
|
retval = sqlite3_exec(handle, get_events, &dm5_cylinders, state, NULL);
|
||||||
if (retval != SQLITE_OK) {
|
if (retval != SQLITE_OK) {
|
||||||
|
@ -584,7 +599,7 @@ int parse_dm5_buffer(sqlite3 *handle, const char *url, const char *buffer, int s
|
||||||
|
|
||||||
/* StartTime is converted from Suunto's nano seconds to standard
|
/* StartTime is converted from Suunto's nano seconds to standard
|
||||||
* time. We also need epoch, not seconds since year 1. */
|
* time. We also need epoch, not seconds since year 1. */
|
||||||
char get_dives[] = "select DiveId,StartTime/10000000-62135596800,Note,Duration,coalesce(SourceSerialNumber,SerialNumber),Source,MaxDepth,SampleInterval,StartTemperature,BottomTemperature,StartPressure,EndPressure,'','',SurfacePressure,DiveTime,SampleInterval,ProfileBlob,TemperatureBlob,PressureBlob,'','','','',SampleBlob FROM Dive where Deleted is null";
|
char get_dives[] = "select DiveId,StartTime/10000000-62135596800,Note,Duration,coalesce(SourceSerialNumber,SerialNumber),Source,MaxDepth,SampleInterval,StartTemperature,BottomTemperature,StartPressure,EndPressure,'','',SurfacePressure,DiveTime,SampleInterval,ProfileBlob,TemperatureBlob,PressureBlob,'','','','',SampleBlob,Mode FROM Dive where Deleted is null";
|
||||||
|
|
||||||
retval = sqlite3_exec(handle, get_dives, &dm5_dive, &state, &err);
|
retval = sqlite3_exec(handle, get_dives, &dm5_dive, &state, &err);
|
||||||
free_parser_state(&state);
|
free_parser_state(&state);
|
||||||
|
|
Loading…
Add table
Reference in a new issue