summaryrefslogtreecommitdiffstats
path: root/uemis-downloader.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-11-11 14:29:26 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-11-11 14:29:26 +0100
commitfe4f13f184ffb97ee4b6dbd4138a9d8ae3aabd14 (patch)
treeae127ca3591cb72b86bd1b512134086902e140cd /uemis-downloader.c
parent78ad07c72ed37928020cdbf4842e24690ce35f81 (diff)
downloadsubsurface-fe4f13f184ffb97ee4b6dbd4138a9d8ae3aabd14.tar.gz
Add special download modes to force updates from the divecomputer
This will hopefully not be something we need often, but if we improve support for a divecomputer (either in libdivecomputer or in our native Uemis code or even in the way we handle (and potentially discard) events), then it is extremely useful to be able to say "re-download things from the divecomputer and for things that were not edited in Subsurface, don't try to merge the data (which gives BAD results if for example you fixed a bug in the depth calculation in libdivecomputer) but instead simply take the samples, the events and some of the other unedited data straight from the download". This commit implements just that - a "force download" checkbox in the download dialog that makes us reimport all dives from the dive computer, even the ones we already have, and an "always prefer downloaded dive" checkbox that then tells Subsurface not to merge but simply to take the data from the downloaded dive - without overwriting the things we have already edited in Subsurface (like location, buddy, equipment, etc). This, as a precaution, refuses to merge dives that don't have identical start times. So if you have edited the date / time of a dive or if you have previously merged your dive with a different dive computer (and therefore modified samples and events) you are out of luck. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'uemis-downloader.c')
-rw-r--r--uemis-downloader.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/uemis-downloader.c b/uemis-downloader.c
index 6f85eca59..922aa90ae 100644
--- a/uemis-downloader.c
+++ b/uemis-downloader.c
@@ -44,6 +44,7 @@ struct argument_block {
char **max_dive_data;
char **xml_buffer;
progressbar_t *progress;
+ gboolean force_download;
};
static int import_thread_done = 0, import_thread_cancelled;
@@ -796,7 +797,7 @@ static char *do_uemis_download(struct argument_block *args)
* certainly want to start downloading from the first dive on
* the Uemis; otherwise check which was the last dive
* downloaded */
- if (dive_table.nr > 0)
+ if (!args->force_download && dive_table.nr > 0)
newmax = get_divenr(*max_dive_data, deviceid);
else
newmax = strdup("0");
@@ -874,11 +875,12 @@ static void *pthread_wrapper(void *_data)
return (void *)err_string;
}
-GError *uemis_download(const char *mountpath, char **max_dive_data, char **xml_buffer, progressbar_t *progress)
+GError *uemis_download(const char *mountpath, char **max_dive_data, char **xml_buffer, progressbar_t *progress,
+ gboolean force_download)
{
pthread_t pthread;
void *retval;
- struct argument_block args = {mountpath, max_dive_data, xml_buffer, progress};
+ struct argument_block args = {mountpath, max_dive_data, xml_buffer, progress, force_download};
/* I'm sure there is some better interface for waiting on a thread in a UI main loop */
import_thread_done = 0;