Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
cogu committed Oct 23, 2023
1 parent 73dd0ac commit 23aab03
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ It has some support for parsing ARXML files.

Python AUTOSAR v0.5+ uses a new API and is incompatible with previous versions.

Currently, only AUTOSAR data types are supported. If you want a full API, wait for v0.6.0.

For Python AUTOSAR v0.4, see the [v0.4 maintenance branch](https://github.com/cogu/autosar/tree/maintenance/0.4).

### Key features

* New class hierachy
* Attempt to follow the AUTOSAR XML schema file where possible.
* Follow the structure of the AUTOSAR XML schema where possible.
* Snake-case naming of variables and methods (Follow PEP8 standard).
* Modern type hinting (this unfortunately requires Python 3.10 or later).
* Python Enum classes for enumeration types.
Expand Down Expand Up @@ -65,6 +67,8 @@ cd ..
python -m pip install cfile_0.3
```

You can delete the directory `cfile_0.3` after install.

### Standard install

```bash
Expand Down Expand Up @@ -190,16 +194,17 @@ workspace = autosar.xml.Workspace()
packages = dict(zip(["BaseTypes", "ImplementationDataTypes"],
workspace.make_packages("DataTypes/BaseTypes",
"DataTypes/ImplementationDataTypes")))
uint8_base_type = ar_element.SwBaseType("uint8")

#Create new base type
uint8_base_type = ar_element.SwBaseType("uint8")
# Taking a reference before element is added to a package returns None
print(uint8_base_type.ref())
# Add base type to package
packages["BaseTypes"].append(uint8_base_type)
# Taking a reference after element is added to package returns a SwBaseTypeRef object
print(uint8_base_type.ref())

# Add implementation data type to package
# Create new implementation data type
sw_data_def_props = ar_element.SwDataDefPropsConditional(base_type_ref=uint8_base_type.ref())
inactive_active_t = ar_element.ImplementationDataType("InactiveActive_T",
category="VALUE",
Expand All @@ -211,7 +216,6 @@ element = workspace.find("/DataTypes/ImplementationDataTypes/InactiveActive_T")
print(f"{element.name}: {str(type(element))}")
```


Output

```text
Expand Down Expand Up @@ -262,7 +266,7 @@ workspace.write_documents(scehema_version=48)

### Reading XML files

Use the Reader class to read ARXML from files or strings. The read-methods produces `Document` objects.
Use the Reader class to read ARXML from files or strings. The read-methods produce `Document` objects.

```python
import os
Expand Down Expand Up @@ -347,7 +351,6 @@ typedef uint8 InactiveActive_T;
#endif // RTE_TYPE_H_
```


## Python Module Hierachy

### autosar.xml
Expand All @@ -361,11 +364,11 @@ Implementation model, an intermediate model between XML and RTE generation.
### autosar.generator

RTE generators. Right now it only has a generator for the RTE type header.
This part is in early stages of development and is probably not very useful to anyone.
This part is in early stages of development and is probably not very useful.

## Development Roadmap

Below is a very rough roadmap of planned releases.
Below is a rough roadmap of planned releases.

**v0.5.0:** Data types

Expand All @@ -382,4 +385,3 @@ Below is a very rough roadmap of planned releases.
**v0.5.?:** System description

**v0.6.0:** First stable release. Publish to PyPI.

0 comments on commit 23aab03

Please sign in to comment.