diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2014-11-15 17:34:20 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-11-15 08:15:15 -0800 |
commit | 5807e4589f09e917a673f5ee3514b2c11fb86082 (patch) | |
tree | 5292e252b56b16ee1cda2bb1bf4caa2d245177b3 /file.c | |
parent | ff193e309c7f699a1a9a4081c9886d066c7668cd (diff) | |
download | subsurface-5807e4589f09e917a673f5ee3514b2c11fb86082.tar.gz |
Initial support for Suunto DM5 import
This implements import from Suunto DM5 database, but there is something
wrong with some of the sample dives in the database I received as
sample. It seems that we should detect missing/bogus data and treat it
properly as divelogs.de does with the same dives. Anyway, when we have
proper data, this import appears to produce sensible results.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -160,6 +160,7 @@ static int try_to_open_db(const char *filename, struct memblock *mem) { sqlite3 *handle; 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%'"; int retval; @@ -170,6 +171,14 @@ static int try_to_open_db(const char *filename, struct memblock *mem) return 1; } + /* Testing if DB schema resembles Suunto DM5 database format */ + retval = sqlite3_exec(handle, dm5_test, &db_test_func, 0, NULL); + if (!retval) { + retval = parse_dm5_buffer(handle, filename, mem->buffer, mem->size, &dive_table); + sqlite3_close(handle); + return retval; + } + /* Testing if DB schema resembles Suunto DM4 database format */ retval = sqlite3_exec(handle, dm4_test, &db_test_func, 0, NULL); if (!retval) { |