2017-04-27 18:18:03 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2011-09-15 04:00:49 +00:00
|
|
|
/*
|
|
|
|
* defines and prototypes for the uemis Zurich SDA file parser
|
|
|
|
*/
|
|
|
|
|
2011-10-03 19:27:14 +00:00
|
|
|
#ifndef UEMIS_H
|
|
|
|
#define UEMIS_H
|
|
|
|
|
2024-04-29 05:02:54 +00:00
|
|
|
#include "libdivecomputer.h" // for device_data_t, which is a typedef, not a struct :(
|
2011-10-03 19:27:14 +00:00
|
|
|
|
2013-10-05 19:11:46 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
2024-04-29 05:02:54 +00:00
|
|
|
#include <string>
|
|
|
|
#include <string_view>
|
2024-04-23 14:09:52 +00:00
|
|
|
#include <unordered_map>
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
struct dive;
|
|
|
|
struct uemis_sample;
|
|
|
|
struct dive_site;
|
|
|
|
|
|
|
|
struct uemis {
|
2024-04-29 05:02:54 +00:00
|
|
|
void parse_divelog_binary(std::string_view base64, struct dive *dive);
|
2024-04-23 14:09:52 +00:00
|
|
|
int get_weight_unit(uint32_t diveid) const;
|
|
|
|
void mark_divelocation(int diveid, int divespot, struct dive_site *ds);
|
2024-04-29 05:02:54 +00:00
|
|
|
void set_divelocation(int divespot, const std::string &text, double longitude, double latitude);
|
2024-04-23 14:09:52 +00:00
|
|
|
int get_divespot_id_by_diveid(uint32_t diveid) const;
|
|
|
|
private:
|
|
|
|
struct helper {
|
|
|
|
int lbs = 9;
|
|
|
|
int divespot = 9;
|
|
|
|
struct dive_site *dive_site = nullptr;
|
|
|
|
};
|
|
|
|
// Use a hash-table (std::unordered_map) to access dive information.
|
|
|
|
// Might also use a balanced binary tree (std::map) or a sorted array (std::vector).
|
|
|
|
std::unordered_map<uint32_t, helper> helper_table;
|
|
|
|
|
|
|
|
static void event(struct dive *dive, struct divecomputer *dc, struct sample *sample, const uemis_sample *u_sample);
|
|
|
|
struct helper &get_helper(uint32_t diveid);
|
|
|
|
void weight_unit(int diveid, int lbs);
|
|
|
|
};
|
|
|
|
|
2024-04-29 05:02:54 +00:00
|
|
|
std::string do_uemis_import(device_data_t *data);
|
2011-10-03 19:27:14 +00:00
|
|
|
|
2013-10-05 19:11:46 +00:00
|
|
|
#endif
|
|
|
|
|
2014-02-11 18:14:46 +00:00
|
|
|
#endif // UEMIS_H
|