snap7-cli 0.1.6

CLI tool for communicating with Siemens S7 PLCs — read/write data blocks, watch tags, upload blocks, query SZL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use anyhow::Result;
use snap7_client::{transport::TcpTransport, S7Client};

use crate::args::{PasswordAction, PasswordArgs};

pub async fn run(client: &S7Client<TcpTransport>, args: PasswordArgs) -> Result<()> {
    match args.action {
        PasswordAction::Set { password } => {
            client.set_session_password(&password).await?;
            println!("ok  – session password set");
        }
        PasswordAction::Clear => {
            client.clear_session_password().await?;
            println!("ok  – session password cleared");
        }
    }
    Ok(())
}