feat(sdk+launcher): SDK nav/media封装 + §10.5 App前台唤起通知中心 (agent-206) — meow_ui_nav.c(env栈初始化+report/request_exit) + meow_ui_media.c(懒连断线重连, meta上报+playctl接收) + MSG_NOTIF_OPEN=0x28/CLOSE=0x29(0x25/26已被占); SDK顶部下滑手势→IPC; launcher App前台会话叠加通知中心(SIGSTOP→读帧→接管输入→恢复SIGCONT, 面板内App崩溃即关); hello接线验证

meow_ui.a→9a8eb7ef; hello→fc299577; launcher→b33da20a; 宿主5套件+新test_notif_open+qemu分发 全过
出入: SDK符号用meow_ui_前缀防与launcher内同名冲突; 叠加会话真机待验; §10.5文档旧号段已过时
This commit is contained in:
MeowOS committed 2026-08-31 07:53:57 +08:00
1 parent 21519ce2e4
commit 9b4195724c
37 files changed
+1042 -21

No files matched your search

+65 -2
View File
@@ -419,6 +419,57 @@ static int read_frame(int fd, uint16_t *type, uint32_t *req_id, uint8_t *rbuf, u
return (int)len;
}
/* §10.5:App 前台顶部下滑 → 请求展开通知中心叠加会话 → MSG_NOTIF_OPEN,期望 MSG_ACK。
* notifopen <app_id> [origin_y] [hotzone] */
static int cmd_notifopen(const char *app_id, uint16_t origin_y, uint16_t hotzone)
{
int fd = connect_path(g_sock);
if (fd < 0) return 1;
m_notif_open_t o;
memset(&o, 0, sizeof o);
strncpy(o.app_id, app_id, MEOW_APP_ID_MAX - 1);
o.event_seq = 1;
o.origin_x = 0;
o.origin_y = origin_y;
o.hotzone = hotzone;
uint8_t rbuf[256];
int rt = xchg(fd, MSG_NOTIF_OPEN, 20, &o, sizeof o, rbuf, sizeof rbuf);
close(fd);
if (rt == MSG_ACK) {
m_ack_t a;
memcpy(&a, rbuf, sizeof a);
printf("NOTIF_OPEN ok: app=%s oy=%u hz=%u code=%d status=%u\n",
app_id, origin_y, hotzone, a.code, a.status);
return a.code == MEOW_OK ? 0 : 1;
}
if (rt == MSG_ERR) { print_err((const m_err_t *)rbuf); return 1; }
fprintf(stderr, "NOTIF_OPEN: unexpected resp type 0x%04x\n", rt);
return 1;
}
/* §10.5:App 告知结束/退出 → MSG_NOTIF_CLOSE(launcher 收尾兜底),期望 MSG_ACK。
* notifclose <app_id> <reason> */
static int cmd_notifclose(const char *app_id, uint32_t reason)
{
int fd = connect_path(g_sock);
if (fd < 0) return 1;
m_notif_close_t o;
memset(&o, 0, sizeof o);
strncpy(o.app_id, app_id, MEOW_APP_ID_MAX - 1);
o.reason = reason;
uint8_t rbuf[256];
int rt = xchg(fd, MSG_NOTIF_CLOSE, 21, &o, sizeof o, rbuf, sizeof rbuf);
close(fd);
if (rt == MSG_ACK) {
m_ack_t a;
memcpy(&a, rbuf, sizeof a);
printf("NOTIF_CLOSE ok: app=%s reason=%u code=%d\n", app_id, reason, a.code);
return a.code == MEOW_OK ? 0 : 1;
}
if (rt == MSG_ERR) { print_err((const m_err_t *)rbuf); return 1; }
fprintf(stderr, "NOTIF_CLOSE: unexpected resp type 0x%04x\n", rt);
return 1;
}
/* 媒体源监听:HELLO(MF_PLAYBACK) + META → 保持连接等待 launcher 下发 MSG_PLAYCTL。
* listen <app_id> <state> <pos_ms> <dur_ms> <title> <artist> <album> [artwork] */
static int cmd_listen(const char *app_id, uint32_t state, uint32_t pos, uint32_t dur,
@@ -472,8 +523,7 @@ int main(int argc, char **argv)
for (; i < argc; i++) {
if (!strcmp(argv[i], "--sock") && i + 1 < argc) { g_sock = argv[++i]; }
else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
fprintf(stderr, "usage: meow_ipc [--sock <path>] hello|ping|query|declare ...\n");
return 0;
fprintf(stderr, "usage: meow_ipc [--sock <path>] hello|ping|query|declare ...\n"); return 0;
}
else break;
}
@@ -552,6 +602,19 @@ int main(int argc, char **argv)
int64_t seek = (i + 2 < argc) ? (int64_t)strtoll(argv[i + 2], NULL, 0) : 0;
return cmd_playctl(cmd2, seek);
}
if (!strcmp(cmd, "notifopen")) {
/* notifopen <app_id> [origin_y] [hotzone] */
if (i + 1 >= argc) { fprintf(stderr, "notifopen needs <app_id>\n"); return 1; }
uint16_t oy = (i + 2 < argc) ? (uint16_t)strtoul(argv[i + 2], NULL, 0) : 0;
uint16_t hz = (i + 3 < argc) ? (uint16_t)strtoul(argv[i + 3], NULL, 0) : 28;
return cmd_notifopen(argv[i + 1], oy, hz);
}
if (!strcmp(cmd, "notifclose")) {
/* notifclose <app_id> <reason> */
if (i + 1 >= argc) { fprintf(stderr, "notifclose needs <app_id>\n"); return 1; }
uint32_t r2 = (i + 2 < argc) ? (uint32_t)strtoul(argv[i + 2], NULL, 0) : 0;
return cmd_notifclose(argv[i + 1], r2);
}
if (!strcmp(cmd, "nav")) {
/* nav report <app_id> <depth> <top> | nav exit <app_id> */
if (i + 1 >= argc) { fprintf(stderr, "nav needs <app_id> and report|exit\n"); return 1; }