|
TuyaOS
|
tuya unique file database module 更多...
#include "tuya_cloud_types.h"
宏定义 | |
| #define | UF_SEEK_CUR 1 |
| #define | UF_SEEK_END 2 |
| #define | UF_SEEK_SET 0 |
类型定义 | |
| typedef VOID | uFILE |
| unique file handle | |
| typedef unsigned char | ufmode_t |
| unique file mode | |
函数 | |
| 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 更多... | |
| 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 | ufaccess (IN CONST CHAR_T *filepath, IN INT_T mode) |
| test the permission of the unique file 更多... | |
| OPERATE_RET | ufclose (IN uFILE *fd) |
| close a unique file 更多... | |
| OPERATE_RET | ufdelete (IN CONST CHAR_T *filepath) |
| delete the unique file 更多... | |
| BOOL_T | ufeof (IN uFILE *fd) |
| check if the current offset reach the end of the file 更多... | |
| BOOL_T | ufexist (IN CONST CHAR_T *filepath) |
| check if unique file is exist 更多... | |
| INT_T | ufflush (IN uFILE *stream) |
| flush the unique file, write the cache to physical disk 更多... | |
| OPERATE_RET | ufformat (VOID) |
| format uf flash 更多... | |
| INT_T | ufgetc (IN uFILE *stream) |
| read a character from unique file 更多... | |
| CHAR_T * | ufgets (IN CHAR_T *s, IN INT_T n, IN uFILE *stream) |
| read a line from 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 | ufinit (VOID) |
| unique file system initialization 更多... | |
| uFILE * | ufopen (IN CONST CHAR_T *filepath, IN CONST CHAR_T *mode) |
| open a unique file 更多... | |
| INT_T | ufprintf (IN uFILE *stream, IN const char *pFmt,...) |
| write a specail format to unique file 更多... | |
| UINT_T | ufread (IN uFILE *fd, IN UCHAR_T *buf, IN CONST UINT_T len) |
| read from unique file 更多... | |
| INT_T | ufscanf (IN uFILE *stream, IN INT_T count, IN PCHAR_T pFmt,...) |
| read a special format from unique file 更多... | |
| 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 更多... | |
| INT_T | uftell (IN uFILE *fd) |
| get current offset of the unique file 更多... | |
| UINT_T | ufwrite (IN uFILE *fd, IN CONST UCHAR_T *buf, IN CONST UINT_T len) |
| write to unique file 更多... | |
tuya unique file database module
copyright Copyright (c) {2018-2020} 涂鸦科技 www.tuya.com
| 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
| [out] | buf | buffer of the data read from user parameter file database |
| [out] | len | length of the data read from user parameter file database |
| OPERATE_RET uf_db_user_param_write | ( | IN CONST BYTE_T * | data, |
| IN CONST UINT_T | len | ||
| ) |
write user parameter to unique file database
| [in] | data | data write to user parameter database |
| [in] | len | data length write to user parameter database |
| INT_T ufaccess | ( | IN CONST CHAR_T * | filepath, |
| IN INT_T | mode | ||
| ) |
test the permission of the unique file
| [in] | filepath | the full file path |
| [in] | mode | check the access mode |
| OPERATE_RET ufclose | ( | IN uFILE * | fd | ) |
close a unique file
| fd | the file handle |
| OPERATE_RET ufdelete | ( | IN CONST CHAR_T * | filepath | ) |
delete the unique file
| [in] | filepath | the full file path |
| BOOL_T ufeof | ( | IN uFILE * | fd | ) |
check if the current offset reach the end of the file
| [in] | fd | the file handle |
| BOOL_T ufexist | ( | IN CONST CHAR_T * | filepath | ) |
check if unique file is exist
| [in] | filepath | the full file path |
| INT_T ufflush | ( | IN uFILE * | stream | ) |
flush the unique file, write the cache to physical disk
| [in] | stream | the file handle |
| OPERATE_RET ufformat | ( | VOID | ) |
format uf flash
| INT_T ufgetc | ( | IN uFILE * | stream | ) |
read a character from unique file
| [in] | stream | the file handle |
| CHAR_T * ufgets | ( | IN CHAR_T * | s, |
| IN INT_T | n, | ||
| IN uFILE * | stream | ||
| ) |
read a line from unique file
| [in] | s | the buffer used to save the string |
| [in] | n | the numbers want to get from the file |
| [in] | stream | the file handle |
| INT_T ufgetsize | ( | IN CONST CHAR_T * | filepath | ) |
get the size of the unique file
| [in] | filepath | the full file path |
| INT_T ufileno | ( | IN uFILE * | stream | ) |
get the file description
| [in] | stream | the file handle |
| OPERATE_RET ufinit | ( | VOID | ) |
unique file system initialization
| uFILE * ufopen | ( | IN CONST CHAR_T * | filepath, |
| IN CONST CHAR_T * | mode | ||
| ) |
open a unique file
| [in] | filepath | the full file path |
| [in] | mode | the open mode |
| INT_T ufprintf | ( | IN uFILE * | stream, |
| IN const char * | pFmt, | ||
| ... | |||
| ) |
write a specail format to unique file
| [in] | stream | the file handle |
| [in] | pFmt | the variable parameters format |
| ... |
| UINT_T ufread | ( | IN uFILE * | fd, |
| IN UCHAR_T * | buf, | ||
| IN CONST UINT_T | len | ||
| ) |
read from unique file
| [in] | fd | the file handle |
| [in] | buf | the buffer used to save the data read from the unique file |
| [in] | len | the length want to read |
| INT_T ufscanf | ( | IN uFILE * | stream, |
| IN INT_T | count, | ||
| IN PCHAR_T | pFmt, | ||
| ... | |||
| ) |
read a special format from unique file
| [in] | stream | the file handle |
| [in] | count | the counts read from file |
| [in] | pFmt | the variable parameters format |
| ... |
seek to the offset of the unique file
| [in] | fd | the file handle |
| [in] | offset | the offset want to seek |
| [in] | uf_mode | the seek mode |
| INT_T ufsync | ( | IN INT_T | fd | ) |
sync the unique file, write the file info to pysical disk
| [in] | fd | the file handle |
| INT_T uftell | ( | IN uFILE * | fd | ) |
get current offset of the unique file
| fd | the file handle |
| UINT_T ufwrite | ( | IN uFILE * | fd, |
| IN CONST UCHAR_T * | buf, | ||
| IN CONST UINT_T | len | ||
| ) |
write to unique file
| [in] | fd | the file handle |
| [in] | buf | the buffer write to the unique file |
| [in] | len | the length write to the unique file, in byte |