Skip to main content

NanonisClient

Struct NanonisClient 

Source
pub struct NanonisClient { /* private fields */ }
Expand description

High-level client for communicating with Nanonis SPM systems via TCP.

NanonisClient provides a type-safe, Rust-friendly interface to the Nanonis TCP protocol. It handles connection management, protocol serialization/deserialization, and provides convenient methods for common operations like reading signals, controlling bias voltage, and managing the scanning probe.

§Connection Management

The client maintains a persistent TCP connection to the Nanonis server. Connection timeouts and retry logic are handled automatically.

§Protocol Support

Supports the standard Nanonis TCP command set including:

  • Signal reading (Signals.ValsGet, Signals.NamesGet)
  • Bias control (Bias.Set, Bias.Get)
  • Position control (FolMe.XYPosSet, FolMe.XYPosGet)
  • Motor control (Motor.* commands)
  • Auto-approach (AutoApproach.* commands)

§Examples

Basic usage:

use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Read signal names
let signals = client.signal_names_get()?;

// Set bias voltage
client.bias_set(1.0)?;

// Read signal values
let values = client.signals_vals_get(vec![0, 1, 2], true)?;

With builder pattern:

use std::time::Duration;
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::builder()
    .address("192.168.1.100")
    .port(6501)
    .debug(true)
    .connect_timeout(Duration::from_secs(30))
    .build()?;

Implementations§

Source§

impl NanonisClient

Source

pub fn atom_track_ctrl_set( &mut self, control: ATControl, enabled: bool, ) -> Result<(), NanonisError>

Turn the selected Atom Tracking control on or off.

§Arguments
  • control - Which control to switch (modulation, controller, or drift measurement)
  • enabled - True to enable, false to disable
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::atom_track::ATControl;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.atom_track_ctrl_set(ATControl::Controller, true)?;
Source

pub fn atom_track_status_get( &mut self, control: ATControl, ) -> Result<bool, NanonisError>

Get the status of the selected Atom Tracking control.

§Arguments
  • control - Which control to query
§Returns

True if the control is enabled.

§Errors

Returns NanonisError if communication fails.

Source

pub fn atom_track_props_set( &mut self, props: &AtomTrackProps, ) -> Result<(), NanonisError>

Set the Atom Tracking parameters.

§Arguments
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::atom_track::AtomTrackProps;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let props = AtomTrackProps {
    integral_gain: 10.0,
    frequency_hz: 200.0,
    amplitude_m: 1e-10,
    phase_deg: 0.0,
    switch_off_delay_s: 0.1,
};
client.atom_track_props_set(&props)?;
Source

pub fn atom_track_props_get(&mut self) -> Result<AtomTrackProps, NanonisError>

Get the Atom Tracking parameters.

§Returns

An AtomTrackProps struct with current tracking parameters.

§Errors

Returns NanonisError if communication fails.

Source

pub fn atom_track_quick_comp_start( &mut self, comp_type: QuickCompType, ) -> Result<(), NanonisError>

Start the Tilt or Drift compensation.

§Arguments
  • comp_type - Which compensation to start (tilt or drift)
§Errors

Returns NanonisError if communication fails.

Source

pub fn atom_track_drift_comp(&mut self) -> Result<(), NanonisError>

Apply the Drift measurement to the Drift compensation and turn on compensation.

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn auto_approach_open(&mut self) -> Result<(), NanonisError>

Open the Auto-Approach module

Source

pub fn auto_approach_on_off_set( &mut self, on_off: bool, ) -> Result<(), NanonisError>

Start or stop the Z auto-approach procedure

Source

pub fn auto_approach_on_off_get(&mut self) -> Result<bool, NanonisError>

Get the on-off status of the Z auto-approach procedure

Source§

impl NanonisClient

Source

pub fn beam_defl_hor_config_set( &mut self, config: &BeamDeflConfig, ) -> Result<(), NanonisError>

Set the horizontal deflection configuration.

§Arguments
  • config - Beam deflection configuration
§Errors

Returns NanonisError if communication fails.

Source

pub fn beam_defl_hor_config_get( &mut self, ) -> Result<BeamDeflConfig, NanonisError>

Get the horizontal deflection configuration.

§Returns

Beam deflection configuration.

§Errors

Returns NanonisError if communication fails.

Source

pub fn beam_defl_ver_config_set( &mut self, config: &BeamDeflConfig, ) -> Result<(), NanonisError>

Set the vertical deflection configuration.

§Arguments
  • config - Beam deflection configuration
§Errors

Returns NanonisError if communication fails.

Source

pub fn beam_defl_ver_config_get( &mut self, ) -> Result<BeamDeflConfig, NanonisError>

Get the vertical deflection configuration.

§Returns

Beam deflection configuration.

§Errors

Returns NanonisError if communication fails.

Source

pub fn beam_defl_int_config_set( &mut self, config: &BeamDeflConfig, ) -> Result<(), NanonisError>

Set the intensity signal configuration.

§Arguments
  • config - Beam deflection configuration
§Errors

Returns NanonisError if communication fails.

Source

pub fn beam_defl_int_config_get( &mut self, ) -> Result<BeamDeflConfig, NanonisError>

Get the intensity signal configuration.

§Returns

Beam deflection configuration.

§Errors

Returns NanonisError if communication fails.

Source

pub fn beam_defl_auto_offset( &mut self, signal: DeflectionSignal, ) -> Result<(), NanonisError>

Auto-offset the beam deflection signal.

Adds the current deflection value to the offset so the signal is close to 0.

§Arguments
  • signal - Which deflection signal to offset
§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn bias_set(&mut self, voltage: f32) -> Result<(), NanonisError>

Set the bias voltage applied to the scanning probe tip.

This corresponds to the Nanonis Bias.Set command and is fundamental for tip-sample interaction control.

§Arguments
  • voltage - The bias voltage to apply (in volts)
§Errors

Returns NanonisError if:

  • The command fails or communication times out
  • The voltage is outside the instrument’s safe operating range
§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set bias to 1.5V
client.bias_set(1.5)?;

// Set bias to -0.5V
client.bias_set(-0.5)?;
Source

pub fn bias_get(&mut self) -> Result<f32, NanonisError>

Get the current bias voltage applied to the scanning probe tip.

This corresponds to the Nanonis Bias.Get command.

§Returns

The current bias voltage in volts.

§Errors

Returns NanonisError if:

  • The command fails or communication times out
  • The server returns invalid or missing data
§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let current_bias = client.bias_get()?;
println!("Current bias voltage: {:.3}V", current_bias);
Source

pub fn bias_range_set( &mut self, bias_range_index: u16, ) -> Result<(), NanonisError>

Set the range of the bias voltage, if different ranges are available.

Sets the bias voltage range by selecting from available ranges. Use bias_range_get() first to retrieve the list of available ranges.

§Arguments
  • bias_range_index - Index from the list of ranges (0-based)
§Errors

Returns NanonisError if:

  • Invalid range index is provided
  • Communication timeout or protocol error
§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// First get available ranges
let (ranges, current_index) = client.bias_range_get()?;
println!("Available ranges: {:?}", ranges);

// Set to range index 1
client.bias_range_set(1)?;
Source

pub fn bias_range_get(&mut self) -> Result<(Vec<String>, u16), NanonisError>

Get the selectable ranges of bias voltage and the index of the selected one.

Returns all available bias voltage ranges and which one is currently selected. This information is needed for bias_range_set() and bias_calibr_set/get().

§Returns

A tuple containing:

  • Vec<String> - Array of available bias range descriptions
  • u16 - Index of currently selected range
§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let (ranges, current_index) = client.bias_range_get()?;
println!("Current range: {} (index {})", ranges[current_index as usize], current_index);

for (i, range) in ranges.iter().enumerate() {
    println!("Range {}: {}", i, range);
}
Source

pub fn bias_calibr_set( &mut self, calibration: f32, offset: f32, ) -> Result<(), NanonisError>

Set the calibration and offset of bias voltage.

Sets the calibration parameters for the currently selected bias range. If multiple ranges are available, this affects only the selected range.

§Arguments
  • calibration - Calibration factor (typically in V/V or similar units)
  • offset - Offset value in the same units as calibration
§Errors

Returns NanonisError if communication fails or invalid parameters provided.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set calibration factor and offset for current range
client.bias_calibr_set(1.0, 0.0)?;

// Apply a small offset correction
client.bias_calibr_set(0.998, 0.005)?;
Ok::<(), Box<dyn std::error::Error>>(())
Source

pub fn bias_calibr_get(&mut self) -> Result<(f32, f32), NanonisError>

Get the calibration and offset of bias voltage.

Returns the calibration parameters for the currently selected bias range. If multiple ranges are available, this returns values for the selected range.

§Returns

A tuple containing:

  • f32 - Calibration factor
  • f32 - Offset value
§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let (calibration, offset) = client.bias_calibr_get()?;
println!("Bias calibration: {:.6}, offset: {:.6}", calibration, offset);
Ok::<(), Box<dyn std::error::Error>>(())
Source

pub fn bias_pulse( &mut self, wait_until_done: bool, pulse_width_s: f32, bias_value_v: f32, z_controller_hold: u16, pulse_mode: u16, ) -> Result<(), NanonisError>

Generate one bias pulse.

Applies a bias voltage pulse for a specified duration. This is useful for tunneling spectroscopy, tip conditioning, or sample manipulation experiments.

§Arguments
  • wait_until_done - If true, function waits until pulse completes
  • pulse_width_s - Pulse duration in seconds
  • bias_value_v - Bias voltage during pulse (in volts)
  • z_controller_hold - Z-controller behavior: 0=no change, 1=hold, 2=don’t hold
  • pulse_mode - Pulse mode: 0=no change, 1=relative to current, 2=absolute value
§Errors

Returns NanonisError if:

  • Invalid pulse parameters (negative duration, etc.)
  • Bias voltage exceeds safety limits
  • Communication timeout or protocol error
§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Apply a 100ms pulse at +2V, holding Z-controller, absolute voltage
client.bias_pulse(true, 0.1, 2.0, 1, 2)?;

// Quick +0.5V pulse relative to current bias, don't wait
client.bias_pulse(false, 0.01, 0.5, 0, 1)?;

// Long conditioning pulse at -3V absolute, hold Z-controller
client.bias_pulse(true, 1.0, -3.0, 1, 2)?;
Source§

impl NanonisClient

Source

pub fn bias_spectr_open(&mut self) -> Result<(), NanonisError>

Open the Bias Spectroscopy module.

Opens and initializes the Bias Spectroscopy module for STS measurements. This must be called before performing spectroscopy operations.

§Errors

Returns NanonisError if communication fails or module cannot be opened.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.bias_spectr_open()?;
Source

pub fn bias_spectr_start( &mut self, get_data: bool, save_base_name: &str, ) -> Result<BiasSpectrResult, NanonisError>

Start a bias spectroscopy measurement.

Starts a bias spectroscopy (STS) measurement with configured parameters. Select channels to record before calling this function.

§Arguments
  • get_data - If true, returns measurement data
  • save_base_name - Base filename for saving (empty for no change)
§Returns

A BiasSpectrResult containing channel names, 2D data, and parameters.

§Errors

Returns NanonisError if communication fails or measurement cannot start.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Start spectroscopy and get data
let result = client.bias_spectr_start(true, "sts_001")?;
println!("Recorded {} channels", result.channel_names.len());
println!("Data shape: {} x {}", result.data.len(),
         result.data.first().map(|r| r.len()).unwrap_or(0));
Source

pub fn bias_spectr_stop(&mut self) -> Result<(), NanonisError>

Stop the current bias spectroscopy measurement.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.bias_spectr_stop()?;
Source

pub fn bias_spectr_status_get(&mut self) -> Result<bool, NanonisError>

Get the status of the bias spectroscopy measurement.

§Returns

true if measurement is running, false otherwise.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
if client.bias_spectr_status_get()? {
    println!("Spectroscopy is running");
}
Source

pub fn bias_spectr_chs_set( &mut self, channel_indexes: &[i32], ) -> Result<(), NanonisError>

Set the list of recorded channels in bias spectroscopy.

§Arguments
  • channel_indexes - Indexes of channels to record (0-23 for signals in Signals Manager)
§Errors

Returns NanonisError if communication fails or invalid indexes provided.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
// Record channels 0, 1, and 5
client.bias_spectr_chs_set(&[0, 1, 5])?;
Source

pub fn bias_spectr_chs_get( &mut self, ) -> Result<(Vec<i32>, Vec<String>), NanonisError>

Get the list of recorded channels in bias spectroscopy.

§Returns

A tuple containing:

  • Vec<i32> - Indexes of recorded channels
  • Vec<String> - Names of recorded channels
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let (indexes, names) = client.bias_spectr_chs_get()?;
for (idx, name) in indexes.iter().zip(names.iter()) {
    println!("Channel {}: {}", idx, name);
}
Source

pub fn bias_spectr_props_set( &mut self, config: BiasSpectrPropsBuilder, ) -> Result<(), NanonisError>

Set the bias spectroscopy properties.

Uses a builder pattern to configure only the properties you want to change. Properties not set in the builder will remain unchanged on the instrument.

§Arguments
  • config - Configuration builder with properties to set
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::bias_spectr::{BiasSpectrPropsBuilder, OptionalFlag};

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Configure using builder pattern - only set what you need
let config = BiasSpectrPropsBuilder::new()
    .num_sweeps(10)
    .num_points(200)
    .backward_sweep(OptionalFlag::On)
    .autosave(OptionalFlag::On);

client.bias_spectr_props_set(config)?;
Source

pub fn bias_spectr_props_get(&mut self) -> Result<BiasSpectrProps, NanonisError>

Get the bias spectroscopy properties.

§Returns

A BiasSpectrProps struct with current configuration.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let props = client.bias_spectr_props_get()?;
println!("Sweeps: {}, Points: {}", props.num_sweeps, props.num_points);
Source

pub fn bias_spectr_adv_props_set( &mut self, reset_bias: OptionalFlag, z_controller_hold: OptionalFlag, record_final_z: OptionalFlag, lockin_run: OptionalFlag, ) -> Result<(), NanonisError>

Set the advanced bias spectroscopy properties.

§Arguments
  • reset_bias - Reset bias to initial value after sweep: NoChange/On/Off
  • z_controller_hold - Hold Z-controller during sweep: NoChange/On/Off
  • record_final_z - Record final Z position: NoChange/On/Off
  • lockin_run - Run lock-in during measurement: NoChange/On/Off
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::bias_spectr::OptionalFlag;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.bias_spectr_adv_props_set(
    OptionalFlag::On,   // reset_bias
    OptionalFlag::On,   // z_controller_hold
    OptionalFlag::Off,  // record_final_z
    OptionalFlag::Off,  // lockin_run
)?;
Source

pub fn bias_spectr_adv_props_get( &mut self, ) -> Result<BiasSpectrAdvProps, NanonisError>

Get the advanced bias spectroscopy properties.

§Returns

A BiasSpectrAdvProps struct with current advanced settings.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let adv = client.bias_spectr_adv_props_get()?;
println!("Z-controller hold: {}", adv.z_controller_hold);
Source

pub fn bias_spectr_limits_set( &mut self, start_value_v: f32, end_value_v: f32, ) -> Result<(), NanonisError>

Set the bias spectroscopy sweep limits.

§Arguments
  • start_value_v - Starting bias voltage in volts
  • end_value_v - Ending bias voltage in volts
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
// Sweep from -2V to +2V
client.bias_spectr_limits_set(-2.0, 2.0)?;
Source

pub fn bias_spectr_limits_get(&mut self) -> Result<(f32, f32), NanonisError>

Get the bias spectroscopy sweep limits.

§Returns

A tuple (start_v, end_v) with the voltage limits.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let (start, end) = client.bias_spectr_limits_get()?;
println!("Sweep range: {:.2}V to {:.2}V", start, end);
Source

pub fn bias_spectr_timing_set( &mut self, timing: &BiasSpectrTiming, ) -> Result<(), NanonisError>

Set the bias spectroscopy timing parameters.

§Arguments
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::bias_spectr::BiasSpectrTiming;
use std::time::Duration;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let timing = BiasSpectrTiming {
    settling_time: Duration::from_millis(20),
    integration_time: Duration::from_millis(50),
    ..Default::default()
};
client.bias_spectr_timing_set(&timing)?;
Source

pub fn bias_spectr_timing_get( &mut self, ) -> Result<BiasSpectrTiming, NanonisError>

Get the bias spectroscopy timing parameters.

§Returns

A BiasSpectrTiming struct with current timing settings.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let timing = client.bias_spectr_timing_get()?;
println!("Integration time: {:?}", timing.integration_time);
Source

pub fn bias_spectr_dig_sync_set( &mut self, mode: DigitalSync, ) -> Result<(), NanonisError>

Set the digital synchronization mode.

§Arguments
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::bias_spectr::DigitalSync;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.bias_spectr_dig_sync_set(DigitalSync::TTLSync)?;
Source

pub fn bias_spectr_dig_sync_get(&mut self) -> Result<DigitalSync, NanonisError>

Get the digital synchronization mode.

§Returns

The current DigitalSync mode.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let mode = client.bias_spectr_dig_sync_get()?;
println!("Digital sync mode: {:?}", mode);
Source

pub fn bias_spectr_ttl_sync_set( &mut self, config: &TTLSyncConfig, ) -> Result<(), NanonisError>

Set the TTL synchronization configuration.

§Arguments
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::bias_spectr::{TTLSyncConfig, TTLLine, TTLPolarity};
use std::time::Duration;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let config = TTLSyncConfig {
    line: TTLLine::HSLine1,
    polarity: TTLPolarity::HighActive,
    time_to_on: Duration::from_millis(10),
    on_duration: Duration::from_millis(100),
};
client.bias_spectr_ttl_sync_set(&config)?;
Source

pub fn bias_spectr_ttl_sync_get( &mut self, ) -> Result<TTLSyncConfig, NanonisError>

Get the TTL synchronization configuration.

§Returns

A TTLSyncConfig struct with current TTL settings.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let config = client.bias_spectr_ttl_sync_get()?;
println!("TTL line: {:?}, on duration: {:?}", config.line, config.on_duration);
Source

pub fn bias_spectr_pulse_seq_sync_set( &mut self, config: &PulseSeqSyncConfig, ) -> Result<(), NanonisError>

Set the pulse sequence synchronization configuration.

§Arguments
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::bias_spectr::PulseSeqSyncConfig;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let config = PulseSeqSyncConfig {
    sequence_nr: 1,
    num_periods: 10,
};
client.bias_spectr_pulse_seq_sync_set(&config)?;
Source

pub fn bias_spectr_pulse_seq_sync_get( &mut self, ) -> Result<PulseSeqSyncConfig, NanonisError>

Get the pulse sequence synchronization configuration.

§Returns

A PulseSeqSyncConfig struct with current settings.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let config = client.bias_spectr_pulse_seq_sync_get()?;
println!("Sequence #{}, {} periods", config.sequence_nr, config.num_periods);
Source

pub fn bias_spectr_alt_z_ctrl_set( &mut self, config: &AltZCtrlConfig, ) -> Result<(), NanonisError>

Set the alternate Z-controller setpoint configuration.

§Arguments
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::bias_spectr::AltZCtrlConfig;
use std::time::Duration;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let config = AltZCtrlConfig {
    enabled: true,
    setpoint: 1e-9,  // 1 nA
    settling_time: Duration::from_millis(200),
};
client.bias_spectr_alt_z_ctrl_set(&config)?;
Source

pub fn bias_spectr_alt_z_ctrl_get( &mut self, ) -> Result<AltZCtrlConfig, NanonisError>

Get the alternate Z-controller setpoint configuration.

§Returns

An AltZCtrlConfig struct with current settings.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let config = client.bias_spectr_alt_z_ctrl_get()?;
println!("Alt Z-ctrl enabled: {}, setpoint: {}", config.enabled, config.setpoint);
Source

pub fn bias_spectr_z_off_revert_set( &mut self, revert: OptionalFlag, ) -> Result<(), NanonisError>

Set the Z offset revert flag.

When enabled, the Z offset applied at the beginning is reverted at the end.

§Arguments
  • revert - Whether to revert Z offset: NoChange/On/Off
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::bias_spectr::OptionalFlag;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.bias_spectr_z_off_revert_set(OptionalFlag::On)?;
Source

pub fn bias_spectr_z_off_revert_get(&mut self) -> Result<bool, NanonisError>

Get the Z offset revert flag.

§Returns

true if Z offset revert is enabled.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let revert = client.bias_spectr_z_off_revert_get()?;
println!("Z offset revert: {}", revert);
Source

pub fn bias_spectr_mls_lockin_per_seg_set( &mut self, enabled: bool, ) -> Result<(), NanonisError>

Set the MLS lock-in per segment flag.

When enabled, lock-in can be configured per segment in the MLS editor.

§Arguments
  • enabled - Whether to enable per-segment lock-in configuration
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.bias_spectr_mls_lockin_per_seg_set(true)?;
Source

pub fn bias_spectr_mls_lockin_per_seg_get( &mut self, ) -> Result<bool, NanonisError>

Get the MLS lock-in per segment flag.

§Returns

true if per-segment lock-in configuration is enabled.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let enabled = client.bias_spectr_mls_lockin_per_seg_get()?;
println!("MLS lock-in per segment: {}", enabled);
Source

pub fn bias_spectr_mls_mode_set( &mut self, mode: SweepMode, ) -> Result<(), NanonisError>

Set the MLS sweep mode.

§Arguments
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::bias_spectr::SweepMode;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.bias_spectr_mls_mode_set(SweepMode::MLS)?;
Source

pub fn bias_spectr_mls_mode_get(&mut self) -> Result<SweepMode, NanonisError>

Get the current MLS sweep mode.

§Returns

The current SweepMode.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let mode = client.bias_spectr_mls_mode_get()?;
println!("Sweep mode: {:?}", mode);
Source

pub fn bias_spectr_mls_vals_set( &mut self, segments: &[MLSSegment], ) -> Result<(), NanonisError>

Set the MLS segment values.

§Arguments
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::bias_spectr::MLSSegment;
use std::time::Duration;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let segments = vec![
    MLSSegment {
        bias_start: -2.0,
        bias_end: 0.0,
        steps: 100,
        ..Default::default()
    },
    MLSSegment {
        bias_start: 0.0,
        bias_end: 2.0,
        steps: 100,
        ..Default::default()
    },
];
client.bias_spectr_mls_vals_set(&segments)?;
Source

pub fn bias_spectr_mls_vals_get( &mut self, ) -> Result<Vec<MLSSegment>, NanonisError>

Get the MLS segment values.

§Returns

A vector of MLSSegment configurations.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let segments = client.bias_spectr_mls_vals_get()?;
for (i, seg) in segments.iter().enumerate() {
    println!("Segment {}: {:.2}V to {:.2}V, {} steps",
             i, seg.bias_start, seg.bias_end, seg.steps);
}
Source§

impl NanonisClient

Source

pub fn bias_sweep_open(&mut self) -> Result<(), NanonisError>

Open the Bias Sweep module.

Opens and initializes the Bias Sweep module for bias voltage sweep measurements. This must be called before performing bias sweep operations.

§Errors

Returns NanonisError if communication fails or module cannot be opened.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Open bias sweep module
client.bias_sweep_open()?;
println!("Bias Sweep module opened");
Source

pub fn bias_sweep_start( &mut self, get_data: bool, sweep_direction: bool, z_controller_status: u32, save_base_name: &str, reset_bias: bool, ) -> Result<(Vec<String>, Vec<Vec<f32>>), NanonisError>

Start a bias sweep measurement.

Starts a bias voltage sweep with the configured parameters. The sweep will step through bias voltages between the set limits while recording selected channels.

§Arguments
  • get_data - If true, returns measurement data; if false, only starts measurement
  • sweep_direction - Sweep direction: true starts from lower limit, false from upper
  • z_controller_status - Z-controller behavior: 0=no change, 1=turn off, 2=don’t turn off
  • save_base_name - Base filename for saving data (empty for no change)
  • reset_bias - Whether to reset bias after sweep: true for on, false for off
§Returns

If get_data is true, returns a tuple containing:

  • Vec<String> - Channel names
  • Vec<Vec<f32>> - 2D measurement data [rows][columns]
§Errors

Returns NanonisError if communication fails or sweep cannot start.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Start sweep and get data, from lower to upper limit, turn off Z-controller
let (channels, data) = client.bias_sweep_start(
    true,           // get_data
    true,           // sweep from lower limit
    1,              // turn off Z-controller
    "bias_sweep_001", // save basename
    true            // reset bias after sweep
)?;
println!("Recorded {} channels with {} points", channels.len(), data.len());

// Just start sweep without getting data
let (_, _) = client.bias_sweep_start(false, true, 0, "", false)?;
Source

pub fn bias_sweep_props_set( &mut self, number_of_steps: u16, period_ms: u16, autosave: u16, save_dialog_box: u16, ) -> Result<(), NanonisError>

Set the bias sweep configuration parameters.

Configures the bias sweep measurement parameters including number of steps, timing, and save behavior.

§Arguments
  • number_of_steps - Number of bias steps in the sweep (0 = no change)
  • period_ms - Period between steps in milliseconds (0 = no change)
  • autosave - Auto-save behavior: 0=no change, 1=on, 2=off
  • save_dialog_box - Show save dialog: 0=no change, 1=on, 2=off
§Errors

Returns NanonisError if communication fails or invalid parameters provided.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Configure 100 steps, 50ms per step, auto-save on, no dialog
client.bias_sweep_props_set(100, 50, 1, 2)?;

// High resolution sweep with slower timing
client.bias_sweep_props_set(500, 100, 1, 2)?;
Source

pub fn bias_sweep_limits_set( &mut self, lower_limit: f32, upper_limit: f32, ) -> Result<(), NanonisError>

Set the bias sweep voltage limits.

Configures the voltage range for the bias sweep. The sweep will step between these limits according to the configured number of steps.

§Arguments
  • lower_limit - Lower voltage limit in volts
  • upper_limit - Upper voltage limit in volts
§Errors

Returns NanonisError if communication fails or invalid limits provided.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set sweep range from -2V to +2V
client.bias_sweep_limits_set(-2.0, 2.0)?;

// Positive voltage sweep only
client.bias_sweep_limits_set(0.0, 5.0)?;

// Negative voltage sweep
client.bias_sweep_limits_set(-3.0, 0.0)?;
Source

pub fn bias_sweep_limits_get(&mut self) -> Result<(f32, f32), NanonisError>

Get the current bias sweep voltage limits.

Returns the voltage range configuration for bias sweep measurements.

§Returns

A tuple containing:

  • f32 - Lower voltage limit in volts
  • f32 - Upper voltage limit in volts
§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let (lower, upper) = client.bias_sweep_limits_get()?;
println!("Bias sweep range: {:.2}V to {:.2}V", lower, upper);
println!("Sweep span: {:.2}V", upper - lower);

// Check if limits are reasonable
if (upper - lower).abs() < 0.1 {
    println!("Warning: Very narrow sweep range");
}
Source

pub fn bias_sweep_props_get( &mut self, ) -> Result<(u16, u16, bool, bool), NanonisError>

Get the current bias sweep configuration parameters.

Returns the current sweep configuration including number of steps, timing, and save behavior.

§Returns

A tuple containing:

  • u16 - Number of bias steps in the sweep
  • u16 - Period between steps in milliseconds
  • bool - Autosave enabled
  • bool - Save dialog box enabled
§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let (steps, period_ms, autosave, save_dialog) = client.bias_sweep_props_get()?;
println!("Steps: {}, Period: {}ms", steps, period_ms);
println!("Autosave: {}, Save dialog: {}", autosave, save_dialog);
Source§

