summaryrefslogtreecommitdiffstats
path: root/libdivecomputer.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-07 20:08:29 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-07 21:03:39 -0800
commit9d80e7bfe47726e1f27be323088eb7d36f14c854 (patch)
tree584d33e44d80a1be22abfd36fc0ce296550d2554 /libdivecomputer.c
parenta72597189ddccf4e495b52d964d175477414abb9 (diff)
downloadsubsurface-9d80e7bfe47726e1f27be323088eb7d36f14c854.tar.gz
Add CNS and pO2 tracking in the samples
This adds the new members to the sample structure and fills them from supported dive computers (Uemis SDA and OSTC / Shearwater Predator, assuming you have libdivecomputer 0.3). Save relvant values of this to the XML file and load it back. Handle the new fields when merging dives. At this stage we don't DO anything with this, all we do is extract them from the dive computer, save them to the XML file and load them back. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'libdivecomputer.c')
-rw-r--r--libdivecomputer.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libdivecomputer.c b/libdivecomputer.c
index ca91dc892..e62265b7a 100644
--- a/libdivecomputer.c
+++ b/libdivecomputer.c
@@ -185,6 +185,18 @@ sample_cb(dc_sample_type_t type, dc_sample_value_t value, void *userdata)
printf("%02X", ((unsigned char *) value.vendor.data)[i]);
printf("</vendor>\n");
break;
+#if DC_VERSION_CHECK(0, 3, 0)
+ case DC_SAMPLE_SETPOINT:
+ /* for us a setpoint means constant pO2 from here */
+ sample->po2 = value.setpoint * 1000 + 0.5;
+ break;
+ case DC_SAMPLE_PPO2:
+ sample->po2 = value.ppo2 * 1000 + 0.5;
+ break;
+ case DC_SAMPLE_CNS:
+ sample->cns = value.cns * 100 + 0.5;
+ break;
+#endif
default:
break;
}