2011-09-20 19:40:34 +00:00
|
|
|
#ifndef LIBDIVECOMPUTER_H
|
|
|
|
#define LIBDIVECOMPUTER_H
|
|
|
|
|
2013-05-20 19:43:33 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2011-09-20 19:40:34 +00:00
|
|
|
/* libdivecomputer */
|
2013-05-14 18:50:55 +00:00
|
|
|
#include <libdivecomputer/version.h>
|
2012-07-10 19:33:44 +00:00
|
|
|
#include <libdivecomputer/device.h>
|
|
|
|
#include <libdivecomputer/parser.h>
|
2011-09-20 19:40:34 +00:00
|
|
|
|
|
|
|
/* handling uemis Zurich SDA files */
|
|
|
|
#include "uemis.h"
|
|
|
|
|
|
|
|
/* don't forget to include the UI toolkit specific display-XXX.h first
|
|
|
|
to get the definition of progressbar_t */
|
|
|
|
typedef struct device_data_t {
|
2012-06-22 20:37:39 +00:00
|
|
|
dc_descriptor_t *descriptor;
|
|
|
|
const char *vendor, *product, *devname;
|
Assemble the actual Suunto serial number
It turns out that the serial number returned by libdivecomputer isn't
really the serial number as interpreted by the vendor. Those tend to be
strings, but libdivecomputer gives us a 32bit number.
Some experimenting showed that for the Suunto devies tested the serial
number is encoded in that 32bit number:
It so happens that the Suunto serial number strings are strings that have
all numbers, but they aren't *one* number. They are four bytes
representing two numbers each, and the "23500027" string is actually the
four bytes 23 50 00 27 (0x17 0x32 0x00 0x1b). And libdivecomputer has
incorrectly parsed those four bytes as one number, not as the encoded
serial number string it is. So the value 389152795 is actually hex
0x1732001b, which is 0x17 0x32 0x00 0x1b, which is - 23 50 00 27.
This should be done by libdivecomputer, but hey, in the meantime this at
least shows the concept. And helps test the XML save/restore code.
It depends on the two patches that create the whole "device.c"
infrastructure, of course. With this, my dive file ends up having the
settings section look like this:
<divecomputerid model='Suunto Vyper Air' deviceid='d4629110'
serial='01201094' firmware='1.1.22'/>
<divecomputerid model='Suunto HelO2' deviceid='995dd566'
serial='23500027' firmware='1.0.4'/>
where the format of the firmware version is something I guessed at,
but it was the obvious choice (again, it's byte-based, I'm ignoring
the high byte that is zero for both of my Suuntos).
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-10 00:14:21 +00:00
|
|
|
const char *model;
|
2012-11-25 19:44:27 +00:00
|
|
|
unsigned int deviceid, diveid;
|
2012-06-22 20:37:39 +00:00
|
|
|
dc_device_t *device;
|
2012-08-27 22:06:58 +00:00
|
|
|
dc_context_t *context;
|
2011-09-26 20:04:14 +00:00
|
|
|
int preexisting;
|
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>
2012-11-11 13:29:26 +00:00
|
|
|
gboolean force_download;
|
2011-09-20 19:40:34 +00:00
|
|
|
} device_data_t;
|
|
|
|
|
2013-05-20 19:43:33 +00:00
|
|
|
const char *do_libdivecomputer_import(device_data_t *data);
|
2013-06-24 22:14:07 +00:00
|
|
|
char *do_uemis_import(const char *mountpath, short force_download);
|
2011-09-20 19:40:34 +00:00
|
|
|
|
2013-05-20 20:02:17 +00:00
|
|
|
extern int import_thread_cancelled;
|
|
|
|
extern const char *progress_bar_text;
|
|
|
|
extern double progress_bar_fraction;
|
|
|
|
|
2013-05-20 19:43:33 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2011-09-20 19:40:34 +00:00
|
|
|
#endif
|
2013-05-20 19:43:33 +00:00
|
|
|
|
2013-06-24 22:14:07 +00:00
|
|
|
#endif
|