init: ShowenV2 项目骨架 — 数字生命窗口平台

- core/ 跨平台内核骨架 (Plugin trait, Message, ServiceManager, Config)
- plugins/ 空桩 (video, http, ble, screen, wifi)
- PROGRESS.md 进度跟踪, TEAM.md 团队档案
- cargo check 零 warning 通过

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
showen
2026-03-12 05:03:58 +08:00
commit 23f4d46287
21 changed files with 2223 additions and 0 deletions

75
src/core/message.rs Normal file
View File

@@ -0,0 +1,75 @@
use crate::core::config::AppConfig;
use std::sync::Arc;
/// 消息信封:包含来源、目的地、消息体
pub struct Envelope {
pub from: &'static str,
pub to: Destination,
pub message: Message,
}
/// 消息目的地
pub enum Destination {
/// 点对点发送给指定插件
Plugin(&'static str),
/// 广播给所有插件
Broadcast,
/// 发给管理层自身
Manager,
}
/// 所有插件间通信的类型安全消息
pub enum Message {
// ── 播放控制 ──
PlayerCommand(PlayerCommand),
PlayerStatus(PlayerStatusData),
Trigger { name: String, value: String },
StateChanged { old_state: String, new_state: String },
// ── 屏幕管理 ──
ScreenLockRequest(bool),
CursorVisibility(bool),
// ── 网络 ──
WifiCommand(WifiCommand),
WifiResult(String),
WifiProvisioned { ssid: String, ip: String },
// ── 配置 ──
ConfigReloaded(Arc<AppConfig>),
ConfigReloadRequest,
// ── 系统 ──
Shutdown,
PluginReady(&'static str),
// ── 扩展(未来插件用) ──
Custom { kind: String, payload: String },
}
pub enum PlayerCommand {
Play,
Pause,
Next,
Previous,
Goto(usize),
ChangeScene(String),
}
#[derive(Debug, Clone, serde::Serialize)]
pub struct PlayerStatusData {
pub running: bool,
pub paused: bool,
pub in_transition: bool,
pub current_index: usize,
pub playlist_length: usize,
pub current_video: Option<String>,
}
pub enum WifiCommand {
Scan,
Connect { ssid: String, password: String },
Status,
ApStart { ssid: String, password: String },
ApStop,
}