summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Salvador Cuñat <salvador.cunat@gmail.com>2017-05-07 10:27:44 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-05-07 07:48:12 -0700
commit22f07f5ada787bc24abb9cce9ccb9ae3196983b3 (patch)
treed7c93688178b1ea1931647d232623e78743dce15
parent25cec35d24a89ecf114961acc52415566f332dea (diff)
downloadsubsurface-22f07f5ada787bc24abb9cce9ccb9ae3196983b3.tar.gz
Datatrak import rework: initial changes
Remove dtrakheader structure. In the end, we only make use of the number of dives in the log file. Define a models_table_t table which strores the known Uwatec's Aladin models and its equivalence with libdivecomputer known models. Add a macro to check that movements in memblock buffer don't get out of the allocated memory. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
-rw-r--r--core/datatrak.h46
1 files changed, 40 insertions, 6 deletions
diff --git a/core/datatrak.h b/core/datatrak.h
index a774c6018..c207e3baf 100644
--- a/core/datatrak.h
+++ b/core/datatrak.h
@@ -3,13 +3,47 @@
#define DATATRAK_HEADER_H
#include <string.h>
+#include "libdivecomputer.h"
-typedef struct dtrakheader_ {
- int header; //Must be 0xA100;
- int divesNum;
- int dc_serial_1;
- int dc_serial_2;
-} dtrakheader;
+struct models_table_t {
+ int model_num;
+ int libdc_num;
+ const char *name;
+ dc_family_t type;
+};
+
+/*
+ * Set of known models and equivalences with libdivecomputer.
+ * Not included 0x14, 0x24, 0x41, and 0x73 known to exist, but not its model name.
+ * Unknown model equivalence is set to Air X which should cover most profiles.
+ * Nitrox and 02 models seems to keep its number more seriously than earlier
+ * series and OEMs. Info for unknown models is always welcome.
+ */
+static const struct models_table_t g_models[] = {
+ {0x00, 0x00, "Manually entered dive", DC_FAMILY_NULL},
+ {0x1B, 0x3F, "Uwatec Aladin Pro", DC_FAMILY_UWATEC_ALADIN},
+ {0x1C, 0x1C, "Uwatec Aladin Air", DC_FAMILY_UWATEC_ALADIN},
+ {0x1D, 0x3F, "Spiro Monitor 2 plus", DC_FAMILY_UWATEC_ALADIN},
+ {0x1E, 0x3E, "Uwatec Aladin Sport", DC_FAMILY_UWATEC_ALADIN},
+ {0x1F, 0x3F, "Uwatec Aladin Pro", DC_FAMILY_UWATEC_ALADIN},
+ {0x34, 0x44, "Uwatec Aladin Air X/Z", DC_FAMILY_UWATEC_ALADIN},
+ {0x3D, 0x3F, "Spiro Monitor 2 plus", DC_FAMILY_UWATEC_ALADIN},
+ {0x3E, 0x3E, "Uwatec Aladin Sport", DC_FAMILY_UWATEC_ALADIN},
+ {0x3F, 0x3F, "Uwatec Aladin Pro", DC_FAMILY_UWATEC_ALADIN},
+ {0x44, 0x44, "Uwatec Aladin Air X/Z", DC_FAMILY_UWATEC_ALADIN},
+ {0x48, 0x1C, "Spiro Monitor 3 Air", DC_FAMILY_UWATEC_ALADIN},
+ {0xA4, 0xA4, "Uwatec Aladin Air X/Z O2", DC_FAMILY_UWATEC_ALADIN},
+ {0xB1, 0x3E, "Citizen Hyper Aqualand", DC_FAMILY_UWATEC_ALADIN},
+ {0xB2, 0x3F, "Citizen ProMaster", DC_FAMILY_UWATEC_ALADIN},
+ {0xB3, 0x3F, "Mares Guardian", DC_FAMILY_UWATEC_ALADIN},
+ {0xF4, 0xF4, "Uwatec Aladin Air X/Z Nitrox", DC_FAMILY_UWATEC_ALADIN},
+ {0xFF, 0xFF, "Uwatec Aladin Pro Nitrox", DC_FAMILY_UWATEC_ALADIN},
+ {0xEE, 0x44, "Uwatec Unknown model", DC_FAMILY_UWATEC_ALADIN},
+};
+
+extern struct sample *add_sample(struct sample *sample, int time, struct divecomputer *dc);
+
+#define JUMP(_ptr, _n) if ((long) (_ptr += _n) > maxbuf) goto bail
#define read_bytes(_n) \
switch (_n) { \