-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
918 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
examples/xml/port_interface/data/sender_receiver_interface.arxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<AUTOSAR xsi:schemaLocation="http://autosar.org/schema/r4.0 AUTOSAR_00051.xsd" xmlns="http://autosar.org/schema/r4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<AR-PACKAGES> | ||
<AR-PACKAGE> | ||
<SHORT-NAME>PortInterfaces</SHORT-NAME> | ||
<ELEMENTS> | ||
<SENDER-RECEIVER-INTERFACE> | ||
<SHORT-NAME>HeadLightStatus_I</SHORT-NAME> | ||
<DATA-ELEMENTS> | ||
<VARIABLE-DATA-PROTOTYPE> | ||
<SHORT-NAME>HeadLightStatus</SHORT-NAME> | ||
<TYPE-TREF DEST="IMPLEMENTATION-DATA-TYPE">/DataTypes/ImplementationDataTypes/InactiveActive_T</TYPE-TREF> | ||
</VARIABLE-DATA-PROTOTYPE> | ||
</DATA-ELEMENTS> | ||
</SENDER-RECEIVER-INTERFACE> | ||
</ELEMENTS> | ||
</AR-PACKAGE> | ||
</AR-PACKAGES> | ||
</AUTOSAR> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
""" | ||
Sender-receiver port interface examples | ||
""" | ||
import os | ||
import autosar | ||
import autosar.xml.element as ar_element | ||
|
||
|
||
def create_interface_with_one_element(): | ||
""" | ||
Creates an array implementation data type with VALUE element | ||
""" | ||
workspace = autosar.xml.Workspace() | ||
packages = dict(zip(["BaseTypes", "ImplementationDataTypes", "PortInterfaces"], | ||
workspace.make_packages("DataTypes/BaseTypes", | ||
"DataTypes/ImplementationDataTypes", | ||
"PortInterfaces"))) | ||
uint8_base_type = ar_element.SwBaseType('uint8', size=8) | ||
packages["BaseTypes"].append(uint8_base_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", | ||
sw_data_def_props=sw_data_def_props) | ||
packages["ImplementationDataTypes"].append(inactive_active_t) | ||
portinterface = ar_element.SenderReceiverInterface.make_simple("HeadLightStatus_I", | ||
"HeadLightStatus", | ||
type_ref=inactive_active_t.ref()) | ||
packages["PortInterfaces"].append(portinterface) | ||
document_path = os.path.abspath(os.path.join(os.path.dirname( | ||
__file__), 'data', 'sender_receiver_interface.arxml')) | ||
workspace.create_document(document_path, packages="/PortInterfaces") | ||
workspace.write_documents() | ||
|
||
|
||
if __name__ == "__main__": | ||
create_interface_with_one_element() |
Oops, something went wrong.