mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
25cec35d24
commit
22f07f5ada
1 changed files with 40 additions and 6 deletions
|
@ -3,13 +3,47 @@
|
||||||
#define DATATRAK_HEADER_H
|
#define DATATRAK_HEADER_H
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "libdivecomputer.h"
|
||||||
|
|
||||||
typedef struct dtrakheader_ {
|
struct models_table_t {
|
||||||
int header; //Must be 0xA100;
|
int model_num;
|
||||||
int divesNum;
|
int libdc_num;
|
||||||
int dc_serial_1;
|
const char *name;
|
||||||
int dc_serial_2;
|
dc_family_t type;
|
||||||
} dtrakheader;
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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) \
|
#define read_bytes(_n) \
|
||||||
switch (_n) { \
|
switch (_n) { \
|
||||||
|
|
Loading…
Reference in a new issue