INI File can be parsed
This commit is contained in:
parent
955bc37afe
commit
efeb9d8227
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@
|
|||||||
.vscode/launch.json
|
.vscode/launch.json
|
||||||
.vscode/ipch
|
.vscode/ipch
|
||||||
todo.txt
|
todo.txt
|
||||||
|
*.ini
|
||||||
|
@ -364,6 +364,9 @@ LEDboardClient <ip address>"
|
|||||||
println!("<ip address>");
|
println!("<ip address>");
|
||||||
println!("second argument is optional:");
|
println!("second argument is optional:");
|
||||||
println!("<ip of mqtt server>");
|
println!("<ip of mqtt server>");
|
||||||
|
println!("");
|
||||||
|
println!("Config mode");
|
||||||
|
println!("--mode config <file.ini>");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_connection(ipaddress: String) -> bool {
|
fn check_connection(ipaddress: String) -> bool {
|
||||||
@ -401,7 +404,8 @@ struct Message {
|
|||||||
fn main_function(ipaddress: String, mqtt: Option<String>, config: Option<String>) -> ExitCode {
|
fn main_function(ipaddress: String, mqtt: Option<String>, config: Option<String>) -> ExitCode {
|
||||||
|
|
||||||
// Read configuration file
|
// Read configuration file
|
||||||
if config.is_some() {
|
if ( (config.is_some()) && (mqtt.is_some()) && (ipaddress == "--mode") )
|
||||||
|
{
|
||||||
let i = Ini::load_from_file(config.clone().unwrap()).unwrap();
|
let i = Ini::load_from_file(config.clone().unwrap()).unwrap();
|
||||||
for (sec, prop) in i.iter() {
|
for (sec, prop) in i.iter() {
|
||||||
println!("Section: {:?}", sec);
|
println!("Section: {:?}", sec);
|
||||||
@ -409,6 +413,9 @@ fn main_function(ipaddress: String, mqtt: Option<String>, config: Option<String>
|
|||||||
println!("{}:{}", k, v);
|
println!("{}:{}", k, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME stop here
|
||||||
|
return ExitCode::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut device_online = check_connection(ipaddress.clone());
|
let mut device_online = check_connection(ipaddress.clone());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user