impl NanonisClient

Source

pub fn cpd_comp_open(&mut self) -> Result<(), NanonisError>

Open the CPD compensation module.

This opens the Contact Potential Difference compensation interface.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.cpd_comp_open()?;
Source

pub fn cpd_comp_close(&mut self) -> Result<(), NanonisError>

Close the CPD compensation module.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.cpd_comp_close()?;
Source

pub fn cpd_comp_params_set( &mut self, params: &CPDCompParams, ) -> Result<(), NanonisError>

Set the CPD compensation parameters.

§Arguments
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::cpd_comp::CPDCompParams;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let params = CPDCompParams {
    speed_hz: 10.0,
    range_v: 2.0,
    averaging: 5,
};
client.cpd_comp_params_set(&params)?;
Source

pub fn cpd_comp_params_get(&mut self) -> Result<CPDCompParams, NanonisError>

Get the CPD compensation parameters.

§Returns

A CPDCompParams struct with current parameters.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let params = client.cpd_comp_params_get()?;
println!("Speed: {} Hz, Range: {} V", params.speed_hz, params.range_v);
Source

pub fn cpd_comp_data_get(&mut self) -> Result<CPDCompData, NanonisError>

Get the CPD compensation data.

Returns the graph data, CPD estimate, and fit coefficients from the CPD compensation module.

§Returns

A CPDCompData struct with sweep data and fit results.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let data = client.cpd_comp_data_get()?;
println!("CPD estimate: {} V", data.cpd_estimate_v);
println!("Fit: a={}, b={}", data.fit_coefficients.a, data.fit_coefficients.b);
Source§

impl NanonisClient

Source

pub fn current_get(&mut self) -> Result<f32, NanonisError>

Get the current tunneling current value.

Returns the instantaneous tunneling current measurement from the current amplifier. This is one of the most fundamental measurements in STM, providing direct information about the tip-sample conductance.

§Returns

Current value in Amperes (A).

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let current = client.current_get()?;
println!("Tunneling current: {:.3e} A", current);

// Convert to more convenient units
if current.abs() < 1e-9 {
    println!("Current: {:.1} pA", current * 1e12);
} else {
    println!("Current: {:.1} nA", current * 1e9);
}
Source

pub fn current_100_get(&mut self) -> Result<f32, NanonisError>

Get the current value from the “Current 100” module.

Returns the tunneling current from the specialized Current 100 module, which may have different gain or filtering characteristics than the main current amplifier.

§Returns

Current 100 value in Amperes (A).

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let current_100 = client.current_100_get()?;
println!("Current 100 module: {:.3e} A", current_100);
Source

pub fn current_beem_get(&mut self) -> Result<f32, NanonisError>

Get the BEEM current value from the corresponding module.

Returns the Ballistic Electron Emission Microscopy (BEEM) current value in systems equipped with BEEM capabilities. BEEM measures hot electrons transmitted through thin metal films.

§Returns

BEEM current value in Amperes (A).

§Errors

Returns NanonisError if:

  • BEEM module is not available or not configured
  • Communication fails or protocol error occurs
§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let beem_current = client.current_beem_get()?;
println!("BEEM current: {:.3e} A", beem_current);
Source

pub fn current_gain_set( &mut self, gain_index: i32, filter_index: i32, ) -> Result<(), NanonisError>

Set the gain and filter of the current amplifier.

Configures the current amplifier’s gain and filtering characteristics. Use current_gains_get() to retrieve the available gain and filter options before setting specific indices.

§Arguments
  • gain_index - Index from the list of available gains
  • filter_index - Index from the list of available filters
§Errors

Returns NanonisError if:

  • Invalid gain or filter index provided
  • Communication fails or protocol error occurs
§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Get available options first
let (gains, current_gain_idx, filters, current_filter_idx) = client.current_gains_get()?;
println!("Available gains: {:?}", gains);
println!("Available filters: {:?}", filters);

// Set to high gain (index 3) with medium filtering (index 1)
client.current_gain_set(3, 1)?;
Source

pub fn current_gains_get( &mut self, ) -> Result<(Vec<String>, u16, Vec<String>, i32), NanonisError>

Get the available gains and filters of the current amplifier.

Returns all selectable gains and filters for the current amplifier, along with the currently selected indices. This information is needed for current_gain_set().

§Returns

A tuple containing:

  • Vec<String> - Array of available gain descriptions
  • u16 - Index of currently selected gain
  • Vec<String> - Array of available filter descriptions
  • i32 - Index of currently selected filter
§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let (gains, gain_idx, filters, filter_idx) = client.current_gains_get()?;

println!("Current gain: {} (index {})", gains[gain_idx as usize], gain_idx);
println!("Current filter: {} (index {})", filters[filter_idx as usize], filter_idx);

// List all available options
for (i, gain) in gains.iter().enumerate() {
    println!("Gain {}: {}", i, gain);
}
Source

pub fn current_calibr_set( &mut self, gain_index: i32, calibration: f64, offset: f64, ) -> Result<(), NanonisError>

Set the calibration and offset for a specific gain in the Current module.

Configures the calibration parameters for accurate current measurements. Each gain setting can have its own calibration and offset values.

§Arguments
  • gain_index - Index of the gain to calibrate (-1 for currently selected gain)
  • calibration - Calibration factor (typically A/V or similar)
  • offset - Offset value in the same units
§Errors

Returns NanonisError if communication fails or invalid parameters provided.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Calibrate currently selected gain
client.current_calibr_set(-1, 1.0e-9, 0.0)?;

// Calibrate specific gain (index 2) with offset correction
client.current_calibr_set(2, 9.87e-10, -1.5e-12)?;
Source

pub fn current_calibr_get( &mut self, gain_index: i32, ) -> Result<(f64, f64), NanonisError>

Get the calibration and offset for a specific gain in the Current module.

Returns the calibration parameters for the specified gain setting.

§Arguments
  • gain_index - Index of the gain to query (-1 for currently selected gain)
§Returns

A tuple containing:

  • f64 - Calibration factor
  • f64 - Offset value
§Errors

Returns NanonisError if communication fails or invalid gain index.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Get calibration for currently selected gain
let (calibration, offset) = client.current_calibr_get(-1)?;
println!("Current calibration: {:.3e}, offset: {:.3e}", calibration, offset);

// Check calibration for specific gain
let (cal, off) = client.current_calibr_get(2)?;
Source§

impl NanonisClient

Source

pub fn data_log_open(&mut self) -> Result<(), NanonisError>

Open the Data Logger module.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.data_log_open()?;
Source

pub fn data_log_start(&mut self) -> Result<(), NanonisError>

Start the acquisition in the Data Logger module.

Before using this function, select the channels to record.

§Errors

Returns NanonisError if communication fails.

Source

pub fn data_log_stop(&mut self) -> Result<(), NanonisError>

Stop the acquisition in the Data Logger module.

§Errors

Returns NanonisError if communication fails.

Source

pub fn data_log_status_get(&mut self) -> Result<DataLogStatus, NanonisError>

Get the status of the Data Logger module.

§Returns

A DataLogStatus struct with current status information.

§Errors

Returns NanonisError if communication fails.

Source

pub fn data_log_chs_set( &mut self, channel_indexes: &[i32], ) -> Result<(), NanonisError>

Set the list of recorded channels in the Data Logger.

§Arguments
  • channel_indexes - Channel indexes (0-23 for signals in the Signals Manager)
§Errors

Returns NanonisError if communication fails.

Source

pub fn data_log_chs_get(&mut self) -> Result<Vec<i32>, NanonisError>

Get the list of recorded channels in the Data Logger.

§Returns

A vector of channel indexes.

§Errors

Returns NanonisError if communication fails.

Source

pub fn data_log_props_set( &mut self, props: &DataLogProps, modules: &[String], ) -> Result<(), NanonisError>

Set the acquisition configuration for the Data Logger.

§Arguments
  • props - A DataLogProps struct with configuration
  • modules - List of module names whose parameters will be saved in file header
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::data_log::{DataLogProps, DataLogAcqMode};

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let props = DataLogProps {
    mode: DataLogAcqMode::Timed,
    duration_hours: 0,
    duration_minutes: 10,
    duration_seconds: 0.0,
    averaging: 10,
    basename: "measurement".to_string(),
    comment: "Test measurement".to_string(),
};
client.data_log_props_set(&props, &["Z-Controller".to_string()])?;
Source

pub fn data_log_props_get(&mut self) -> Result<DataLogProps, NanonisError>

Get the acquisition configuration for the Data Logger.

§Returns

A DataLogProps struct with current configuration.

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn dig_lines_props_set( &mut self, config: &DigitalLineConfig, ) -> Result<(), NanonisError>

Configure the properties of a digital line.

§Arguments
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::dig_lines::{DigitalLineConfig, DigitalPort, DigitalDirection, DigitalPolarity};

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let config = DigitalLineConfig {
    line: 1,
    port: DigitalPort::PortA,
    direction: DigitalDirection::Output,
    polarity: DigitalPolarity::HighActive,
};
client.dig_lines_props_set(&config)?;
Source

pub fn dig_lines_out_status_set( &mut self, port: DigitalPort, line: u32, active: bool, ) -> Result<(), NanonisError>

Set the status of a digital output line.

§Arguments
  • port - Port selection
  • line - Digital line number (1-8)
  • active - True for active, false for inactive
§Errors

Returns NanonisError if communication fails.

Source

pub fn dig_lines_ttl_val_get( &mut self, port: DigitalPort, ) -> Result<Vec<u32>, NanonisError>

Read the TTL voltages present at the pins of the selected port.

§Arguments
  • port - Port selection
§Returns

A vector of TTL values for each line (0 = inactive, 1 = active).

§Errors

Returns NanonisError if communication fails.

Source

pub fn dig_lines_pulse( &mut self, config: &PulseConfig, ) -> Result<(), NanonisError>

Configure and start the pulse generator on the selected digital outputs.

§Arguments
  • config - A PulseConfig struct with pulse configuration
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::dig_lines::{PulseConfig, DigitalPort};

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let config = PulseConfig {
    port: DigitalPort::PortA,
    lines: vec![1, 2],
    pulse_width_s: 0.001,
    pulse_pause_s: 0.001,
    num_pulses: 10,
    wait_until_finished: true,
};
client.dig_lines_pulse(&config)?;
Source§

impl NanonisClient

Source

pub fn folme_xy_pos_get( &mut self, wait_for_newest_data: bool, ) -> Result<Position, NanonisError>

Get the current x-y position.

§Arguments
  • wait_for_newest_data - If true, waits for newest data
§Returns

Current position.

§Errors

Returns NanonisError if communication fails.

Source

pub fn folme_xy_pos_set( &mut self, position: Position, wait_until_finished: bool, ) -> Result<(), NanonisError>

Set the x-y position.

§Arguments
  • position - Target position
  • wait_until_finished - If true, waits until move completes
§Errors

Returns NanonisError if communication fails.

Source

pub fn folme_speed_set( &mut self, speed_m_s: f32, custom_speed: bool, ) -> Result<(), NanonisError>

Set the tip speed when moving in Follow Me mode.

§Arguments
  • speed_m_s - Speed in m/s
  • custom_speed - True to use custom speed, false for scan speed
§Errors

Returns NanonisError if communication fails.

Source

pub fn folme_speed_get(&mut self) -> Result<FolMeSpeed, NanonisError>

Get the tip speed configuration for Follow Me mode.

§Returns

Speed configuration.

§Errors

Returns NanonisError if communication fails.

Source

pub fn folme_oversampl_set( &mut self, oversampling: i32, ) -> Result<(), NanonisError>

Set the oversampling for data acquisition in Follow Me mode.

§Arguments
  • oversampling - Oversampling factor
§Errors

Returns NanonisError if communication fails.

Source

pub fn folme_oversampl_get(&mut self) -> Result<FolMeOversampling, NanonisError>

Get the oversampling and sampling rate for Follow Me mode.

§Returns

Oversampling configuration including sampling rate.

§Errors

Returns NanonisError if communication fails.

Source

pub fn folme_stop(&mut self) -> Result<(), NanonisError>

Stop the tip movement in Follow Me mode.

§Errors

Returns NanonisError if communication fails.

Source

pub fn folme_ps_on_off_get(&mut self) -> Result<bool, NanonisError>

Get the Point & Shoot status in Follow Me mode.

§Returns

True if Point & Shoot is enabled.

§Errors

Returns NanonisError if communication fails.

Source

pub fn folme_ps_on_off_set(&mut self, enabled: bool) -> Result<(), NanonisError>

Enable or disable Point & Shoot in Follow Me mode.

§Arguments
  • enabled - True to enable, false to disable
§Errors

Returns NanonisError if communication fails.

Source

pub fn folme_ps_exp_get(&mut self) -> Result<FolMePSExperiment, NanonisError>

Get the Point & Shoot experiment configuration.

§Returns

Selected experiment and list of available experiments.

§Errors

Returns NanonisError if communication fails.

Source

pub fn folme_ps_exp_set( &mut self, experiment_index: u16, ) -> Result<(), NanonisError>

Set the Point & Shoot experiment.

§Arguments
  • experiment_index - Index of the experiment to select
§Errors

Returns NanonisError if communication fails.

Source

pub fn folme_ps_props_get(&mut self) -> Result<FolMePSProps, NanonisError>

Get the Point & Shoot properties.

§Returns

Point & Shoot configuration.

§Errors

Returns NanonisError if communication fails.

Source

pub fn folme_ps_props_set( &mut self, auto_resume: PSAutoResume, basename_mode: PSBasenameMode, basename: &str, external_vi_path: &str, pre_measure_delay_s: f32, ) -> Result<(), NanonisError>

Set the Point & Shoot properties.

§Arguments
  • auto_resume - Resume mode after experiment
  • basename_mode - Basename selection mode
  • basename - Basename for Point & Shoot files
  • external_vi_path - Path to external VI
  • pre_measure_delay_s - Delay before measurement in seconds
§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn gen_pi_ctrl_on_off_set( &mut self, enabled: bool, ) -> Result<(), NanonisError>

Enable or disable the Generic PI Controller.

§Arguments
  • enabled - True to enable, false to disable
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.gen_pi_ctrl_on_off_set(true)?;
Source

pub fn gen_pi_ctrl_on_off_get(&mut self) -> Result<bool, NanonisError>

Get the on/off status of the Generic PI Controller.

§Returns

True if controller is enabled.

§Errors

Returns NanonisError if communication fails.

Source

pub fn gen_pi_ctrl_ao_val_set( &mut self, output_value: f32, ) -> Result<(), NanonisError>

Set the output signal value of the User Output controlled by the Generic PI controller.

§Arguments
  • output_value - Output value
§Errors

Returns NanonisError if communication fails.

Source

pub fn gen_pi_ctrl_ao_val_get(&mut self) -> Result<f32, NanonisError>

Get the output signal value of the User Output controlled by the Generic PI controller.

§Returns

The current output value.

§Errors

Returns NanonisError if communication fails.

Source

pub fn gen_pi_ctrl_ao_props_set( &mut self, props: &AOProps, ) -> Result<(), NanonisError>

Set the properties of the User Output controlled by the Generic PI controller.

§Arguments
  • props - An AOProps struct with analog output properties
§Errors

Returns NanonisError if communication fails.

Source

pub fn gen_pi_ctrl_ao_props_get(&mut self) -> Result<AOProps, NanonisError>

Get the properties of the User Output controlled by the Generic PI controller.

§Returns

An AOProps struct with current analog output properties.

§Errors

Returns NanonisError if communication fails.

Source

pub fn gen_pi_ctrl_mod_ch_set( &mut self, output_index: i32, ) -> Result<(), NanonisError>

Set the index of the User Output controlled by the Generic PI controller.

§Arguments
  • output_index - Output index (1 to number of available outputs)
§Errors

Returns NanonisError if communication fails.

Source

pub fn gen_pi_ctrl_mod_ch_get(&mut self) -> Result<i32, NanonisError>

Get the index of the User Output controlled by the Generic PI controller.

§Returns

The output index (0 means no output selected).

§Errors

Returns NanonisError if communication fails.

Source

pub fn gen_pi_ctrl_demod_ch_set( &mut self, input_index: i32, ac_mode: ACMode, ) -> Result<(), NanonisError>

Set the index of the signal demodulated by the Generic PI controller.

§Arguments
  • input_index - Input index (0-127 for signals, -1 for no change)
  • ac_mode - AC mode setting
§Errors

Returns NanonisError if communication fails.

Source

pub fn gen_pi_ctrl_demod_ch_get(&mut self) -> Result<i32, NanonisError>

Get the index of the signal demodulated by the Generic PI controller.

§Returns

The input index.

§Errors

Returns NanonisError if communication fails.

Source

pub fn gen_pi_ctrl_props_set( &mut self, props: &GenPICtrlProps, ) -> Result<(), NanonisError>

Set the properties of the Generic PI controller.

§Arguments
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::gen_pi_ctrl::{GenPICtrlProps, GenPISlope};

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let props = GenPICtrlProps {
    setpoint: 0.0,
    p_gain: 1.0,
    time_constant: 0.001,
    slope: GenPISlope::Positive,
};
client.gen_pi_ctrl_props_set(&props)?;
Source

pub fn gen_pi_ctrl_props_get(&mut self) -> Result<GenPICtrlProps, NanonisError>

Get the properties of the Generic PI controller.

§Returns

A GenPICtrlProps struct with current controller properties.

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn gen_swp_open(&mut self) -> Result<(), NanonisError>

Open the Generic Sweeper module.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.gen_swp_open()?;
Source

pub fn gen_swp_acq_chs_set( &mut self, channel_indexes: &[i32], channel_names: &[String], ) -> Result<(), NanonisError>

Set the list of recorded channels for the Generic Sweeper.

§Arguments
  • channel_indexes - Indexes of channels to record
  • channel_names - Names of channels to record
§Errors

Returns NanonisError if communication fails.

Source

pub fn gen_swp_acq_chs_get( &mut self, ) -> Result<(Vec<i32>, Vec<String>), NanonisError>

Get the list of recorded channels for the Generic Sweeper.

§Returns

A tuple of (channel_indexes, channel_names).

§Errors

Returns NanonisError if communication fails.

Source

pub fn gen_swp_swp_signal_set( &mut self, signal_name: &str, ) -> Result<(), NanonisError>

Set the sweep signal for the Generic Sweeper.

§Arguments
  • signal_name - Name of the signal to sweep
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.gen_swp_swp_signal_set("Bias (V)")?;
Source

pub fn gen_swp_swp_signal_get(&mut self) -> Result<String, NanonisError>

Get the selected sweep signal for the Generic Sweeper.

§Returns

The name of the sweep signal.

§Errors

Returns NanonisError if communication fails.

Source

pub fn gen_swp_swp_signal_list_get( &mut self, ) -> Result<Vec<String>, NanonisError>

Get the list of available sweep signals for the Generic Sweeper.

§Returns

A vector of available signal names.

§Errors

Returns NanonisError if communication fails.

Source

pub fn gen_swp_limits_set( &mut self, lower_limit: f32, upper_limit: f32, ) -> Result<(), NanonisError>

Set the sweep limits for the Generic Sweeper.

§Arguments
  • lower_limit - Lower limit of sweep range
  • upper_limit - Upper limit of sweep range
§Errors

Returns NanonisError if communication fails.

Source

pub fn gen_swp_limits_get(&mut self) -> Result<(f32, f32), NanonisError>

Get the sweep limits for the Generic Sweeper.

§Returns

A tuple of (lower_limit, upper_limit).

§Errors

Returns NanonisError if communication fails.

Source

pub fn gen_swp_props_set( &mut self, props: &GenSwpProps, ) -> Result<(), NanonisError>

Set the Generic Sweeper properties.

§Arguments
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::gen_swp::GenSwpProps;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let props = GenSwpProps {
    num_steps: 200,
    period_ms: 100,
    ..Default::default()
};
client.gen_swp_props_set(&props)?;
Source

pub fn gen_swp_props_get(&mut self) -> Result<GenSwpProps, NanonisError>

Get the Generic Sweeper properties.

§Returns

A GenSwpProps struct with current configuration.

§Errors

Returns NanonisError if communication fails.

Source

pub fn gen_swp_start( &mut self, get_data: bool, sweep_direction: bool, save_base_name: &str, reset_signal: bool, z_controller: u16, ) -> Result<GenSwpResult, NanonisError>

Start a sweep in the Generic Sweeper.

§Arguments
  • get_data - If true, returns measurement data
  • sweep_direction - true = lower to upper, false = upper to lower
  • save_base_name - Base filename for saving (empty for no change)
  • reset_signal - Reset signal after sweep
  • z_controller - Z-controller behavior: 0=no change, 1=turn off, 2=don’t turn off
§Returns

A GenSwpResult with channel names and 2D data.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let result = client.gen_swp_start(true, true, "sweep_001", false, 0)?;
println!("Channels: {:?}", result.channel_names);
Source

pub fn gen_swp_stop(&mut self) -> Result<(), NanonisError>

Stop the sweep in the Generic Sweeper.

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn hs_swp_acq_chs_set( &mut self, channel_indices: &[i32], ) -> Result<(), NanonisError>

Set the acquisition channels for the high-speed sweeper.

§Arguments
  • channel_indices - Indices of channels to record
§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_acq_chs_get( &mut self, ) -> Result<HSSwpAvailableChannels, NanonisError>

Get the acquisition channels for the high-speed sweeper.

§Returns

An HSSwpAvailableChannels struct with channel information.

§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_auto_reverse_set( &mut self, config: &HSSwpAutoReverse, ) -> Result<(), NanonisError>

Set the auto-reverse configuration.

§Arguments
  • config - Auto-reverse configuration
§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_auto_reverse_get( &mut self, ) -> Result<HSSwpAutoReverse, NanonisError>

Get the auto-reverse configuration.

§Returns

An HSSwpAutoReverse struct with current configuration.

§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_end_settl_set(&mut self, time_s: f32) -> Result<(), NanonisError>

Set the end settling time.

§Arguments
  • time_s - End settling time in seconds
§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_end_settl_get(&mut self) -> Result<f32, NanonisError>

Get the end settling time.

§Returns

End settling time in seconds.

§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_num_sweeps_set( &mut self, num_sweeps: u32, continuous: bool, ) -> Result<(), NanonisError>

Set the number of sweeps.

§Arguments
  • num_sweeps - Number of sweeps (ignored if continuous)
  • continuous - Enable continuous sweep mode
§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_num_sweeps_get(&mut self) -> Result<(u32, bool), NanonisError>

Get the number of sweeps.

§Returns

Tuple of (number of sweeps, continuous mode enabled).

§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_reset_signals_set( &mut self, reset: bool, ) -> Result<(), NanonisError>

Set whether signals are reset at sweep end.

§Arguments
  • reset - True to reset signals at sweep end
§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_reset_signals_get(&mut self) -> Result<bool, NanonisError>

Get whether signals are reset at sweep end.

§Returns

True if signals are reset at sweep end.

§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_save_basename_set( &mut self, basename: &str, path: &str, ) -> Result<(), NanonisError>

Set the save basename and path.

§Arguments
  • basename - Base name for saved files
  • path - Directory path for saved files
§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_save_basename_get( &mut self, ) -> Result<(String, String), NanonisError>

Get the save basename and path.

§Returns

Tuple of (basename, path).

§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_save_data_set(&mut self, save: bool) -> Result<(), NanonisError>

Set whether data is saved.

§Arguments
  • save - True to save data
§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_save_data_get(&mut self) -> Result<bool, NanonisError>

Get whether data is saved.

§Returns

True if data is being saved.

§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_save_options_set( &mut self, options: &HSSwpSaveOptions, ) -> Result<(), NanonisError>

Set save options.

§Arguments
  • options - Save options configuration
§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_save_options_get( &mut self, ) -> Result<HSSwpSaveOptions, NanonisError>

Get save options.

§Returns

An HSSwpSaveOptions struct with current options.

§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_start( &mut self, wait_until_done: bool, timeout_ms: i32, ) -> Result<(), NanonisError>

Start a high-speed sweep.

§Arguments
  • wait_until_done - Wait for sweep to complete before returning
  • timeout_ms - Timeout in milliseconds (-1 for indefinite)
§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_stop(&mut self) -> Result<(), NanonisError>

Stop the high-speed sweep.

§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_status_get(&mut self) -> Result<bool, NanonisError>

Get the sweep status.

§Returns

True if sweep is running.

§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_swp_ch_sig_list_get( &mut self, ) -> Result<HSSwpSignalList, NanonisError>

Get the list of available sweep signals.

§Returns

An HSSwpSignalList struct with signal information.

§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_swp_ch_signal_set( &mut self, signal_index: i32, timed_sweep: bool, ) -> Result<(), NanonisError>

Set the sweep channel signal.

§Arguments
  • signal_index - Index of sweep signal
  • timed_sweep - Use timed sweep mode (ignores signal)
§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_swp_ch_signal_get(&mut self) -> Result<(i32, bool), NanonisError>

Get the sweep channel signal.

§Returns

Tuple of (signal index, timed sweep enabled).

§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_swp_ch_limits_set( &mut self, limits: &HSSwpLimits, ) -> Result<(), NanonisError>

Set the sweep channel limits.

§Arguments
  • limits - Limits configuration
§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_swp_ch_limits_get(&mut self) -> Result<HSSwpLimits, NanonisError>

Get the sweep channel limits.

§Returns

An HSSwpLimits struct with current limits.

§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_swp_ch_num_pts_set( &mut self, num_points: u32, ) -> Result<(), NanonisError>

Set the number of sweep points.

§Arguments
  • num_points - Number of points in sweep
§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_swp_ch_num_pts_get(&mut self) -> Result<i32, NanonisError>

Get the number of sweep points.

§Returns

Number of points in sweep.

§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_swp_ch_timing_set( &mut self, timing: &HSSwpTiming, ) -> Result<(), NanonisError>

Set the sweep timing parameters.

§Arguments
  • timing - Timing configuration
§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_swp_ch_timing_get(&mut self) -> Result<HSSwpTiming, NanonisError>

Get the sweep timing parameters.

§Returns

An HSSwpTiming struct with current timing.

§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_swp_ch_bwd_sw_set( &mut self, enabled: bool, ) -> Result<(), NanonisError>

Set whether backward sweep is enabled.

§Arguments
  • enabled - Enable backward sweep
§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_swp_ch_bwd_sw_get(&mut self) -> Result<bool, NanonisError>

Get whether backward sweep is enabled.

§Returns

True if backward sweep is enabled.

§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_swp_ch_bwd_delay_set( &mut self, delay_s: f32, ) -> Result<(), NanonisError>

Set the backward sweep delay.

§Arguments
  • delay_s - Delay between forward and backward sweep in seconds
§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_swp_ch_bwd_delay_get(&mut self) -> Result<f32, NanonisError>

Get the backward sweep delay.

§Returns

Delay in seconds.

§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_z_ctrl_off_set( &mut self, config: &HSSwpZCtrl, ) -> Result<(), NanonisError>

Set the Z-controller behavior during sweep.

§Arguments
  • config - Z-controller configuration
§Errors

Returns NanonisError if communication fails.

Source

pub fn hs_swp_z_ctrl_off_get(&mut self) -> Result<HSSwpZCtrl, NanonisError>

Get the Z-controller behavior during sweep.

§Returns

An HSSwpZCtrl struct with current configuration.

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn interf_ctrl_on_off_set(&mut self, on: bool) -> Result<(), NanonisError>

Switch the interferometer controller on or off.

