diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-06-01 12:07:29 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-01 12:07:29 -0700 |
commit | 1a040134538b7733f3088ea34f101cfedecc2c64 (patch) | |
tree | 53eb0fc9dd65f3e75fb886075cc5b952b3800157 /dive.h | |
parent | fb4d9b34f87f71b072bccb36633d7247b9d9dd9d (diff) | |
download | subsurface-1a040134538b7733f3088ea34f101cfedecc2c64.tar.gz |
Encapsulate the horrid gas encoding in gas change events
We should never pass permille values around as integers. And we shouldn't
have to decode the stupid value in more than one place.
This doesn't tackle all the places where we access O2 and He "too early"
and should instead keep passing around a gaxmix. But it's a first step.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.h')
-rw-r--r-- | dive.h | 29 |
1 files changed, 13 insertions, 16 deletions
@@ -69,6 +69,18 @@ typedef struct const char *description; /* "integrated", "belt", "ankle" */ } weightsystem_t; +/* + * Events are currently based straight on what libdivecomputer gives us. + * We need to wrap these into our own events at some point to remove some of the limitations. + */ +struct event { + struct event *next; + duration_t time; + int type, flags, value; + bool deleted; + char name[]; +}; + extern int get_pressure_units(int mb, const char **units); extern double get_depth_units(int mm, int *frac, const char **units); extern double get_volume_units(unsigned int ml, int *frac, const char **units); @@ -94,6 +106,7 @@ static inline int get_he(const struct gasmix *mix) extern void sanitize_gasmix(struct gasmix *mix); extern int gasmix_distance(const struct gasmix *a, const struct gasmix *b); +extern struct gasmix *get_gasmix_from_event(struct event *ev); static inline bool is_air(int o2, int he) { @@ -168,22 +181,6 @@ void taglist_init_global(); void taglist_free(struct tag_entry *tag_list); /* - * Events are currently pretty meaningless. This is - * just based on the random data that libdivecomputer - * gives us. I'm not sure what a real "architected" - * event model would actually look like, but right - * now you can associate a list of events with a dive, - * and we'll do something about it. - */ -struct event { - struct event *next; - duration_t time; - int type, flags, value; - bool deleted; - char name[]; -}; - -/* * NOTE! The deviceid and diveid are model-specific *hashes* of * whatever device identification that model may have. Different * dive computers will have different identifying data, it could |