Divinglog import: include heartbeat info

Note, that this patch is not tested with real data as I do not have log
that would include heartbeat available.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Miika Turkia 2015-07-13 21:43:54 +05:30 committed by Dirk Hohndel
parent ad79476f54
commit 669a8085d9

View file

@ -2882,7 +2882,7 @@ extern int divinglog_profile(void *handle, int columns, char **data, char **colu
{ {
int sinterval = 0; int sinterval = 0;
unsigned long i, len, lenprofile2 = 0; unsigned long i, len, lenprofile2 = 0;
char *ptr, temp[4], pres[5]; char *ptr, temp[4], pres[5], hbeat[4];
short oldcyl = -1; short oldcyl = -1;
/* We do not have samples */ /* We do not have samples */
@ -2944,6 +2944,11 @@ extern int divinglog_profile(void *handle, int columns, char **data, char **colu
cur_sample->cylinderpressure.mbar = atoi(pres) * 100; cur_sample->cylinderpressure.mbar = atoi(pres) * 100;
} }
if (data[3] && strlen(data[3])) {
memcpy(hbeat, &data[3][i * 14 + 8], 3);
cur_sample->heartbeat = atoi(hbeat);
}
ptr += 12; ptr += 12;
sample_end(); sample_end();
} }
@ -3012,7 +3017,7 @@ extern int divinglog_dive(void *param, int columns, char **data, char **column)
int retval = 0; int retval = 0;
sqlite3 *handle = (sqlite3 *)param; sqlite3 *handle = (sqlite3 *)param;
char *err = NULL; char *err = NULL;
char get_profile_template[] = "select ProfileInt,Profile,Profile2 from Logbook where ID = %d"; char get_profile_template[] = "select ProfileInt,Profile,Profile2,Profile3 from Logbook where ID = %d";
char get_cylinder0_template[] = "select 0,TankSize,PresS,PresE,PresW,O2,He,DblTank from Logbook where ID = %d"; char get_cylinder0_template[] = "select 0,TankSize,PresS,PresE,PresW,O2,He,DblTank from Logbook where ID = %d";
char get_cylinder_template[] = "select TankID,TankSize,PresS,PresE,PresW,O2,He,DblTank from Tank where LogID = %d order by TankID"; char get_cylinder_template[] = "select TankID,TankSize,PresS,PresE,PresW,O2,He,DblTank from Tank where LogID = %d order by TankID";
char get_buffer[1024]; char get_buffer[1024];