From 2bc7aa5fc72203b25eb77948da44cf7f7b65bc17 Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Sat, 29 Dec 2018 21:32:55 +0200 Subject: 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 --- core/file.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'core/file.c') 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) { -- cgit v1.2.3-70-g09d2