From: Antonio Ospite Date: Wed, 13 Mar 2013 14:08:06 +0000 (+0100) Subject: Fix parsing systolic pressure X-Git-Url: https://git.ao2.it/visomat-utils.git/commitdiff_plain/32d3e4d3b1e13fc36501cd90a2ff85644670af3f Fix parsing systolic pressure There is another field between the time and the systolic pressure, it is still not 100% clear what it means, it could be an indicator for arrhythmia. --- diff --git a/README b/README index 07c9332..9cc74be 100644 --- a/README +++ b/README @@ -46,23 +46,25 @@ The structure can be better visualized when split in fields: 06 # number of records in this memory block # Each records stores date, time, systolic and diastolic pressure, pulses + # Maybe the third field is an indication of arrhythmia? + # Or a flag to mark test or out of scale measurements? - # yymmdd HHMM systolic diastolic pulses - 100101 1202 1151 102 120 - 100101 1208 1156 107 116 - 100101 1203 0103 065 073 - 440601 1320 0113 068 066 - 100101 1311 0127 084 066 - 100101 1203 0106 068 066 + # yymmdd HHMM ? systolic diastolic pulses + 100101 1202 1 151 102 120 + 100101 1208 1 156 107 116 + 100101 1203 0 103 065 073 + 440601 1320 0 113 068 066 + 100101 1311 0 127 084 066 + 100101 1203 0 106 068 066 # Same structure for the other memory block M 2 07 - 100101 1203 1155 111 116 - 100101 1202 0117 070 076 - 440601 1312 0128 071 072 - 440601 1317 0126 050 065 - 440601 1319 0114 063 066 - 100101 1400 0114 070 071 - 130312 1145 0121 080 072 + 100101 1203 1 155 111 116 + 100101 1202 0 117 070 076 + 440601 1312 0 128 071 072 + 440601 1317 0 126 050 065 + 440601 1319 0 114 063 066 + 100101 1400 0 114 070 071 + 130312 1145 0 121 080 072 diff --git a/src/visomat-data-downloader.c b/src/visomat-data-downloader.c index 08a752a..d925388 100644 --- a/src/visomat-data-downloader.c +++ b/src/visomat-data-downloader.c @@ -63,6 +63,7 @@ struct datetime { }; struct pressure { + unsigned int flag; /* XXX Maybe this means arrhythmia? */ unsigned int systolic; unsigned int diastolic; unsigned int pulses; @@ -102,10 +103,16 @@ static void print_record_csv_compat(struct datetime *d, struct pressure *p) pulse_pressure = p->systolic - p->diastolic; printf("%u;", pulse_pressure); + if (p->flag) + printf("x"); + +#if 0 + /* The original software does not seem to be doing that */ if (p->pulses > 100) printf("tachycardia"); else if (p->pulses < 60) printf("bradycardia"); +#endif printf("\n"); } @@ -157,11 +164,12 @@ static int decode_eeprom(unsigned char *buffer, unsigned int len) i += 10; ret = sscanf((char *)(buffer + i), - "%04u%03u%03u", + "%1u%03u%03u%03u", + &p.flag, &p.systolic, &p.diastolic, &p.pulses); - if (ret != 3) + if (ret != 4) return -EINVAL; /* pressure data is 10 bytes */