file api interface refactored

This commit is contained in:
Bogdan Pilyugin 2024-03-28 12:08:49 +02:00
parent ec5069c096
commit 83ab4dcba2
5 changed files with 8 additions and 47 deletions

View File

@ -16,8 +16,6 @@ idf_component_register(
"src/HTTPServer.c"
"src/FileServer.c"
"src/HTTPAPISystem.c"
# "src/HTTPPrintSystem.c"
# "src/HTTPPostSystem.c"
"src/CommandProcSys.c"
"src/Helpers.c"
"src/NetTransport.c"
@ -27,7 +25,7 @@ idf_component_register(
"src/MQTT.c"
"src/CronTimers.c"
"src/SerialPort.c"
src/RawMemAPI.c
src/FileBlockHandler.c
src/OTA.c
src/RestApiHandler.c
src/SysComm.c

View File

@ -1,36 +0,0 @@
/* Copyright 2024 Bogdan Pilyugin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* File name: RawMemAPI.h
* Project: WebguiappTemplate
* Created on: 2024-03-11
* Author: bogd
* Description:
*/
#ifndef COMPONENTS_WEBGUIAPP_INCLUDE_RAWMEMAPI_H_
#define COMPONENTS_WEBGUIAPP_INCLUDE_RAWMEMAPI_H_
#include "webguiapp.h"
typedef struct
{
bool isActive;
int operType;
int dataLengthTotal;
int dataLengthReady;
} mqtt_files_cb;
void RawDataHandler(char *argres, int rw);
#endif /* COMPONENTS_WEBGUIAPP_INCLUDE_RAWMEMAPI_H_ */

View File

@ -119,5 +119,6 @@ esp_err_t SetConfVar(char* name, char* val, rest_var_types *tp);
esp_err_t ServiceDataHandler(data_message_t *MSG);
sys_error_code SysVarsPayloadHandler(data_message_t *MSG);
void GetSysErrorDetales(sys_error_code err, const char **br, const char **ds);
void FileBlockHandler(char *argres, int rw);
#endif /* COMPONENTS_WEBGUIAPP_INCLUDE_SYSTEMAPPLICATION_H_ */

View File

@ -12,14 +12,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* File name: RawMemAPI.c
* File name: FileBlockHandler.c
* Project: WebguiappTemplate
* Created on: 2024-03-11
* Author: bogd
* Description:
*/
#include "RawMemAPI.h"
#include "SystemApplication.h"
#include <SysConfiguration.h>
#include <webguiapp.h>
@ -31,7 +30,6 @@
/*
{
"opertype" : 1, [1-READ, 2-DELETE, 3-WRITE]
"operphase" : 1, [0- DO NOTHING, 1-OPEN, 2-CLOSE, 3-OPEN and CLOSE]
"part": 0, []
"parts": 3, []
"mem_object": "testfile.txt", [Resource name string]
@ -157,7 +155,7 @@ static esp_err_t parse_raw_data_object(char *argres, file_transaction_t *ft)
}
void RawDataHandler(char *argres, int rw)
void FileBlockHandler(char *argres, int rw)
{
if (parse_raw_data_object(argres, &FileTransaction) != ESP_OK)

View File

@ -21,6 +21,7 @@
* \copyright Apache License, Version 2.0
*/
#include "SystemApplication.h"
#include <SysConfiguration.h>
#include <webguiapp.h>
@ -31,7 +32,6 @@
#include "esp_idf_version.h"
#include "NetTransport.h"
#include "esp_vfs.h"
#include "RawMemAPI.h"
extern SYS_CONFIG SysConfig;
@ -416,9 +416,9 @@ static void funct_file_list(char *argres, int rw)
}
static void funct_raw_data(char *argres, int rw)
static void funct_file_block(char *argres, int rw)
{
RawDataHandler(argres, rw);
FileBlockHandler(argres, rw);
}
const int hw_rev = CONFIG_BOARD_HARDWARE_REVISION;
@ -608,7 +608,7 @@ const rest_var_t SystemVariables[] =
{ 0, "objsinfo", &funct_objsinfo, VAR_FUNCT, R, 0, 0 },
{ 0, "file_list", &funct_file_list, VAR_FUNCT, R, 0, 0 },
{ 0, "raw_data", &funct_raw_data, VAR_FUNCT, R, 0, 0 },
{ 0, "file_block", &funct_file_block, VAR_FUNCT, R, 0, 0 },
};