Documentation

Documentation

Includes

tuya_cloud_types.h

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

tuya_base_utilities.h

#include "tuya_base_utilities.h"
#include "tuya_base_utilities.h"

uni_msg_queue.h

#include "uni_msg_queue.h"
#include "uni_msg_queue.h"

Macros

Marco _UNI_MODULE_H

#define _UNI_MODULE_H

      

Functions

Func ReleaseModule

OPERATE_RET ReleaseModule(IN CONST MODULE_HANDLE moduleHandle);
/**
 * @brief Release module handle.
 *
 * @param[in] moduleHandle: the handle of the module
 *
 * @note This API is used for releasing module handle.
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Func CreateModuleAndStart

OPERATE_RET CreateModuleAndStart(OUT MODULE_HANDLE *pModuleHandle,\
                                        IN CONST P_CONSTRUCT_FUNC enter,\
                                        IN CONST P_EXTRACT_FUNC exit,\
                                        IN CONST THRD_PARAM_S *thrd_param);
/**
 * @brief Create and start the module
 *
 * @param[out] pModuleHandle: the handle of the module
 * @param[in] enter: the construct function of the module
 * @param[in] exit: the deconstructor function of the module
 * @param[in] thrd_param: the parameaters of the thread
 *
 * @note This API is used for creating and starting the module
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Func ModulePostMessage

OPERATE_RET ModulePostMessage(IN CONST MODULE_HANDLE moduleHandle,\
                                    IN CONST MSG_ID msgID,\
                                    IN CONST P_MSG_DATA pMsgData,\
                                    IN CONST MSG_DATA_LEN msgDataLen);
/**
 * @brief Post a message.
 *
 * @param[in] moduleHandle: the handle of the module
 * @param[in] msgID: message id
 * @param[in] pMsgData: message data
 * @param[in] msgDataLen: message data len
 *
 * @note This API is used for posting a message
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Func ModPostMsgMalloc

OPERATE_RET ModPostMsgMalloc(IN CONST MODULE_HANDLE moduleHandle,\
                                   IN CONST MSG_ID msgID,\
                                   IN CONST P_MSG_DATA pMsgData,\
                                   IN CONST MSG_DATA_LEN msgDataLen);
/**
 * @brief Post a message with memory alloc
 *
 * @param[in] moduleHandle: the handle of the module
 * @param[in] msgID: message id
 * @param[in] pMsgData: message data
 * @param[in] msgDataLen: message data len
 *
 * @note This API is used for posting a message with memory alloc, the param of message data can be local variable
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Func ModulePostInstancyMsg

OPERATE_RET ModulePostInstancyMsg(IN CONST MODULE_HANDLE moduleHandle,\
                                         IN CONST MSG_ID msgID,\
                                         IN CONST P_MSG_DATA pMsgData,\
                                         IN CONST MSG_DATA_LEN msgDataLen);
/**
 * @brief Post a message instantly
 *
 * @param[in] moduleHandle: the handle of the module
 * @param[in] msgID: message id
 * @param[in] pMsgData: message data
 * @param[in] msgDataLen: message data len
 *
 * @note This API is used for posting a message instantly
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Func ModPostInstancyMsgMalloc

OPERATE_RET ModPostInstancyMsgMalloc(IN CONST MODULE_HANDLE moduleHandle,\
                                              IN CONST MSG_ID msgID,\
                                              IN CONST P_MSG_DATA pMsgData,\
                                              IN CONST MSG_DATA_LEN msgDataLen);
/**
 * @brief Post a instant message with memory alloc
 *
 * @param[in] moduleHandle: the handle of the module
 * @param[in] msgID: message id
 * @param[in] pMsgData: message data
 * @param[in] msgDataLen: message data len
 *
 * @note This API is used for posting a instant message with memory alloc, the param of message data can be local variable
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Func ModuleRegisterMsgCb

OPERATE_RET ModuleRegisterMsgCb(IN CONST MODULE_HANDLE moduleHandle,\
                                       IN CONST MSG_CALLBACK msg_cb,\
                                       OUT MSG_ID *msg_id);
/**
 * @brief Regist callback function for message.
 *
 * @param[in] moduleHandle: the handle of the module
 * @param[in] msg_cb: message callback function
 * @param[out] msg_id: message id
 *
 * @note This API is used for registing message's callback function.
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Func ModuleUnregisterMsgCb

OPERATE_RET ModuleUnregisterMsgCb(IN CONST MODULE_HANDLE moduleHandle,IN CONST MSG_ID msgID);
/**
 * @brief Unregist callback function for message.
 *
 * @param[in] moduleHandle: the handle of the module
 * @param[in] msgID: message id
 *
 * @note This API is used for unRegisting message's callback function.
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Func module_cr_tm_msg_hand

OPERATE_RET module_cr_tm_msg_hand(IN CONST MODULE_HANDLE moduleHandle,IN CONST VOID *data,\
                                          IN CONST TM_MSG_CB cb,OUT TM_MSG_S **tm_msg);
/**
 * @brief Create timer message handle.
 *
 * @param[in] moduleHandle: the handle of the module
 * @param[in] data: message data
 * @param[in] cb: callback function
 * @param[out] tm_msg: timer message info
 *
 * @note This API is used for creating a timer message handle
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Func module_start_tm_msg

OPERATE_RET module_start_tm_msg(IN CONST TM_MSG_S *tm_msg,IN CONST TIME_MS timeCycle,\
                                       IN CONST TIMER_TYPE timer_type);
/**
 * @brief Start the timer message.
 *
 * @param[in] tm_msg: timer message info
 * @param[in] timeCycle: cycle time of the timer
 * @param[in] timer_type: timer type, cycle or once
 *
 * @note This API is used for starting the timer message
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Func module_stop_tm_msg

OPERATE_RET module_stop_tm_msg(IN CONST TM_MSG_S *tm_msg);
/**
 * @brief Stop the timer message.
 *
 * @param[in] tm_msg: timer message info
 *
 * @note This API is used for stopping the timer message
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Func module_release_tm_msg

OPERATE_RET module_release_tm_msg(IN CONST TM_MSG_S *tm_msg);
/**
 * @brief Release the timer message.
 *
 * @param[in] tm_msg: timer message info
 *
 * @note This API is used for releasing the timer message
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Func ModuleGetMsgNodeNum

OPERATE_RET ModuleGetMsgNodeNum(IN CONST MODULE_HANDLE moduleHandle,OUT PINT_T pMsgNodeNum);
/**
 * @brief Get message node count.
 *
 * @param[in] moduleHandle: the handle of the module
 * @param[out] pMsgNodeNum: the message node count in the module
 *
 * @note This API is used for getting the count of message node.
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Vars

Consts

Types

Typedefs

Typedef MODULE_HANDLE

typedef PVOID_T MODULE_HANDLE;
//the handle of the module