Skip to content

Commit

Permalink
Add Scanner::device_name property
Browse files Browse the repository at this point in the history
This is going to be used for auto-discovered scanners.
  • Loading branch information
tanuva committed Nov 25, 2023
1 parent 328d23b commit a971a9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion escl-scan-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct DeviceArgs {

fn get_scanner(cli: &Cli) -> Scanner {
if let Some(host) = &cli.device.host {
return Scanner::new(&host, None);
return Scanner::new("Manually Configured", &host, None);
}

panic!("get_scanner called while no device was specified");
Expand Down
8 changes: 5 additions & 3 deletions escl-scan/src/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ use reqwest::blocking::Response;
use std::fs::File;

pub struct Scanner {
base_url: String,
pub base_url: String,
pub device_name: String,
}

impl Scanner {
pub fn new(ip_or_host: String, root: Option<String>) -> Scanner {
pub fn new(device_name: &str, ip_or_host: &str, root: Option<&str>) -> Scanner {
let resource_root = if root.is_some() {
root.unwrap()
} else {
"eSCL".to_string()
"eSCL"
};

Scanner {
device_name: device_name.to_string(),
base_url: format!("http://{}:80/{}", ip_or_host, resource_root),
}
}
Expand Down

0 comments on commit a971a9a

Please sign in to comment.