§Arguments
  • on - True to enable, false to disable
§Errors

Returns NanonisError if communication fails.

Source

pub fn interf_ctrl_on_off_get(&mut self) -> Result<bool, NanonisError>

Get the status of the interferometer controller.

§Returns

True if controller is on.

§Errors

Returns NanonisError if communication fails.

Source

pub fn interf_ctrl_props_set( &mut self, props: &InterfCtrlProps, ) -> Result<(), NanonisError>

Set the interferometer controller properties.

§Arguments
  • props - Controller properties
§Errors

Returns NanonisError if communication fails.

Source

pub fn interf_ctrl_props_get(&mut self) -> Result<InterfCtrlProps, NanonisError>

Get the interferometer controller properties.

§Returns

Controller properties.

§Errors

Returns NanonisError if communication fails.

Source

pub fn interf_w_piezo_set(&mut self, w_piezo: f32) -> Result<(), NanonisError>

Set the W-piezo position.

The interferometer controller must be off to change this.

§Arguments
  • w_piezo - W-piezo position value
§Errors

Returns NanonisError if communication fails.

Source

pub fn interf_w_piezo_get(&mut self) -> Result<f32, NanonisError>

Get the W-piezo position.

§Returns

W-piezo position value.

§Errors

Returns NanonisError if communication fails.

Source

pub fn interf_val_get(&mut self) -> Result<f32, NanonisError>

Get the interferometer value.

§Returns

Interferometer value.

§Errors

Returns NanonisError if communication fails.

Source

pub fn interf_ctrl_calibr_open(&mut self) -> Result<(), NanonisError>

Open the calibration panel for the interferometer controller.

§Errors

Returns NanonisError if communication fails.

Source

pub fn interf_ctrl_reset(&mut self) -> Result<(), NanonisError>

Reset the interferometer controller.

§Errors

Returns NanonisError if communication fails.

Source

pub fn interf_ctrl_null_defl(&mut self) -> Result<(), NanonisError>

Apply null deflection to the interferometer controller.

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn kelvin_ctrl_on_off_set( &mut self, enabled: bool, ) -> Result<(), NanonisError>

Enable or disable the Kelvin controller.

§Arguments
  • enabled - True to enable, false to disable
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.kelvin_ctrl_on_off_set(true)?;
Source

pub fn kelvin_ctrl_on_off_get(&mut self) -> Result<bool, NanonisError>

Get the Kelvin controller on/off status.

§Returns

True if controller is enabled.

§Errors

Returns NanonisError if communication fails.

Source

pub fn kelvin_ctrl_setpnt_set( &mut self, setpoint: f32, ) -> Result<(), NanonisError>

Set the Kelvin controller setpoint.

§Arguments
  • setpoint - Setpoint value
§Errors

Returns NanonisError if communication fails.

Source

pub fn kelvin_ctrl_setpnt_get(&mut self) -> Result<f32, NanonisError>

Get the Kelvin controller setpoint.

§Returns

The current setpoint value.

§Errors

Returns NanonisError if communication fails.

Source

pub fn kelvin_ctrl_gain_set( &mut self, gain: &KelvinGain, ) -> Result<(), NanonisError>

Set the Kelvin controller gain parameters.

§Arguments
§Errors

Returns NanonisError if communication fails.

Source

pub fn kelvin_ctrl_gain_get(&mut self) -> Result<KelvinGain, NanonisError>

Get the Kelvin controller gain parameters.

§Returns

A KelvinGain struct with current gain parameters.

§Errors

Returns NanonisError if communication fails.

Source

pub fn kelvin_ctrl_mod_params_set( &mut self, params: &KelvinModParams, ) -> Result<(), NanonisError>

Set the Kelvin controller modulation parameters.

§Arguments
§Errors

Returns NanonisError if communication fails.

Source

pub fn kelvin_ctrl_mod_params_get( &mut self, ) -> Result<KelvinModParams, NanonisError>

Get the Kelvin controller modulation parameters.

§Returns

A KelvinModParams struct with current modulation parameters.

§Errors

Returns NanonisError if communication fails.

Source

pub fn kelvin_ctrl_mod_on_off_set( &mut self, ac_mode: KelvinACMode, modulation: bool, ) -> Result<(), NanonisError>

Set the Kelvin controller AC mode and modulation status.

§Arguments
  • ac_mode - AC mode setting
  • modulation - True to enable modulation, false to disable
§Errors

Returns NanonisError if communication fails.

Source

pub fn kelvin_ctrl_mod_on_off_get( &mut self, ) -> Result<KelvinModStatus, NanonisError>

Get the Kelvin controller AC mode and modulation status.

§Returns

A KelvinModStatus struct with current status.

§Errors

Returns NanonisError if communication fails.

Source

pub fn kelvin_ctrl_signal_set( &mut self, signal_index: i32, ) -> Result<(), NanonisError>

Set the Kelvin controller demodulated/control signal index.

§Arguments
  • signal_index - Signal index
§Errors

Returns NanonisError if communication fails.

Source

pub fn kelvin_ctrl_signal_get(&mut self) -> Result<i32, NanonisError>

Get the Kelvin controller demodulated/control signal index.

§Returns

The signal index.

§Errors

Returns NanonisError if communication fails.

Source

pub fn kelvin_ctrl_amp_get(&mut self) -> Result<f32, NanonisError>

Get the amplitude of the demodulated/control signal.

§Returns

The amplitude value.

§Errors

Returns NanonisError if communication fails.

Source

pub fn kelvin_ctrl_bias_limits_set( &mut self, limits: &KelvinBiasLimits, ) -> Result<(), NanonisError>

Set the Kelvin controller bias limits.

The bias voltage will be limited to these values as long as the controller is on.

§Arguments
§Errors

Returns NanonisError if communication fails.

Source

pub fn kelvin_ctrl_bias_limits_get( &mut self, ) -> Result<KelvinBiasLimits, NanonisError>

Get the Kelvin controller bias limits.

§Returns

A KelvinBiasLimits struct with current bias limits.

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn laser_on_off_set(&mut self, on: bool) -> Result<(), NanonisError>

Switch the laser on or off.

§Arguments
  • on - True to enable, false to disable
§Errors

Returns NanonisError if communication fails.

Source

pub fn laser_on_off_get(&mut self) -> Result<bool, NanonisError>

Get the laser status.

§Returns

True if laser is on.

§Errors

Returns NanonisError if communication fails.

Source

pub fn laser_props_set(&mut self, setpoint: f32) -> Result<(), NanonisError>

Set the laser setpoint.

§Arguments
  • setpoint - Laser setpoint value
§Errors

Returns NanonisError if communication fails.

Source

pub fn laser_props_get(&mut self) -> Result<f32, NanonisError>

Get the laser setpoint.

§Returns

Laser setpoint value.

§Errors

Returns NanonisError if communication fails.

Source

pub fn laser_power_get(&mut self) -> Result<f32, NanonisError>

Get the current laser power.

§Returns

Laser power value.

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn lockin_mod_on_off_set( &mut self, modulator_num: i32, on: bool, ) -> Result<(), NanonisError>

Turn the specified Lock-In modulator on or off.

§Arguments
  • modulator_num - Modulator number (1-8)
  • on - true to turn on, false to turn off
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.lockin_mod_on_off_set(1, true)?; // Turn on modulator 1
Source

pub fn lockin_mod_on_off_get( &mut self, modulator_num: i32, ) -> Result<bool, NanonisError>

Get the on/off status of the specified Lock-In modulator.

§Arguments
  • modulator_num - Modulator number (1-8)
§Returns

true if modulator is on, false if off.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let is_on = client.lockin_mod_on_off_get(1)?;
println!("Modulator 1 is {}", if is_on { "on" } else { "off" });
Source

pub fn lockin_mod_signal_set( &mut self, modulator_num: i32, signal_index: i32, ) -> Result<(), NanonisError>

Set the modulated signal of the specified Lock-In modulator.

§Arguments
  • modulator_num - Modulator number (1-8)
  • signal_index - Signal index (0-127)
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.lockin_mod_signal_set(1, 14)?; // Set modulator 1 to signal 14
Source

pub fn lockin_mod_signal_get( &mut self, modulator_num: i32, ) -> Result<i32, NanonisError>

Get the modulated signal index of the specified Lock-In modulator.

§Arguments
  • modulator_num - Modulator number (1-8)
§Returns

Signal index (0-127).

§Errors

Returns NanonisError if communication fails.

Source

pub fn lockin_mod_phas_reg_set( &mut self, modulator_num: i32, phase_register_index: i32, ) -> Result<(), NanonisError>

Set the phase register index of the specified Lock-In modulator.

§Arguments
  • modulator_num - Modulator number (1-8)
  • phase_register_index - Phase register index (1-8)
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.lockin_mod_phas_reg_set(1, 1)?; // Assign modulator 1 to phase register 1
Source

pub fn lockin_mod_phas_reg_get( &mut self, modulator_num: i32, ) -> Result<i32, NanonisError>

Get the phase register index of the specified Lock-In modulator.

§Arguments
  • modulator_num - Modulator number (1-8)
§Returns

Phase register index (1-8).

Source

pub fn lockin_mod_harmonic_set( &mut self, modulator_num: i32, harmonic: i32, ) -> Result<(), NanonisError>

Set the harmonic of the specified Lock-In modulator.

§Arguments
  • modulator_num - Modulator number (1-8)
  • harmonic - Harmonic number (1 = base frequency)
§Errors

Returns NanonisError if communication fails.

Source

pub fn lockin_mod_harmonic_get( &mut self, modulator_num: i32, ) -> Result<i32, NanonisError>

Get the harmonic of the specified Lock-In modulator.

§Arguments
  • modulator_num - Modulator number (1-8)
§Returns

Harmonic number (1 = base frequency).

Source

pub fn lockin_mod_phas_set( &mut self, modulator_num: i32, phase_deg: f32, ) -> Result<(), NanonisError>

Set the modulation phase offset of the specified Lock-In modulator.

§Arguments
  • modulator_num - Modulator number (1-8)
  • phase_deg - Phase offset in degrees
§Errors

Returns NanonisError if communication fails.

Source

pub fn lockin_mod_phas_get( &mut self, modulator_num: i32, ) -> Result<f32, NanonisError>

Get the modulation phase offset of the specified Lock-In modulator.

§Arguments
  • modulator_num - Modulator number (1-8)
§Returns

Phase offset in degrees.

Source

pub fn lockin_mod_amp_set( &mut self, modulator_num: i32, amplitude: f32, ) -> Result<(), NanonisError>

Set the modulation amplitude of the specified Lock-In modulator.

§Arguments
  • modulator_num - Modulator number (1-8)
  • amplitude - Modulation amplitude
§Errors

Returns NanonisError if communication fails.

Source

pub fn lockin_mod_amp_get( &mut self, modulator_num: i32, ) -> Result<f32, NanonisError>

Get the modulation amplitude of the specified Lock-In modulator.

§Arguments
  • modulator_num - Modulator number (1-8)
§Returns

Modulation amplitude.

Source

pub fn lockin_mod_phas_freq_set( &mut self, modulator_num: i32, frequency_hz: f64, ) -> Result<(), NanonisError>

Set the frequency of the specified Lock-In phase register/modulator.

§Arguments
  • modulator_num - Phase register/modulator number (1-8)
  • frequency_hz - Frequency in Hz
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.lockin_mod_phas_freq_set(1, 1000.0)?; // Set 1kHz
Source

pub fn lockin_mod_phas_freq_get( &mut self, modulator_num: i32, ) -> Result<f64, NanonisError>

Get the frequency of the specified Lock-In phase register/modulator.

§Arguments
  • modulator_num - Phase register/modulator number (1-8)
§Returns

Frequency in Hz.

Source

pub fn lockin_demod_signal_set( &mut self, demodulator_num: i32, signal_index: i32, ) -> Result<(), NanonisError>

Set the demodulated signal of the specified Lock-In demodulator.

§Arguments
  • demodulator_num - Demodulator number (1-8)
  • signal_index - Signal index (0-127)
§Errors

Returns NanonisError if communication fails.

Source

pub fn lockin_demod_signal_get( &mut self, demodulator_num: i32, ) -> Result<i32, NanonisError>

Get the demodulated signal index of the specified Lock-In demodulator.

§Arguments
  • demodulator_num - Demodulator number (1-8)
§Returns

Signal index (0-127).

Source

pub fn lockin_demod_harmonic_set( &mut self, demodulator_num: i32, harmonic: i32, ) -> Result<(), NanonisError>

Set the harmonic of the specified Lock-In demodulator.

§Arguments
  • demodulator_num - Demodulator number (1-8)
  • harmonic - Harmonic number (1 = base frequency)
Source

pub fn lockin_demod_harmonic_get( &mut self, demodulator_num: i32, ) -> Result<i32, NanonisError>

Get the harmonic of the specified Lock-In demodulator.

§Arguments
  • demodulator_num - Demodulator number (1-8)
§Returns

Harmonic number (1 = base frequency).

Source

pub fn lockin_demod_hp_filter_set( &mut self, demodulator_num: i32, filter_order: i32, cutoff_hz: f32, ) -> Result<(), NanonisError>

Set the high-pass filter properties for the specified demodulator.

§Arguments
  • demodulator_num - Demodulator number (1-8)
  • filter_order - Filter order (-1=no change, 0=off, 1-8=active)
  • cutoff_hz - Cutoff frequency in Hz (0=no change)
Source

pub fn lockin_demod_hp_filter_get( &mut self, demodulator_num: i32, ) -> Result<FilterConfig, NanonisError>

Get the high-pass filter properties for the specified demodulator.

§Arguments
  • demodulator_num - Demodulator number (1-8)
§Returns

A FilterConfig with order and cutoff frequency.

Source

pub fn lockin_demod_lp_filter_set( &mut self, demodulator_num: i32, filter_order: i32, cutoff_hz: f32, ) -> Result<(), NanonisError>

Set the low-pass filter properties for the specified demodulator.

§Arguments
  • demodulator_num - Demodulator number (1-8)
  • filter_order - Filter order (-1=no change, 0=off, 1-8=active)
  • cutoff_hz - Cutoff frequency in Hz (0=no change)
Source

pub fn lockin_demod_lp_filter_get( &mut self, demodulator_num: i32, ) -> Result<FilterConfig, NanonisError>

Get the low-pass filter properties for the specified demodulator.

§Arguments
  • demodulator_num - Demodulator number (1-8)
§Returns

A FilterConfig with order and cutoff frequency.

Source

pub fn lockin_demod_phas_reg_set( &mut self, demodulator_num: i32, phase_register_index: i32, ) -> Result<(), NanonisError>

Set the phase register index of the specified Lock-In demodulator.

§Arguments
  • demodulator_num - Demodulator number (1-8)
  • phase_register_index - Phase register index (1-8)
Source

pub fn lockin_demod_phas_reg_get( &mut self, demodulator_num: i32, ) -> Result<i32, NanonisError>

Get the phase register index of the specified Lock-In demodulator.

§Arguments
  • demodulator_num - Demodulator number (1-8)
§Returns

Phase register index (1-8).

Source

pub fn lockin_demod_phas_set( &mut self, demodulator_num: i32, phase_deg: f32, ) -> Result<(), NanonisError>

Set the reference phase of the specified Lock-In demodulator.

§Arguments
  • demodulator_num - Demodulator number (1-8)
  • phase_deg - Reference phase in degrees
Source

pub fn lockin_demod_phas_get( &mut self, demodulator_num: i32, ) -> Result<f32, NanonisError>

Get the reference phase of the specified Lock-In demodulator.

§Arguments
  • demodulator_num - Demodulator number (1-8)
§Returns

Reference phase in degrees.

Source

pub fn lockin_demod_sync_filter_set( &mut self, demodulator_num: i32, on: bool, ) -> Result<(), NanonisError>

Set the sync filter on/off for the specified demodulator.

The synchronous filter suppresses harmonic components very well but only updates after each period of the demodulation frequency.

§Arguments
  • demodulator_num - Demodulator number (1-8)
  • on - true to enable sync filter, false to disable
Source

pub fn lockin_demod_sync_filter_get( &mut self, demodulator_num: i32, ) -> Result<bool, NanonisError>

Get the sync filter status for the specified demodulator.

§Arguments
  • demodulator_num - Demodulator number (1-8)
§Returns

true if sync filter is on.

Source

pub fn lockin_demod_rt_signals_set( &mut self, demodulator_num: i32, mode: RTSignalMode, ) -> Result<(), NanonisError>

Set the RT signals mode for the specified demodulator.

§Arguments
Source

pub fn lockin_demod_rt_signals_get( &mut self, demodulator_num: i32, ) -> Result<RTSignalMode, NanonisError>

Get the RT signals mode for the specified demodulator.

§Arguments
  • demodulator_num - Demodulator number (1-8)
§Returns

The RTSignalMode (X/Y or R/phi).

Source§

impl NanonisClient

Source

pub fn lockin_freq_swp_open(&mut self) -> Result<(), NanonisError>

Open the Lock-In Frequency Sweep (Transfer Function) module.

The transfer function does not run when its front panel is closed. To automate measurements it may be required to open the module first.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.lockin_freq_swp_open()?;
Source

pub fn lockin_freq_swp_start( &mut self, get_data: bool, direction: FreqSwpDirection, ) -> Result<LockInFreqSwpResult, NanonisError>

Start a Lock-In frequency sweep.

§Arguments
  • get_data - If true, returns measurement data
  • direction - Sweep direction (up or down)
§Returns

A LockInFreqSwpResult with channel names and 2D data.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::lockin_freq_swp::FreqSwpDirection;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let result = client.lockin_freq_swp_start(true, FreqSwpDirection::Up)?;
println!("Channels: {:?}", result.channel_names);
Source

pub fn lockin_freq_swp_signal_set( &mut self, signal_index: i32, ) -> Result<(), NanonisError>

Set the sweep signal for the Lock-In frequency sweep module.

§Arguments
  • signal_index - Sweep signal index, or -1 for no signal
§Errors

Returns NanonisError if communication fails.

Source

pub fn lockin_freq_swp_signal_get(&mut self) -> Result<i32, NanonisError>

Get the sweep signal for the Lock-In frequency sweep module.

§Returns

The sweep signal index, or -1 if no signal is selected.

§Errors

Returns NanonisError if communication fails.

Source

pub fn lockin_freq_swp_limits_set( &mut self, lower_limit_hz: f32, upper_limit_hz: f32, ) -> Result<(), NanonisError>

Set the frequency limits for the Lock-In frequency sweep.

§Arguments
  • lower_limit_hz - Lower frequency limit in Hz
  • upper_limit_hz - Upper frequency limit in Hz
§Errors

Returns NanonisError if communication fails.

Source

pub fn lockin_freq_swp_limits_get(&mut self) -> Result<(f32, f32), NanonisError>

Get the frequency limits for the Lock-In frequency sweep.

§Returns

A tuple of (lower_limit_hz, upper_limit_hz).

§Errors

Returns NanonisError if communication fails.

Source

pub fn lockin_freq_swp_props_set( &mut self, props: &LockInFreqSwpProps, ) -> Result<(), NanonisError>

Set the Lock-In frequency sweep properties.

§Arguments
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::lockin_freq_swp::LockInFreqSwpProps;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let props = LockInFreqSwpProps {
    num_steps: 200,
    integration_periods: 20,
    ..Default::default()
};
client.lockin_freq_swp_props_set(&props)?;
Source

pub fn lockin_freq_swp_props_get( &mut self, ) -> Result<LockInFreqSwpProps, NanonisError>

Get the Lock-In frequency sweep properties.

§Returns

A LockInFreqSwpProps struct with current configuration.

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn marks_point_draw( &mut self, x_m: f32, y_m: f32, text: &str, color: u32, ) -> Result<(), NanonisError>

Draw text at a specified point in the scan frame.

§Arguments
  • x_m - X coordinate in meters
  • y_m - Y coordinate in meters
  • text - Text to draw
  • color - RGB color value
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
// Draw red "X" at position (1nm, 2nm)
client.marks_point_draw(1e-9, 2e-9, "X", 0xFF0000)?;
Source

pub fn marks_points_draw( &mut self, x_coords_m: &[f32], y_coords_m: &[f32], texts: &[String], colors: &[u32], ) -> Result<(), NanonisError>

Draw text at multiple points in the scan frame.

§Arguments
  • x_coords_m - X coordinates in meters
  • y_coords_m - Y coordinates in meters
  • texts - Text labels for each point
  • colors - RGB colors for each point
§Errors

Returns NanonisError if communication fails.

Source

pub fn marks_line_draw( &mut self, start_x_m: f32, start_y_m: f32, end_x_m: f32, end_y_m: f32, color: u32, ) -> Result<(), NanonisError>

Draw a line in the scan frame.

§Arguments
  • start_x_m - Start X coordinate in meters
  • start_y_m - Start Y coordinate in meters
  • end_x_m - End X coordinate in meters
  • end_y_m - End Y coordinate in meters
  • color - RGB color value
§Errors

Returns NanonisError if communication fails.

Source

pub fn marks_lines_draw( &mut self, start_x_m: &[f32], start_y_m: &[f32], end_x_m: &[f32], end_y_m: &[f32], colors: &[u32], ) -> Result<(), NanonisError>

Draw multiple lines in the scan frame.

§Arguments
  • start_x_m - Start X coordinates in meters
  • start_y_m - Start Y coordinates in meters
  • end_x_m - End X coordinates in meters
  • end_y_m - End Y coordinates in meters
  • colors - RGB colors for each line
§Errors

Returns NanonisError if communication fails.

Source

pub fn marks_points_erase( &mut self, point_index: i32, ) -> Result<(), NanonisError>

Erase a point mark from the scan frame.

§Arguments
  • point_index - Index of point to erase (-1 to erase all)
§Errors

Returns NanonisError if communication fails.

Source

pub fn marks_lines_erase(&mut self, line_index: i32) -> Result<(), NanonisError>

Erase a line mark from the scan frame.

§Arguments
  • line_index - Index of line to erase (-1 to erase all)
§Errors

Returns NanonisError if communication fails.

Source

pub fn marks_points_visible_set( &mut self, point_index: i32, visible: bool, ) -> Result<(), NanonisError>

Show or hide a point mark.

§Arguments
  • point_index - Index of point (-1 for all)
  • visible - True to show, false to hide
§Errors

Returns NanonisError if communication fails.

Source

pub fn marks_lines_visible_set( &mut self, line_index: i32, visible: bool, ) -> Result<(), NanonisError>

Show or hide a line mark.

§Arguments
  • line_index - Index of line (-1 for all)
  • visible - True to show, false to hide
§Errors

Returns NanonisError if communication fails.

Source

pub fn marks_points_get(&mut self) -> Result<Vec<PointMark>, NanonisError>

Get information about all drawn point marks.

§Returns

A vector of PointMark structs.

§Errors

Returns NanonisError if communication fails.

Source

pub fn marks_lines_get(&mut self) -> Result<Vec<LineMark>, NanonisError>

Get information about all drawn line marks.

§Returns

A vector of LineMark structs.

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn motor_start_move( &mut self, direction: impl Into<MotorDirection>, number_of_steps: impl Into<u16>, group: impl Into<MotorGroup>, wait_until_finished: bool, ) -> Result<(), NanonisError>

Move the coarse positioning device (motor, piezo actuator)

Source

pub fn motor_start_closed_loop( &mut self, movement_mode: MovementMode, target_position: Position3D, wait_until_finished: bool, group: MotorGroup, ) -> Result<(), NanonisError>

Move the coarse positioning device in closed loop

Source

pub fn motor_stop_move(&mut self) -> Result<(), NanonisError>

Stop the motor motion

Source

pub fn motor_pos_get( &mut self, group: MotorGroup, timeout: Duration, ) -> Result<Position3D, NanonisError>

Get the positions of the motor control module

Source

pub fn motor_step_counter_get( &mut self, reset_x: bool, reset_y: bool, reset_z: bool, ) -> Result<(i32, i32, i32), NanonisError>

Get step counter values and optionally reset them Available only on Attocube ANC150 devices

Source

pub fn motor_freq_amp_get( &mut self, axis: MotorAxis, ) -> Result<(Frequency, Amplitude), NanonisError>

Get frequency and amplitude of the motor control module Available only for PD5, PMD4, and Attocube ANC150 devices

Source

pub fn motor_freq_amp_set( &mut self, frequency: impl Into<Frequency>, amplitude: impl Into<Amplitude>, axis: impl Into<MotorAxis>, ) -> Result<(), NanonisError>

Set frequency and amplitude of the motor control module Available only for PD5, PMD4, and Attocube ANC150 devices

Source§

impl NanonisClient

Source

pub fn mpass_activate(&mut self, on: bool) -> Result<(), NanonisError>

Activate or deactivate Multi-Pass in the Scan Control module.

§Arguments
  • on - True to activate, false to deactivate
§Errors

Returns NanonisError if communication fails.

Source

pub fn mpass_load(&mut self, file_path: &str) -> Result<(), NanonisError>

Load a Multi-Pass configuration file (.mpas).

§Arguments
  • file_path - Path to the .mpas file (empty to load from session)
§Errors

Returns NanonisError if communication fails.

Source

pub fn mpass_save(&mut self, file_path: &str) -> Result<(), NanonisError>

Save the current Multi-Pass configuration to a file (.mpas).

§Arguments
  • file_path - Path to save the .mpas file (empty to save to session)
§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn oc_sync_angles_set( &mut self, angles: &OCSyncAngles, ) -> Result<(), NanonisError>

Set the angle values for digital channels 1 and 2.

The On angle is the excitation angle at which the digital channel goes high. The Off angle is the excitation angle at which the digital channel goes low.

§Arguments
  • angles - Angle configuration
§Errors

Returns NanonisError if communication fails.

Source

pub fn oc_sync_angles_get(&mut self) -> Result<OCSyncAngles, NanonisError>

Get the angle values for digital channels 1 and 2.

§Returns

Angle configuration.

§Errors

Returns NanonisError if communication fails.

Set the link angles status for channels 1 and 2.

When linked, the difference between Off and On angles is kept constant.

§Arguments
  • ch1_mode - Channel 1 link mode
  • ch2_mode - Channel 2 link mode
§Errors

Returns NanonisError if communication fails.

Get the link angles status for channels 1 and 2.

§Returns

Link status for both channels.

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn osci1t_ch_set(&mut self, channel_index: i32) -> Result<(), NanonisError>

Set the channel to display in the Oscilloscope 1-Channel channel_index: 0-23, corresponds to signals assigned to the 24 slots in the Signals Manager

Source

pub fn osci1t_ch_get(&mut self) -> Result<i32, NanonisError>

Get the channel displayed in the Oscilloscope 1-Channel Returns: channel index (0-23)

Source

pub fn osci1t_timebase_set( &mut self, timebase_index: i32, ) -> Result<(), NanonisError>

Set the timebase in the Oscilloscope 1-Channel Use osci1t_timebase_get() first to obtain available timebases, then use the index

Source

pub fn osci1t_timebase_get(&mut self) -> Result<(i32, Vec<f32>), NanonisError>

Get the timebase in the Oscilloscope 1-Channel Returns: (timebase_index, timebases_array)

Source

pub fn osci1t_trig_set( &mut self, trigger_mode: u16, trigger_slope: u16, trigger_level: f64, trigger_hysteresis: f64, ) -> Result<(), NanonisError>

Set the trigger configuration in the Oscilloscope 1-Channel trigger_mode: 0 = Immediate, 1 = Level, 2 = Auto trigger_slope: 0 = Falling, 1 = Rising

Source

