Rename command from motion to pir
This commit is contained in:
1 parent
9f1bcd6f55
commit
2b56705172
7 files changed
+33
-33
No files matched your search
+1
-1
@@ -20,6 +20,6 @@ pub enum Command {
|
||||
Rtsp(super::rtsp::Opt),
|
||||
StatusLight(super::statusled::Opt),
|
||||
Reboot(super::reboot::Opt),
|
||||
Motion(super::motion::Opt),
|
||||
Pir(super::pir::Opt),
|
||||
Talk(super::talk::Opt),
|
||||
}
|
||||
+3
-3
@@ -17,7 +17,7 @@ use validator::Validate;
|
||||
mod cmdline;
|
||||
mod config;
|
||||
mod reboot;
|
||||
mod motion;
|
||||
mod pir;
|
||||
mod rtsp;
|
||||
mod statusled;
|
||||
mod talk;
|
||||
@@ -65,8 +65,8 @@ fn main() -> Result<()> {
|
||||
Some(Command::Reboot(opts)) => {
|
||||
reboot::main(opts, config)?;
|
||||
}
|
||||
Some(Command::Motion(opts)) => {
|
||||
motion::main(opts, config)?;
|
||||
Some(Command::Pir(opts)) => {
|
||||
pir::main(opts, config)?;
|
||||
}
|
||||
Some(Command::Talk(opts)) => {
|
||||
talk::main(opts, config)?;
|
||||
|
||||
@@ -12,7 +12,7 @@ fn onoff_parse(src: &str) -> Result<bool> {
|
||||
}
|
||||
}
|
||||
|
||||
/// The motion command will control the motion status off the camera
|
||||
/// The pir command will control the PIR status of the camera
|
||||
#[derive(StructOpt, Debug)]
|
||||
pub struct Opt {
|
||||
/// The name of the camera. Must be a name in the config
|
||||
@@ -1,16 +1,16 @@
|
||||
///
|
||||
/// # Neolink Motion
|
||||
/// # Neolink PIR
|
||||
///
|
||||
/// This module handles the controls of the motion alarm
|
||||
/// This module handles the controls of the pir sensor alarm
|
||||
///
|
||||
///
|
||||
/// # Usage
|
||||
///
|
||||
/// ```bash
|
||||
/// # To turn the motion on
|
||||
/// neolink motion --config=config.toml CameraName on
|
||||
/// # To turn the pir sensor on
|
||||
/// neolink pir --config=config.toml CameraName on
|
||||
/// # Or off
|
||||
/// neolink motion --config=config.toml CameraName off
|
||||
/// neolink pir --config=config.toml CameraName off
|
||||
/// ```
|
||||
///
|
||||
use anyhow::{Context, Result};
|
||||
@@ -21,14 +21,14 @@ use super::config::Config;
|
||||
use crate::utils::find_and_connect;
|
||||
pub(crate) use cmdline::Opt;
|
||||
|
||||
/// Entry point for the motion subcommand
|
||||
/// Entry point for the pir subcommand
|
||||
///
|
||||
/// Opt is the command line options
|
||||
pub(crate) fn main(opt: Opt, config: Config) -> Result<()> {
|
||||
let mut camera = find_and_connect(&config, &opt.camera)?;
|
||||
|
||||
camera
|
||||
.motion_set(opt.on)
|
||||
.context("Unable to set camera motion state")?;
|
||||
.pir_set(opt.on)
|
||||
.context("Unable to set camera PIR state")?;
|
||||
Ok(())
|
||||
}
|
||||
Reference in new issue
Block a user