diff --git a/config.toml.example b/config.toml.example index 735c18e7f8d0d097475a016dc2a6ce7fceec36c9..7d9e794d6e9de50701bd9922bfcc5ce0e8c98b89 100644 --- a/config.toml.example +++ b/config.toml.example @@ -11,6 +11,11 @@ paths = [ # must be 6 characters or less callsign = "NOCALL" +# Comment this section out if you're not using +# APRS for control +[control] +kiss = "localhost:8001" + # used for authenticating incoming # APRS packets. Note that this is a # signature, *not* encryption @@ -20,7 +25,7 @@ callsign = "NOCALL" secret = "changeme" # command to burst the balloon -burst_command = "echo 'boom!'" +burst_command = ">&2 echo 'boom!'" # command to cut down the payload -cutdown_command = "echo 'snip'" +cutdown_command = ">&2 echo 'snip'" diff --git a/src/config.rs b/src/config.rs index ff3aba2fb844d8db5d395930813d843b9e7d654e..97de0df44d0b728e3c0bc33d190d3d35d2fb1d46 100644 --- a/src/config.rs +++ b/src/config.rs @@ -4,14 +4,20 @@ use anyhow::{bail, Context}; use serde::Deserialize; #[derive(Deserialize, Clone)] -pub struct Config { - pub paths: Vec<PathBuf>, - pub callsign: String, +pub struct ControlConfig { pub secret: String, pub burst_command: String, pub cutdown_command: String, } +#[derive(Deserialize, Clone)] +pub struct Config { + pub paths: Vec<PathBuf>, + pub callsign: String, + + pub control: Option<ControlConfig>, +} + impl Config { pub fn load() -> anyhow::Result<Self> { let file_contents = read_conf_file()?; diff --git a/src/control.rs b/src/control.rs index 5cff55f76e5c90c97259df78f6be34e8a5b79d9e..99bf5166f559f5a50f51a973c4c2a48e33580c08 100644 --- a/src/control.rs +++ b/src/control.rs @@ -60,15 +60,17 @@ impl Controller { // used to request HD images, as well as // to initiate burst/cutdown fn aprs_thread(config: Config, tx: Sender<u8>) { - let mut handler = CommandHandler::new( - config.callsign, - config.secret, - config.burst_command, - config.cutdown_command, - tx, - ); - - handler.process_forever(); + if let Some(ctrl) = config.control { + let mut handler = CommandHandler::new( + config.callsign, + ctrl.secret, + ctrl.burst_command, + ctrl.cutdown_command, + tx, + ); + + handler.process_forever(); + } } // manages our transceiver