Documentation

Documentation

Includes

tuya_cloud_types.h

#include "tuya_cloud_types.h"
#include "tuya_cloud_types.h"

tuya_os_adapter.h

#include "tuya_os_adapter.h"
#include "tuya_os_adapter.h"

uni_pointer.h

#include "uni_pointer.h"
#include "uni_pointer.h"

Macros

Marco __LOG_SEQ_H

#define __LOG_SEQ_H


      

Marco STR_DATA_MAX_LENGTH

#define STR_DATA_MAX_LENGTH 64


      

Marco LS_DELIMITER

#define LS_DELIMITER " | "


      

Marco INSERT_LOG_SEQ_NULL(seq)

#define INSERT_LOG_SEQ_NULL(seq)          log_seq_insert_log(LOGSEQ_OBJ, seq, LDT_NULL, NULL)


      

Marco INSERT_LOG_SEQ_DEC(seq,dec)

#define INSERT_LOG_SEQ_DEC(seq,dec)       log_seq_insert_log(LOGSEQ_OBJ, seq, LDT_DEC, (VOID_T*)(intptr_t)dec)


      

Marco INSERT_LOG_SEQ_HEX(seq,hex)

#define INSERT_LOG_SEQ_HEX(seq,hex)       log_seq_insert_log(LOGSEQ_OBJ, seq, LDT_HEX, (VOID_T*)(uintptr_t)hex)


      

Marco INSERT_LOG_SEQ_TM(seq,tm)

#define INSERT_LOG_SEQ_TM(seq,tm)         log_seq_insert_log(LOGSEQ_OBJ, seq, LDT_TIMESTAMP, (VOID_T*)tm)


      

Marco INSERT_LOG_SEQ_STR(seq,str)

#define INSERT_LOG_SEQ_STR(seq,str)       log_seq_insert_log(LOGSEQ_OBJ, seq, LDT_STRING, (VOID_T*)str)
//string max length is STR_DATA_MAX_LENGTH

Marco INSERT_ERROR_LOG_SEQ_NULL(seq)

#define INSERT_ERROR_LOG_SEQ_NULL(seq)    log_seq_insert_error_log(LOGSEQ_OBJ, seq, LDT_NULL, NULL)


      

Marco INSERT_ERROR_LOG_SEQ_DEC(seq,dec)

#define INSERT_ERROR_LOG_SEQ_DEC(seq,dec) log_seq_insert_error_log(LOGSEQ_OBJ, seq, LDT_DEC, (VOID_T*)(intptr_t)dec)


      

Marco INSERT_ERROR_LOG_SEQ_HEX(seq,hex)

#define INSERT_ERROR_LOG_SEQ_HEX(seq,hex) log_seq_insert_error_log(LOGSEQ_OBJ, seq, LDT_HEX, (VOID_T*)(uintptr_t)hex)


      

Marco INSERT_ERROR_LOG_SEQ_TM(seq,tm)

#define INSERT_ERROR_LOG_SEQ_TM(seq,tm)   log_seq_insert_error_log(LOGSEQ_OBJ, seq, LDT_TIMESTAMP, (VOID_T*)tm)


      

Marco INSERT_ERROR_LOG_SEQ_STR(seq,str)

#define INSERT_ERROR_LOG_SEQ_STR(seq,str) log_seq_insert_error_log(LOGSEQ_OBJ, seq, LDT_STRING, (VOID_T*)str)
//string max length is STR_DATA_MAX_LENGTH

Marco INSERT_REPORT_LOG_SEQ_NULL(seq)

#define INSERT_REPORT_LOG_SEQ_NULL(seq)   log_seq_insert_report_log(LOGSEQ_OBJ, seq, LDT_NULL, NULL)


      

Marco INSERT_REPORT_LOG_SEQ_DEC(seq,dec)

#define INSERT_REPORT_LOG_SEQ_DEC(seq,dec) log_seq_insert_report_log(LOGSEQ_OBJ, seq, LDT_DEC, (VOID_T*)(intptr_t)dec)


      

Marco INSERT_REPORT_LOG_SEQ_HEX(seq,hex)

#define INSERT_REPORT_LOG_SEQ_HEX(seq,hex) log_seq_insert_report_log(LOGSEQ_OBJ, seq, LDT_HEX, (VOID_T*)(uintptr_t)hex)


      