pub fn osci1t_trig_get(&mut self) -> Result<(u16, u16, f64, f64), NanonisError>

Get the trigger configuration in the Oscilloscope 1-Channel Returns: (trigger_mode, trigger_slope, trigger_level, trigger_hysteresis)

Source

pub fn osci1t_run(&mut self) -> Result<(), NanonisError>

Start the Oscilloscope 1-Channel

Source

pub fn osci1t_data_get( &mut self, data_to_get: u16, ) -> Result<(f64, f64, i32, Vec<f64>), NanonisError>

Get the graph data from the Oscilloscope 1-Channel data_to_get: 0 = Current, 1 = Next trigger, 2 = Wait 2 triggers Returns: (t0, dt, size, data_values)

Source§

impl NanonisClient

Source

pub fn osci2t_ch_set( &mut self, channel_a_index: i32, channel_b_index: i32, ) -> Result<(), NanonisError>

Set the channels to display in the Oscilloscope 2-Channels channel_a_index: 0-23, channel A signal index
channel_b_index: 0-23, channel B signal index

Source

pub fn osci2t_ch_get(&mut self) -> Result<(i32, i32), NanonisError>

Get the channels displayed in the Oscilloscope 2-Channels Returns: (channel_a_index, channel_b_index)

Source

pub fn osci2t_timebase_set( &mut self, timebase_index: u16, ) -> Result<(), NanonisError>

Set the timebase in the Oscilloscope 2-Channels Use osci2t_timebase_get() first to obtain available timebases, then use the index

Source

pub fn osci2t_timebase_get(&mut self) -> Result<(u16, Vec<f32>), NanonisError>

Get the timebase in the Oscilloscope 2-Channels Returns: (timebase_index, timebases_array)

Source

pub fn osci2t_oversampl_set( &mut self, oversampling_index: u16, ) -> Result<(), NanonisError>

Set the oversampling in the Oscilloscope 2-Channels oversampling_index: 0=50 samples, 1=20, 2=10, 3=5, 4=2, 5=1 sample (no averaging)

Source

pub fn osci2t_oversampl_get(&mut self) -> Result<u16, NanonisError>

Get the oversampling in the Oscilloscope 2-Channels Returns: oversampling index (0=50 samples, 1=20, 2=10, 3=5, 4=2, 5=1 sample)

Source

pub fn osci2t_trig_set( &mut self, trigger_mode: u16, trig_channel: u16, trigger_slope: u16, trigger_level: f64, trigger_hysteresis: f64, trig_position: f64, ) -> Result<(), NanonisError>

Set the trigger configuration in the Oscilloscope 2-Channels trigger_mode: 0 = Immediate, 1 = Level, 2 = Auto trig_channel: trigger channel trigger_slope: 0 = Falling, 1 = Rising

Source

pub fn osci2t_trig_get( &mut self, ) -> Result<(u16, u16, u16, f64, f64, f64), NanonisError>

Get the trigger configuration in the Oscilloscope 2-Channels Returns: (trigger_mode, trig_channel, trigger_slope, trigger_level, trigger_hysteresis, trig_position)

Source

pub fn osci2t_run(&mut self) -> Result<(), NanonisError>

Start the Oscilloscope 2-Channels

Source

pub fn osci2t_data_get( &mut self, data_to_get: u16, ) -> Result<(f64, f64, Vec<f64>, Vec<f64>), NanonisError>

Get the graph data from the Oscilloscope 2-Channels data_to_get: 0 = Current, 1 = Next trigger, 2 = Wait 2 triggers Returns: (t0, dt, channel_a_data, channel_b_data)

Source§

impl NanonisClient

Source

pub fn osci_hr_ch_set( &mut self, osci_index: impl Into<OscilloscopeIndex>, signal: impl Into<SignalIndex>, ) -> Result<(), NanonisError>

Set the measured signal index of the selected channel from the Oscilloscope High Resolution

Source

pub fn osci_hr_ch_get( &mut self, osci_index: impl Into<OscilloscopeIndex>, ) -> Result<SignalIndex, NanonisError>

Get the measured signal index of the selected channel from the Oscilloscope High Resolution

Source

pub fn osci_hr_oversampl_set( &mut self, oversampling_index: i32, ) -> Result<(), NanonisError>

Set the oversampling index of the Oscilloscope High Resolution

Source

pub fn osci_hr_oversampl_get(&mut self) -> Result<i32, NanonisError>

Get the oversampling index of the Oscilloscope High Resolution

Source

pub fn osci_hr_calibr_mode_set( &mut self, osci_index: i32, calibration_mode: u16, ) -> Result<(), NanonisError>

Set the calibration mode of the selected channel from the Oscilloscope High Resolution calibration_mode: 0 = Raw values, 1 = Calibrated values

Source

pub fn osci_hr_calibr_mode_get( &mut self, osci_index: i32, ) -> Result<u16, NanonisError>

Get the calibration mode of the selected channel from the Oscilloscope High Resolution Returns: 0 = Raw values, 1 = Calibrated values

Source

pub fn osci_hr_samples_set( &mut self, number_of_samples: impl Into<SampleCount>, ) -> Result<(), NanonisError>

Set the number of samples to acquire in the Oscilloscope High Resolution

Source

pub fn osci_hr_samples_get(&mut self) -> Result<SampleCount, NanonisError>

Get the number of samples to acquire in the Oscilloscope High Resolution

Source

pub fn osci_hr_pre_trig_set( &mut self, pre_trigger_samples: u32, pre_trigger_s: f64, ) -> Result<(), NanonisError>

Set the Pre-Trigger Samples or Seconds in the Oscilloscope High Resolution

Source

pub fn osci_hr_pre_trig_get(&mut self) -> Result<i32, NanonisError>

Get the Pre-Trigger Samples in the Oscilloscope High Resolution

Source

pub fn osci_hr_run(&mut self) -> Result<(), NanonisError>

Start the Oscilloscope High Resolution module

Source

pub fn osci_hr_osci_data_get( &mut self, osci_index: i32, data_to_get: u16, timeout_s: f64, ) -> Result<(String, f64, Vec<f32>, bool), NanonisError>

Get the graph data of the selected channel from the Oscilloscope High Resolution data_to_get: 0 = Current returns the currently displayed data, 1 = Next trigger waits for the next trigger Returns: (timestamp, time_delta, data_values, timeout_occurred)

Source

pub fn osci_hr_trig_mode_set( &mut self, trigger_mode: impl Into<TriggerMode>, ) -> Result<(), NanonisError>

Set the trigger mode in the Oscilloscope High Resolution

Source

pub fn osci_hr_trig_mode_get(&mut self) -> Result<TriggerMode, NanonisError>

Get the trigger mode in the Oscilloscope High Resolution

Source

pub fn osci_hr_trig_lev_ch_set( &mut self, level_trigger_channel_index: i32, ) -> Result<(), NanonisError>

Set the Level Trigger Channel index in the Oscilloscope High Resolution

Source

pub fn osci_hr_trig_lev_ch_get(&mut self) -> Result<i32, NanonisError>

Get the Level Trigger Channel index in the Oscilloscope High Resolution

Source

pub fn osci_hr_trig_lev_val_set( &mut self, level_trigger_value: impl Into<TriggerLevel>, ) -> Result<(), NanonisError>

Set the Level Trigger value in the Oscilloscope High Resolution

Source

pub fn osci_hr_trig_lev_val_get(&mut self) -> Result<TriggerLevel, NanonisError>

Get the Level Trigger value in the Oscilloscope High Resolution

Source

pub fn osci_hr_trig_arm_mode_set( &mut self, trigger_arming_mode: u16, ) -> Result<(), NanonisError>

Set the Trigger Arming Mode in the Oscilloscope High Resolution

Source

pub fn osci_hr_trig_arm_mode_get(&mut self) -> Result<u16, NanonisError>

Get the Trigger Arming Mode in the Oscilloscope High Resolution

Source

pub fn osci_hr_trig_lev_hyst_set( &mut self, hysteresis: f64, ) -> Result<(), NanonisError>

Set the Level Trigger Hysteresis in the Oscilloscope High Resolution

Source

pub fn osci_hr_trig_lev_hyst_get(&mut self) -> Result<f64, NanonisError>

Get the Level Trigger Hysteresis in the Oscilloscope High Resolution

Source

pub fn osci_hr_trig_lev_slope_set( &mut self, slope: u16, ) -> Result<(), NanonisError>

Set the Level Trigger Slope in the Oscilloscope High Resolution

Source

pub fn osci_hr_trig_lev_slope_get(&mut self) -> Result<u16, NanonisError>

Get the Level Trigger Slope in the Oscilloscope High Resolution

Source

pub fn osci_hr_trig_dig_ch_set( &mut self, digital_trigger_channel: i32, ) -> Result<(), NanonisError>

Set the Digital Trigger Channel index in the Oscilloscope High Resolution.

§Arguments
  • digital_trigger_channel - Digital trigger channel index
§Errors

Returns NanonisError if communication fails.

Source

pub fn osci_hr_trig_dig_ch_get(&mut self) -> Result<i32, NanonisError>

Get the Digital Trigger Channel index in the Oscilloscope High Resolution.

§Returns

Digital trigger channel index.

§Errors

Returns NanonisError if communication fails.

Source

pub fn osci_hr_trig_dig_slope_set( &mut self, slope: u16, ) -> Result<(), NanonisError>

Set the Digital Trigger Slope in the Oscilloscope High Resolution.

§Arguments
  • slope - Digital trigger slope (0 = Rising, 1 = Falling, 2 = Both)
§Errors

Returns NanonisError if communication fails.

Source

pub fn osci_hr_trig_dig_slope_get(&mut self) -> Result<u16, NanonisError>

Get the Digital Trigger Slope in the Oscilloscope High Resolution.

§Returns

Digital trigger slope (0 = Rising, 1 = Falling, 2 = Both).

§Errors

Returns NanonisError if communication fails.

Source

pub fn osci_hr_trig_rearm(&mut self) -> Result<(), NanonisError>

Rearm the trigger in the Oscilloscope High Resolution.

§Errors

Returns NanonisError if communication fails.

Source

pub fn osci_hr_psd_show(&mut self) -> Result<(), NanonisError>

Show the PSD (Power Spectral Density) view in the Oscilloscope High Resolution.

§Errors

Returns NanonisError if communication fails.

Source

pub fn osci_hr_psd_weight_set( &mut self, osci_index: i32, weighting: u16, ) -> Result<(), NanonisError>

Set the PSD weighting mode in the Oscilloscope High Resolution.

§Arguments
  • osci_index - Oscilloscope channel index
  • weighting - Weighting mode (0 = None, 1 = A-weighting, 2 = C-weighting)
§Errors

Returns NanonisError if communication fails.

Source

pub fn osci_hr_psd_weight_get( &mut self, osci_index: i32, ) -> Result<u16, NanonisError>

Get the PSD weighting mode in the Oscilloscope High Resolution.

§Arguments
  • osci_index - Oscilloscope channel index
§Returns

Weighting mode (0 = None, 1 = A-weighting, 2 = C-weighting).

§Errors

Returns NanonisError if communication fails.

Source

pub fn osci_hr_psd_window_set( &mut self, osci_index: i32, window: u16, ) -> Result<(), NanonisError>

Set the PSD window function in the Oscilloscope High Resolution.

§Arguments
  • osci_index - Oscilloscope channel index
  • window - Window function (0 = None, 1 = Hann, 2 = Hamming, 3 = Blackman-Harris, 4 = Flat Top)
§Errors

Returns NanonisError if communication fails.

Source

pub fn osci_hr_psd_window_get( &mut self, osci_index: i32, ) -> Result<u16, NanonisError>

Get the PSD window function in the Oscilloscope High Resolution.

§Arguments
  • osci_index - Oscilloscope channel index
§Returns

Window function (0 = None, 1 = Hann, 2 = Hamming, 3 = Blackman-Harris, 4 = Flat Top).

§Errors

Returns NanonisError if communication fails.

Source

pub fn osci_hr_psd_avrg_type_set( &mut self, osci_index: i32, averaging_type: u16, ) -> Result<(), NanonisError>

Set the PSD averaging type in the Oscilloscope High Resolution.

§Arguments
  • osci_index - Oscilloscope channel index
  • averaging_type - Averaging type (0 = None, 1 = Linear, 2 = Exponential)
§Errors

Returns NanonisError if communication fails.

Source

pub fn osci_hr_psd_avrg_type_get( &mut self, osci_index: i32, ) -> Result<u16, NanonisError>

Get the PSD averaging type in the Oscilloscope High Resolution.

§Arguments
  • osci_index - Oscilloscope channel index
§Returns

Averaging type (0 = None, 1 = Linear, 2 = Exponential).

§Errors

Returns NanonisError if communication fails.

Source

pub fn osci_hr_psd_avrg_count_set( &mut self, osci_index: i32, count: i32, ) -> Result<(), NanonisError>

Set the PSD averaging count in the Oscilloscope High Resolution.

§Arguments
  • osci_index - Oscilloscope channel index
  • count - Number of averages
§Errors

Returns NanonisError if communication fails.

Source

pub fn osci_hr_psd_avrg_count_get( &mut self, osci_index: i32, ) -> Result<i32, NanonisError>

Get the PSD averaging count in the Oscilloscope High Resolution.

§Arguments
  • osci_index - Oscilloscope channel index
§Returns

Number of averages.

§Errors

Returns NanonisError if communication fails.

Source

pub fn osci_hr_psd_avrg_restart( &mut self, osci_index: i32, ) -> Result<(), NanonisError>

Restart PSD averaging in the Oscilloscope High Resolution.

§Arguments
  • osci_index - Oscilloscope channel index
§Errors

Returns NanonisError if communication fails.

Source

pub fn osci_hr_psd_data_get( &mut self, osci_index: i32, data_to_get: u16, timeout_s: f64, ) -> Result<(f64, f64, Vec<f32>, bool), NanonisError>

Get the PSD data from the Oscilloscope High Resolution.

§Arguments
  • osci_index - Oscilloscope channel index
  • data_to_get - 0 = Current data, 1 = Wait for next acquisition
  • timeout_s - Timeout in seconds
§Returns

Tuple of (frequency_start, frequency_delta, psd_data, timeout_occurred).

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn pattern_exp_open(&mut self) -> Result<(), NanonisError>

Open the selected grid experiment.

Required to configure the experiment and be able to start it.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.pattern_exp_open()?;
Source

pub fn pattern_exp_start( &mut self, pattern: PatternType, ) -> Result<(), NanonisError>

Start the selected grid experiment.

Before using this function, select the experiment through pattern_props_set, and be sure to have it open.

§Arguments
  • pattern - Pattern type to switch to before starting
§Errors

Returns NanonisError if communication fails.

Source

pub fn pattern_exp_pause(&mut self, pause: bool) -> Result<(), NanonisError>

Pause or resume the selected grid experiment.

§Arguments
  • pause - True to pause, false to resume
§Errors

Returns NanonisError if communication fails.

Source

pub fn pattern_exp_stop(&mut self) -> Result<(), NanonisError>

Stop the selected grid experiment.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pattern_exp_status_get(&mut self) -> Result<bool, NanonisError>

Get the status of the selected grid experiment.

§Returns

True if the experiment is running.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pattern_grid_set( &mut self, set_active: bool, config: &GridConfig, use_scan_frame: bool, ) -> Result<(), NanonisError>

Set the grid pattern parameters.

§Arguments
  • set_active - If true, switch to grid pattern
  • config - Grid configuration
  • use_scan_frame - If true, use scan frame size
§Errors

Returns NanonisError if communication fails.

Source

pub fn pattern_grid_get(&mut self) -> Result<GridConfig, NanonisError>

Get the grid pattern parameters.

§Returns

A GridConfig struct with current grid parameters.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pattern_line_set( &mut self, set_active: bool, config: &LineConfig, use_scan_frame: bool, ) -> Result<(), NanonisError>

Set the line pattern parameters.

§Arguments
  • set_active - If true, switch to line pattern
  • config - Line configuration
  • use_scan_frame - If true, use scan frame diagonal
§Errors

Returns NanonisError if communication fails.

Source

pub fn pattern_line_get(&mut self) -> Result<LineConfig, NanonisError>

Get the line pattern parameters.

§Returns

A LineConfig struct with current line parameters.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pattern_cloud_set( &mut self, set_active: bool, config: &CloudConfig, ) -> Result<(), NanonisError>

Set the cloud pattern parameters.

§Arguments
  • set_active - If true, switch to cloud pattern
  • config - Cloud configuration with point coordinates
§Errors

Returns NanonisError if communication fails.

Source

pub fn pattern_cloud_get(&mut self) -> Result<CloudConfig, NanonisError>

Get the cloud pattern parameters.

§Returns

A CloudConfig struct with current cloud point coordinates.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pattern_props_set( &mut self, selected_experiment: &str, basename: &str, external_vi_path: &str, pre_measure_delay_s: f32, save_scan_channels: bool, ) -> Result<(), NanonisError>

Set the pattern experiment properties.

§Arguments
  • selected_experiment - Name of experiment to select
  • basename - Base filename for saved files
  • external_vi_path - Path to external VI
  • pre_measure_delay_s - Delay before measurement on each point
  • save_scan_channels - Save scan channels to file
§Errors

Returns NanonisError if communication fails.

Source

pub fn pattern_props_get(&mut self) -> Result<PatternProps, NanonisError>

Get the pattern experiment properties.

§Returns

A PatternProps struct with current experiment properties.

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn pi_ctrl_on_off_set( &mut self, controller_index: i32, enabled: bool, ) -> Result<(), NanonisError>

Enable or disable a PI controller.

§Arguments
  • controller_index - Controller index (1-8)
  • enabled - True to enable, false to disable
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.pi_ctrl_on_off_set(1, true)?;
Source

pub fn pi_ctrl_on_off_get( &mut self, controller_index: i32, ) -> Result<bool, NanonisError>

Get the on/off status of a PI controller.

§Arguments
  • controller_index - Controller index (1-8)
§Returns

True if controller is enabled.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pi_ctrl_ctrl_ch_set( &mut self, controller_index: i32, signal_index: i32, ) -> Result<(), NanonisError>

Set the control channel for a PI controller.

§Arguments
  • controller_index - Controller index (1-8)
  • signal_index - Control signal index
§Errors

Returns NanonisError if communication fails.

Source

pub fn pi_ctrl_ctrl_ch_get( &mut self, controller_index: i32, ) -> Result<ControlSignalInfo, NanonisError>

Get the control channel information for a PI controller.

§Arguments
  • controller_index - Controller index (1-8)
§Returns

A ControlSignalInfo struct with current and available signals.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pi_ctrl_input_ch_set( &mut self, controller_index: i32, input_index: i32, ) -> Result<(), NanonisError>

Set the input channel for a PI controller.

§Arguments
  • controller_index - Controller index (1-8)
  • input_index - Input signal index
§Errors

Returns NanonisError if communication fails.

Source

pub fn pi_ctrl_input_ch_get( &mut self, controller_index: i32, ) -> Result<ControlSignalInfo, NanonisError>

Get the input channel information for a PI controller.

§Arguments
  • controller_index - Controller index (1-8)
§Returns

A ControlSignalInfo struct with current and available input signals.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pi_ctrl_props_set( &mut self, controller_index: i32, props: &PICtrlProps, ) -> Result<(), NanonisError>

Set the properties of a PI controller.

§Arguments
  • controller_index - Controller index (1-8)
  • props - A PICtrlProps struct with controller properties
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::pi_ctrl::{PICtrlProps, PISlope};

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let props = PICtrlProps {
    setpoint: 0.0,
    p_gain: 1.0,
    i_gain: 100.0,
    slope: PISlope::Positive,
};
client.pi_ctrl_props_set(1, &props)?;
Source

pub fn pi_ctrl_props_get( &mut self, controller_index: i32, ) -> Result<PICtrlProps, NanonisError>

Get the properties of a PI controller.

§Arguments
  • controller_index - Controller index (1-8)
§Returns

A PICtrlProps struct with current controller properties.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pi_ctrl_ctrl_ch_props_set( &mut self, controller_index: i32, limits: &PICtrlLimits, ) -> Result<(), NanonisError>

Set the control channel output limits for a PI controller.

§Arguments
  • controller_index - Controller index (1-8)
  • limits - A PICtrlLimits struct with output limits
§Errors

Returns NanonisError if communication fails.

Source

pub fn pi_ctrl_ctrl_ch_props_get( &mut self, controller_index: i32, ) -> Result<PICtrlLimits, NanonisError>

Get the control channel output limits for a PI controller.

§Arguments
  • controller_index - Controller index (1-8)
§Returns

A PICtrlLimits struct with current output limits.

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn piezo_tilt_set( &mut self, tilt_x_deg: f32, tilt_y_deg: f32, ) -> Result<(), NanonisError>

Set the piezo tilt correction parameters.

§Arguments
  • tilt_x_deg - Tilt angle correction in X direction (degrees)
  • tilt_y_deg - Tilt angle correction in Y direction (degrees)
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.piezo_tilt_set(0.5, -0.3)?;
Source

pub fn piezo_tilt_get(&mut self) -> Result<TiltCorrection, NanonisError>

Get the piezo tilt correction parameters.

§Returns

A TiltCorrection struct with current tilt angles.

§Errors

Returns NanonisError if communication fails.

Source

pub fn piezo_range_set( &mut self, range: &PiezoRange, ) -> Result<(), NanonisError>

Set the piezo range values for all 3 axes.

Changing the range will also change the sensitivity (HV gain will remain unchanged).

§Arguments
  • range - A PiezoRange struct with X, Y, Z range values in meters
§Errors

Returns NanonisError if communication fails.

Source

pub fn piezo_range_get(&mut self) -> Result<PiezoRange, NanonisError>

Get the piezo range values for all 3 axes.

§Returns

A PiezoRange struct with current range values in meters.

§Errors

Returns NanonisError if communication fails.

Source

pub fn piezo_sens_set( &mut self, sensitivity: &PiezoSensitivity, ) -> Result<(), NanonisError>

Set the piezo sensitivity values for all 3 axes.

Changing the sensitivity will also change the range (HV gain will remain unchanged).

§Arguments
§Errors

Returns NanonisError if communication fails.

Source

pub fn piezo_sens_get(&mut self) -> Result<PiezoSensitivity, NanonisError>

Get the piezo sensitivity values for all 3 axes.

§Returns

A PiezoSensitivity struct with current sensitivity values in m/V.

§Errors

Returns NanonisError if communication fails.

Source

pub fn piezo_drift_comp_set( &mut self, config: &DriftCompConfig, ) -> Result<(), NanonisError>

Set the drift compensation parameters.

§Arguments
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::piezo::{DriftCompConfig, PiezoToggle};

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let config = DriftCompConfig {
    enabled: PiezoToggle::On,
    vx_m_s: 1e-12,
    vy_m_s: 0.5e-12,
    vz_m_s: 0.0,
    saturation_limit: 0.1,
};
client.piezo_drift_comp_set(&config)?;
Source

pub fn piezo_drift_comp_get(&mut self) -> Result<DriftCompStatus, NanonisError>

Get the drift compensation settings and status.

§Returns

A DriftCompStatus struct with current settings and saturation status.

§Errors

Returns NanonisError if communication fails.

Source

pub fn piezo_calibr_get(&mut self) -> Result<PiezoSensitivity, NanonisError>

Get the piezo calibration values for all 3 axes.

The calibration returned is for the low voltage signals (±10V) before the HV amplifier.

§Returns

A PiezoSensitivity struct with calibration values in m/V.

§Errors

Returns NanonisError if communication fails.

Source

pub fn piezo_hva_info_get(&mut self) -> Result<HVAInfo, NanonisError>

Get the HVA (High Voltage Amplifier) gain information.

If HVA gain readout is not enabled, this function returns a warning.

§Returns

A HVAInfo struct with gain values and enabled status.

§Errors

Returns NanonisError if communication fails.

Source

pub fn piezo_hva_status_led_get(&mut self) -> Result<HVAStatusLED, NanonisError>

Get the HVA status LED indicators.

§Returns

A HVAStatusLED struct with LED status indicators.

§Errors

Returns NanonisError if communication fails.

Source

pub fn piezo_xyz_limits_set( &mut self, enable: PiezoToggle, limits: &XYZLimits, ) -> Result<(), NanonisError>

Set the XYZ voltage limits.

§Arguments
§Errors

Returns NanonisError if communication fails.

Source

pub fn piezo_xyz_limits_get(&mut self) -> Result<XYZLimits, NanonisError>

Get the XYZ voltage limits.

§Returns

A XYZLimits struct with current voltage limits.

§Errors

Returns NanonisError if communication fails.

Source

pub fn piezo_hyst_on_off_set( &mut self, enabled: bool, ) -> Result<(), NanonisError>

Enable or disable hysteresis compensation.

§Arguments
  • enabled - True to enable, false to disable
§Errors

Returns NanonisError if communication fails.

Source

pub fn piezo_hyst_on_off_get(&mut self) -> Result<bool, NanonisError>

Get hysteresis compensation enabled status.

§Returns

True if hysteresis compensation is enabled.

§Errors

Returns NanonisError if communication fails.

Source

pub fn piezo_hyst_vals_set( &mut self, values: &HysteresisValues, ) -> Result<(), NanonisError>

Set and apply the hysteresis compensation values.

§Arguments
§Errors

Returns NanonisError if communication fails.

Source

pub fn piezo_hyst_vals_get(&mut self) -> Result<HysteresisValues, NanonisError>

Get the hysteresis compensation values.

§Returns

A HysteresisValues struct with current hysteresis points.

§Errors

Returns NanonisError if communication fails.

Source

pub fn piezo_hyst_file_load( &mut self, file_path: &str, ) -> Result<(), NanonisError>

Load hysteresis compensation values from a CSV file.

§Arguments
  • file_path - Path to the CSV file to load
§Errors

Returns NanonisError if communication fails or file cannot be loaded.

Source

pub fn piezo_hyst_file_save( &mut self, file_path: &str, ) -> Result<(), NanonisError>

Save hysteresis compensation values to a CSV file.

§Arguments
  • file_path - Path to the CSV file to save
§Errors

Returns NanonisError if communication fails or file cannot be saved.

Source§

impl NanonisClient

Source

pub fn pll_inp_calibr_set( &mut self, modulator_index: i32, calibration_m_per_v: f32, ) -> Result<(), NanonisError>

Set the input calibration of the oscillation control module.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • calibration_m_per_v - Input calibration in m/V
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_inp_calibr_get( &mut self, modulator_index: i32, ) -> Result<f32, NanonisError>

Get the input calibration of the oscillation control module.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns

Input calibration in m/V.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_inp_range_set( &mut self, modulator_index: i32, input_range_m: f32, ) -> Result<(), NanonisError>

Set the input range of the oscillation control module.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • input_range_m - Input range in meters
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_inp_range_get( &mut self, modulator_index: i32, ) -> Result<f32, NanonisError>

Get the input range of the oscillation control module.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns

Input range in meters.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_inp_props_set( &mut self, modulator_index: i32, props: &PLLInputProps, ) -> Result<(), NanonisError>

Set the input properties of the oscillation control module.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • props - Input properties
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_inp_props_get( &mut self, modulator_index: i32, ) -> Result<PLLInputProps, NanonisError>

Get the input properties of the oscillation control module.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns

Input properties.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_add_on_off_set( &mut self, modulator_index: i32, enabled: bool, ) -> Result<(), NanonisError>

Set the add external signal status.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • enabled - True to add external signal to output
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_add_on_off_get( &mut self, modulator_index: i32, ) -> Result<bool, NanonisError>

Get the add external signal status.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns

