summaryrefslogtreecommitdiffstats
path: root/save-xml.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-11-25 11:44:27 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-11-25 13:05:11 -0800
commit1ca1fe7994799ec7786a53914d713e51d56f87a3 (patch)
tree1348d98e71c9337d784900a4fc7607206c0e9c10 /save-xml.c
parent1b861ba20e1626d28686c3998fc3bb6b6b49a6d4 (diff)
downloadsubsurface-1ca1fe7994799ec7786a53914d713e51d56f87a3.tar.gz
Improve on divecomputer data handling
This simplifies the vendor/product fields into just a single "model" string for the dive computer, since we can't really validly ever use it any other way anyway. Also, add 'deviceid' and 'diveid' fields: they are just 32-bit hex values that are unique for that particular dive computer model. For libdivecomputer, they are basically the first word of the SHA1 of the data that libdivecomputer gives us. (Trying to expose it in some other way is insane - different dive computers use different models for the ID, so don't try to do some kind of serial number or something like that) For the Uemis Zurich, which doesn't use the libdivecomputer import, we currently only set the model name. The computer does have some kind of device ID string, and we could/should just do the same "SHA1 over the ID" to give it a unique ID, but the pseudo-xml parsing confuses me, so I'll let Dirk fix that up. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'save-xml.c')
-rw-r--r--save-xml.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/save-xml.c b/save-xml.c
index af4356840..58faf6aeb 100644
--- a/save-xml.c
+++ b/save-xml.c
@@ -351,10 +351,12 @@ static void save_dc(FILE *f, struct dive *dive, struct divecomputer *dc)
int i;
fprintf(f, " <divecomputer");
- if (dc->vendor)
- show_utf8(f, dc->vendor, " vendor='", "'", 1);
- if (dc->product)
- show_utf8(f, dc->product, " product='", "'", 1);
+ if (dc->model)
+ show_utf8(f, dc->model, " model='", "'", 1);
+ if (dc->deviceid)
+ fprintf(f, " deviceid='%08x'", dc->deviceid);
+ if (dc->diveid)
+ fprintf(f, " diveid='%08x'", dc->diveid);
if (dc->when && dc->when != dive->when)
show_date(f, dc->when);
fprintf(f, ">\n");