Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
cmake_minimum_required(VERSION 3.10)
project(MC_APP_BOILERPLATE VERSION 0.1.0 LANGUAGES C CXX)

set(PROJECT_EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/components" CACHE PATH
"Common ESP-IDF components" FORCE)

include(platforms/desktop/CMakeLists.txt)
10 changes: 10 additions & 0 deletions components/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set(PROJECT_COMPONENTS
settings_core
settings_ui
connection_tester
net_sntp
ota_update
diag
backup_server
CACHE INTERNAL "Registered user components"
)
11 changes: 11 additions & 0 deletions components/backup_server/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
idf_component_register(
SRCS
"src/backup_server.c"
"src/backup_format.c"
INCLUDE_DIRS
"include"
REQUIRES
settings_core
esp_http_server
log
)
23 changes: 23 additions & 0 deletions components/backup_server/include/backup_server/backup_format.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
*
* SPDX-License-Identifier: MIT
*/
#pragma once

#include <stddef.h>

#include "esp_err.h"
#include "settings_core/app_cfg.h"

#ifdef __cplusplus
extern "C"
{
#endif

size_t backup_server_calculate_json_size(const app_cfg_t* cfg);
esp_err_t backup_server_write_json(const app_cfg_t* cfg, char* buffer, size_t length);

#ifdef __cplusplus
}
#endif
28 changes: 28 additions & 0 deletions components/backup_server/include/backup_server/backup_server.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
*
* SPDX-License-Identifier: MIT
*/
#pragma once

#include "esp_err.h"
#include "esp_http_server.h"
#include "settings_core/app_cfg.h"

#ifdef __cplusplus
extern "C"
{
#endif

typedef struct
{
httpd_handle_t httpd;
const app_cfg_t* cfg;
} backup_server_handle_t;

esp_err_t backup_server_start(backup_server_handle_t* handle, const app_cfg_t* cfg);
void backup_server_stop(backup_server_handle_t* handle);

#ifdef __cplusplus
}
#endif
Loading
Loading