True if external signal is being added.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_out_on_off_set( &mut self, modulator_index: i32, enabled: bool, ) -> Result<(), NanonisError>

Set the PLL output on/off status.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • enabled - True to enable PLL output
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_out_on_off_get( &mut self, modulator_index: i32, ) -> Result<bool, NanonisError>

Get the PLL output on/off status.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns

True if PLL output is enabled.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_exc_range_set( &mut self, modulator_index: i32, range: PLLExcRange, ) -> Result<(), NanonisError>

Set the excitation range.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • range - Excitation output range
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_exc_range_get( &mut self, modulator_index: i32, ) -> Result<PLLExcRange, NanonisError>

Get the excitation range.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns

Excitation output range.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_excitation_set( &mut self, modulator_index: i32, excitation_v: f32, ) -> Result<(), NanonisError>

Set the excitation value (drive amplitude).

Only works when amplitude controller is off.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • excitation_v - Excitation value in volts
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_excitation_get( &mut self, modulator_index: i32, ) -> Result<f32, NanonisError>

Get the excitation value (drive amplitude).

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns

Excitation value in volts.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_amp_ctrl_setpnt_set( &mut self, modulator_index: i32, setpoint_m: f32, ) -> Result<(), NanonisError>

Set the amplitude controller setpoint for a PLL modulator.

Sets the amplitude controller setpoint value for the specified PLL modulator. This controls the target oscillation amplitude for the phase-locked loop.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • setpoint_m - Amplitude setpoint in meters
§Errors

Returns NanonisError if communication fails or invalid modulator index.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set amplitude setpoint for first PLL to 1 nanometer
client.pll_amp_ctrl_setpnt_set(1, 1e-9)?;

// Set amplitude setpoint for second PLL to 500 picometers
client.pll_amp_ctrl_setpnt_set(2, 500e-12)?;
Source

pub fn pll_amp_ctrl_setpnt_get( &mut self, modulator_index: i32, ) -> Result<f32, NanonisError>

Get the amplitude controller setpoint for a PLL modulator.

Returns the current amplitude controller setpoint value for the specified PLL modulator.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns
  • f32 - Current amplitude setpoint in meters
§Errors

Returns NanonisError if communication fails or invalid modulator index.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Get current amplitude setpoint for first PLL
let setpoint = client.pll_amp_ctrl_setpnt_get(1)?;
println!("Current amplitude setpoint: {:.2e} m", setpoint);

// Check if setpoint is within expected range
if setpoint > 1e-9 {
    println!("Amplitude setpoint is greater than 1 nm");
}
Source

pub fn pll_amp_ctrl_on_off_set( &mut self, modulator_index: i32, status: bool, ) -> Result<(), NanonisError>

Set the amplitude controller on/off status for a PLL modulator.

Switches the amplitude controller for the specified PLL modulator on or off. When enabled, the amplitude controller actively maintains the oscillation amplitude at the setpoint value.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • status - true to turn on, false to turn off
§Errors

Returns NanonisError if communication fails or invalid modulator index.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Turn on amplitude controller for first PLL
client.pll_amp_ctrl_on_off_set(1, true)?;

// Turn off amplitude controller for second PLL
client.pll_amp_ctrl_on_off_set(2, false)?;
Source

pub fn pll_amp_ctrl_on_off_get( &mut self, modulator_index: i32, ) -> Result<bool, NanonisError>

Get the amplitude controller on/off status for a PLL modulator.

Returns the current on/off status of the amplitude controller for the specified PLL modulator.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns
  • bool - true if controller is on, false if off
§Errors

Returns NanonisError if communication fails or invalid modulator index.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Check amplitude controller status for first PLL
let is_on = client.pll_amp_ctrl_on_off_get(1)?;
if is_on {
    println!("Amplitude controller is active");
} else {
    println!("Amplitude controller is inactive");
}

// Enable controller if it's off
if !is_on {
    client.pll_amp_ctrl_on_off_set(1, true)?;
}
Source

pub fn pll_amp_ctrl_gain_set( &mut self, modulator_index: i32, p_gain_v_div_m: f32, time_constant_s: f32, ) -> Result<(), NanonisError>

Set the amplitude controller gain parameters for a PLL modulator.

Sets the proportional gain and time constant for the amplitude controller of the specified PLL modulator. These parameters control the response characteristics of the amplitude control loop.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • p_gain_v_div_m - Proportional gain in V/m
  • time_constant_s - Time constant in seconds
§Errors

Returns NanonisError if communication fails or invalid modulator index.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set moderate gain and fast response for first PLL
client.pll_amp_ctrl_gain_set(1, 1e6, 0.01)?;

// Set higher gain and slower response for second PLL
client.pll_amp_ctrl_gain_set(2, 5e6, 0.1)?;
Source

pub fn pll_amp_ctrl_gain_get( &mut self, modulator_index: i32, ) -> Result<(f32, f32), NanonisError>

Get the amplitude controller gain parameters for a PLL modulator.

Returns the current proportional gain and time constant settings for the amplitude controller of the specified PLL modulator.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns
  • (f32, f32) - Tuple of (proportional gain in V/m, time constant in seconds)
§Errors

Returns NanonisError if communication fails or invalid modulator index.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Get current gain parameters for first PLL
let (p_gain, time_const) = client.pll_amp_ctrl_gain_get(1)?;
println!("P gain: {:.2e} V/m, Time constant: {:.3} s", p_gain, time_const);

// Check if parameters are within acceptable range
if p_gain < 1e5 {
    println!("Warning: Low proportional gain");
}
if time_const > 1.0 {
    println!("Warning: Slow time constant");
}
Source

pub fn pll_amp_ctrl_bandwidth_set( &mut self, modulator_index: i32, bandwidth_hz: f32, ) -> Result<(), NanonisError>

Set the amplitude controller bandwidth.

Uses current Q factor and amplitude to excitation ratio.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • bandwidth_hz - Bandwidth in Hz
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_amp_ctrl_bandwidth_get( &mut self, modulator_index: i32, ) -> Result<f32, NanonisError>

Get the amplitude controller bandwidth.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns

Bandwidth in Hz.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_phas_ctrl_on_off_set( &mut self, modulator_index: i32, enabled: bool, ) -> Result<(), NanonisError>

Set the phase controller on/off status.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • enabled - True to enable phase controller
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_phas_ctrl_on_off_get( &mut self, modulator_index: i32, ) -> Result<bool, NanonisError>

Get the phase controller on/off status.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns

True if phase controller is enabled.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_phas_ctrl_gain_set( &mut self, modulator_index: i32, p_gain_hz_per_deg: f32, time_constant_s: f32, ) -> Result<(), NanonisError>

Set the phase controller gain parameters.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • p_gain_hz_per_deg - Proportional gain in Hz/deg
  • time_constant_s - Time constant in seconds
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_phas_ctrl_gain_get( &mut self, modulator_index: i32, ) -> Result<PLLPhasCtrlGain, NanonisError>

Get the phase controller gain parameters.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns

Phase controller gain parameters.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_phas_ctrl_bandwidth_set( &mut self, modulator_index: i32, bandwidth_hz: f32, ) -> Result<(), NanonisError>

Set the phase controller bandwidth.

Uses current Q factor.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • bandwidth_hz - Bandwidth in Hz
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_phas_ctrl_bandwidth_get( &mut self, modulator_index: i32, ) -> Result<f32, NanonisError>

Get the phase controller bandwidth.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns

Bandwidth in Hz.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_freq_range_set( &mut self, modulator_index: i32, freq_range_hz: f32, ) -> Result<(), NanonisError>

Set the frequency range.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • freq_range_hz - Frequency range in Hz
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_freq_range_get( &mut self, modulator_index: i32, ) -> Result<f32, NanonisError>

Get the frequency range.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns

Frequency range in Hz.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_center_freq_set( &mut self, modulator_index: i32, center_freq_hz: f64, ) -> Result<(), NanonisError>

Set the center frequency.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • center_freq_hz - Center frequency in Hz
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_center_freq_get( &mut self, modulator_index: i32, ) -> Result<f64, NanonisError>

Get the center frequency.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns

Center frequency in Hz.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_freq_shift_set( &mut self, modulator_index: i32, freq_shift_hz: f32, ) -> Result<(), NanonisError>

Set the frequency shift.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • freq_shift_hz - Frequency shift in Hz
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_freq_shift_get( &mut self, modulator_index: i32, ) -> Result<f32, NanonisError>

Get the frequency shift.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns

Frequency shift in Hz.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_freq_shift_auto_center( &mut self, modulator_index: i32, ) -> Result<(), NanonisError>

Auto-center frequency shift.

Adds current frequency shift to center frequency and sets frequency shift to zero.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_freq_exc_overwrite_set( &mut self, modulator_index: i32, overwrite: &PLLOverwrite, ) -> Result<(), NanonisError>

Set the frequency/excitation overwrite signals.

Works when corresponding controller is not active. Use -2 for no change.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • overwrite - Overwrite configuration
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_freq_exc_overwrite_get( &mut self, modulator_index: i32, ) -> Result<PLLOverwrite, NanonisError>

Get the frequency/excitation overwrite signals.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns

Overwrite configuration.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_demod_input_set( &mut self, demodulator_index: u16, input: &PLLDemodInput, ) -> Result<(), NanonisError>

Set the demodulator input and frequency generator.

§Arguments
  • demodulator_index - Demodulator index (starts from 1)
  • input - Demodulator input configuration
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_demod_input_get( &mut self, demodulator_index: u16, ) -> Result<PLLDemodInput, NanonisError>

Get the demodulator input and frequency generator.

§Arguments
  • demodulator_index - Demodulator index (starts from 1)
§Returns

Demodulator input configuration.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_demod_harmonic_set( &mut self, demodulator_index: u16, harmonic: u16, ) -> Result<(), NanonisError>

Set the demodulator harmonic.

Harmonic 1 corresponds to modulation frequency.

§Arguments
  • demodulator_index - Demodulator index (starts from 1)
  • harmonic - Harmonic number
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_demod_harmonic_get( &mut self, demodulator_index: u16, ) -> Result<u16, NanonisError>

Get the demodulator harmonic.

§Arguments
  • demodulator_index - Demodulator index (starts from 1)
§Returns

Harmonic number.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_demod_phas_ref_set( &mut self, demodulator_index: u16, phase_deg: f32, ) -> Result<(), NanonisError>

Set the demodulator phase reference.

§Arguments
  • demodulator_index - Demodulator index (starts from 1)
  • phase_deg - Phase reference in degrees
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_demod_phas_ref_get( &mut self, demodulator_index: u16, ) -> Result<f32, NanonisError>

Get the demodulator phase reference.

§Arguments
  • demodulator_index - Demodulator index (starts from 1)
§Returns

Phase reference in degrees.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_demod_filter_set( &mut self, demodulator_index: u16, filter_order: u16, ) -> Result<(), NanonisError>

Set the demodulator filter order.

§Arguments
  • demodulator_index - Demodulator index (starts from 1)
  • filter_order - Low-pass filter order
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_demod_filter_get( &mut self, demodulator_index: u16, ) -> Result<u16, NanonisError>

Get the demodulator filter order.

§Arguments
  • demodulator_index - Demodulator index (starts from 1)
§Returns

Low-pass filter order.

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn pll_freq_swp_open( &mut self, modulator_index: i32, ) -> Result<(), NanonisError>

Open the PLL frequency sweep module.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_freq_swp_params_set( &mut self, modulator_index: i32, params: &PLLFreqSwpParams, ) -> Result<(), NanonisError>

Set the PLL frequency sweep parameters.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • params - Sweep parameters
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_freq_swp_params_get( &mut self, modulator_index: i32, ) -> Result<PLLFreqSwpParams, NanonisError>

Get the PLL frequency sweep parameters.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Returns

Sweep parameters.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_freq_swp_start( &mut self, modulator_index: i32, get_data: bool, sweep_up: bool, ) -> Result<Option<PLLFreqSwpData>, NanonisError>

Start a PLL frequency sweep.

Set center frequency and frequency range in Oscillation Control module first.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • get_data - If true, return recorded channels and data
  • sweep_up - If true, sweep from lower to upper limit
§Returns

Sweep data and characteristics if get_data is true.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_freq_swp_stop( &mut self, modulator_index: i32, ) -> Result<(), NanonisError>

Stop the PLL frequency sweep.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_phas_swp_start( &mut self, modulator_index: i32, get_data: bool, ) -> Result<Option<PLLPhasSwpData>, NanonisError>

Start a PLL phase sweep.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
  • get_data - If true, return recorded channels and data
§Returns

Sweep data if get_data is true.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_phas_swp_stop( &mut self, modulator_index: i32, ) -> Result<(), NanonisError>

Stop the PLL phase sweep.

§Arguments
  • modulator_index - PLL modulator index (starts from 1)
§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn pll_signal_anlzr_open(&mut self) -> Result<(), NanonisError>

Open the PLL signal analyzer.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_signal_anlzr_ch_set( &mut self, channel_index: i32, ) -> Result<(), NanonisError>

Set the analyzer channel.

§Arguments
  • channel_index - Channel index
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_signal_anlzr_ch_get(&mut self) -> Result<i32, NanonisError>

Get the analyzer channel.

§Returns

Channel index.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_signal_anlzr_timebase_set( &mut self, timebase_index: i32, update_rate: i32, ) -> Result<(), NanonisError>

Set the timebase and update rate.

§Arguments
  • timebase_index - Timebase index (-1 = no change)
  • update_rate - Update rate (1 = fastest, -1 = no change)
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_signal_anlzr_timebase_get( &mut self, ) -> Result<PLLAnlzrTimebase, NanonisError>

Get the timebase and update rate.

§Returns

Timebase settings with available timebases.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_signal_anlzr_trig_auto(&mut self) -> Result<(), NanonisError>

Set trigger to automatic mode.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_signal_anlzr_trig_rearm(&mut self) -> Result<(), NanonisError>

Rearm the trigger.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_signal_anlzr_trig_set( &mut self, trigger: &PLLAnlzrTrigger, ) -> Result<(), NanonisError>

Set the trigger configuration.

§Arguments
  • trigger - Trigger configuration
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_signal_anlzr_trig_get( &mut self, ) -> Result<PLLAnlzrTrigger, NanonisError>

Get the trigger configuration.

§Returns

Trigger configuration.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_signal_anlzr_osci_data_get( &mut self, ) -> Result<OsciAnalyzerData, NanonisError>

Get oscilloscope data from analyzer.

§Returns

Oscilloscope data.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_signal_anlzr_fft_props_set( &mut self, props: &FFTProps, ) -> Result<(), NanonisError>

Set FFT properties.

§Arguments
  • props - FFT configuration
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_signal_anlzr_fft_props_get( &mut self, ) -> Result<FFTProps, NanonisError>

Get FFT properties.

§Returns

FFT configuration.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_signal_anlzr_fft_avg_restart(&mut self) -> Result<(), NanonisError>

Restart FFT averaging.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_signal_anlzr_fft_data_get( &mut self, ) -> Result<FFTAnalyzerData, NanonisError>

Get FFT data.

§Returns

FFT data.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_zoom_fft_open(&mut self) -> Result<(), NanonisError>

Open the PLL Zoom FFT module.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_zoom_fft_ch_set( &mut self, channel_index: i32, ) -> Result<(), NanonisError>

Set the Zoom FFT channel.

§Arguments
  • channel_index - Channel index
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_zoom_fft_ch_get(&mut self) -> Result<i32, NanonisError>

Get the Zoom FFT channel.

§Returns

Channel index.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_zoom_fft_avg_restart(&mut self) -> Result<(), NanonisError>

Restart Zoom FFT averaging.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_zoom_fft_props_set( &mut self, props: &FFTProps, ) -> Result<(), NanonisError>

Set Zoom FFT properties.

§Arguments
  • props - FFT configuration
§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_zoom_fft_props_get(&mut self) -> Result<FFTProps, NanonisError>

Get Zoom FFT properties.

§Returns

FFT configuration.

§Errors

Returns NanonisError if communication fails.

Source

pub fn pll_zoom_fft_data_get(&mut self) -> Result<FFTAnalyzerData, NanonisError>

Get Zoom FFT data.

§Returns

FFT data.

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn safe_tip_on_off_set( &mut self, safe_tip_on: bool, ) -> Result<(), NanonisError>

Switch the Safe Tip feature on or off.

The Safe Tip feature provides automatic tip protection by monitoring specific signals and triggering safety actions when dangerous conditions are detected. This prevents tip crashes and damage during scanning and approach operations.

§Arguments
  • safe_tip_on - true to enable Safe Tip, false to disable
§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Enable Safe Tip protection
client.safe_tip_on_off_set(true)?;
println!("Safe Tip protection enabled");

// Disable for manual operations
client.safe_tip_on_off_set(false)?;
Source

pub fn safe_tip_on_off_get(&mut self) -> Result<bool, NanonisError>

Get the current on-off status of the Safe Tip feature.

Returns whether the Safe Tip protection is currently active. This is essential for verifying tip safety status before starting potentially dangerous operations.

§Returns

true if Safe Tip is enabled, false if disabled.

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

if client.safe_tip_on_off_get()? {
    println!("Safe Tip protection is active");
} else {
    println!("Warning: Safe Tip protection is disabled");
}
Source

pub fn safe_tip_signal_get(&mut self) -> Result<f32, NanonisError>

Get the current Safe Tip signal value.

Returns the current value of the signal being monitored by the Safe Tip system. This allows real-time monitoring of the safety-critical parameter.

§Returns

Current signal value being monitored by Safe Tip.

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let signal_value = client.safe_tip_signal_get()?;
println!("Safe Tip signal: {:.3e}", signal_value);

// Check if approaching threshold
let (_, _, threshold) = client.safe_tip_props_get()?;
if signal_value.abs() > threshold * 0.8 {
    println!("Warning: Approaching Safe Tip threshold!");
}
Source

pub fn safe_tip_props_set( &mut self, auto_recovery: bool, auto_pause_scan: bool, threshold: f32, ) -> Result<(), NanonisError>

Set the Safe Tip configuration parameters.

Configures the behavior of the Safe Tip protection system including automatic recovery and scan pause features. These settings determine how the system responds to safety threshold violations.

§Arguments
  • auto_recovery - Enable automatic Z-controller recovery after Safe Tip event
  • auto_pause_scan - Enable automatic scan pause/hold on Safe Tip events
  • threshold - Signal threshold value that triggers Safe Tip protection
§Errors

Returns NanonisError if communication fails or invalid parameters provided.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Configure Safe Tip with automatic recovery and scan pause
client.safe_tip_props_set(true, true, 1e-9)?;  // 1 nA threshold

// Conservative settings for delicate samples
client.safe_tip_props_set(true, true, 500e-12)?;  // 500 pA threshold
Source

pub fn safe_tip_props_get(&mut self) -> Result<(bool, bool, f32), NanonisError>

Get the current Safe Tip configuration.

Returns all Safe Tip protection parameters including automatic recovery settings, scan pause behavior, and the safety threshold value.

§Returns

A tuple containing:

  • bool - Auto recovery enabled/disabled
  • bool - Auto pause scan enabled/disabled
  • f32 - Threshold value for triggering Safe Tip protection
§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let (auto_recovery, auto_pause, threshold) = client.safe_tip_props_get()?;

println!("Safe Tip Configuration:");
println!("  Auto recovery: {}", if auto_recovery { "On" } else { "Off" });
println!("  Auto pause scan: {}", if auto_pause { "On" } else { "Off" });
println!("  Threshold: {:.3e}", threshold);

// Convert threshold to more readable units
if threshold < 1e-9 {
    println!("  Threshold: {:.1} pA", threshold * 1e12);
} else {
    println!("  Threshold: {:.1} nA", threshold * 1e9);
}
Source

pub fn z_ctrl_tip_lift_set( &mut self, tip_lift_m: f32, ) -> Result<(), NanonisError>

Set the tip lift distance for safety operations.

Sets the distance the tip is lifted when safety procedures are triggered. This is part of the Z-controller tip safety system and works in conjunction with Safe Tip to provide comprehensive tip protection.

Note: This function is part of the Z-controller system but included here for safety-related operations.

§Arguments
  • tip_lift_m - Tip lift distance in meters (positive = away from surface)
§Errors

Returns NanonisError if communication fails or invalid lift distance.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set conservative lift distance for safety
client.z_ctrl_tip_lift_set(100e-9)?;  // 100 nm lift

// Set larger lift for problematic areas
client.z_ctrl_tip_lift_set(500e-9)?;  // 500 nm lift
Source

pub fn z_ctrl_tip_lift_get(&mut self) -> Result<f32, NanonisError>

Get the current tip lift distance setting.

Returns the distance the tip will be lifted during safety operations. This helps verify that adequate safety margins are configured.

§Returns

Current tip lift distance in meters.

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let tip_lift = client.z_ctrl_tip_lift_get()?;
println!("Tip lift distance: {:.1} nm", tip_lift * 1e9);

// Check if lift distance is adequate
if tip_lift < 50e-9 {
    println!("Warning: Tip lift may be too small for safe operation");
}
Source

pub fn safety_status_comprehensive( &mut self, ) -> Result<(bool, f32, f32, f32, bool), NanonisError>

Perform a comprehensive safety check of all tip protection systems.

This convenience method checks the status of all major tip safety systems and returns a summary. Use this before starting critical operations to ensure all safety measures are properly configured.

§Returns

A tuple containing safety status information:

  • bool - Safe Tip enabled
  • f32 - Current Safe Tip signal value
  • f32 - Safe Tip threshold
  • f32 - Tip lift distance (m)
  • bool - Z-controller status
§Errors

Returns NanonisError if any safety system check fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let (safe_tip_on, signal_val, threshold, tip_lift, z_ctrl_on) =
    client.safety_status_comprehensive()?;

println!("=== Tip Safety Status ===");
println!("Safe Tip: {}", if safe_tip_on { "ENABLED" } else { "DISABLED" });
println!("Signal: {:.2e} / Threshold: {:.2e}", signal_val, threshold);
println!("Tip Lift: {:.1} nm", tip_lift * 1e9);
println!("Z-Controller: {}", if z_ctrl_on { "ON" } else { "OFF" });

if !safe_tip_on {
    println!("WARNING: Safe Tip protection is disabled!");
}
Source§

impl NanonisClient

Source

pub fn scan_action( &mut self, scan_action: ScanAction, scan_direction: ScanDirection, ) -> Result<(), NanonisError>

Start, stop, pause or resume a scan

Source

pub fn scan_frame_set(&mut self, frame: ScanFrame) -> Result<(), NanonisError>

Configure the scan frame parameters

Source

pub fn scan_frame_get(&mut self) -> Result<ScanFrame, NanonisError>

Get the scan frame parameters

Source

pub fn scan_buffer_get(&mut self) -> Result<(Vec<i32>, i32, i32), NanonisError>

Get the scan buffer parameters Returns: (channel_indexes, pixels, lines)

Source

pub fn scan_status_get(&mut self) -> Result<bool, NanonisError>

Get the current scan status.

Returns whether a scan is currently running or not.

§Returns

true if scan is running, false if scan is not running.

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

if client.scan_status_get()? {
    println!("Scan is currently running");
} else {
    println!("Scan is stopped");
}
Source

pub fn scan_buffer_set( &mut self, channel_indexes: Vec<i32>, pixels: i32, lines: i32, ) -> Result<(), NanonisError>

Configure the scan buffer parameters.

Sets which channels to record during scanning and the scan resolution. The channel indexes refer to the 24 signals assigned in the Signals Manager (0-23).

Important: The number of pixels is coerced to the closest multiple of 16 because scan data is sent in packages of 16 pixels.

§Arguments
  • channel_indexes - Indexes of channels to record (0-23 for signals in Signals Manager)
  • pixels - Number of pixels per line (coerced to multiple of 16)
  • lines - Number of scan lines
§Errors

Returns NanonisError if communication fails or invalid parameters provided.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Record channels 0, 1, and 2 with 512x512 resolution
client.scan_buffer_set(vec![0, 1, 2], 512, 512)?;

// High resolution scan with multiple channels
client.scan_buffer_set(vec![0, 1, 2, 3, 4], 1024, 1024)?;
Source

pub fn scan_config_set( &mut self, config: ScanConfig, ) -> Result<(), NanonisError>

Configure scan speed parameters.

Sets the tip scanning speeds for both forward and backward scan directions. You can specify either linear speed or time per line, and set speed ratios between forward and backward scanning.

§Arguments
  • forward_linear_speed_m_s - Forward linear speed in m/s
  • backward_linear_speed_m_s - Backward linear speed in m/s
  • forward_time_per_line_s - Forward time per line in seconds
  • backward_time_per_line_s - Backward time per line in seconds
  • keep_parameter_constant - Which parameter to keep constant: 0=no change, 1=linear speed, 2=time per line
  • speed_ratio - Backward tip speed relative to forward speed
§Errors

Returns NanonisError if communication fails or invalid parameters provided.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::scan::ScanConfig;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set 1 μm/s forward, 2 μm/s backward, keep linear speed constant
let config = ScanConfig {
    forward_linear_speed_m_s: 1e-6,
    backward_linear_speed_m_s: 2e-6,
    forward_time_per_line_s: 0.1,
    backward_time_per_line_s: 0.05,
    keep_parameter_constant: 1,
    speed_ratio: 2.0,
};
client.scan_config_set(config)?;
Source

pub fn scan_speed_get(&mut self) -> Result<ScanConfig, NanonisError>

Get the current scan speed parameters.

Returns all scan speed configuration values including linear speeds, time per line, and speed ratio settings.

§Returns

A tuple containing:

  • f32 - Forward linear speed (m/s)
  • f32 - Backward linear speed (m/s)
  • f32 - Forward time per line (s)
  • f32 - Backward time per line (s)
  • u16 - Keep parameter constant (0=linear speed, 1=time per line)
  • f32 - Speed ratio (backward relative to forward)
§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let config = client.scan_speed_get()?;

println!("Forward speed: {:.2e} m/s", config.forward_linear_speed_m_s);
println!("Backward speed: {:.2e} m/s", config.backward_linear_speed_m_s);
println!("Speed ratio: {:.1}", config.speed_ratio);
Source

pub fn scan_xy_pos_get( &mut self, wait_newest_data: bool, ) -> Result<(f32, f32), NanonisError>

Get the current XY position during scanning.

Returns the current values of the X and Y signals, useful for monitoring tip position during scanning operations.

§Arguments
  • wait_newest_data - If true, discards first value and waits for fresh data
§Returns

A tuple containing (X position in m, Y position in m)

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Get current position immediately
let (x, y) = client.scan_xy_pos_get(false)?;
println!("Current position: ({:.6}, {:.6}) m", x, y);

// Wait for fresh position data
let (x, y) = client.scan_xy_pos_get(true)?;
Source

pub fn scan_save( &mut self, wait_until_saved: bool, timeout_ms: i32, ) -> Result<bool, NanonisError>

Save the current scan data buffer to file.

Saves the current scan data into a file. If wait_until_saved is true, the function waits for the save operation to complete before returning.

§Arguments
  • wait_until_saved - If true, waits for save completion before returning
  • timeout_ms - Timeout in milliseconds (-1 for indefinite wait)
§Returns

true if timeout occurred while waiting for save completion, false otherwise

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Save immediately without waiting
let timed_out = client.scan_save(false, 5000)?;

// Save and wait up to 30 seconds for completion
let timed_out = client.scan_save(true, 30000)?;
if timed_out {
    println!("Save operation timed out");
}
Source

