Added stop command to PTZ

This commit is contained in:
Adrian Bates committed 2023-04-22 11:13:59 -04:00
1 parent 81a573ba6d
commit 427046239c
3 files changed
+8 -2

No files matched your search

+5 -2
View File
@@ -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 {
+2
View File
@@ -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));
+1
View File
@@ -207,6 +207,7 @@ async fn listen_on_camera(cam_config: Arc<CameraConfig>, mqtt_config: &MqttConfi
"right" => Direction::Right(amount),
"in" => Direction::In(amount),
"out" => Direction::Out(amount),
"stop" => Direction::Stop(amount),
_ => {
error!("Unrecongnized PTZ direction");
continue;