update project

This commit is contained in:
2026-04-03 23:28:02 +03:00
parent 5e7f26f128
commit 1681a694d3
12 changed files with 191 additions and 83 deletions

View File

@@ -0,0 +1,32 @@
#include "protocol_test.h"
#include "protocol.h"
#include "cJSON.h"
#include "esp_log.h"
#include "esp_timer.h"
static const char* TAG = "protocol_test";
void protocol_run_tests()
{
ESP_LOGI(TAG, "Running protocol test...");
ProtocolMessage msg;
msg.v = 1;
msg.id = "msg-001";
msg.type = "command";
msg.deviceId = "esp32-01";
msg.ts = esp_timer_get_time();
msg.payload = cJSON_CreateObject();
cJSON_AddStringToObject(msg.payload, "command", "ping");
cJSON* json = protocol_message_to_json(&msg);
char* json_str = cJSON_Print(json);
ESP_LOGI(TAG, "ProtocolMessage JSON:\n%s", json_str);
cJSON_Delete(json);
free(json_str);
cJSON_Delete(msg.payload);
}