/* * meow_notify_ipc.h — MeowOS SDK 通知 → launcher IPC 桥(内部头,不随 meow_ui.h 发布给应用)。 * * 定位(任务 #5 SDK↔IPC 桥关键断点):让框架 app 调 meow_notify_send() 的通知真正经 * AF_UNIX IPC 送到 launcher(meow_launcherd)中央存储(meow_notif.c 的 meow_notif_post), * 通知中心(阶段 B · M5)才能显示。消息通道(FRAMEWORK_DESIGN §1 / meow_ipc.h): * - MSG_NOTIFY 0x0020 ↑:推送/更新通知(负载 m_notify_t;含 SDK icon→app_icon、urgency); * - MSG_NOTIFY_ACK 0x0021 ↓:落库结果(m_ack_t,status=launcher 分配的通知 id nid); * - MSG_NOTIFY_DISMISS 0x0022 ↑:撤下通知(负载 uint32 nid); * - MSG_NOTIFY_PROGRESS 0x0024 ↑:实时更新通知进度(负载 m_notify_progress_t,仅改内存活跃槽)。 * * 约定:只做「一次性发送 + 读 ACK」,不造 IPC 订阅循环;SDK 本地活动表(meow_ui_notify.c) * 保留(app 进程内即时查询/配额自检),真正的通知中心数据在 launcher 中央存储,二者以 * 本接口经 IPC 同步。全部失败路径优雅降级(无 socket/写失败/超时 → 返回 0,不崩)。 * * 本接口只暴露「SDK 类型出/进 + 状态码」,不把 m_notify_t / 帧格式泄漏给 meow_ui_notify.c; * 映射层(SDK 枚举 ↔ IPC 字符串/uint32)实现在 meow_notify_ipc.c 内部。 */ #ifndef MEOW_NOTIFY_IPC_H #define MEOW_NOTIFY_IPC_H #include #include "meow_ui.h" /* meow_notify */ #ifdef __cplusplus extern "C" { #endif /* 当前 app 的 app_id(env MEOW_LOG_APP,缺省 "app";pthread_once 缓存,线程安全)。 */ const char *meow_notify_ipc_app_id(void); /* 把一条 SDK meow_notify 映射为 m_notify_t 并一次性发送 MSG_NOTIFY,阻塞读 * MSG_NOTIFY_ACK 取 launcher 分配的通知 id(nid)。replaces_id:0=新建;>0=更新已存在 * 通知(与 freedesktop 语义一致)。成功返回 nid(>0);无 socket/写失败/超时/非 ACK → * 返回 0(调用方保留本地 id 兜底,不崩)。 */ uint32_t meow_notify_ipc_send(const meow_notify *n, uint32_t replaces_id); /* 一次性发送 MSG_NOTIFY_DISMISS 撤下 launcher 侧通知。best-effort:写失败/无 socket * 静默(不崩、不回读 ACK)。 */ void meow_notify_ipc_dismiss(uint32_t nid); /* 一次性发送 MSG_NOTIFY_PROGRESS 更新 launcher 侧已存在通知的进度(仅改内存活跃槽, * 不落盘)。best-effort:写失败/无 socket 静默。 */ void meow_notify_ipc_update_progress(uint32_t nid, int progress); #ifdef __cplusplus } #endif #endif /* MEOW_NOTIFY_IPC_H */