Marco INSERT_REPORT_LOG_SEQ_TM(seq,tm)

#define INSERT_REPORT_LOG_SEQ_TM(seq,tm)  log_seq_insert_report_log(LOGSEQ_OBJ, seq, LDT_TIMESTAMP, (VOID_T*)tm)


      

Marco INSERT_REPORT_LOG_SEQ_STR(seq,str)

#define INSERT_REPORT_LOG_SEQ_STR(seq,str) log_seq_insert_report_log(LOGSEQ_OBJ, seq, LDT_STRING, (VOID_T*)str)
//string max length is STR_DATA_MAX_LENGTH

Functions

Func log_seq_insert_log

int log_seq_insert_log(const char *ls_name, BYTE_T id, LS_DATA_TP_T type, VOID_T* data);


      

Func log_seq_insert_error_log

int log_seq_insert_error_log(const char *ls_name, BYTE_T id, LS_DATA_TP_T type, VOID_T* data);


      

Func log_seq_insert_report_log

int log_seq_insert_report_log(const char *ls_name, BYTE_T id, LS_DATA_TP_T type, VOID_T* data);


      

Func log_seq_init

int log_seq_init(const char *log_seq_path);
/**
 * @brief initialize of log sequence.
 *
 * @param[in] log_seq_path log sequence path
 *
 * @note This API is used for initialize log sequence.
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Func log_seq_set_enable

int log_seq_set_enable(bool_t enable);
/**
 * @brief enable or disable log sequence.
 *
 * @param[in] enable if value is true, enable log sequence, otherwise disable log sequence
 *
 * @note This API is used for enalbe or disable log sequence.
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Func log_seq_set_depth

int log_seq_set_depth(const        unsigned int depth);
/**
 * @brief set log sequence depth.
 *
 * @param[in] depth log sequence depth
 *
 * @note This API is used for set depth of log sequence.
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Func log_seq_clean

int log_seq_clean(int is_force_clean_all);
/**
 * @brief reset log sequence, clean all log sequence, this is used when device reset.
 *
 * @param[in] is_force_clean_all, force clean all log sequence object
 *
 * @note This API is used for clean all log sequence object.
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Func log_seq_force_sync

int log_seq_force_sync(void);
/**
* @brief force synchronization of log sequence .
*
* @param[in] NONE
*
* @note This API is used for synchronization of log sequence.
*
* @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
*/

Func log_seq_upload_custom_log

int log_seq_upload_custom_log(const char *p_log);
/**
 * @brief upload customer log sequence .
 *
 * @param[in] p_log user log
 *
 * @note This API is used for upload customer log sequence.
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Func log_seq_get_netcfg_log

int log_seq_get_netcfg_log(char **log_buff, int *log_len);
/**
 * @brief get network configure log sequence.
 *
 * @param[in] log_buff, log buffer
 * @param[in] log_len, log size
 *
 * @note This API is used for get network configure log sequence.
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Vars

Consts

Types

Typedefs

Typedef LS_DATA_TP_T

typedef BYTE_T LS_DATA_TP_T; // log sequence data type
#define LDT_NULL 0
#define LDT_DEC 1
#define LDT_HEX 2
#define LDT_TIMESTAMP 3
#define LDT_STRING 4



      

Typedef LOG_DA_TP_U;

typedef union {
   INT_T  dec_data;
   UINT_T hex_data;
   TIME_T tm_data;
   CHAR_T *str_data;
}LOG_DA_TP_U;
/**
 * @brief data storage structure of log sequence
 */

Typedef LS_DATA_S;

typedef struct {
   /** log id */
   BYTE_T         id;
   /** log type */
   LS_DATA_TP_T   type;
   /** log data */
   LOG_DA_TP_U    data;
   /** log list node */
   struct tuya_list_head node;
}LS_DATA_S;
/**
 * @brief data structure of log sequence
 */

Typedef LS_STAT_T

typedef BYTE_T LS_STAT_T;
#define LSS_INIT 0
#define LSS_RECORDING 1
#define LSS_LOCKED 2 // LOG_SEQ_T set locked status when record the error log sequence



      

Typedef LOG_SEQ_UPLOAD_CB

typedef int (*LOG_SEQ_UPLOAD_CB)(const char *p_log); 
// Calling when record the error log sequence