增加事件驱动和业务回滚处理方式
This commit is contained in:
58
app/event_trigger.h
Normal file
58
app/event_trigger.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* event_trigger.h
|
||||
*
|
||||
* Created on: 2026-03-04
|
||||
* Author: RT-Thread
|
||||
*
|
||||
* 功能: 事件触发机制模块头文件
|
||||
* 依赖: RT-Thread Nano, osal, event_queue
|
||||
* 跨平台适配: 基于RT-Thread Nano,使用标准API
|
||||
*/
|
||||
|
||||
#ifndef EVENT_TRIGGER_H
|
||||
#define EVENT_TRIGGER_H
|
||||
|
||||
#include <rtthread.h>
|
||||
#include "osal.h"
|
||||
#include "event_queue.h"
|
||||
|
||||
/**
|
||||
* @brief 触发事件
|
||||
* @param type 事件类型
|
||||
* @param priority 事件优先级
|
||||
* @param data 事件数据
|
||||
* @param data_size 事件数据大小
|
||||
* @return 0 成功,非0 失败
|
||||
*/
|
||||
int event_trigger(event_type_t type, event_priority_t priority, void *data, size_t data_size);
|
||||
|
||||
/**
|
||||
* @brief 创建定时器事件
|
||||
* @param type 事件类型
|
||||
* @param interval 定时器间隔,单位ms
|
||||
* @return 定时器句柄,失败返回NULL
|
||||
*/
|
||||
osal_timer_t event_timer_create(event_type_t type, int interval);
|
||||
|
||||
/**
|
||||
* @brief 启动定时器事件
|
||||
* @param timer 定时器句柄
|
||||
* @return 0 成功,非0 失败
|
||||
*/
|
||||
int event_timer_start(osal_timer_t timer);
|
||||
|
||||
/**
|
||||
* @brief 停止定时器事件
|
||||
* @param timer 定时器句柄
|
||||
* @return 0 成功,非0 失败
|
||||
*/
|
||||
int event_timer_stop(osal_timer_t timer);
|
||||
|
||||
/**
|
||||
* @brief 删除定时器事件
|
||||
* @param timer 定时器句柄
|
||||
* @return 0 成功,非0 失败
|
||||
*/
|
||||
int event_timer_delete(osal_timer_t timer);
|
||||
|
||||
#endif /* EVENT_TRIGGER_H */
|
||||
Reference in New Issue
Block a user