mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-04-30 01:46:37 +08:00
feat: 深入适配 RK628D CSI 采集卡的设备识别、参数读取、自恢复和音频采集
This commit is contained in:
@@ -64,6 +64,8 @@ fn topic_prefix(event_name: &str) -> Option<String> {
|
||||
/// bus.publish(SystemEvent::StreamStateChanged {
|
||||
/// state: "streaming".to_string(),
|
||||
/// device: Some("/dev/video0".to_string()),
|
||||
/// reason: None,
|
||||
/// next_retry_ms: None,
|
||||
/// });
|
||||
///
|
||||
/// // Subscribe to events
|
||||
@@ -188,6 +190,8 @@ mod tests {
|
||||
bus.publish(SystemEvent::StreamStateChanged {
|
||||
state: "streaming".to_string(),
|
||||
device: Some("/dev/video0".to_string()),
|
||||
reason: None,
|
||||
next_retry_ms: None,
|
||||
});
|
||||
|
||||
let event = rx.recv().await.unwrap();
|
||||
@@ -205,6 +209,8 @@ mod tests {
|
||||
bus.publish(SystemEvent::StreamStateChanged {
|
||||
state: "ready".to_string(),
|
||||
device: Some("/dev/video0".to_string()),
|
||||
reason: None,
|
||||
next_retry_ms: None,
|
||||
});
|
||||
|
||||
let event1 = rx1.recv().await.unwrap();
|
||||
@@ -222,6 +228,8 @@ mod tests {
|
||||
bus.publish(SystemEvent::StreamStateChanged {
|
||||
state: "ready".to_string(),
|
||||
device: None,
|
||||
reason: None,
|
||||
next_retry_ms: None,
|
||||
});
|
||||
|
||||
let event = rx.recv().await.unwrap();
|
||||
@@ -236,6 +244,8 @@ mod tests {
|
||||
bus.publish(SystemEvent::StreamStateChanged {
|
||||
state: "ready".to_string(),
|
||||
device: None,
|
||||
reason: None,
|
||||
next_retry_ms: None,
|
||||
});
|
||||
|
||||
let event = rx.recv().await.unwrap();
|
||||
@@ -257,6 +267,8 @@ mod tests {
|
||||
bus.publish(SystemEvent::StreamStateChanged {
|
||||
state: "ready".to_string(),
|
||||
device: None,
|
||||
reason: None,
|
||||
next_retry_ms: None,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,13 +158,16 @@ pub enum SystemEvent {
|
||||
from_mode: String,
|
||||
},
|
||||
|
||||
/// Stream state changed (e.g., started, stopped, error)
|
||||
/// Stream state for the UI (`streaming`, `no_signal`, `device_lost`, `device_busy`, etc.).
|
||||
/// Optional `reason` / `next_retry_ms` are hints only; branch on `state`.
|
||||
#[serde(rename = "stream.state_changed")]
|
||||
StreamStateChanged {
|
||||
/// Current state: "uninitialized", "ready", "streaming", "no_signal", "error"
|
||||
state: String,
|
||||
/// Device path if available
|
||||
device: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
reason: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
next_retry_ms: Option<u64>,
|
||||
},
|
||||
|
||||
/// Stream configuration is being changed
|
||||
@@ -407,6 +410,8 @@ mod tests {
|
||||
let event = SystemEvent::StreamStateChanged {
|
||||
state: "streaming".to_string(),
|
||||
device: Some("/dev/video0".to_string()),
|
||||
reason: None,
|
||||
next_retry_ms: None,
|
||||
};
|
||||
assert_eq!(event.event_name(), "stream.state_changed");
|
||||
}
|
||||
@@ -416,6 +421,8 @@ mod tests {
|
||||
let event = SystemEvent::StreamStateChanged {
|
||||
state: "streaming".to_string(),
|
||||
device: None,
|
||||
reason: None,
|
||||
next_retry_ms: None,
|
||||
};
|
||||
|
||||
assert!(event.matches_topic("*"));
|
||||
|
||||
Reference in New Issue
Block a user