feat: 实现事件驱动应用框架,支持前台/后台分离、事件优先级和CPU占用控制
This commit is contained in:
33
App/appmgr.h
Normal file
33
App/appmgr.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef __APPMGR_H__
|
||||
#define __APPMGR_H__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
/* =========================================================================
|
||||
* 应用管理器接口声明
|
||||
* ========================================================================= */
|
||||
|
||||
// 初始化应用管理器,注册所有应用
|
||||
void AppManager_Init(void);
|
||||
|
||||
// 启动指定应用(切换前台)
|
||||
// 参数:app_id - 目标应用ID
|
||||
void AppManager_StartApp(AppID app_id);
|
||||
|
||||
// 关闭当前前台应用,回退到默认应用(时钟)
|
||||
void AppManager_CloseApp(void);
|
||||
|
||||
// 获取当前活跃的前台应用ID
|
||||
AppID AppManager_GetActiveAppID(void);
|
||||
|
||||
// 事件分发函数:将事件分发给前台/后台应用
|
||||
// 分发逻辑:前台应用优先处理 -> 后台应用兜底处理 -> 未处理则丢弃
|
||||
void AppManager_DispatchEvent(SystemEvent evt);
|
||||
|
||||
// 运行当前活跃应用的onRun回调(带CPU占用控制)
|
||||
void AppManager_RunActiveApp(void);
|
||||
|
||||
// 广播事件给所有后台应用(用于系统级事件)
|
||||
void AppManager_BroadcastToBackground(SystemEvent evt);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user