pub fn scan_frame_data_grab( &mut self, channel_index: u32, data_direction: bool, ) -> Result<(String, Vec<Vec<f32>>, bool), NanonisError>

Get scan frame data for a specific channel and direction.

Returns the complete 2D scan data array for the selected channel. The channel must be one of the channels configured in the scan buffer.

§Arguments
  • channel_index - Index of channel to retrieve data from (must be in acquired channels)
  • data_direction - Data direction: true for forward, false for backward
§Returns

A tuple containing:

  • String - Channel name
  • Vec<Vec<f32>> - 2D scan data array [rows][columns]
  • bool - Scan direction: true for up, false for down
§Errors

Returns NanonisError if:

  • Invalid channel index (not in acquired channels)
  • Communication fails or protocol error occurs
§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Get forward scan data for channel 0
let (channel_name, data, scan_up) = client.scan_frame_data_grab(0, true)?;
println!("Channel: {}, Direction: {}", channel_name, if scan_up { "up" } else { "down" });
println!("Data size: {}x{}", data.len(), data[0].len());

// Get backward scan data
let (_, back_data, _) = client.scan_frame_data_grab(0, false)?;
Source

pub fn scan_wait_end_of_scan( &mut self, timeout: Duration, ) -> Result<(bool, String), NanonisError>

Wait for the End-of-Scan.

Waits for the current scan to complete or timeout to occur, whichever comes first. This is useful for synchronizing operations with scan completion.

§Arguments
  • timeout - Timeout duration (-1 for indefinite wait)
§Returns

A tuple containing:

  • bool - true if timeout occurred, false if scan completed normally
  • String - File path where data was auto-saved (empty if no auto-save)
§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::scan::{ScanAction, ScanDirection};
use std::time::Duration;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Start a scan
client.scan_action(ScanAction::Start, ScanDirection::Up)?;

// Wait for scan to complete (up to 5 minutes)
let (timed_out, file_path) = client.scan_wait_end_of_scan(Duration::from_secs(300))?;

if timed_out {
    println!("Scan timed out after 5 minutes");
} else {
    println!("Scan completed");
    if !file_path.is_empty() {
        println!("Data saved to: {}", file_path);
    }
}
Source

pub fn scan_props_get(&mut self) -> Result<ScanProps, NanonisError>

Get scan properties configuration.

Returns current scan properties including continuous scan, bouncy scan, autosave, series name, comment, modules names, and autopaste settings.

§Returns

ScanProps structure containing all scan property settings

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let props = client.scan_props_get()?;
println!("Continuous scan: {:?}", props.continuous_scan);
println!("Bouncy scan: {:?}", props.bouncy_scan);
println!("Series name: {}", props.series_name);
Examples found in repository?
examples/scan_props.rs (line 12)
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5
6    let mut client = NanonisClient::new("127.0.0.1", 6501)?;
7
8    println!("=== Scan Properties Test ===\n");
9
10    // Step 1: Read current properties
11    println!("1. Reading current scan properties...");
12    let props_before = client.scan_props_get()?;
13    println!("   Continuous scan: {}", props_before.continuous_scan);
14    println!("   Bouncy scan: {}", props_before.bouncy_scan);
15    println!("   Autosave: {:?}", props_before.autosave);
16    println!("   Series name: {:?}", props_before.series_name);
17    println!("   Comment: {:?}", props_before.comment);
18    println!("   Modules: {:?}", props_before.modules_names);
19    println!("   Autopaste: {:?}", props_before.autopaste);
20    println!();
21
22    // Step 2: Modify properties using builder
23    println!("2. Setting new scan properties...");
24    let new_props = ScanPropsBuilder::new()
25        .continuous_scan(true)         // Enable continuous scan
26        .bouncy_scan(true)             // Enable bouncy scan
27        .autosave(AutosaveMode::Off);  // Disable autosave
28
29    client.scan_props_set(new_props)?;
30    println!("   Properties set successfully");
31    println!();
32
33    // Step 3: Read properties again to verify
34    println!("3. Reading properties again to verify changes...");
35    let props_after = client.scan_props_get()?;
36    println!("   Continuous scan: {}", props_after.continuous_scan);
37    println!("   Bouncy scan: {}", props_after.bouncy_scan);
38    println!("   Autosave: {:?}", props_after.autosave);
39    println!("   Series name: {:?}", props_after.series_name);
40    println!("   Comment: {:?}", props_after.comment);
41    println!("   Modules: {:?}", props_after.modules_names);
42    println!("   Autopaste: {:?}", props_after.autopaste);
43    println!();
44
45    // Step 4: Verify changes
46    println!("4. Verifying changes...");
47    let mut success = true;
48
49    if !props_after.continuous_scan {
50        println!("   ✗ Continuous scan not set correctly");
51        success = false;
52    } else {
53        println!("   ✓ Continuous scan set to On");
54    }
55
56    if !props_after.bouncy_scan {
57        println!("   ✗ Bouncy scan not set correctly");
58        success = false;
59    } else {
60        println!("   ✓ Bouncy scan set to On");
61    }
62
63    if props_after.autosave != AutosaveMode::Off {
64        println!("   ✗ Autosave not set correctly");
65        success = false;
66    } else {
67        println!("   ✓ Autosave set to Off");
68    }
69
70    println!();
71    if success {
72        println!("✓ All properties changed successfully!");
73    } else {
74        println!("✗ Some properties did not change as expected");
75    }
76
77    // Step 5: Restore original properties
78    println!("\n5. Restoring original properties...");
79    let restore = ScanPropsBuilder::new()
80        .continuous_scan(props_before.continuous_scan)
81        .bouncy_scan(props_before.bouncy_scan)
82        .autosave(props_before.autosave);
83    client.scan_props_set(restore)?;
84    println!("   Properties restored");
85
86    Ok(())
87}
Source

pub fn scan_props_set( &mut self, builder: ScanPropsBuilder, ) -> Result<(), NanonisError>

Set scan properties configuration.

Configures scan parameters including continuous scan, bouncy scan, autosave behavior, series name, comment, and autopaste settings. Use ScanPropsBuilder to set only the properties you want to change.

§Arguments
  • builder - Builder with properties to set. Fields set to None will not be changed.
§Errors

Returns NanonisError if communication fails or invalid parameters provided.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::scan::{ScanPropsBuilder, AutosaveMode, AutopasteMode};

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set only specific properties using the builder
let builder = ScanPropsBuilder::new()
    .continuous_scan(true)        // Enable continuous scan
    .bouncy_scan(true)            // Enable bouncy scan
    .autosave(AutosaveMode::Off); // Disable autosave

client.scan_props_set(builder)?;
Examples found in repository?
examples/scan_props.rs (line 29)
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5
6    let mut client = NanonisClient::new("127.0.0.1", 6501)?;
7
8    println!("=== Scan Properties Test ===\n");
9
10    // Step 1: Read current properties
11    println!("1. Reading current scan properties...");
12    let props_before = client.scan_props_get()?;
13    println!("   Continuous scan: {}", props_before.continuous_scan);
14    println!("   Bouncy scan: {}", props_before.bouncy_scan);
15    println!("   Autosave: {:?}", props_before.autosave);
16    println!("   Series name: {:?}", props_before.series_name);
17    println!("   Comment: {:?}", props_before.comment);
18    println!("   Modules: {:?}", props_before.modules_names);
19    println!("   Autopaste: {:?}", props_before.autopaste);
20    println!();
21
22    // Step 2: Modify properties using builder
23    println!("2. Setting new scan properties...");
24    let new_props = ScanPropsBuilder::new()
25        .continuous_scan(true)         // Enable continuous scan
26        .bouncy_scan(true)             // Enable bouncy scan
27        .autosave(AutosaveMode::Off);  // Disable autosave
28
29    client.scan_props_set(new_props)?;
30    println!("   Properties set successfully");
31    println!();
32
33    // Step 3: Read properties again to verify
34    println!("3. Reading properties again to verify changes...");
35    let props_after = client.scan_props_get()?;
36    println!("   Continuous scan: {}", props_after.continuous_scan);
37    println!("   Bouncy scan: {}", props_after.bouncy_scan);
38    println!("   Autosave: {:?}", props_after.autosave);
39    println!("   Series name: {:?}", props_after.series_name);
40    println!("   Comment: {:?}", props_after.comment);
41    println!("   Modules: {:?}", props_after.modules_names);
42    println!("   Autopaste: {:?}", props_after.autopaste);
43    println!();
44
45    // Step 4: Verify changes
46    println!("4. Verifying changes...");
47    let mut success = true;
48
49    if !props_after.continuous_scan {
50        println!("   ✗ Continuous scan not set correctly");
51        success = false;
52    } else {
53        println!("   ✓ Continuous scan set to On");
54    }
55
56    if !props_after.bouncy_scan {
57        println!("   ✗ Bouncy scan not set correctly");
58        success = false;
59    } else {
60        println!("   ✓ Bouncy scan set to On");
61    }
62
63    if props_after.autosave != AutosaveMode::Off {
64        println!("   ✗ Autosave not set correctly");
65        success = false;
66    } else {
67        println!("   ✓ Autosave set to Off");
68    }
69
70    println!();
71    if success {
72        println!("✓ All properties changed successfully!");
73    } else {
74        println!("✗ Some properties did not change as expected");
75    }
76
77    // Step 5: Restore original properties
78    println!("\n5. Restoring original properties...");
79    let restore = ScanPropsBuilder::new()
80        .continuous_scan(props_before.continuous_scan)
81        .bouncy_scan(props_before.bouncy_scan)
82        .autosave(props_before.autosave);
83    client.scan_props_set(restore)?;
84    println!("   Properties restored");
85
86    Ok(())
87}
Source

pub fn scan_background_paste( &mut self, x: f64, y: f64, ) -> Result<(), NanonisError>

Paste background image at specified location.

Pastes a previously copied background image to the scan buffer at the specified position. This is used for background subtraction operations.

§Arguments
  • x - X position in meters for paste location
  • y - Y position in meters for paste location
§Errors

Returns NanonisError if communication fails or no background is available.

Source

pub fn scan_background_delete(&mut self) -> Result<(), NanonisError>

Delete the stored background image.

Removes the background image from memory, freeing resources and disabling background subtraction until a new background is captured.

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn script_open(&mut self) -> Result<(), NanonisError>

Open the Script module.

§Errors

Returns NanonisError if communication fails.

Source

pub fn script_load( &mut self, script_index: i32, file_path: &str, load_session: bool, ) -> Result<(), NanonisError>

Load a script in the Script module.

§Arguments
  • script_index - Script slot (1 to total scripts, -1 for current)
  • file_path - Path to the script file
  • load_session - If true, loads from session file instead of file_path
§Errors

Returns NanonisError if communication fails.

Source

pub fn script_save( &mut self, script_index: i32, file_path: &str, save_session: bool, ) -> Result<(), NanonisError>

Save the current script to a file.

§Arguments
  • script_index - Script slot (1 to total scripts, -1 for current)
  • file_path - Path to save the script file
  • save_session - If true, saves to session file instead
§Errors

Returns NanonisError if communication fails.

Source

pub fn script_deploy(&mut self, script_index: i32) -> Result<(), NanonisError>

Deploy a script in the Script module.

§Arguments
  • script_index - Script slot (1 to total scripts, -1 for current)
§Errors

Returns NanonisError if communication fails.

Source

pub fn script_undeploy(&mut self, script_index: i32) -> Result<(), NanonisError>

Undeploy a script in the Script module.

§Arguments
  • script_index - Script slot (1 to total scripts, -1 for current)
§Errors

Returns NanonisError if communication fails.

Source

pub fn script_run( &mut self, script_index: i32, wait: bool, ) -> Result<(), NanonisError>

Run a script in the Script module.

§Arguments
  • script_index - Script slot (1 to total scripts, -1 for current)
  • wait - If true, waits until script finishes
§Errors

Returns NanonisError if communication fails.

Source

pub fn script_stop(&mut self) -> Result<(), NanonisError>

Stop the running script.

§Errors

Returns NanonisError if communication fails.

Source

pub fn script_chs_get( &mut self, buffer: AcquireBuffer, ) -> Result<Vec<i32>, NanonisError>

Get the list of acquired channels in the Script module.

§Arguments
  • buffer - Acquire buffer to read from
§Returns

Vector of channel indexes (0-23).

§Errors

Returns NanonisError if communication fails.

Source

pub fn script_chs_set( &mut self, buffer: AcquireBuffer, channel_indexes: &[i32], ) -> Result<(), NanonisError>

Set the list of acquired channels in the Script module.

§Arguments
  • buffer - Acquire buffer to configure
  • channel_indexes - Channel indexes (0-23)
§Errors

Returns NanonisError if communication fails.

Source

pub fn script_data_get( &mut self, buffer: AcquireBuffer, sweep_number: i32, ) -> Result<ScriptData, NanonisError>

Get the data acquired in the Script module.

§Arguments
  • buffer - Acquire buffer to read from
  • sweep_number - Sweep number (starts at 0)
§Returns

2D array of script data.

§Errors

Returns NanonisError if communication fails.

Source

pub fn script_autosave( &mut self, buffer: AcquireBuffer, sweep_number: i32, all_sweeps_to_same_file: bool, folder_path: &str, basename: &str, ) -> Result<(), NanonisError>

Autosave script data to file.

§Arguments
  • buffer - Acquire buffer(s) to save
  • sweep_number - Sweep number (-1 for all sweeps)
  • all_sweeps_to_same_file - If true, saves all sweeps to one file
  • folder_path - Folder path (empty for last used)
  • basename - File basename (empty for last used)
§Errors

Returns NanonisError if communication fails.

Source

pub fn script_lut_open(&mut self) -> Result<(), NanonisError>

Open the LUT (Look Up Table) Editor from the Script module.

§Errors

Returns NanonisError if communication fails.

Source

pub fn script_lut_load( &mut self, lut_index: i32, file_path: &str, values: &[f32], ) -> Result<(), NanonisError>

Load a LUT from file or from values.

§Arguments
  • lut_index - LUT index (1 to total LUTs)
  • file_path - Path to .luts file (empty to use values)
  • values - LUT values (used if file_path is empty)
§Errors

Returns NanonisError if communication fails.

Source

pub fn script_lut_save( &mut self, lut_index: i32, file_path: &str, ) -> Result<(), NanonisError>

Save a LUT to file.

§Arguments
  • lut_index - LUT index (1 to total LUTs)
  • file_path - Path to save .luts file
§Errors

Returns NanonisError if communication fails.

Source

pub fn script_lut_deploy( &mut self, lut_index: i32, wait: bool, timeout_ms: i32, ) -> Result<(), NanonisError>

Deploy a LUT from the LUT Editor.

§Arguments
  • lut_index - LUT index (1 to total LUTs)
  • wait - If true, waits until deployment finishes
  • timeout_ms - Timeout in milliseconds (-1 for forever)
§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn signal_chart_open(&mut self) -> Result<(), NanonisError>

Open the signal chart module.

This opens the signal chart interface in the Nanonis software.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
client.signal_chart_open()?;
Source

pub fn signal_chart_chs_set( &mut self, channels: &SignalChartChannels, ) -> Result<(), NanonisError>

Set the signal chart channels.

Sets the signal indices for channels A and B in the signal chart. Use -1 to disable a channel.

§Arguments
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::signal_chart::SignalChartChannels;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let channels = SignalChartChannels {
    channel_a_index: 0,  // First signal
    channel_b_index: 1,  // Second signal
};
client.signal_chart_chs_set(&channels)?;
Source

pub fn signal_chart_chs_get( &mut self, ) -> Result<SignalChartChannels, NanonisError>

Get the signal chart channels.

Returns the current signal indices for channels A and B.

§Returns

A SignalChartChannels struct with current channel indices.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let channels = client.signal_chart_chs_get()?;
println!("Channel A: {}, Channel B: {}", channels.channel_a_index, channels.channel_b_index);
Source§

impl NanonisClient

Source

pub fn signal_names_get(&mut self) -> Result<Vec<String>, NanonisError>

Get available signal names

Examples found in repository?
examples/hello_world.rs (line 6)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4    let mut client = NanonisClient::new("127.0.0.1", 6501)?;
5
6    let names = client.signal_names_get()?;
7    for (i, name) in names.iter().enumerate() {
8        println!("{}: {}", i, name);
9    }
10
11    Ok(())
12}
Source

pub fn signals_calibr_get( &mut self, signal_index: SignalIndex, ) -> Result<(f32, f32), NanonisError>

Get calibration and offset of a signal by index

Source

pub fn signals_range_get( &mut self, signal_index: SignalIndex, ) -> Result<(f32, f32), NanonisError>

Get range limits of a signal by index

Source

pub fn signals_vals_get( &mut self, signal_indexes: Vec<i32>, wait_for_newest_data: bool, ) -> Result<Vec<f32>, NanonisError>

Get current values of signals by index(es)

Source

pub fn signal_val_get( &mut self, signal_index: impl Into<SignalIndex>, wait_for_newest_data: bool, ) -> Result<f32, NanonisError>

Get the current value of a single selected signal.

Returns the current value of the selected signal, oversampled during the Acquisition Period time (Tap). The signal is continuously oversampled and published every Tap seconds.

§Signal Measurement Principle

This function waits for the next oversampled data to be published and returns its value. It does not trigger a measurement but waits for data to be published. The function returns a value 0 to Tap seconds after being called.

Important: If you change a signal and immediately call this function, you might get “old” data measured before the signal change. Set wait_for_newest_data to true to ensure you get only fresh data.

§Arguments
  • signal_index - Signal index (0-127)
  • wait_for_newest_data - If true, discards first value and waits for fresh data. Takes Tap to 2*Tap seconds. If false, returns next available value (0 to Tap seconds).
§Returns

The signal value in physical units.

§Errors

Returns NanonisError if:

  • Invalid signal index provided
  • Communication timeout or protocol error
§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::signals::SignalIndex;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Read bias signal immediately
let bias_value = client.signal_val_get(SignalIndex(24), false)?;

// Wait for fresh data after signal change
let fresh_value = client.signal_val_get(SignalIndex(24), true)?;
Source

pub fn signals_meas_names_get(&mut self) -> Result<Vec<String>, NanonisError>

Get the list of measurement channels names available in the software.

Returns the names of measurement channels used in sweepers and other measurement modules.

Important Note: Measurement channels are different from Signals. Measurement channels are used in sweepers, while Signals are used by graphs and other modules. The indexes returned here are used for sweeper channel configuration (e.g., GenSwp.ChannelsGet/Set).

§Returns

A vector of measurement channel names where each name corresponds to an index that can be used in sweeper functions.

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let meas_channels = client.signals_meas_names_get()?;
println!("Available measurement channels: {}", meas_channels.len());

for (index, name) in meas_channels.iter().enumerate() {
    println!("  {}: {}", index, name);
}
Source

pub fn signals_add_rt_get( &mut self, ) -> Result<(Vec<String>, String, String), NanonisError>

Get the list of additional Real-Time (RT) signals and current assignments.

Returns the list of additional RT signals available for assignment to Internal 23 and 24, plus the names of signals currently assigned to these internal channels.

Note: This assignment in the Signals Manager doesn’t automatically make them available in graphs and modules. Internal 23 and 24 must be assigned to one of the 24 display slots using functions like Signals.InSlotSet to be visible in the software.

§Returns

A tuple containing:

  • Vec<String> - List of additional RT signals that can be assigned to Internal 23/24
  • String - Name of RT signal currently assigned to Internal 23
  • String - Name of RT signal currently assigned to Internal 24
§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let (available_signals, internal_23, internal_24) = client.signals_add_rt_get()?;

println!("Available additional RT signals: {}", available_signals.len());
for (i, signal) in available_signals.iter().enumerate() {
    println!("  {}: {}", i, signal);
}

println!("Internal 23 assigned to: {}", internal_23);
println!("Internal 24 assigned to: {}", internal_24);
Source

pub fn signals_add_rt_set( &mut self, additional_rt_signal_1: i32, additional_rt_signal_2: i32, ) -> Result<(), NanonisError>

Assign additional Real-Time (RT) signals to Internal 23 and 24 signals.

Links advanced RT signals to Internal 23 and Internal 24 in the Signals Manager. This enables routing of specialized real-time signals through the internal channel system.

Important Note: This assignment only links the RT signals to Internal 23/24. To make them visible in graphs and available for acquisition in modules, Internal 23 and 24 must be assigned to one of the 24 display slots using functions like Signals.InSlotSet.

§Arguments
  • additional_rt_signal_1 - Index of the RT signal to assign to Internal 23 (from signals_add_rt_get())
  • additional_rt_signal_2 - Index of the RT signal to assign to Internal 24 (from signals_add_rt_get())
§Errors

Returns NanonisError if:

  • Invalid RT signal indices provided
  • RT signals are not available or accessible
  • Communication fails or protocol error occurs
§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// First, get the available RT signals
let (available_signals, current_23, current_24) = client.signals_add_rt_get()?;

println!("Available RT signals:");
for (i, signal) in available_signals.iter().enumerate() {
    println!("  {}: {}", i, signal);
}

// Assign RT signal index 0 to Internal 23 and index 1 to Internal 24
client.signals_add_rt_set(0, 1)?;

// Verify the assignment
let (_, new_23, new_24) = client.signals_add_rt_get()?;
println!("Internal 23 now assigned to: {}", new_23);
println!("Internal 24 now assigned to: {}", new_24);
Source

pub fn signals_in_slots_get(&mut self) -> Result<Vec<i32>, NanonisError>

Get the input slot assignments for each signal.

Returns the hardware input slot index for each signal in the system. Input slots represent the physical or virtual input sources that feed into each signal channel.

§Returns

Vector of input slot indices, one for each signal in the system.

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let input_slots = client.signals_in_slots_get()?;
println!("Input slot assignments for {} signals:", input_slots.len());
for (signal_idx, slot_idx) in input_slots.iter().enumerate() {
    println!("  Signal {}: Input slot {}", signal_idx, slot_idx);
}
Source§

impl NanonisClient

Source

pub fn spectrum_anlzr_ch_set( &mut self, instance: SpectrumAnalyzerInstance, channel_index: i32, ) -> Result<(), NanonisError>

Set the channel to display in the spectrum analyzer.

§Arguments
  • instance - Spectrum analyzer instance (1 or 2)
  • channel_index - Channel index (0-23) corresponding to signal slots
§Errors

Returns NanonisError if communication fails.

Source

pub fn spectrum_anlzr_ch_get( &mut self, instance: SpectrumAnalyzerInstance, ) -> Result<i32, NanonisError>

Get the channel displayed in the spectrum analyzer.

§Arguments
  • instance - Spectrum analyzer instance (1 or 2)
§Returns

Channel index (0-23) corresponding to signal slots.

§Errors

Returns NanonisError if communication fails.

Source

pub fn spectrum_anlzr_freq_range_set( &mut self, instance: SpectrumAnalyzerInstance, range_index: i32, ) -> Result<(), NanonisError>

Set the frequency range in the spectrum analyzer.

Use spectrum_anlzr_freq_range_get first to get available ranges.

§Arguments
  • instance - Spectrum analyzer instance (1 or 2)
  • range_index - Index of the desired frequency range
§Errors

Returns NanonisError if communication fails.

Source

pub fn spectrum_anlzr_freq_range_get( &mut self, instance: SpectrumAnalyzerInstance, ) -> Result<SpectrumFreqRange, NanonisError>

Get the frequency range configuration from the spectrum analyzer.

§Arguments
  • instance - Spectrum analyzer instance (1 or 2)
§Returns

Frequency range information including selected index and available ranges.

§Errors

Returns NanonisError if communication fails.

Source

pub fn spectrum_anlzr_freq_res_set( &mut self, instance: SpectrumAnalyzerInstance, resolution_index: u16, ) -> Result<(), NanonisError>

Set the frequency resolution in the spectrum analyzer.

Use spectrum_anlzr_freq_res_get first to get available resolutions.

§Arguments
  • instance - Spectrum analyzer instance (1 or 2)
  • resolution_index - Index of the desired frequency resolution
§Errors

Returns NanonisError if communication fails.

Source

pub fn spectrum_anlzr_freq_res_get( &mut self, instance: SpectrumAnalyzerInstance, ) -> Result<SpectrumFreqResolution, NanonisError>

Get the frequency resolution configuration from the spectrum analyzer.

§Arguments
  • instance - Spectrum analyzer instance (1 or 2)
§Returns

Frequency resolution information including selected index and available resolutions.

§Errors

Returns NanonisError if communication fails.

Source

pub fn spectrum_anlzr_fft_window_set( &mut self, instance: SpectrumAnalyzerInstance, window: SpectrumFFTWindow, ) -> Result<(), NanonisError>

Set the FFT window in the spectrum analyzer.

§Arguments
  • instance - Spectrum analyzer instance (1 or 2)
  • window - FFT window type
§Errors

Returns NanonisError if communication fails.

Source

pub fn spectrum_anlzr_fft_window_get( &mut self, instance: SpectrumAnalyzerInstance, ) -> Result<SpectrumFFTWindow, NanonisError>

Get the FFT window from the spectrum analyzer.

§Arguments
  • instance - Spectrum analyzer instance (1 or 2)
§Returns

Currently selected FFT window type.

§Errors

Returns NanonisError if communication fails.

Source

pub fn spectrum_anlzr_averag_set( &mut self, instance: SpectrumAnalyzerInstance, averaging: &SpectrumAveraging, ) -> Result<(), NanonisError>

Set the averaging parameters in the spectrum analyzer.

§Arguments
  • instance - Spectrum analyzer instance (1 or 2)
  • averaging - Averaging configuration
§Errors

Returns NanonisError if communication fails.

Source

pub fn spectrum_anlzr_averag_get( &mut self, instance: SpectrumAnalyzerInstance, ) -> Result<SpectrumAveraging, NanonisError>

Get the averaging parameters from the spectrum analyzer.

§Arguments
  • instance - Spectrum analyzer instance (1 or 2)
§Returns

Averaging configuration.

§Errors

Returns NanonisError if communication fails.

Source

pub fn spectrum_anlzr_ac_coupling_set( &mut self, instance: SpectrumAnalyzerInstance, enabled: bool, ) -> Result<(), NanonisError>

Set the AC coupling mode in the spectrum analyzer.

Use spectrum_anlzr_dc_get to get the DC component when AC coupling is enabled.

§Arguments
  • instance - Spectrum analyzer instance (1 or 2)
  • enabled - True to enable AC coupling, false to disable
§Errors

Returns NanonisError if communication fails.

Source

pub fn spectrum_anlzr_ac_coupling_get( &mut self, instance: SpectrumAnalyzerInstance, ) -> Result<bool, NanonisError>

Get the AC coupling mode from the spectrum analyzer.

§Arguments
  • instance - Spectrum analyzer instance (1 or 2)
§Returns

True if AC coupling is enabled.

§Errors

Returns NanonisError if communication fails.

Source

pub fn spectrum_anlzr_cursor_pos_set( &mut self, instance: SpectrumAnalyzerInstance, cursor_type: SpectrumCursorType, cursor1_x_hz: f64, cursor2_x_hz: f64, ) -> Result<(), NanonisError>

Set the cursor positions in the spectrum analyzer.

Cursors 1 and 2 are used to define the frequency band.

§Arguments
  • instance - Spectrum analyzer instance (1 or 2)
  • cursor_type - Type of cursor to display
  • cursor1_x_hz - X position of cursor 1 in Hz
  • cursor2_x_hz - X position of cursor 2 in Hz
§Errors

Returns NanonisError if communication fails.

Source

pub fn spectrum_anlzr_cursor_pos_get( &mut self, instance: SpectrumAnalyzerInstance, cursor_type: SpectrumCursorType, ) -> Result<SpectrumCursorPos, NanonisError>

