Skip to main content

nanonis_rs/client/
mpass.rs

1use super::NanonisClient;
2use crate::error::NanonisError;
3use crate::types::NanonisValue;
4
5impl NanonisClient {
6    // ==================== Multi-Pass ====================
7
8    /// Activate or deactivate Multi-Pass in the Scan Control module.
9    ///
10    /// # Arguments
11    /// * `on` - True to activate, false to deactivate
12    ///
13    /// # Errors
14    /// Returns `NanonisError` if communication fails.
15    pub fn mpass_activate(&mut self, on: bool) -> Result<(), NanonisError> {
16        self.quick_send(
17            "MPass.Activate",
18            vec![NanonisValue::U32(if on { 1 } else { 0 })],
19            vec!["I"],
20            vec![],
21        )?;
22        Ok(())
23    }
24
25    /// Load a Multi-Pass configuration file (.mpas).
26    ///
27    /// # Arguments
28    /// * `file_path` - Path to the .mpas file (empty to load from session)
29    ///
30    /// # Errors
31    /// Returns `NanonisError` if communication fails.
32    pub fn mpass_load(&mut self, file_path: &str) -> Result<(), NanonisError> {
33        self.quick_send(
34            "MPass.Load",
35            vec![NanonisValue::String(file_path.to_string())],
36            vec!["+*c"],
37            vec![],
38        )?;
39        Ok(())
40    }
41
42    /// Save the current Multi-Pass configuration to a file (.mpas).
43    ///
44    /// # Arguments
45    /// * `file_path` - Path to save the .mpas file (empty to save to session)
46    ///
47    /// # Errors
48    /// Returns `NanonisError` if communication fails.
49    pub fn mpass_save(&mut self, file_path: &str) -> Result<(), NanonisError> {
50        self.quick_send(
51            "MPass.Save",
52            vec![NanonisValue::String(file_path.to_string())],
53            vec!["+*c"],
54            vec![],
55        )?;
56        Ok(())
57    }
58}