2 unstable releases
0.2.0 | Nov 3, 2020 |
---|---|
0.1.0 | Jun 16, 2020 |
#6 in #ethercat
Used in ethercat
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.7–2.2MB
~51K SLoC