export metrics

This commit is contained in:
2024-12-07 22:46:38 +01:00
parent 311ab2db2f
commit 873d63e6fa
7 changed files with 307 additions and 200 deletions

42
main/metrics.h Normal file
View File

@ -0,0 +1,42 @@
#ifndef H_HTTPS_METRICS
#define H_HTTPS_METRICS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "spi_flash_mmap.h"
#include <esp_http_server.h>
#include "esp_wifi.h"
#include "esp_event.h"
#include "freertos/event_groups.h"
#include "esp_log.h"
#include "nvs_flash.h"
#include "esp_netif.h"
#include <lwip/sockets.h>
#include <lwip/sys.h>
#include <lwip/api.h>
#include <lwip/netdb.h>
#define WIFI_CONNECTED_BIT BIT0
#define WIFI_FAIL_BIT BIT1
#define HTML_RESPONSE_SIZE 256U
#define METRIC_NAME_MAX_SIZE 64U
#define METRIC_MAX_COUNT 32U
typedef struct _metric
{
char caMetricName[METRIC_NAME_MAX_SIZE];
float fMetricValue;
} sMetric;
void initMetrics(void);
void connect_wifi(void);
httpd_handle_t setup_server(void);
void vSetMetrics(sMetric *paMetrics, uint16_t u16Size);
#endif /* H_HTTPS_METRICS */