initial refactoring

This commit is contained in:
Sebastien L
2023-12-04 23:25:57 -05:00
parent d03678ea81
commit c0ddf0a997
331 changed files with 29663 additions and 16553 deletions

View File

@@ -6,15 +6,12 @@
#include "esp_netif.h"
#include "esp_ota_ops.h"
#include "esp_tls.h"
#include "nvs_flash.h"
#if CONFIG_MBEDTLS_CERTIFICATE_BUNDLE
#include "esp_crt_bundle.h"
#endif
#include "esp_system.h"
#include "http_handlers.h"
#include "nvs.h"
#include "nvs_flash.h"
#include "nvs_utilities.h"
#include "tools.h"
#include <algorithm>
#include <iomanip>
@@ -85,7 +82,7 @@ void Batch::push() {
_events.clear();
}
FREE_AND_NULL(json_str)
ESP_LOGD(TAG, "Total duration for metrics call: %lu. ", gettime_ms() - start_time);
ESP_LOGD(TAG, "Total duration for metrics call: %u. ", gettime_ms() - start_time);
}
void Batch::build_guid() {

View File

@@ -10,6 +10,7 @@
#include <stdio.h>
#include <string.h>
#include <string>
#include <time.h>
namespace Metrics {
struct StrCompare {
@@ -45,7 +46,7 @@ class Event {
}
private:
char* _name = nullptr;
uint32_t _time;
std::time_t _time;
cJSON* _json = nullptr;
};

View File

@@ -9,7 +9,6 @@
#include "esp_tls.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "nvs_flash.h"
#include "tools.h"
#include <cstdarg>
#include <cstdio>
@@ -21,7 +20,8 @@
#include "cJSON.h"
#include "freertos/timers.h"
#include "network_manager.h"
#include "platform_config.h"
// #include "Configurator.h"
#pragma message("fixme: search for TODO below")
static const char* TAG = "metrics";
@@ -36,7 +36,7 @@ static uint32_t metrics_usage_gen_time = 0;
#pragma message "Metrics API key needs to be passed from the environment"
#define METRICS_API_KEY "ZZZ"
#endif
static const char* metrics_api_key =
static const char* metrics_api_key = METRICS_API_KEY;
static const char* parms_str = "params";
static const char* properties_str = "properties";
static const char* user_properties_str = "user_properties";