Get the cursor positions from the spectrum analyzer.

§Arguments
  • instance - Spectrum analyzer instance (1 or 2)
  • cursor_type - Type of cursor to display (also sets the cursor type)
§Returns

Cursor position information.

§Errors

Returns NanonisError if communication fails.

Source

pub fn spectrum_anlzr_band_rms_get( &mut self, instance: SpectrumAnalyzerInstance, ) -> Result<SpectrumBandRMS, NanonisError>

Get the RMS value in the frequency band from the spectrum analyzer.

This function sets the cursor type to Band RMS if previously set to another type.

§Arguments
  • instance - Spectrum analyzer instance (1 or 2)
§Returns

Band RMS measurement including RMS value and frequency limits.

§Errors

Returns NanonisError if communication fails.

Source

pub fn spectrum_anlzr_dc_get( &mut self, instance: SpectrumAnalyzerInstance, ) -> Result<f64, NanonisError>

Get the DC value from the spectrum analyzer.

Only returns meaningful values when AC coupling mode is enabled.

§Arguments
  • instance - Spectrum analyzer instance (1 or 2)
§Returns

DC value.

§Errors

Returns NanonisError if communication fails.

Source

pub fn spectrum_anlzr_run( &mut self, instance: SpectrumAnalyzerInstance, ) -> Result<(), NanonisError>

Start the spectrum analyzer.

The spectrum analyzer does not run when its front panel is closed. Use this function to start the module for automated measurements.

§Arguments
  • instance - Spectrum analyzer instance (1 or 2)
§Errors

Returns NanonisError if communication fails.

Source

pub fn spectrum_anlzr_data_get( &mut self, instance: SpectrumAnalyzerInstance, ) -> Result<SpectrumData, NanonisError>

Get the data from the spectrum analyzer.

§Arguments
  • instance - Spectrum analyzer instance (1 or 2)
§Returns

Spectrum data including frequency axis and amplitude values.

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn tcplog_start(&mut self) -> Result<(), NanonisError>

Start the acquisition in the TCP Logger module.

Before using this function, select the channels to record in the TCP Logger using tcplog_chs_set().

§Returns

Ok(()) if the command succeeds.

§Errors

Returns NanonisError if:

  • Communication with the server fails
  • Protocol error occurs
§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Configure channels first (using signal slots, not full indices)
client.tcplog_chs_set(vec![0, 1, 2])?; // First 3 signal slots

// Start logging
client.tcplog_start()?;
Source

pub fn tcplog_stop(&mut self) -> Result<(), NanonisError>

Stop the acquisition in the TCP Logger module.

§Returns

Ok(()) if the command succeeds.

§Errors

Returns NanonisError if:

  • Communication with the server fails
  • Protocol error occurs
§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Stop logging
client.tcplog_stop()?;
Source

pub fn tcplog_chs_set( &mut self, channel_indexes: Vec<i32>, ) -> Result<(), NanonisError>

Set the list of recorded channels in the TCP Logger module.

The channel indexes are comprised between 0 and 23 for the 24 signals assigned in the Signals Manager. To get the signal name and its corresponding index in the list of the 128 available signals in the Nanonis Controller, use the signal_names_get() function.

§Arguments
  • channel_indexes - Vector of channel indexes to record (0-23)
§Returns

Ok(()) if the command succeeds.

§Errors

Returns NanonisError if:

  • Invalid channel indexes provided
  • Communication with the server fails
  • Protocol error occurs
§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Record first few signal slots (current, height, etc.)
client.tcplog_chs_set(vec![0, 1, 2])?;

// Record only the first slot (typically current)
client.tcplog_chs_set(vec![0])?;
Source

pub fn tcplog_oversampl_set( &mut self, oversampling_value: i32, ) -> Result<(), NanonisError>

Set the oversampling value in the TCP Logger.

The oversampling value controls the data acquisition rate.

§Arguments
  • oversampling_value - Oversampling index (0-1000)
§Returns

Ok(()) if the command succeeds.

§Errors

Returns NanonisError if:

  • Invalid oversampling value provided (outside 0-1000 range)
  • Communication with the server fails
  • Protocol error occurs
§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set moderate oversampling
client.tcplog_oversampl_set(100)?;

// Set maximum oversampling
client.tcplog_oversampl_set(1000)?;
Source

pub fn tcplog_status_get(&mut self) -> Result<TCPLogStatus, NanonisError>

Return the current status of the TCP Logger.

§Returns

The current TCPLogStatus of the TCP Logger module.

§Errors

Returns NanonisError if:

  • Communication with the server fails
  • Protocol error occurs
  • Invalid status value returned from server
§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::tcplog::TCPLogStatus;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let status = client.tcplog_status_get()?;
match status {
    TCPLogStatus::Idle => println!("Logger is idle"),
    TCPLogStatus::Running => println!("Logger is running"),
    TCPLogStatus::BufferOverflow => println!("Warning: Buffer overflow detected!"),
    _ => println!("Logger status: {}", status),
}
Source§

impl NanonisClient

Source

pub fn tip_rec_buffer_size_set( &mut self, buffer_size: i32, ) -> Result<(), NanonisError>

Set the buffer size of the Tip Move Recorder.

Sets the number of data elements that can be stored in the Tip Move Recorder buffer. This recorder tracks signal values while the tip is moving in Follow Me mode. Note: This function clears the existing graph data.

§Arguments
  • buffer_size - Number of data elements to store in the recorder buffer
§Errors

Returns NanonisError if communication fails or invalid buffer size.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set buffer for 10,000 data points
client.tip_rec_buffer_size_set(10000)?;

// Set smaller buffer for quick tests
client.tip_rec_buffer_size_set(1000)?;
Source

pub fn tip_rec_buffer_size_get(&mut self) -> Result<i32, NanonisError>

Get the current buffer size of the Tip Move Recorder.

Returns the number of data elements that can be stored in the recorder buffer.

§Returns

Current buffer size (number of data elements).

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let buffer_size = client.tip_rec_buffer_size_get()?;
println!("Tip recorder buffer size: {} points", buffer_size);
Source

pub fn tip_rec_buffer_clear(&mut self) -> Result<(), NanonisError>

Clear the buffer of the Tip Move Recorder.

Removes all recorded data from the Tip Move Recorder buffer, resetting it to an empty state. This is useful before starting a new recording session.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Clear buffer before starting new measurement
client.tip_rec_buffer_clear()?;
println!("Tip recorder buffer cleared");
Source

pub fn tip_rec_data_get( &mut self, ) -> Result<(Vec<i32>, Vec<Vec<f32>>), NanonisError>

Get the recorded data from the Tip Move Recorder.

Returns all data recorded while the tip was moving in Follow Me mode. This includes channel indexes, names, and the complete 2D data array with measurements taken during tip movement.

§Returns

A tuple containing:

  • Vec<i32> - Channel indexes (0-23 for Signals Manager slots)
  • Vec<Vec<f32>> - 2D data array [rows][columns] with recorded measurements
§Errors

Returns NanonisError if communication fails or no data available.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Get recorded tip movement data
let (channel_indexes, data) = client.tip_rec_data_get()?;

println!("Recorded {} channels with {} data points",
         channel_indexes.len(), data.len());

// Analyze data for each channel
for (i, &channel_idx) in channel_indexes.iter().enumerate() {
    if i < data[0].len() {
        println!("Channel {}: {} values", channel_idx, data.len());
    }
}
Source

pub fn tip_rec_data_save( &mut self, clear_buffer: bool, basename: &str, ) -> Result<(), NanonisError>

Save the tip movement data to a file.

Saves all data recorded in Follow Me mode to a file with the specified basename. Optionally clears the buffer after saving to prepare for new recordings.

§Arguments
  • clear_buffer - If true, clears buffer after saving
  • basename - Base filename for saved data (empty to use last basename)
§Errors

Returns NanonisError if communication fails or file save error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Save data and clear buffer for next measurement
client.tip_rec_data_save(true, "tip_approach_001")?;

// Save without clearing buffer (keep data for analysis)
client.tip_rec_data_save(false, "tip_movement_log")?;
Source

pub fn tip_shaper_start( &mut self, wait_until_finished: bool, timeout: Duration, ) -> Result<(), NanonisError>

Start the tip shaper procedure for tip conditioning.

Initiates the tip shaper procedure which performs controlled tip conditioning by applying specific voltage sequences and mechanical movements. This is used to improve tip sharpness and stability after crashes or contamination.

§Arguments
  • wait_until_finished - If true, waits for procedure completion
  • timeout_ms - Timeout in milliseconds (-1 for infinite wait)
§Errors

Returns NanonisError if communication fails or procedure cannot start.

§Examples
use nanonis_rs::NanonisClient;
use std::time::Duration;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Start tip shaping and wait for completion (30 second timeout)
client.tip_shaper_start(true, Duration::from_secs(30))?;
println!("Tip shaping completed");

// Start tip shaping without waiting
client.tip_shaper_start(false, Duration::ZERO)?;
Source

pub fn tip_shaper_props_set( &mut self, config: TipShaperConfig, ) -> Result<(), NanonisError>

Set the tip shaper procedure configuration.

Configures all parameters for the tip conditioning procedure including timing, voltages, and mechanical movements. This is a complex procedure with multiple stages of tip treatment.

§Arguments
  • config - Tip shaper configuration parameters
§Errors

Returns NanonisError if communication fails or invalid parameters.

§Examples
use nanonis_rs::NanonisClient;
use nanonis_rs::tip_recovery::TipShaperConfig;
use std::time::Duration;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Conservative tip conditioning parameters
let config = TipShaperConfig {
    switch_off_delay: Duration::from_millis(100),
    change_bias: true,
    bias_v: -2.0,
    tip_lift_m: 50e-9,   // 50 nm
    lift_time_1: Duration::from_secs(1),
    bias_lift_v: 5.0,
    bias_settling_time: Duration::from_millis(500),
    lift_height_m: 100e-9, // 100 nm
    lift_time_2: Duration::from_millis(500),
    end_wait_time: Duration::from_millis(200),
    restore_feedback: true,
};
client.tip_shaper_props_set(config)?;
Source

pub fn tip_shaper_props_get(&mut self) -> Result<TipShaperProps, NanonisError>

Get the current tip shaper procedure configuration.

Returns all parameters currently configured for the tip conditioning procedure. Use this to verify settings before starting the procedure.

§Returns

A tuple containing all tip shaper parameters:

  • f32 - Switch off delay (s)
  • u32 - Change bias flag (0=no change, 1=true, 2=false)
  • f32 - Bias voltage (V)
  • f32 - Tip lift distance (m)
  • f32 - First lift time (s)
  • f32 - Bias lift voltage (V)
  • f32 - Bias settling time (s)
  • f32 - Second lift height (m)
  • f32 - Second lift time (s)
  • f32 - End wait time (s)
  • u32 - Restore feedback flag (0=no change, 1=true, 2=false)
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let (switch_delay, change_bias, bias_v, tip_lift, lift_time1,
     bias_lift, settling, lift_height, lift_time2, end_wait, restore) =
     client.tip_shaper_props_get()?;

println!("Tip lift: {:.1} nm, Bias: {:.1} V", tip_lift * 1e9, bias_v);
println!("Total procedure time: ~{:.1} s",
         switch_delay + lift_time1 + settling + lift_time2 + end_wait);
Source

pub fn tip_shaper_config_get(&mut self) -> Result<TipShaperConfig, NanonisError>

Get the Tip Shaper properties as a type-safe TipShaperConfig struct

This method returns the same information as tip_shaper_props_get() but with Duration types for time fields instead of raw f32 seconds.

§Returns

Returns a TipShaperConfig struct with type-safe Duration fields for all time parameters.

§Errors

Returns NanonisError if communication fails or if the response format is invalid.

§Examples
use nanonis_rs::NanonisClient;
use std::time::Duration;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;
let config = client.tip_shaper_config_get()?;

println!("Tip lift: {:.1} nm, Bias: {:.1} V",
         config.tip_lift_m * 1e9, config.bias_v);
println!("Total procedure time: {:.1} s",
         (config.switch_off_delay + config.lift_time_1 +
          config.bias_settling_time + config.lift_time_2 +
          config.end_wait_time).as_secs_f32());
Source§

impl NanonisClient

Source

pub fn user_in_calibr_set( &mut self, input_index: i32, calibration_per_volt: f32, offset_physical_units: f32, ) -> Result<(), NanonisError>

Set the calibration of a user input.

§Arguments
  • input_index - Input index (1 to available inputs)
  • calibration_per_volt - Calibration value per volt
  • offset_physical_units - Offset in physical units
§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn user_out_mode_set( &mut self, output_index: i32, output_mode: OutputMode, ) -> Result<(), NanonisError>

Set the mode (User Output, Monitor, Calculated signal) of the selected user output channel.

§Arguments
  • output_index - Output to be used (1 to number of available outputs)
  • output_mode - Output mode to set
§Errors

Returns NanonisError if:

  • Invalid output index is provided
  • Communication timeout or protocol error
§Examples
use nanonis_rs::{NanonisClient, user_out::OutputMode};

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set output 1 to Monitor mode
client.user_out_mode_set(1, OutputMode::Monitor)?;
Source

pub fn user_out_mode_get( &mut self, output_index: i32, ) -> Result<OutputMode, NanonisError>

Get the mode (User Output, Monitor, Calculated signal) of the selected user output channel.

§Arguments
  • output_index - Output to query (1 to number of available outputs)
§Returns

The current output mode (UserOutput, Monitor, CalcSignal, or Override)

§Errors

Returns NanonisError if communication fails or invalid response received.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let mode = client.user_out_mode_get(1)?;
println!("Output 1 mode: {:?}", mode);
Source

pub fn user_out_monitor_ch_set( &mut self, output_index: i32, monitor_channel_index: i32, ) -> Result<(), NanonisError>

Set the monitor channel of the selected output channel.

§Arguments
  • output_index - Output to configure (1 to number of available outputs)
  • monitor_channel_index - Index of the channel to monitor (0-127)
§Errors

Returns NanonisError if invalid indices provided or communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set output 1 to monitor channel 5
client.user_out_monitor_ch_set(1, 5)?;
Source

pub fn user_out_monitor_ch_get( &mut self, output_index: i32, ) -> Result<i32, NanonisError>

Get the monitor channel of the selected output channel.

§Arguments
  • output_index - Output to query (1 to number of available outputs)
§Returns

The monitor channel index (0-127)

§Errors

Returns NanonisError if communication fails or invalid response received.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let channel = client.user_out_monitor_ch_get(1)?;
println!("Output 1 is monitoring channel {}", channel);
Source

pub fn user_out_val_set( &mut self, output_index: i32, output_value: f32, ) -> Result<(), NanonisError>

Set the value of the selected user output channel.

§Arguments
  • output_index - Output to set (1 to number of available outputs)
  • output_value - Value to apply in physical units
§Errors

Returns NanonisError if invalid output index or communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set output 1 to 2.5V (or appropriate physical unit)
client.user_out_val_set(1, 2.5)?;
Source

pub fn user_out_calibr_set( &mut self, output_index: i32, calibration_per_volt: f32, offset_in_physical_units: f32, ) -> Result<(), NanonisError>

Set the calibration of the selected user output or monitor channel.

§Arguments
  • output_index - Output to configure (1 to number of available outputs)
  • calibration_per_volt - Calibration factor per volt
  • offset_in_physical_units - Offset in physical units
§Errors

Returns NanonisError if invalid parameters or communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set calibration for output 1: 10 units/V with 0.5 unit offset
client.user_out_calibr_set(1, 10.0, 0.5)?;
Source

pub fn user_out_calc_signal_name_set( &mut self, output_index: i32, calculated_signal_name: String, ) -> Result<(), NanonisError>

Set the Calculated Signal name of the selected output channel.

§Arguments
  • output_index - Output to configure (1 to number of available outputs)
  • calculated_signal_name - Name of the calculated signal
§Errors

Returns NanonisError if invalid output index or communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

client.user_out_calc_signal_name_set(1, "MyCalcSignal".to_string())?;
Source

pub fn user_out_calc_signal_name_get( &mut self, output_index: i32, ) -> Result<String, NanonisError>

Get the Calculated Signal name of the selected output channel.

§Arguments
  • output_index - Output to query (1 to number of available outputs)
§Returns

The calculated signal name

§Errors

Returns NanonisError if communication fails or invalid response received.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let name = client.user_out_calc_signal_name_get(1)?;
println!("Calculated signal name: {}", name);
Source

pub fn user_out_calc_signal_config_set( &mut self, output_index: i32, config: CalcSignalConfig, ) -> Result<(), NanonisError>

Set the configuration of the Calculated Signal for the selected output channel.

The configuration is a math operation between 2 signals, or the logarithmic value of one signal.

§Arguments
  • output_index - Output to configure (1 to number of available outputs)
  • config - Calculated signal configuration
§Errors

Returns NanonisError if invalid parameters or communication fails.

§Examples
use nanonis_rs::{NanonisClient, user_out::{CalcSignalConfig, CalcOperation}};

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Configure output 1 to add signals 5 and 10
let config = CalcSignalConfig::new(5, CalcOperation::Add, 10);
client.user_out_calc_signal_config_set(1, config)?;
Source

pub fn user_out_calc_signal_config_get( &mut self, output_index: i32, ) -> Result<CalcSignalConfig, NanonisError>

Get the configuration of the Calculated Signal for the selected output channel.

§Arguments
  • output_index - Output to query (1 to number of available outputs)
§Returns

The calculated signal configuration

§Errors

Returns NanonisError if communication fails or invalid response received.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let config = client.user_out_calc_signal_config_get(1)?;
println!("Signal 1: {}, Operation: {:?}, Signal 2: {}",
         config.signal_1, config.operation, config.signal_2);
Source

pub fn user_out_limits_set( &mut self, output_index: i32, upper_limit: f32, lower_limit: f32, raw_limits: bool, ) -> Result<(), NanonisError>

Set the physical limits (in calibrated units) of the selected output channel.

§Arguments
  • output_index - Output to configure (1 to number of available outputs)
  • upper_limit - Upper physical limit of the user output
  • lower_limit - Lower physical limit of the user output
  • raw_limits - Whether to set physical limits (false) or raw limits (true)
§Errors

Returns NanonisError if invalid parameters or communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set physical limits: -10V to +10V
client.user_out_limits_set(1, 10.0, -10.0, false)?;
Source

pub fn user_out_limits_get( &mut self, output_index: i32, raw_limits: bool, ) -> Result<(f32, f32), NanonisError>

Get the physical limits (in calibrated units) of the selected output channel.

§Arguments
  • output_index - Output to query (1 to number of available outputs)
  • raw_limits - Whether to get physical limits (false) or raw limits (true)
§Returns

A tuple containing (upper_limit, lower_limit)

§Errors

Returns NanonisError if communication fails or invalid response received.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let (upper, lower) = client.user_out_limits_get(1, false)?;
println!("Limits: {} to {}", lower, upper);
Source§

impl NanonisClient

Source

pub fn util_session_path_get(&mut self) -> Result<String, NanonisError>

Get the session path from the Nanonis software.

Returns the current session path where Nanonis stores configuration and data files for the active session.

§Returns

The session path as a String.

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let session_path = client.util_session_path_get()?;
println!("Session path: {}", session_path);
Source

pub fn util_settings_load( &mut self, settings_file_path: &str, load_session_settings: bool, ) -> Result<(), NanonisError>

Load settings from a specified .ini file.

Loads the Nanonis configuration settings from the specified file path. Can also automatically load settings from the session file.

§Arguments
  • settings_file_path - Path to the settings file to load
  • load_session_settings - If true, automatically loads from session file (bypasses path argument)
§Errors

Returns NanonisError if the file doesn’t exist, can’t be read, or communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Load from specific file
client.util_settings_load("/path/to/settings.ini", false)?;

// Or load from session file
client.util_settings_load("", true)?;
Source

pub fn util_settings_save( &mut self, settings_file_path: &str, save_session_settings: bool, ) -> Result<(), NanonisError>

Save current settings to a specified .ini file.

Saves the current Nanonis configuration settings to the specified file path. Can also automatically save to the session file.

§Arguments
  • settings_file_path - Path where the settings file will be saved
  • save_session_settings - If true, automatically saves to session file (bypasses path argument)
§Errors

Returns NanonisError if the file can’t be written or communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Save to specific file
client.util_settings_save("/path/to/settings.ini", false)?;

// Or save to session file
client.util_settings_save("", true)?;
Source

pub fn util_layout_load( &mut self, layout_file_path: &str, load_session_layout: bool, ) -> Result<(), NanonisError>

Load a layout from a specified .ini file.

Loads the Nanonis UI layout configuration from the specified file path. Can also automatically load the layout from the session file.

§Arguments
  • layout_file_path - Path to the layout file to load
  • load_session_layout - If true, automatically loads from session file (bypasses path argument)
§Errors

Returns NanonisError if the file doesn’t exist, can’t be read, or communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Load from specific file
client.util_layout_load("/path/to/layout.ini", false)?;

// Or load from session file
client.util_layout_load("", true)?;
Source

pub fn util_layout_save( &mut self, layout_file_path: &str, save_session_layout: bool, ) -> Result<(), NanonisError>

Save current layout to a specified .ini file.

Saves the current Nanonis UI layout configuration to the specified file path. Can also automatically save to the session file.

§Arguments
  • layout_file_path - Path where the layout file will be saved
  • save_session_layout - If true, automatically saves to session file (bypasses path argument)
§Errors

Returns NanonisError if the file can’t be written or communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Save to specific file
client.util_layout_save("/path/to/layout.ini", false)?;

// Or save to session file
client.util_layout_save("", true)?;
Source

pub fn util_lock(&mut self) -> Result<(), NanonisError>

Lock the Nanonis software interface.

Launches a lock modal window that prevents user interaction with the Nanonis software until it is unlocked manually or through util_unlock(). This is useful for automated experiments where you want to prevent accidental user interference.

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;
use std::thread;
use std::time::Duration;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Lock the interface during automated experiment
client.util_lock()?;

// Perform automated operations
thread::sleep(Duration::from_secs(5));

// Unlock when done
client.util_unlock()?;
Source

pub fn util_unlock(&mut self) -> Result<(), NanonisError>

Unlock the Nanonis software interface.

Closes the lock modal window that prevents user interaction with the Nanonis software. Use this after util_lock() when automated operations are complete.

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Unlock the interface
client.util_unlock()?;
Source

pub fn util_rt_freq_set( &mut self, rt_frequency: f32, ) -> Result<(), NanonisError>

Set the Real Time controller frequency.

Configures the frequency of the Real Time (RT) controller which determines the speed at which the feedback loop and other real-time operations run.

§Arguments
  • rt_frequency - RT frequency in Hz
§Errors

Returns NanonisError if invalid frequency provided or communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set RT frequency to 20 kHz
client.util_rt_freq_set(20000.0)?;
Source

pub fn util_rt_freq_get(&mut self) -> Result<f32, NanonisError>

Get the Real Time controller frequency.

Returns the current frequency of the Real Time (RT) controller.

§Returns

RT frequency in Hz.

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let frequency = client.util_rt_freq_get()?;
println!("RT frequency: {} Hz", frequency);
Source

pub fn util_acq_period_set( &mut self, acquisition_period: f32, ) -> Result<(), NanonisError>

Set the Acquisition Period in the TCP Receiver.

Configures the period at which data is acquired and transmitted via the TCP interface.

§Arguments
  • acquisition_period - Acquisition period in seconds
§Errors

Returns NanonisError if invalid period provided or communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set acquisition period to 100 ms
client.util_acq_period_set(0.1)?;
Source

pub fn util_acq_period_get(&mut self) -> Result<f32, NanonisError>

Get the Acquisition Period from the TCP Receiver.

Returns the current acquisition period configured in the TCP Receiver.

§Returns

Acquisition period in seconds.

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let period = client.util_acq_period_get()?;
println!("Acquisition period: {} s ({} ms)", period, period * 1000.0);
Source

pub fn util_rt_oversampl_set( &mut self, rt_oversampling: i32, ) -> Result<(), NanonisError>

Set the Real-time oversampling in the TCP Receiver.

Configures the oversampling factor for the 24 signals on the RT engine before they are sent to the host. The oversampling affects the maximum Spectrum Analyzer frequency and other displays.

§Arguments
  • rt_oversampling - RT oversampling factor
§Errors

Returns NanonisError if invalid oversampling value or communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set oversampling to 10x
client.util_rt_oversampl_set(10)?;
Source

pub fn util_rt_oversampl_get(&mut self) -> Result<i32, NanonisError>

Get the Real-time oversampling from the TCP Receiver.

Returns the current oversampling factor configured for RT engine signals.

§Returns

RT oversampling factor.

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let oversampling = client.util_rt_oversampl_get()?;
println!("RT oversampling: {}x", oversampling);
Source

pub fn util_quit( &mut self, use_stored_values: bool, settings_name: &str, layout_name: &str, save_signals: bool, ) -> Result<(), NanonisError>

Quit the Nanonis software with options to save settings, layout, and signals.

Provides the same functionality as the dialog that appears when quitting through the File menu. Can save settings, layout, and signal configurations before exiting.

Warning: This will close the Nanonis software and terminate the TCP connection.

§Arguments
  • use_stored_values - If true, uses stored quit preferences (ignores other arguments)
  • settings_name - Name of settings file to save (empty string = don’t save)
  • layout_name - Name of layout file to save (empty string = don’t save)
  • save_signals - If true, saves signal configuration
§Errors

Returns NanonisError if communication fails before quit completes.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Quit without saving anything
client.util_quit(false, "", "", false)?;

// Quit and save everything with stored preferences
// client.util_quit(true, "", "", false)?;

// Quit and save specific settings and layout
// client.util_quit(false, "my_settings", "my_layout", true)?;
Source

pub fn util_version_get(&mut self) -> Result<VersionInfo, NanonisError>

Get version information from the Nanonis software.

Returns detailed version information about the Nanonis system including product line, version string, and release numbers for both host application and RT Engine.

§Returns

A VersionInfo struct containing all version details.

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let version = client.util_version_get()?;
println!("Product: {}", version.product_line);
println!("Version: {}", version.version);
println!("Host release: {}", version.host_app_release);
println!("RT Engine release: {}", version.rt_engine_release);
Source§

impl NanonisClient

Source

pub fn z_ctrl_on_off_set( &mut self, controller_on: bool, ) -> Result<(), NanonisError>

Switch the Z-Controller on or off.

Controls the Z-Controller state. This is fundamental for enabling/disabling tip-sample distance regulation during scanning and positioning operations.

§Arguments
  • controller_on - true to turn controller on, false to turn off
§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Turn Z-controller on for feedback control
client.z_ctrl_on_off_set(true)?;

// Turn Z-controller off for manual positioning
client.z_ctrl_on_off_set(false)?;
Source

pub fn z_ctrl_on_off_get(&mut self) -> Result<bool, NanonisError>

Get the current status of the Z-Controller.

Returns the real-time status from the controller (not from the Z-Controller module). This is useful to ensure the controller is truly off before starting experiments, as there can be communication delays and switch-off delays.

§Returns

true if controller is on, false if controller is off.

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Check controller status before experiment
if client.z_ctrl_on_off_get()? {
    println!("Z-controller is active");
} else {
    println!("Z-controller is off - safe to move tip manually");
}
Source

pub fn z_ctrl_z_pos_set( &mut self, z_position_m: f32, ) -> Result<(), NanonisError>

Set the Z position of the tip.

