2017-04-27 18:18:03 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2013-04-08 03:20:25 +00:00
|
|
|
#ifndef PLANNER_H
|
|
|
|
#define PLANNER_H
|
|
|
|
|
2019-08-05 18:43:06 +00:00
|
|
|
#include "units.h"
|
|
|
|
#include "divemode.h"
|
2024-05-04 15:55:50 +00:00
|
|
|
#include <string>
|
2019-08-05 18:43:06 +00:00
|
|
|
|
|
|
|
/* this should be converted to use our types */
|
|
|
|
struct divedatapoint {
|
|
|
|
int time;
|
|
|
|
depth_t depth;
|
|
|
|
int cylinderid;
|
|
|
|
pressure_t minimum_gas;
|
|
|
|
int setpoint;
|
|
|
|
bool entered;
|
|
|
|
struct divedatapoint *next;
|
|
|
|
enum divemode_t divemode;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct diveplan {
|
|
|
|
timestamp_t when;
|
|
|
|
int surface_pressure; /* mbar */
|
|
|
|
int bottomsac; /* ml/min */
|
|
|
|
int decosac; /* ml/min */
|
|
|
|
int salinity;
|
|
|
|
short gflow;
|
|
|
|
short gfhigh;
|
|
|
|
short vpmb_conservatism;
|
|
|
|
struct divedatapoint *dp;
|
|
|
|
int eff_gflow, eff_gfhigh;
|
|
|
|
int surface_interval;
|
|
|
|
};
|
|
|
|
|
2024-03-07 18:08:22 +00:00
|
|
|
struct deco_state_cache;
|
|
|
|
|
2024-05-15 05:23:39 +00:00
|
|
|
typedef enum {
|
|
|
|
PLAN_OK,
|
|
|
|
PLAN_ERROR_TIMEOUT,
|
|
|
|
PLAN_ERROR_INAPPROPRIATE_GAS,
|
|
|
|
} planner_error_t;
|
|
|
|
|
2014-06-01 21:17:06 +00:00
|
|
|
extern int validate_gas(const char *text, struct gasmix *gas);
|
2013-04-08 03:20:25 +00:00
|
|
|
extern int validate_po2(const char *text, int *mbar_po2);
|
2016-07-06 12:40:28 +00:00
|
|
|
extern int get_cylinderid_at_time(struct dive *dive, struct divecomputer *dc, duration_t time);
|
2014-05-30 22:40:13 +00:00
|
|
|
extern bool diveplan_empty(struct diveplan *diveplan);
|
2024-05-15 05:23:39 +00:00
|
|
|
extern void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_disclaimer, planner_error_t error);
|
2019-09-01 15:52:25 +00:00
|
|
|
extern const char *get_planner_disclaimer();
|
2013-04-08 03:20:25 +00:00
|
|
|
|
2014-08-19 16:41:09 +00:00
|
|
|
extern void free_dps(struct diveplan *diveplan);
|
2013-08-30 18:06:26 +00:00
|
|
|
|
2019-08-05 18:43:06 +00:00
|
|
|
struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int cylinderid, int po2, bool entered, enum divemode_t divemode);
|
|
|
|
#if DEBUG_PLAN
|
|
|
|
void dump_plan(struct diveplan *diveplan);
|
|
|
|
#endif
|
|
|
|
struct decostop {
|
|
|
|
int depth;
|
|
|
|
int time;
|
|
|
|
};
|
|
|
|
|
2024-03-08 09:44:20 +00:00
|
|
|
extern std::string get_planner_disclaimer_formatted();
|
2024-04-25 20:16:08 +00:00
|
|
|
extern bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, int dcNr, int timestep, struct decostop *decostoptable, deco_state_cache &cache, bool is_planner, bool show_disclaimer);
|
2014-02-11 18:14:46 +00:00
|
|
|
#endif // PLANNER_H
|