2 unstable releases

0.2.0 Nov 3, 2020
0.1.0 Jun 16, 2020

#6 in #ethercat

Download history 1/week @ 2024-01-26 5/week @ 2024-02-02 18/week @ 2024-02-09 17/week @ 2024-02-16 56/week @ 2024-02-23 15/week @ 2024-03-01 18/week @ 2024-03-08 13/week @ 2024-03-15 9/week @ 2024-03-22 48/week @ 2024-03-29 29/week @ 2024-04-05

102 downloads per month
Used in ethercat

MIT/Apache

94KB
975 lines

EtherCAT ESI

A library to handle EtherCAT Slave Information (ESI) written in Rust.

License

Copyright 2020 slowtec GmbH

MIT/Apache-2.0


lib.rs:

EtherCAT Slave Information (ESI).

The EtherCAT Slave Information (ESI) file is an XML file that is used by some EtherCAT master stacks to configure the slaves and generate network description files. However, it's main purpose is to describe how data is shared with the slave, including what sync managers it uses, and what PDOs are in each sync manager.

The official XML schema can be found in the EtherCAT Slave Information (ESI) Schema (see EtherCATInfo.xsd).

Example

use ethercat_esi::EtherCatInfo;
use std::{
    env,
    fs::File,
    io::{self, prelude::*},
};

fn main() -> io::Result<()> {
    match env::args().nth(1) {
        None => {
            eprintln!("Missing filename");
        }
        Some(file_name) => {
            let mut xml_file = File::open(file_name)?;
            let mut xml_string = String::new();
            xml_file.read_to_string(&mut xml_string)?;
            let info = EtherCatInfo::from_xml_str(&xml_string)?;
            println!("{:#?}", info);
        }
    }
    Ok(())
}

Dependencies

~1.6–2.2MB
~49K SLoC