#include "tuya_cloud_types.h"
#include "tuya_cloud_types.h"
#include "sys_timer.h"
#include "sys_timer.h"
#define _ASYNC_NOTIFY_H
OPERATE_RET create_notify_handle(OUT NOTIFY_HANDLE *p_handle);
/** * @brief Create notify handle. * * @param[out] p_handle: the notify handle * * @note This API is used for creating the notify handle * * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h */
OPERATE_RET delete_notify_handle(IN NOTIFY_HANDLE *p_handle);
/** * @brief Delete notify handle. * * @param[in] p_handle: the notify handle * * @note This API is used for deleting the notify handle * * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h */
OPERATE_RET register_notify_handle(IN NOTIFY_HANDLE handle, \
IN CONST P_NOTIFY_FUNC func, \
IN CONST NOTIFY_PARAM param, \
IN CONST NOTIFY_TIME_MS time_ms);
/** * @brief Register notify handle information. * * @param[in] handle: the notify handle * @param[in] func: the notify callback function * @param[in] param: the notify call back param * @param[in] time_ms: after time in MS, the notification will be trigged * * @note This API is used for creating the notify handle * * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h */
OPERATE_RET notify_handle_finish(IN NOTIFY_HANDLE handle);
/** * @brief Finish notify handle. * * @param[in] handle: the notify handle * * @note This API is used for telling the caller the notification is finished. * * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h */
OPERATE_RET notify_handle_error(IN NOTIFY_HANDLE handle);
/** * @brief Finish notify handle. * * @param[in] handle: the notify handle * * @note This API is used for telling the caller the notification is error. * * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h */
typedef PVOID_T NOTIFY_HANDLE;
//notify handle
typedef PVOID_T NOTIFY_PARAM;
//notify param
typedef DWORD_T NOTIFY_TIME_MS;
//notify time(ms)
typedef enum
{
NOTIFY_FINISH = 0,
NOTIFY_ERROR,
NOTIFY_OVERTIME,
}NOTIFY_TYPE_E;
/** * @brief Definition of notify type */
typedef VOID (*P_NOTIFY_FUNC)(IN CONST NOTIFY_TYPE_E type, IN NOTIFY_PARAM param);
//notify callback function definition
typedef struct
{
TIMER_ID timer; //timer
P_NOTIFY_FUNC func; //callback function
NOTIFY_PARAM param; //param
NOTIFY_TIME_MS time_ms;//time(ms)
}NOTIFY_HANDLE_S;
/** * @brief notify handle info */