autosar-data
This crate provides functionality to read, modify and write Autosar 4 arxml files, both separately and in projects consisting of multiple files.
Features
- read and write arxml files
- fully validate all data when it is loaded
- non-strict mode so that invalid but structurally sound data can be loaded
- various element operations to modify and create sub-elements, data and attributes
- support for Autosar paths and cross references
- all operations are thread safe, e.g. it is possible to load mutliple files on separate threads
- supports Autosar version 4.0.1 and up.
Example
use *;
/* load a multi-file data model */
let model = new;
let = model.load_file?;
let = model.load_file?;
/* load a buffer */
let = model.load_buffer?;
/* write all files of the model */
model.write?;
/* alternatively: */
for file in model.files
/* iterate over all elements in all files */
for in model.elements_dfs
/* get an element by its Autosar path */
let pdu_element = model.get_element_by_path.unwrap;
/* work with the content of elements */
if let Some = pdu_element
.get_sub_element
.and_then
.and_then
/* modify the attributes of an element */
pdu_element.set_attribute_string;
pdu_element.remove_attribute;
Example Programs
Two complete example programs can be found in the examples directory of the source repostitory. They are:
- businfo, which extracts information about bus settings, frames, pdus and signals from an autosar ECU extract
- generate_files, which for each Autosar version generates an arxml file containing a least one instance of every specified element