TuyaOS
tuya_uf_db.h
浏览该文件的文档.
1
9#ifndef _TUYA_UF_DB_H_
10#define _TUYA_UF_DB_H_
11#include "tuya_cloud_types.h"
12
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
22typedef VOID uFILE;
23
28typedef unsigned char ufmode_t;
29#define UF_SEEK_SET 0 // seek from head of the file
30#define UF_SEEK_CUR 1 // seek from current position
31#define UF_SEEK_END 2 // seek from end of the file
32
38OPERATE_RET uf_db_init(VOID);
39
49OPERATE_RET uf_db_user_param_write(IN CONST BYTE_T *data, IN CONST UINT_T len);
50
60OPERATE_RET uf_db_user_param_read(OUT BYTE_T **buf, OUT UINT_T *len);
61
69OPERATE_RET ufinit(VOID);
70
81uFILE* ufopen(IN CONST CHAR_T *filepath, IN CONST CHAR_T *mode);
82
89OPERATE_RET ufclose(IN uFILE *fd);
90
97OPERATE_RET ufdelete(IN CONST CHAR_T *filepath);
98
107UINT_T ufwrite(IN uFILE *fd, IN CONST UCHAR_T *buf, IN CONST UINT_T len);
108
118UINT_T ufread(IN uFILE *fd, IN UCHAR_T *buf, IN CONST UINT_T len);
119
128INT_T ufseek(IN uFILE *fd, IN UINT_T offset, IN CONST ufmode_t uf_mode);
129
136INT_T uftell(IN uFILE *fd);
137
144BOOL_T ufeof(IN uFILE *fd);
145
152INT_T ufgetsize(IN CONST CHAR_T *filepath);
153
162INT_T ufprintf(IN uFILE * stream, IN const char* pFmt, ...);
163
173INT_T ufscanf(IN uFILE * stream, IN INT_T count, IN PCHAR_T pFmt, ...);
174
181BOOL_T ufexist(IN CONST CHAR_T *filepath);
182
193INT_T ufaccess(IN CONST CHAR_T *filepath, IN INT_T mode);
194
203INT_T ufflush(IN uFILE * stream);
204
213INT_T ufsync(IN INT_T fd);
214
223INT_T ufileno(IN uFILE * stream);
224
231INT_T ufgetc(IN uFILE *stream);
232
243CHAR_T *ufgets(IN CHAR_T *s, IN INT_T n, IN uFILE *stream);
244
250OPERATE_RET ufformat(VOID);
251
252#ifdef __cplusplus
253} // extern "C"
254#endif
255
256
257#endif
258
BOOL_T ufeof(IN uFILE *fd)
check if the current offset reach the end of the file
INT_T ufflush(IN uFILE *stream)
flush the unique file, write the cache to physical disk
UINT_T ufread(IN uFILE *fd, IN UCHAR_T *buf, IN CONST UINT_T len)
read from unique file
OPERATE_RET ufdelete(IN CONST CHAR_T *filepath)
delete the unique file
VOID uFILE
unique file handle
Definition: tuya_uf_db.h:22
INT_T ufseek(IN uFILE *fd, IN UINT_T offset, IN CONST ufmode_t uf_mode)
seek to the offset of the unique file
INT_T ufsync(IN INT_T fd)
sync the unique file, write the file info to pysical disk
CHAR_T * ufgets(IN CHAR_T *s, IN INT_T n, IN uFILE *stream)
read a line from unique file
unsigned char ufmode_t
unique file mode
Definition: tuya_uf_db.h:28
UINT_T ufwrite(IN uFILE *fd, IN CONST UCHAR_T *buf, IN CONST UINT_T len)
write to unique file
OPERATE_RET ufclose(IN uFILE *fd)
close a unique file
OPERATE_RET ufformat(VOID)
format uf flash
OPERATE_RET ufinit(VOID)
unique file system initialization
uFILE * ufopen(IN CONST CHAR_T *filepath, IN CONST CHAR_T *mode)
open a unique file
INT_T ufgetsize(IN CONST CHAR_T *filepath)
get the size of the unique file
INT_T ufileno(IN uFILE *stream)
get the file description
OPERATE_RET uf_db_init(VOID)
tuya unique file database system initialization
OPERATE_RET uf_db_user_param_read(OUT BYTE_T **buf, OUT UINT_T *len)
read user parameter from unique file database
INT_T uftell(IN uFILE *fd)
get current offset of the unique file
BOOL_T ufexist(IN CONST CHAR_T *filepath)
check if unique file is exist
INT_T ufprintf(IN uFILE *stream, IN const char *pFmt,...)
write a specail format to unique file
INT_T ufaccess(IN CONST CHAR_T *filepath, IN INT_T mode)
test the permission of the unique file
OPERATE_RET uf_db_user_param_write(IN CONST BYTE_T *data, IN CONST UINT_T len)
write user parameter to unique file database
INT_T ufgetc(IN uFILE *stream)
read a character from unique file
INT_T ufscanf(IN uFILE *stream, IN INT_T count, IN PCHAR_T pFmt,...)
read a special format from unique file