diff options
Diffstat (limited to 'main/mint_health.h')
| -rw-r--r-- | main/mint_health.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/main/mint_health.h b/main/mint_health.h new file mode 100644 index 0000000..f047d6a --- /dev/null +++ b/main/mint_health.h | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | #ifndef MINT_HEALTH_H | ||
| 2 | #define MINT_HEALTH_H | ||
| 3 | |||
| 4 | #include "esp_err.h" | ||
| 5 | #include <stdint.h> | ||
| 6 | #include <stdbool.h> | ||
| 7 | |||
| 8 | #define MINT_HEALTH_MAX 8 | ||
| 9 | #define MINT_HEALTH_PROBE_INTERVAL_S 300 | ||
| 10 | #define MINT_HEALTH_PROBE_TIMEOUT_MS 15000 | ||
| 11 | #define MINT_HEALTH_RECOVERY_THRESHOLD 3 | ||
| 12 | |||
| 13 | typedef struct { | ||
| 14 | char url[256]; | ||
| 15 | bool reachable; | ||
| 16 | uint8_t consecutive_successes; | ||
| 17 | int64_t last_probe_ms; | ||
| 18 | int last_http_status; | ||
| 19 | } mint_status_t; | ||
| 20 | |||
| 21 | typedef void (*mint_health_changed_cb)(void); | ||
| 22 | |||
| 23 | esp_err_t mint_health_init(const char urls[][256], int count); | ||
| 24 | void mint_health_start(void); | ||
| 25 | void mint_health_stop(void); | ||
| 26 | const mint_status_t *mint_health_get_all(int *out_count); | ||
| 27 | bool mint_health_is_reachable(const char *url); | ||
| 28 | void mint_health_mark_unreachable(const char *url); | ||
| 29 | void mint_health_register_callback(mint_health_changed_cb cb); | ||
| 30 | |||
| 31 | #endif | ||