diff --git a/src/camera/mod.rs b/src/camera/mod.rs index 4f78133..2902808 100644 --- a/src/camera/mod.rs +++ b/src/camera/mod.rs @@ -10,9 +10,10 @@ pub use opencv::OpenCVCamera; use anyhow::Result; use chrono::DateTime; use chrono::Utc; +use serde::{Deserialize, Serialize}; /// Camera resolution options -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq,Serialize,Deserialize)] pub enum Resolution { /// 1920x1080 (1080p) HD1080p, @@ -40,7 +41,7 @@ impl Resolution { } /// Camera exposure mode -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq,Serialize,Deserialize)] pub enum ExposureMode { /// Automatic exposure control Auto, diff --git a/src/main.rs b/src/main.rs index b1fc5da..e9a7878 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,7 @@ mod monitoring; use anyhow::{Context, Result}; use log::{info, error}; use std::path::PathBuf; -use std::sync::Arc; +use std::sync::{Arc,Mutex as StdMutex}; use tokio::sync::Mutex; pub use config::Config; @@ -63,8 +63,8 @@ async fn main() -> Result<()> { overlay::watermark::Watermark::new( config.watermark.clone(), - Arc::new(Mutex::new(env_data)), - Arc::new(Mutex::new(gps_status)), + Arc::new(StdMutex::new(env_data)), + Arc::new(StdMutex::new(gps_status)), ) }; let watermark = Arc::new(Mutex::new(watermark)); @@ -80,8 +80,9 @@ async fn main() -> Result<()> { // Initialize detection pipeline let detection_pipeline = detection::DetectionPipeline::new( camera_controller.clone(), - &config - ).await.context("Failed to initialize detection pipeline")?; + &config, + config.detection.pipeline + ).context("Failed to initialize detection pipeline")?; // Initialize storage system let storage_manager = storage::StorageManager::new(&config) diff --git a/src/overlay/mod.rs b/src/overlay/mod.rs index 0dd64bc..227f99f 100644 --- a/src/overlay/mod.rs +++ b/src/overlay/mod.rs @@ -1,3 +1,3 @@ -mod watermark; +pub(crate) mod watermark; pub use watermark::{WatermarkOptions, WatermarkPosition, Watermark, WatermarkContent}; diff --git a/src/sensors/controller.rs b/src/sensors/controller.rs index bfc3dbc..f1a5a8c 100644 --- a/src/sensors/controller.rs +++ b/src/sensors/controller.rs @@ -344,7 +344,7 @@ impl SensorController { camera_sensor.update_brightness(brightness); // Update the current data - let mut data = self.current_data.lock().unwrap(); + let mut data = self.current_data.lock()?; data.sky_brightness = brightness; data.timestamp = Utc::now(); @@ -376,8 +376,4 @@ impl LightSensor for Box { } } -impl LightSensorExt for Box { - fn as_any(&self) -> &dyn std::any::Any { - self - } -} + diff --git a/src/streaming/rtsp.rs b/src/streaming/rtsp.rs index c059646..8c3c591 100644 --- a/src/streaming/rtsp.rs +++ b/src/streaming/rtsp.rs @@ -1,7 +1,7 @@ use anyhow::{anyhow, Context, Result}; use chrono::Utc; use log::{debug, error, info, warn}; -use opencv::{core, imgproc, prelude::*}; +use opencv::{prelude::*}; use serde::{Deserialize, Serialize}; use std::process::{Child, Command, Stdio}; use std::sync::{Arc, Mutex};