Files
P4-USB-transfer/main/EMOJI_STORAGE/emoji_storage.h
T
zhengxinandCursor 851e347cf5 初始提交卡包 USB 工程
纳入固件源码、屏幕组件、nand_xfer 工具和文档。忽略本机构建产物、sdkconfig,以及含本机路径的依赖锁。

Co-authored-by: Cursor <[email protected]>
2026-10-13 21:54:50 +08:00

92 lines
2.6 KiB
C
Raw 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.
#ifndef __EMOJI_STORAGE_H__
#define __EMOJI_STORAGE_H__
#include "esp_err.h"
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief 从NVS加载表情包信息到内存
* @return esp_err_t ESP_OK表示成功
*/
esp_err_t emoji_storage_load(void);
/**
* @brief 保存当前使用的表情包ID到NVS
* @param pack_id 表情包ID(字符,如'0', 'A', 'B', 'C', 'D'等)
* @return esp_err_t ESP_OK表示成功
*/
esp_err_t emoji_storage_save_using_pack(char pack_id);
/**
* @brief 添加已下载的表情包ID到列表并保存到NVS
* @param pack_id 表情包ID(字符,如'0', 'A', 'B', 'C', 'D'等)
* @return esp_err_t ESP_OK表示成功
*/
esp_err_t emoji_storage_add_downloaded_pack(char pack_id);
/**
* @brief 获取当前使用的表情包ID
* @return char 表情包ID,'0'表示默认表情包
*/
char emoji_storage_get_using_pack(void);
/**
* @brief 获取已下载的表情包列表(JSON格式字符串)
* @param packs 输出缓冲区,存储JSON格式字符串(如"[\"0\",\"A\",\"B\"]")
* @param max_len 缓冲区最大长度
* @return int 实际写入的字符数(不包括'\0'),-1表示失败
*/
int emoji_storage_get_downloaded_packs_json(char *packs, int max_len);
/**
* @brief 获取已下载的表情包列表(逗号分隔字符串)
* @param packs 输出缓冲区,存储逗号分隔字符串(如"0,A,B")
* @param max_len 缓冲区最大长度
* @return int 实际写入的字符数(不包括'\0'),-1表示失败
*/
int emoji_storage_get_downloaded_packs(char *packs, int max_len);
/**
* @brief 检查指定表情包是否已下载
* @param pack_id 表情包ID(字符)
* @return true 已下载,false 未下载
*/
bool emoji_storage_is_downloaded(char pack_id);
/**
* @brief 从列表中删除指定的表情包
* @param pack_id 表情包ID(字符)
* @return esp_err_t ESP_OK表示成功
*/
esp_err_t emoji_storage_remove_downloaded_pack(char pack_id);
/**
* @brief 清空已下载的表情包列表(保留默认表情包'0')
* @return esp_err_t ESP_OK表示成功
*/
esp_err_t emoji_storage_clear_downloaded_packs(void);
/**
* @brief 删除指定表情包的文件(目录 + zip)
* @param pack_id 表情包ID(字符,'A'~'D')
* @return esp_err_t ESP_OK表示成功
*/
esp_err_t emoji_storage_remove_pack_files(char pack_id);
/**
* @brief 清除所有已下载的表情包(删除文件 + 清空NVS + 重置为默认表情包)
* @return esp_err_t ESP_OK表示成功
*/
esp_err_t emoji_storage_clear_all_packs(void);
#ifdef __cplusplus
}
#endif
#endif /* __EMOJI_STORAGE_H__ */