Skip to content

Read a device#

Hardware is required for USB or saved-token WiFi discovery. Use the Rust CLI for a quick inspection, then use the Rust SDK when you need the hierarchy in an application.

CLI#

enody list
enody info

Rust#

use enody::environment::Environment;
use enody::usb::UsbEnvironment;

#[tokio::main]
async fn main() -> Result<(), enody::Error> {
    let env = UsbEnvironment::new();

    for runtime in env.runtimes() {
        let host = runtime.host().await?;
        println!("Host {} v{}", host.identifier(), host.version());

        for fixture in host.fixtures().await? {
            println!("  Fixture {}", fixture.identifier());
            for source in fixture.sources().await? {
                println!("    Source {}", source.identifier());
                for emitter in source.emitters().await? {
                    println!("      Emitter {}", emitter.identifier());
                }
            }
        }
    }

    Ok(())
}

Example output shape:

Host 00000000-0000-0000-0000-000000000000 v0.2.0
  Fixture 00000000-0000-0000-0000-000000000000
    Source 00000000-0000-0000-0000-000000000000
      Emitter 00000000-0000-0000-0000-000000000000