aboutsummaryrefslogtreecommitdiffstats
path: root/core/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2017-08-08 00:00:36 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-08-10 09:09:53 -0700
commit9f290dcdb0395711a38540f79d04e7748cbdde3e (patch)
tree01e276aa381aac7a1551c8ab107ddcb19ee67e8e /core/parse-xml.c
parent070c7e545bbc34bbc7c6a17f4cb587f5b0801ea1 (diff)
downloadsubsurface-9f290dcdb0395711a38540f79d04e7748cbdde3e.tar.gz
DLF: Parse more measurements, import GPS
This add support for parsing more measurements, and now imports GPS data to. Signed-off-by: Anton Lundin <glance@acc.umu.se>
Diffstat (limited to 'core/parse-xml.c')
-rw-r--r--core/parse-xml.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/core/parse-xml.c b/core/parse-xml.c
index da897cd3c..fa9bbe26a 100644
--- a/core/parse-xml.c
+++ b/core/parse-xml.c
@@ -3784,8 +3784,24 @@ int parse_dlf_buffer(unsigned char *buffer, size_t size)
break;
case 7:
/* measure record */
- /* Po2 sample? Solenoid inject? */
- //fprintf(stderr, "%02X %02X%02X %02X%02X\n", ptr[5], ptr[6], ptr[7], ptr[8], ptr[9]);
+ switch (ptr[2] >> 5) {
+ case 1:
+ /* Measure Battery */
+ //printf("B1: %dmV %d% B2: %dmV %d%\n", (ptr[5] << 8) + ptr[4], (ptr[7] << 8) + ptr[6], (ptr[9] << 8) + ptr[8], (ptr[11] << 8) + ptr[10]);
+ case 3:
+ /* Measure Oxygen */
+ //printf("o2 cells(0.01 mV): %d %d %d %d\n", (ptr[5] << 8) + ptr[4], (ptr[7] << 8) + ptr[6], (ptr[9] << 8) + ptr[8], (ptr[11] << 8) + ptr[10]);
+ break;
+ case 4:
+ /* Measure GPS */
+ cur_latitude.udeg = (int)((ptr[7] << 24) + (ptr[6] << 16) + (ptr[5] << 8) + (ptr[4] << 0));
+ cur_longitude.udeg = (int)((ptr[11] << 24) + (ptr[10] << 16) + (ptr[9] << 8) + (ptr[8] << 0));
+ cur_dive->dive_site_uuid = create_dive_site_with_gps(NULL, cur_latitude, cur_longitude, cur_dive->when);
+ printf("gps: %s\n", printGPSCoords(cur_latitude.udeg, cur_longitude.udeg));
+ break;
+ default:
+ break;
+ }
break;
default:
/* Unknown... */