smart-oil-heating-control-s.../main/http_metrics.h

40 lines
896 B
C

#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 connect_wifi(void);
httpd_handle_t setup_server(void);
void vSetMetrics(sMetric* paMetrics, uint16_t u16Size);
#endif /* H_HTTPS_METRICS */