Merge branch 'feature/motion_ai'

This commit is contained in:
Andrew committed 2023-08-15 18:59:49 +07:00
commit 9087169873
2 files changed
+11 -2

No files matched your search

+3
View File
@@ -564,6 +564,9 @@ pub struct AlarmEvent {
pub channel_id: u8,
/// Motion status. Known values are `"MD"` or `"none"`
pub status: String,
/// AI status. Known values are `"people"` or `"none"`
#[yaserde(rename = "AItype")]
pub ai_type: Option<String>,
/// The recording status. Known values `0` or `1`
pub recording: i32,
/// The timestamp associated with the recording. `0` if not recording
+8 -2
View File
@@ -232,10 +232,16 @@ impl BcCamera {
let mut result = MotionStatus::NoChange(Instant::now());
for alarm_event in &alarm_event_list.alarm_events {
if alarm_event.channel_id == channel_id {
if alarm_event.status == "MD" {
if alarm_event.status != "none"
|| alarm_event
.ai_type
.as_ref()
.map(|ai_type| ai_type != "none")
.unwrap_or(false)
{
result = MotionStatus::Start(Instant::now());
break;
} else if alarm_event.status == "none" {
} else {
result = MotionStatus::Stop(Instant::now());
break;
}