diff --git a/crates/core/src/bc_protocol/ptz.rs b/crates/core/src/bc_protocol/ptz.rs index c06fee0..247ce3f 100644 --- a/crates/core/src/bc_protocol/ptz.rs +++ b/crates/core/src/bc_protocol/ptz.rs @@ -15,6 +15,8 @@ pub enum Direction { In, /// To zoom the camera Out (may be done with cropping depending on camera model) Out, + /// To stop currently active PTZ command + Stop } impl BcCamera { @@ -32,10 +34,11 @@ impl BcCamera { Direction::Right => "right", Direction::In => { todo!() - } + }, Direction::Out => { todo!() - } + }, + Direction::Stop => "stop" } .to_string(); let send = Bc { diff --git a/src/mqtt/event_cam.rs b/src/mqtt/event_cam.rs index fe0ae26..788f85f 100644 --- a/src/mqtt/event_cam.rs +++ b/src/mqtt/event_cam.rs @@ -37,6 +37,7 @@ pub(crate) enum Direction { Right(f32), In(f32), Out(f32), + Stop(f32) } #[derive(Debug)] @@ -415,6 +416,7 @@ impl<'a> MessageHandler<'a> { Direction::Right(amount) => (BcDirection::Right, amount), Direction::In(amount) => (BcDirection::In, amount), Direction::Out(amount) => (BcDirection::Out, amount), + Direction::Stop(amount) => (BcDirection::Stop, amount) }; if let Err(e) = self.camera.send_ptz(bc_direction, amount).await { error = Some(format!("Failed to send PTZ: {:?}", e)); diff --git a/src/mqtt/mod.rs b/src/mqtt/mod.rs index dcdb2ab..106f2fc 100644 --- a/src/mqtt/mod.rs +++ b/src/mqtt/mod.rs @@ -207,6 +207,7 @@ async fn listen_on_camera(cam_config: Arc, mqtt_config: &MqttConfi "right" => Direction::Right(amount), "in" => Direction::In(amount), "out" => Direction::Out(amount), + "stop" => Direction::Stop(amount), _ => { error!("Unrecongnized PTZ direction"); continue;