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

40
src/plugins/ble/mod.rs Normal file
View File

@@ -0,0 +1,40 @@
//! BlePlugin — BLE 配网服务
//!
//! 通过 D-Bus 与 BlueZ 交互,注册 GATT 服务和 LE Advertisement。
//! 含 LocalName 双连接修复。
use crate::core::message::Message;
use crate::core::plugin::{Plugin, PluginContext, PluginInfo, Platform};
use anyhow::Result;
pub struct BlePlugin {
ctx: Option<PluginContext>,
}
impl BlePlugin {
pub fn new() -> Self {
Self { ctx: None }
}
}
impl Plugin for BlePlugin {
fn id(&self) -> &'static str { "ble" }
fn info(&self) -> PluginInfo {
PluginInfo {
name: "BLE Provisioning",
version: "0.2.0",
description: "BLE GATT WiFi 配网 (D-Bus BlueZ)",
platform: Platform::Linux,
}
}
fn init(&mut self, ctx: PluginContext) -> Result<()> {
self.ctx = Some(ctx);
Ok(())
}
fn start(&mut self) -> Result<()> { Ok(()) }
fn handle_message(&mut self, _msg: Message) -> Result<()> { Ok(()) }
fn stop(&mut self) -> Result<()> { Ok(()) }
}

39
src/plugins/http/mod.rs Normal file
View File

@@ -0,0 +1,39 @@
//! HttpPlugin — Web UI + REST API
//!
//! 基于 warp 的 HTTP 服务,提供播放控制、配置管理、视频管理等 API。
use crate::core::message::Message;
use crate::core::plugin::{Plugin, PluginContext, PluginInfo, Platform};
use anyhow::Result;
pub struct HttpPlugin {
ctx: Option<PluginContext>,
}
impl HttpPlugin {
pub fn new() -> Self {
Self { ctx: None }
}
}
impl Plugin for HttpPlugin {
fn id(&self) -> &'static str { "http" }
fn info(&self) -> PluginInfo {
PluginInfo {
name: "HTTP API",
version: "0.2.0",
description: "Web UI + REST API (warp)",
platform: Platform::Any,
}
}
fn init(&mut self, ctx: PluginContext) -> Result<()> {
self.ctx = Some(ctx);
Ok(())
}
fn start(&mut self) -> Result<()> { Ok(()) }
fn handle_message(&mut self, _msg: Message) -> Result<()> { Ok(()) }
fn stop(&mut self) -> Result<()> { Ok(()) }
}

5
src/plugins/mod.rs Normal file
View File

@@ -0,0 +1,5 @@
pub mod video;
pub mod http;
pub mod ble;
pub mod screen;
pub mod wifi;

39
src/plugins/screen/mod.rs Normal file
View File

@@ -0,0 +1,39 @@
//! ScreenPlugin — 屏幕管理
//!
//! 唤醒锁systemd-inhibit、光标隐藏unclutter
use crate::core::message::Message;
use crate::core::plugin::{Plugin, PluginContext, PluginInfo, Platform};
use anyhow::Result;
pub struct ScreenPlugin {
ctx: Option<PluginContext>,
}
impl ScreenPlugin {
pub fn new() -> Self {
Self { ctx: None }
}
}
impl Plugin for ScreenPlugin {
fn id(&self) -> &'static str { "screen" }
fn info(&self) -> PluginInfo {
PluginInfo {
name: "Screen Manager",
version: "0.2.0",
description: "屏幕唤醒锁 + 光标管理",
platform: Platform::Linux,
}
}
fn init(&mut self, ctx: PluginContext) -> Result<()> {
self.ctx = Some(ctx);
Ok(())
}
fn start(&mut self) -> Result<()> { Ok(()) }
fn handle_message(&mut self, _msg: Message) -> Result<()> { Ok(()) }
fn stop(&mut self) -> Result<()> { Ok(()) }
}

54
src/plugins/video/mod.rs Normal file
View File

@@ -0,0 +1,54 @@
//! VideoPlugin — 视频播放引擎
//!
//! 基于 OpenCV 的视频播放,支持状态机驱动、帧变换、过渡效果。
//! Phase 1 核心:迁移旧 video_processor.rs + state_machine.rs
pub mod processor;
pub mod state_machine;
use crate::core::message::Message;
use crate::core::plugin::{Plugin, PluginContext, PluginInfo, Platform};
use anyhow::Result;
pub struct VideoPlugin {
ctx: Option<PluginContext>,
}
impl VideoPlugin {
pub fn new() -> Self {
Self { ctx: None }
}
}
impl Plugin for VideoPlugin {
fn id(&self) -> &'static str { "video" }
fn info(&self) -> PluginInfo {
PluginInfo {
name: "Video Player",
version: "0.2.0",
description: "视频播放引擎 (OpenCV)",
platform: Platform::Any,
}
}
fn init(&mut self, ctx: PluginContext) -> Result<()> {
self.ctx = Some(ctx);
Ok(())
}
fn start(&mut self) -> Result<()> {
// TODO: Commit 4 实现
Ok(())
}
fn handle_message(&mut self, _msg: Message) -> Result<()> {
// TODO: Commit 4 实现
Ok(())
}
fn stop(&mut self) -> Result<()> {
// TODO: Commit 4 实现
Ok(())
}
}

View File

@@ -0,0 +1 @@
// VideoProcessor + VideoTransformer — 待 Commit 4 迁移

View File

@@ -0,0 +1 @@
// StateMachine — 待 Commit 4 迁移

39
src/plugins/wifi/mod.rs Normal file
View File

@@ -0,0 +1,39 @@
//! WifiPlugin — WiFi 管理
//!
//! 通过 nmcli 实现 WiFi 扫描、连接、AP 热点。
use crate::core::message::Message;
use crate::core::plugin::{Plugin, PluginContext, PluginInfo, Platform};
use anyhow::Result;
pub struct WifiPlugin {
ctx: Option<PluginContext>,
}
impl WifiPlugin {
pub fn new() -> Self {
Self { ctx: None }
}
}
impl Plugin for WifiPlugin {
fn id(&self) -> &'static str { "wifi" }
fn info(&self) -> PluginInfo {
PluginInfo {
name: "WiFi Manager",
version: "0.2.0",
description: "WiFi 管理 (nmcli)",
platform: Platform::Linux,
}
}
fn init(&mut self, ctx: PluginContext) -> Result<()> {
self.ctx = Some(ctx);
Ok(())
}
fn start(&mut self) -> Result<()> { Ok(()) }
fn handle_message(&mut self, _msg: Message) -> Result<()> { Ok(()) }
fn stop(&mut self) -> Result<()> { Ok(()) }
}