OptrisOptrisDocumentation

Documentation/OTC SDK/optris_sdk — Rust API referencev12.0

HotplugMonitor

pub struct HotplugMonitor

A running hotplug monitor.

Stops when dropped, which waits for any callback in flight to return.

Examples

# fn main() -> optris_sdk::Result<()> {
let _monitor = optris_sdk::HotplugMonitor::start(|device, arrived| {
    if arrived {
        println!("{} appeared", device.serial);
    } else {
        println!("{} went away", device.serial);
    }
})?;

std::thread::sleep(std::time::Duration::from_secs(30));
// Dropping the monitor stops it.
# Ok(())
# }

HotplugMonitor — methods

pub fn is_running() -> Result<bool>

Whether a monitor is running, as the SDK sees it.

Errors

Returns whatever the SDK reports if it cannot answer.