summaryrefslogtreecommitdiffstats
path: root/core/file.c
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2018-12-29 21:32:55 +0200
committerGravatar Miika Turkia <miika.turkia@gmail.com>2018-12-29 21:32:55 +0200
commit2bc7aa5fc72203b25eb77948da44cf7f7b65bc17 (patch)
tree3b158eee67a1475839d3a4786849793fde5e5fc4 /core/file.c
parenta0d7b76dd040b28d3a455d491c904ef53b8368f9 (diff)
downloadsubsurface-2bc7aa5fc72203b25eb77948da44cf7f7b65bc17.tar.gz
Initial support for Shearwater Cloud
This works to some extent to part of a sample log I received. However, still quite a bit more work is needed. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Diffstat (limited to 'core/file.c')
-rw-r--r--core/file.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/file.c b/core/file.c
index 6f2edcf8d..fe2b0878b 100644
--- a/core/file.c
+++ b/core/file.c
@@ -132,6 +132,7 @@ static int try_to_open_db(const char *filename, struct memblock *mem, struct div
char dm4_test[] = "select count(*) from sqlite_master where type='table' and name='Dive' and sql like '%ProfileBlob%'";
char dm5_test[] = "select count(*) from sqlite_master where type='table' and name='Dive' and sql like '%SampleBlob%'";
char shearwater_test[] = "select count(*) from sqlite_master where type='table' and name='system' and sql like '%dbVersion%'";
+ char shearwater_cloud_test[] = "select count(*) from sqlite_master where type='table' and name='SyncV3MetadataDiveLog' and sql like '%CreatedDevice%'";
char cobalt_test[] = "select count(*) from sqlite_master where type='table' and name='TrackPoints' and sql like '%DepthPressure%'";
char divinglog_test[] = "select count(*) from sqlite_master where type='table' and name='DBInfo' and sql like '%PrgName%'";
int retval;
@@ -167,6 +168,14 @@ static int try_to_open_db(const char *filename, struct memblock *mem, struct div
return retval;
}
+ /* Testing if DB schema resembles Shearwater cloud database format */
+ retval = sqlite3_exec(handle, shearwater_cloud_test, &db_test_func, 0, NULL);
+ if (!retval) {
+ retval = parse_shearwater_cloud_buffer(handle, filename, mem->buffer, mem->size, table);
+ sqlite3_close(handle);
+ return retval;
+ }
+
/* Testing if DB schema resembles Atomic Cobalt database format */
retval = sqlite3_exec(handle, cobalt_test, &db_test_func, 0, NULL);
if (!retval) {