make modem init a file
This commit is contained in:
parent
43d208a39f
commit
9d712ddd10
2 changed files with 6 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
use core::panic;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fs,
|
||||
io::{Read, Write},
|
||||
net::TcpStream,
|
||||
thread,
|
||||
|
@ -41,7 +42,10 @@ fn connect(params: &ClientParams) -> Connection {
|
|||
.unwrap();
|
||||
if let Some(modem_init) = params.modem_init {
|
||||
serial.set_timeout(Duration::from_millis(200)).unwrap();
|
||||
for line in modem_init.lines() {
|
||||
for line in fs::read_to_string(modem_init)
|
||||
.expect("invalid modem init file")
|
||||
.lines()
|
||||
{
|
||||
let line = line
|
||||
.replace("$IP", ¶ms.server_ip.to_string())
|
||||
.replace("$PORT", ¶ms.server_port.to_string());
|
||||
|
|
|
@ -31,5 +31,5 @@ fn main() {
|
|||
}
|
||||
eprintln!("Usage: \n\
|
||||
\x20 revpfw3 server <port> <key> [<poll delay>]\n\
|
||||
\x20 revpfw3 client <server ip> <server port> <destination ip> <destination port> <key> [<poll delay> [<modem port> <modem baud> <modem init>]]");
|
||||
\x20 revpfw3 client <server ip> <server port> <destination ip> <destination port> <key> [<poll delay> [<modem port> <modem baud> <modem init file>]]");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue