mcu_hi3321_watch/tjd/fs/fs_user_common.h
2025-05-26 20:15:20 +08:00

90 lines
3.9 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.

/*----------------------------------------------------------------------------
* Copyright (c) Fenda Technologies Co., Ltd. 2021. All rights reserved.
*
* Description: fs_user_common.h
*
* Author: saimen
*
* Create: 2024-06-08
*--------------------------------------------------------------------------*/
#ifndef FS_USER_COMMON_H
#define FS_USER_COMMON_H
/* Includes ------------------------------------------------------------------*/
#include "sys_typedef.h"
#include "fs_api_base.h"
#include "fs_api_ext.h"
#ifdef __cplusplus
extern "C"
{
#endif
//FS DIR
#define TJD_FS_DIR_SYS "/system" //系统与设置
#define TJD_FS_DIR_DAY "/system/tjd_day" //日常天数据
#define TJD_FS_DIR_SLEEP "/system/tjd_sleep" //睡眠数据
#define TJD_FS_DIR_SPORT "/system/tjd_sport" //运动数据
#define TJD_FS_DIR_UPDATE "/update" //更新文件,固件备份。
#define TJD_FS_DIR_USER "/user" //用户文件夹
#define TJD_FS_DIR_RES "/user/tjd_res" //资源数据
#define TJD_FS_DIR_WF "/user/tjd_wf" //表盘-云表盘
#define TJD_FS_DIR_WFC "/user/tjd_wfc" //表盘-自定义表盘
#define TJD_FS_DIR_WFP "/user/tjd_wfp" //表盘-玩转表盘
#define TJD_FS_DIR_JS "/user/tjd_js" //JS运用
#define TJD_FS_DIR_MUSIC "/user/tjd_music" //本地音乐
#define TJD_FS_DIR_ALBUM "/user/tjd_album" //相册
#define TJD_FS_DIR_BOOK "/user/tjd_book" //电子书
#define TJD_FS_DIR_RECORD "/user/tjd_record" //录音
#define TJD_FS_DIR_GPS "/user/tjd_gps" //GPS星历
#define TJD_FS_DIR_GAME "/user/tjd_game" //游戏
#define TJD_FS_DIR_RESERVE "/music" //为与SDK一致保留。
/*所有接口的路径皆为绝对路径,不支持相对路径功能.*/
///扫描目录
/// 统计目录下的文件数量,包括子目录的文件.
int tjd_fs_user_get_file_number(const char *path);
/// 统计目录下的文件数量,不包括子目录的文件.
int tjd_fs_user_get_file_number_exclude_child_dir(const char *path);
/// 统计目录下的子目录数量,不包括子目录的子目录.
int tjd_fs_user_get_dir_number_exclude_child_dir(const char *path);
/// 获取目录下最老文件的绝对路径,不包括子目录.
int tjd_fs_user_get_oldest_file_exclude_child_dir(const char *path, char *buf);
/// 获取目录下最新文件的绝对路径,不包括子目录.
int tjd_fs_user_get_newest_file_exclude_child_dir(const char *path, char *buf);
/// 获取目录下最老目录的绝对路径,不包括子目录.
int tjd_fs_user_get_oldest_dir_exclude_child_dir(const char *path, char *buf);
/// 获取目录下最新目录的绝对路径,不包括子目录.
int tjd_fs_user_get_newest_dir_exclude_child_dir(const char *path, char *buf);
/// 当目录下的文件数量超过保留值时,删除最老的一个文件
int tjd_fs_user_delete_oldest_file_exclude_child_dir(const char *path, uint8_t retain);
/// 当目录下的子目录数量超过保留值时,删除最老的一个文件
int tjd_fs_user_delete_oldest_dir_exclude_child_dir(const char *path, uint8_t retain);
///
int tjd_fs_user_remove_file_periodically(const char *path,void *time);
///
int tjd_fs_user_remove_dir_periodically(const char *path,void *time);
/// 创建下一级目录
int tjd_fs_user_create_dir_by_str(const char *dir,const char *path);
/// 打印文本文件的内容.
int tjd_fs_user_print_text_file(const char *path);
/// 文件系统目录初始化
int tjd_fs_user_dir_init(void);
/// 文件系统上电挂载.
int tjd_fs_user_mount(bool format);
/// 文件系统上电挂载,并创建目录.
void tjd_fs_user_init(bool format);
/// 恢复出厂设置,保留日志文件.
int tjd_fs_user_factory_reset(void);
#ifdef __cplusplus
}
#endif
#endif /* APP_FS_H */