Important: The Z-controller must be switched OFF to change the tip position. This function directly sets the tip’s Z coordinate for manual positioning.

§Arguments
  • z_position_m - Z position in meters
§Errors

Returns NanonisError if:

  • Z-controller is still active (must be turned off first)
  • Position is outside safe limits
  • Communication fails or protocol error occurs
§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Ensure Z-controller is off
client.z_ctrl_on_off_set(false)?;

// Move tip to specific Z position (10 nm above surface)
client.z_ctrl_z_pos_set(10e-9)?;

// Move tip closer to surface (2 nm)
client.z_ctrl_z_pos_set(2e-9)?;
Source

pub fn z_ctrl_z_pos_get(&mut self) -> Result<f32, NanonisError>

Get the current Z position of the tip.

Returns the current tip Z coordinate in meters. This works whether the Z-controller is on or off.

§Returns

Current Z position in meters.

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let z_pos = client.z_ctrl_z_pos_get()?;
println!("Current tip height: {:.2} nm", z_pos * 1e9);

// Check if tip is at safe distance
if z_pos > 5e-9 {
    println!("Tip is safely withdrawn");
}
Source

pub fn z_ctrl_setpoint_set(&mut self, setpoint: f32) -> Result<(), NanonisError>

Set the setpoint of the Z-Controller.

The setpoint is the target value for the feedback signal that the Z-controller tries to maintain by adjusting the tip-sample distance.

§Arguments
  • setpoint - Z-controller setpoint value (units depend on feedback signal)
§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set tunneling current setpoint to 100 pA
client.z_ctrl_setpoint_set(100e-12)?;

// Set force setpoint for AFM mode
client.z_ctrl_setpoint_set(1e-9)?;  // 1 nN
Source

pub fn z_ctrl_setpoint_get(&mut self) -> Result<f32, NanonisError>

Get the current setpoint of the Z-Controller.

Returns the target value that the Z-controller is trying to maintain.

§Returns

Current Z-controller setpoint value.

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let setpoint = client.z_ctrl_setpoint_get()?;
println!("Current setpoint: {:.3e}", setpoint);
Source

pub fn z_ctrl_gain_set( &mut self, p_gain: f32, time_constant_s: f32, i_gain: f32, ) -> Result<(), NanonisError>

Set the Z-Controller gains and time settings.

Configures the PID controller parameters for Z-axis feedback control. The integral gain is calculated as I = P/T where P is proportional gain and T is the time constant.

§Arguments
  • p_gain - Proportional gain of the regulation loop
  • time_constant_s - Time constant T in seconds
  • i_gain - Integral gain of the regulation loop (calculated as P/T)
§Errors

Returns NanonisError if communication fails or invalid gains provided.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Set moderate feedback gains for stable operation
client.z_ctrl_gain_set(1.0, 0.1, 10.0)?;

// Set aggressive gains for fast response
client.z_ctrl_gain_set(5.0, 0.05, 100.0)?;
Source

pub fn z_ctrl_gain_get(&mut self) -> Result<(f32, f32, f32), NanonisError>

Get the current Z-Controller gains and time settings.

Returns the PID controller parameters currently in use.

§Returns

A tuple containing:

  • f32 - Proportional gain
  • f32 - Time constant in seconds
  • f32 - Integral gain (P/T)
§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let (p_gain, time_const, i_gain) = client.z_ctrl_gain_get()?;
println!("P: {:.3}, T: {:.3}s, I: {:.3}", p_gain, time_const, i_gain);

// Check if gains are in reasonable range
if p_gain > 10.0 {
    println!("Warning: High proportional gain may cause instability");
}
Source

pub fn z_ctrl_home(&mut self) -> Result<(), NanonisError>

Move the tip to its home position.

Moves the tip to the predefined home position, which can be either absolute (fixed position) or relative to the current position, depending on the controller configuration.

§Errors

Returns NanonisError if communication fails or protocol error occurs.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Move tip to home position after experiment
client.z_ctrl_home()?;

// Wait a moment for positioning to complete
std::thread::sleep(std::time::Duration::from_secs(1));

// Check final position
let final_pos = client.z_ctrl_z_pos_get()?;
println!("Tip homed to: {:.2} nm", final_pos * 1e9);
Source

pub fn z_ctrl_withdraw( &mut self, wait_until_finished: bool, timeout_ms: Duration, ) -> Result<(), NanonisError>

Withdraw the tip.

Switches off the Z-Controller and fully withdraws the tip to the upper limit. This is a safety function to prevent tip crashes during approach or when moving to new scan areas.

§Arguments
  • wait_until_finished - If true, waits for withdrawal to complete
  • timeout_ms - Timeout in milliseconds for the withdrawal operation
§Errors

Returns NanonisError if communication fails or withdrawal times out.

§Examples
use nanonis_rs::NanonisClient;
use std::time::Duration;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Emergency withdrawal - don't wait
client.z_ctrl_withdraw(false, Duration::from_secs(5))?;

// Controlled withdrawal with waiting
client.z_ctrl_withdraw(true, Duration::from_secs(10))?;
println!("Tip safely withdrawn");
Source

pub fn z_ctrl_switch_off_delay_set( &mut self, delay_s: f32, ) -> Result<(), NanonisError>

Set the Z-Controller switch-off delay.

Before turning off the controller, the Z position is averaged over this delay. This leads to reproducible Z positions when switching off the controller.

§Arguments
  • delay_s - Switch-off delay in seconds
§Errors

Returns NanonisError if communication fails.

Source

pub fn z_ctrl_switch_off_delay_get(&mut self) -> Result<f32, NanonisError>

Get the Z-Controller switch-off delay.

§Returns

Switch-off delay in seconds.

§Errors

Returns NanonisError if communication fails.

Source

pub fn z_ctrl_home_props_set( &mut self, home_mode: u16, home_position_m: f32, ) -> Result<(), NanonisError>

Set the home position properties.

§Arguments
  • home_mode - Home position mode (0=no change, 1=absolute, 2=relative)
  • home_position_m - Home position in meters
§Errors

Returns NanonisError if communication fails.

Source

pub fn z_ctrl_home_props_get(&mut self) -> Result<(bool, f32), NanonisError>

Get the home position properties.

§Returns

Tuple of (is_relative, home_position_m).

§Errors

Returns NanonisError if communication fails.

Source

pub fn z_ctrl_active_ctrl_set( &mut self, controller_index: i32, ) -> Result<(), NanonisError>

Set the active Z-Controller.

§Arguments
  • controller_index - Controller index from the list
§Errors

Returns NanonisError if communication fails.

Source

pub fn z_ctrl_ctrl_list_get( &mut self, ) -> Result<(Vec<String>, i32), NanonisError>

Get the list of Z-Controllers and active controller index.

§Returns

Tuple of (list of controller names, active controller index).

§Errors

Returns NanonisError if communication fails.

Source

pub fn z_ctrl_withdraw_rate_set( &mut self, rate_m_s: f32, ) -> Result<(), NanonisError>

Set the withdraw slew rate.

§Arguments
  • rate_m_s - Withdraw rate in m/s
§Errors

Returns NanonisError if communication fails.

Source

pub fn z_ctrl_withdraw_rate_get(&mut self) -> Result<f32, NanonisError>

Get the withdraw slew rate.

§Returns

Withdraw rate in m/s.

§Errors

Returns NanonisError if communication fails.

Source

pub fn z_ctrl_limits_enabled_set( &mut self, enabled: bool, ) -> Result<(), NanonisError>

Enable or disable Z position limits.

§Arguments
  • enabled - True to enable limits
§Errors

Returns NanonisError if communication fails.

Source

pub fn z_ctrl_limits_enabled_get(&mut self) -> Result<bool, NanonisError>

Get the Z position limits enabled status.

§Returns

True if limits are enabled.

§Errors

Returns NanonisError if communication fails.

Source

pub fn z_ctrl_limits_set( &mut self, high_limit_m: f32, low_limit_m: f32, ) -> Result<(), NanonisError>

Set the Z position limits.

§Arguments
  • high_limit_m - High Z limit in meters
  • low_limit_m - Low Z limit in meters
§Errors

Returns NanonisError if communication fails.

Source

pub fn z_ctrl_limits_get(&mut self) -> Result<(f32, f32), NanonisError>

Get the Z position limits.

§Returns

Tuple of (high_limit_m, low_limit_m).

§Errors

Returns NanonisError if communication fails.

Source

pub fn z_ctrl_status_get(&mut self) -> Result<ZControllerStatus, NanonisError>

Get the current Z-Controller status.

§Returns

Controller status (1=Off, 2=On, 3=Hold, 4=Switching Off, 5=Safe Tip, 6=Withdrawing).

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn z_spectr_open(&mut self) -> Result<(), NanonisError>

Open the Z Spectroscopy module.

Opens and initializes the Z Spectroscopy module for distance-dependent measurements. This must be called before performing spectroscopy operations.

§Errors

Returns NanonisError if communication fails or module cannot be opened.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Open Z spectroscopy module
client.z_spectr_open()?;
println!("Z Spectroscopy module opened");
Source

pub fn z_spectr_start( &mut self, get_data: bool, save_base_name: &str, ) -> Result<ZSpectroscopyResult, NanonisError>

Start a Z spectroscopy measurement.

Initiates a Z spectroscopy measurement with the configured parameters. The tip is moved through a range of Z positions while recording selected channels.

§Arguments
  • get_data - If true, returns measurement data; if false, only starts measurement
  • save_base_name - Base filename for saving data (empty for no change)
§Returns

If get_data is true, returns a tuple containing:

  • Vec<String> - Channel names
  • Vec<Vec<f32>> - 2D measurement data [rows][columns]
  • Vec<f32> - Fixed parameters and settings
§Errors

Returns NanonisError if communication fails or measurement cannot start.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Start measurement and get data
let (channels, data, params) = client.z_spectr_start(true, "approach_001")?;
println!("Recorded {} channels with {} points", channels.len(), data.len());

// Just start measurement without getting data
let (_, _, _) = client.z_spectr_start(false, "")?;
Source

pub fn z_spectr_stop(&mut self) -> Result<(), NanonisError>

Stop the current Z spectroscopy measurement.

Immediately stops any running Z spectroscopy measurement and returns the tip to its original position.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Start a measurement
let (_, _, _) = client.z_spectr_start(false, "")?;

// Stop it after some condition
client.z_spectr_stop()?;
println!("Z spectroscopy stopped");
Source

pub fn z_spectr_status_get(&mut self) -> Result<bool, NanonisError>

Get the status of Z spectroscopy measurement.

Returns whether a Z spectroscopy measurement is currently running.

§Returns

true if measurement is running, false if stopped.

§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

if client.z_spectr_status_get()? {
    println!("Z spectroscopy is running");
} else {
    println!("Z spectroscopy is stopped");
}
Source

pub fn z_spectr_chs_set( &mut self, channel_indexes: Vec<i32>, ) -> Result<(), NanonisError>

Set the channels to record during Z spectroscopy.

Configures which signals will be recorded during the Z spectroscopy measurement. Channel indexes correspond to the 24 signals assigned in the Signals Manager (0-23).

§Arguments
  • channel_indexes - Vector of channel indexes to record (0-23)
§Errors

Returns NanonisError if communication fails or invalid channel indexes provided.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Record current (0), Z position (1), and bias voltage (2)
client.z_spectr_chs_set(vec![0, 1, 2])?;

// Record more comprehensive dataset
client.z_spectr_chs_set(vec![0, 1, 2, 3, 4, 5])?;
Source

pub fn z_spectr_chs_get( &mut self, ) -> Result<(Vec<i32>, Vec<String>), NanonisError>

Get the channels configured for Z spectroscopy recording.

Returns the channel indexes and names that will be recorded during measurements.

§Returns

A tuple containing:

  • Vec<i32> - Channel indexes (0-23 for Signals Manager slots)
  • Vec<String> - Channel names corresponding to the indexes
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let (indexes, names) = client.z_spectr_chs_get()?;
println!("Recording {} channels:", indexes.len());
for (idx, name) in indexes.iter().zip(names.iter()) {
    println!("  Channel {}: {}", idx, name);
}
Source

pub fn z_spectr_range_set( &mut self, z_offset_m: f32, z_sweep_distance_m: f32, ) -> Result<(), NanonisError>

Set the Z range for spectroscopy measurements.

Configures the Z offset and sweep distance for the spectroscopy measurement. The tip will move from (offset - distance/2) to (offset + distance/2).

§Arguments
  • z_offset_m - Z offset position in meters (center of sweep)
  • z_sweep_distance_m - Total sweep distance in meters
§Errors

Returns NanonisError if communication fails or invalid range parameters.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Sweep ±5 nm around current position
client.z_spectr_range_set(0.0, 10e-9)?;

// Sweep from current position up to +20 nm
client.z_spectr_range_set(10e-9, 20e-9)?;
Source

pub fn z_spectr_range_get(&mut self) -> Result<(f32, f32), NanonisError>

Get the current Z range configuration for spectroscopy.

Returns the configured Z offset and sweep distance.

§Returns

A tuple containing:

  • f32 - Z offset in meters (center position)
  • f32 - Z sweep distance in meters (total range)
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let (offset, distance) = client.z_spectr_range_get()?;
println!("Z sweep: {:.1} nm ± {:.1} nm", offset * 1e9, distance * 1e9 / 2.0);
Source

pub fn z_spectr_timing_set( &mut self, z_averaging_time_s: f32, initial_settling_time_s: f32, maximum_slew_rate_vdivs: f32, settling_time_s: f32, integration_time_s: f32, end_settling_time_s: f32, ) -> Result<(), NanonisError>

Set the timing parameters for Z spectroscopy.

Configures timing-related parameters that control the speed and quality of the Z spectroscopy measurement.

§Arguments
  • z_averaging_time_s - Time to average signals at each Z position
  • initial_settling_time_s - Initial settling time before measurement
  • maximum_slew_rate_vdivs - Maximum slew rate in V/s
  • settling_time_s - Settling time between measurement points
  • integration_time_s - Integration time for each measurement point
  • end_settling_time_s - Settling time at the end of sweep
§Errors

Returns NanonisError if communication fails or invalid timing parameters.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Fast spectroscopy settings
client.z_spectr_timing_set(0.01, 0.1, 1000.0, 0.01, 0.01, 0.1)?;

// High-quality slow spectroscopy
client.z_spectr_timing_set(0.1, 0.5, 100.0, 0.05, 0.05, 0.2)?;
Source

pub fn z_spectr_timing_get( &mut self, ) -> Result<(f32, f32, f32, f32, f32, f32), NanonisError>

Get the current timing parameters for Z spectroscopy.

Returns all timing-related configuration parameters.

§Returns

A tuple containing:

  • f32 - Z averaging time (s)
  • f32 - Initial settling time (s)
  • f32 - Maximum slew rate (V/s)
  • f32 - Settling time (s)
  • f32 - Integration time (s)
  • f32 - End settling time (s)
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let (z_avg, init_settle, slew_rate, settle, integrate, end_settle) =
    client.z_spectr_timing_get()?;
println!("Integration time: {:.3} s, settling: {:.3} s", integrate, settle);
Source

pub fn z_spectr_retract_set( &mut self, enable: bool, threshold: f32, signal_index: i32, comparison: u16, ) -> Result<(), NanonisError>

Set the retraction parameters for tip protection during Z spectroscopy.

Configures automatic tip retraction based on signal thresholds to prevent tip crashes during approach spectroscopy.

§Arguments
  • enable - Enable/disable automatic retraction
  • threshold - Signal threshold value for retraction trigger
  • signal_index - Index of signal to monitor (0-23)
  • comparison - Comparison type: 0=greater than, 1=less than
§Errors

Returns NanonisError if communication fails or invalid parameters.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

// Enable retraction when current exceeds 1 nA (signal 0, greater than)
client.z_spectr_retract_set(true, 1e-9, 0, 0)?;

// Disable retraction
client.z_spectr_retract_set(false, 0.0, 0, 0)?;
Source

pub fn z_spectr_retract_get( &mut self, ) -> Result<(bool, f32, i32, u16), NanonisError>

Get the current retraction configuration for Z spectroscopy.

Returns the tip protection settings that prevent crashes during measurements.

§Returns

A tuple containing:

  • bool - Retraction enabled/disabled
  • f32 - Threshold value for retraction
  • i32 - Signal index being monitored
  • u16 - Comparison type (0=greater, 1=less than)
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let (enabled, threshold, signal_idx, comparison) = client.z_spectr_retract_get()?;
if enabled {
    let comp_str = if comparison == 0 { ">" } else { "<" };
    println!("Retraction: signal[{}] {} {:.3e}", signal_idx, comp_str, threshold);
}
Source

pub fn z_spectr_props_set( &mut self, backward_sweep: u16, num_points: i32, num_sweeps: u16, autosave: u16, show_save_dialog: u16, save_all: u16, ) -> Result<(), NanonisError>

Set the Z spectroscopy properties.

§Arguments
  • backward_sweep - 0=no change, 1=enable backward sweep, 2=disable
  • num_points - Number of points (0=no change)
  • num_sweeps - Number of sweeps to average (0=no change)
  • autosave - 0=no change, 1=enable autosave, 2=disable
  • show_save_dialog - 0=no change, 1=show dialog, 2=don’t show
  • save_all - 0=no change, 1=save individual sweeps, 2=don’t save
§Errors

Returns NanonisError if communication fails.

Source

pub fn z_spectr_props_get( &mut self, ) -> Result<(bool, i32, u16, bool, bool, bool), NanonisError>

Get the Z spectroscopy properties.

Returns the current property configuration.

§Returns

A tuple containing:

  • bool - Backward sweep enabled
  • i32 - Number of points
  • u16 - Number of sweeps to average
  • bool - Autosave enabled
  • bool - Show save dialog
  • bool - Save all individual sweeps
§Errors

Returns NanonisError if communication fails.

§Examples
use nanonis_rs::NanonisClient;

let mut client = NanonisClient::new("127.0.0.1", 6501)?;

let (backward, points, sweeps, autosave, dialog, save_all) =
    client.z_spectr_props_get()?;
println!("Points: {}, Sweeps: {}, Backward: {}", points, sweeps, backward);
Source

pub fn z_spectr_adv_props_set( &mut self, time_between_sweeps_s: f32, record_final_z: u16, lockin_run: u16, reset_z: u16, ) -> Result<(), NanonisError>

Set the advanced Z spectroscopy properties.

§Arguments
  • time_between_sweeps_s - Time between forward and backward sweep
  • record_final_z - 0=no change, 1=on, 2=off
  • lockin_run - 0=no change, 1=on, 2=off
  • reset_z - 0=no change, 1=on, 2=off
§Errors

Returns NanonisError if communication fails.

Source

pub fn z_spectr_adv_props_get( &mut self, ) -> Result<(f32, bool, bool, bool), NanonisError>

Get the advanced Z spectroscopy properties.

§Returns

Tuple of (time_between_sweeps, record_final_z, lockin_run, reset_z).

§Errors

Returns NanonisError if communication fails.

Source

pub fn z_spectr_retract_delay_set( &mut self, delay_s: f32, ) -> Result<(), NanonisError>

Set the retract delay.

§Arguments
  • delay_s - Delay in seconds between forward and backward sweep
§Errors

Returns NanonisError if communication fails.

Source

pub fn z_spectr_retract_delay_get(&mut self) -> Result<f32, NanonisError>

Get the retract delay.

§Returns

Delay in seconds.

§Errors

Returns NanonisError if communication fails.

Source

pub fn z_spectr_retract_second_set( &mut self, condition: i32, threshold: f32, signal_index: i32, comparison: u16, ) -> Result<(), NanonisError>

Set the second retraction condition.

§Arguments
  • condition - 0=no change, 1=disabled, 2=OR, 3=AND, 4=THEN
  • threshold - Threshold value
  • signal_index - Signal index (0-127, -1 for no change)
  • comparison - 0=greater than, 1=less than, 2=no change
§Errors

Returns NanonisError if communication fails.

Source

pub fn z_spectr_retract_second_get( &mut self, ) -> Result<(i32, f32, i32, u16), NanonisError>

Get the second retraction condition.

§Returns

Tuple of (condition, threshold, signal_index, comparison).

§Errors

Returns NanonisError if communication fails.

Source

pub fn z_spectr_dig_sync_set( &mut self, dig_sync: u16, ) -> Result<(), NanonisError>

Set the digital synchronization mode.

§Arguments
  • dig_sync - 0=no change, 1=off, 2=TTL sync, 3=pulse sequence
§Errors

Returns NanonisError if communication fails.

Source

pub fn z_spectr_dig_sync_get(&mut self) -> Result<u16, NanonisError>

Get the digital synchronization mode.

§Returns

Sync mode (0=off, 1=TTL sync, 2=pulse sequence).

§Errors

Returns NanonisError if communication fails.

Source

pub fn z_spectr_ttl_sync_set( &mut self, ttl_line: u16, polarity: u16, time_to_on_s: f32, on_duration_s: f32, ) -> Result<(), NanonisError>

Set the TTL synchronization parameters.

§Arguments
  • ttl_line - 0=no change, 1-4=HS line number
  • polarity - 0=no change, 1=low active, 2=high active
  • time_to_on_s - Time to wait before activation
  • on_duration_s - Duration of activation
§Errors

Returns NanonisError if communication fails.

Source

pub fn z_spectr_ttl_sync_get( &mut self, ) -> Result<(u16, u16, f32, f32), NanonisError>

Get the TTL synchronization parameters.

§Returns

Tuple of (ttl_line, polarity, time_to_on_s, on_duration_s).

§Errors

Returns NanonisError if communication fails.

Source

pub fn z_spectr_pulse_seq_sync_set( &mut self, pulse_seq_nr: u16, num_periods: u32, ) -> Result<(), NanonisError>

Set the pulse sequence synchronization.

§Arguments
  • pulse_seq_nr - Pulse sequence number (0=no change)
  • num_periods - Number of periods
§Errors

Returns NanonisError if communication fails.

Source

pub fn z_spectr_pulse_seq_sync_get( &mut self, ) -> Result<(u16, u32), NanonisError>

Get the pulse sequence synchronization.

§Returns

Tuple of (pulse_seq_nr, num_periods).

§Errors

Returns NanonisError if communication fails.

Source§

impl NanonisClient

Source

pub fn new(addr: &str, port: u16) -> Result<Self, NanonisError>

Create a new client with default configuration.

This is the most convenient way to create a client for basic usage. Uses default timeouts and disables debug logging.

§Arguments
  • addr - Server address (e.g., “127.0.0.1”)
  • port - Server port (e.g., 6501)
§Returns

A connected NanonisClient ready for use.

§Errors

Returns NanonisError if:

  • The address format is invalid
  • Connection to the server fails
  • Connection times out
§Examples
use nanonis_rs::NanonisClient;

let client = NanonisClient::new("127.0.0.1", 6501)?;
Examples found in repository?
examples/hello_world.rs (line 4)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4    let mut client = NanonisClient::new("127.0.0.1", 6501)?;
5
6    let names = client.signal_names_get()?;
7    for (i, name) in names.iter().enumerate() {
8        println!("{}: {}", i, name);
9    }
10
11    Ok(())
12}
More examples
Hide additional examples
examples/scan_props.rs (line 6)
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5
6    let mut client = NanonisClient::new("127.0.0.1", 6501)?;
7
8    println!("=== Scan Properties Test ===\n");
9
10    // Step 1: Read current properties
11    println!("1. Reading current scan properties...");
12    let props_before = client.scan_props_get()?;
13    println!("   Continuous scan: {}", props_before.continuous_scan);
14    println!("   Bouncy scan: {}", props_before.bouncy_scan);
15    println!("   Autosave: {:?}", props_before.autosave);
16    println!("   Series name: {:?}", props_before.series_name);
17    println!("   Comment: {:?}", props_before.comment);
18    println!("   Modules: {:?}", props_before.modules_names);
19    println!("   Autopaste: {:?}", props_before.autopaste);
20    println!();
21
22    // Step 2: Modify properties using builder
23    println!("2. Setting new scan properties...");
24    let new_props = ScanPropsBuilder::new()
25        .continuous_scan(true)         // Enable continuous scan
26        .bouncy_scan(true)             // Enable bouncy scan
27        .autosave(AutosaveMode::Off);  // Disable autosave
28
29    client.scan_props_set(new_props)?;
30    println!("   Properties set successfully");
31    println!();
32
33    // Step 3: Read properties again to verify
34    println!("3. Reading properties again to verify changes...");
35    let props_after = client.scan_props_get()?;
36    println!("   Continuous scan: {}", props_after.continuous_scan);
37    println!("   Bouncy scan: {}", props_after.bouncy_scan);
38    println!("   Autosave: {:?}", props_after.autosave);
39    println!("   Series name: {:?}", props_after.series_name);
40    println!("   Comment: {:?}", props_after.comment);
41    println!("   Modules: {:?}", props_after.modules_names);
42    println!("   Autopaste: {:?}", props_after.autopaste);
43    println!();
44
45    // Step 4: Verify changes
46    println!("4. Verifying changes...");
47    let mut success = true;
48
49    if !props_after.continuous_scan {
50        println!("   ✗ Continuous scan not set correctly");
51        success = false;
52    } else {
53        println!("   ✓ Continuous scan set to On");
54    }
55
56    if !props_after.bouncy_scan {
57        println!("   ✗ Bouncy scan not set correctly");
58        success = false;
59    } else {
60        println!("   ✓ Bouncy scan set to On");
61    }
62
63    if props_after.autosave != AutosaveMode::Off {
64        println!("   ✗ Autosave not set correctly");
65        success = false;
66    } else {
67        println!("   ✓ Autosave set to Off");
68    }
69
70    println!();
71    if success {
72        println!("✓ All properties changed successfully!");
73    } else {
74        println!("✗ Some properties did not change as expected");
75    }
76
77    // Step 5: Restore original properties
78    println!("\n5. Restoring original properties...");
79    let restore = ScanPropsBuilder::new()
80        .continuous_scan(props_before.continuous_scan)
81        .bouncy_scan(props_before.bouncy_scan)
82        .autosave(props_before.autosave);
83    client.scan_props_set(restore)?;
84    println!("   Properties restored");
85
86    Ok(())
87}
Source

pub fn builder() -> NanonisClientBuilder

Create a builder for flexible configuration.

Use this when you need to customize timeouts, enable debug logging, or other advanced configuration options.

§Returns

A NanonisClientBuilder with default settings that can be customized.

§Examples
use std::time::Duration;
use nanonis_rs::NanonisClient;

let client = NanonisClient::builder()
    .address("192.168.1.100")
    .port(6501)
    .debug(true)
    .connect_timeout(Duration::from_secs(30))
    .build()?;
Source

pub fn with_config( addr: &str, config: ConnectionConfig, ) -> Result<Self, NanonisError>

Create a new client with custom configuration (legacy method).

Deprecated: Use NanonisClient::builder() instead for more flexibility.

§Arguments
  • addr - Server address in format “host:port”
  • config - Connection configuration with custom timeouts
Source

pub fn set_debug(&mut self, debug: bool)

Enable or disable debug output

Source

pub fn config(&self) -> &ConnectionConfig

Get the current connection configuration

Source

pub fn quick_send( &mut self, command: &str, args: Vec<NanonisValue>, argument_types: Vec<&str>, return_types: Vec<&str>, ) -> Result<Vec<NanonisValue>, NanonisError>

Send a quick command with minimal response handling.

This is a low-level method for sending custom commands that don’t fit the standard method patterns. Most users should use the specific command methods instead.

Trait Implementations§

Source§

impl Drop for NanonisClient

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.