chore: 测试播放和录音

This commit is contained in:
Del Wang
2026-01-02 17:23:24 +08:00
parent 24b3fdddf8
commit a2d06958e1
24 changed files with 712 additions and 1353 deletions
+18 -6
View File
@@ -8,19 +8,31 @@ pub struct DeviceInfo {
pub version: u32,
}
impl DeviceInfo {
pub fn current() -> Self {
Self {
model: "Open-XiaoAi-V2".to_string(),
mac: "00:00:00:00:00:00".to_string(), // TODO: Get actual MAC
version: 1,
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum ControlPacket {
// 服务发现
// Discovery
ServerHello {
tcp_port: u16,
udp_port: u16,
},
// 握手与认证
// Handshake
ClientIdentify {
info: DeviceInfo,
udp_port: u16,
},
IdentifyOk,
// 音频控制
// Audio Control
StartRecording {
config: AudioConfig,
},
@@ -41,12 +53,12 @@ pub enum ControlPacket {
result: RpcResult,
},
// 心跳
// Heartbeat
Ping,
Pong,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct RpcResult {
pub stdout: String,
pub stderr: String,
@@ -55,5 +67,5 @@ pub struct RpcResult {
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct AudioPacket {
pub data: Vec<u8>, // Opus 编码数据
pub data: Vec<u8>,
}