GONEC_ARTERY_HttpServer/Inc/fs_base_func.h

91 lines
3.1 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// Created by cfif on 30.01.23.
//
#include "string.h"
#include "inttypes.h"
//#include "stream.h"
#include "stdbool.h"
#include "time.h"
#include "RtcIO.h"
#include "fs_interface.h"
#include "md5alg.h"
#ifndef GONEC_GSM_FS_BASE_FUNC_H
#define GONEC_GSM_FS_BASE_FUNC_H
void toAddPrefixStr(char *out, char *in, size_t len);
bool CopyFileFs_crc_md5(tFs *fs, uint32_t typeCrc, md5a_context *md5ctx, char *filenameTo, char *filenameFrom,
uint32_t offset, uint32_t initCrc32);
void getDelFileDirDatTracert(tFs *fs, char *path);
void getPath(char *pathIn, char *pathOut, int count_dir);
unsigned char crc8(unsigned char *pcBlock, unsigned char len);
uint8_t SF04_CheckCrc(const uint8_t data[], uint8_t nbrOfBytes);
void reportScan(char *str, uint32_t AT);
FRESULT scan_files(char *path, uint32_t *globDirCount, uint32_t *globFileCount);
void getDelFilesDirDat(tFs *fs, char *path, char *ext);
void getDelFileDirDat(tFs *fs, char *path, char *ext);
// Получение указателя на расширение файла
char *getVoidExt(char *buf);
// Получение имени файла лога
size_t getFileNameLog(tRtcIO *rtc, char *buf, size_t len);
// Создание файла из буфера
bool createFileFromBuf(tFs *fs, char *path_fileName, char *buf, size_t buf_len, bool isCreate);
// Получение строки дата
size_t getDateStr(tRtcIO *rtc, char *buf, size_t len);
// Получение максимального id включая поддиректории
uint32_t getNameMaxDirId(tFs *fs, char *path, char *ext);
// Получение максимального id без поддиректорий
uint32_t getNameMaxFileId(tFs *fs, char *path, char *ext);
// Получение строки дата
size_t getNameDir(tRtcIO *rtc, char *buf, size_t len);
// Получение строки дата время в UTC
size_t getDataTimeUTC(time_t *timestamp, char *buf, size_t len);
// Получение строки дата/время
size_t getDataTime(time_t *timestamp, char *buf, size_t len);
bool CopyFileFs(tFs *fs, char *filenameTo, char *filenameFrom, uint32_t offset);
bool CopyFileFsSize(tFs *fs, char *filenameTo, char *filenameFrom, uint32_t offset, uint32_t max);
bool
CopyFileTrucSizeFs(tFs *fs, uint32_t typeCrc, md5a_context *md5ctx, uint32_t *crc32, uint8_t *md5sum,
uint32_t *crc32sumFile, uint8_t *md5sumFile,
char *filenameTo, char *filenameFrom, uint32_t offset, uint32_t truncBytes, uint32_t size);
void getDelFilesDirClean(tFs *fs, char *path);
// Удаление всех файлов в директории
bool delDirFileFs(tFs *fs, char *dir);
// Удаление всех файлов с директориями
FRESULT deleteAllDir(tFs *fs, char *path);
// Получене crc
uint32_t GetCrcFileFs(tFs *fs, char *filename, uint32_t offset);
// Получене crc
uint32_t GetCrcFileisOpenFs(tFs *fs, FIL *fsrc, uint32_t offset);
void getDelFilesDir(tFs *fs, char *path);
uint32_t CrcFileFs(tFs *fs, char *filename);
#endif //GONEC_GSM_FS_BASE_FUNC_H