Skip to content

Commit 54316e0

Browse files
committed
Implement SenderReceiverInterface
1 parent 0fbf839 commit 54316e0

File tree

11 files changed

+918
-208
lines changed

11 files changed

+918
-208
lines changed

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
# Changelog
22

3+
The first name in a bullet point below is the Python class name while the second name is the identifier used in the XML schema (XSD file).
4+
35
Elements marked as `collectable` means that they can be added directly to a package.
46
Non-collectable elements are various sub-elements to collectable elements.
57

6-
The name in the parenthesis after each element is the name used in the XML schema (XSD file).
8+
## Unreleased
9+
10+
### Added
11+
12+
#### XML Port interface elements
13+
14+
* SenderReceiverInterface | SENDER-RECEIVER-INTERFACE | `collectable`
15+
* InvalidationPolicy | INVALIDATION-POLICY
16+
17+
#### XML - Data type elements
18+
19+
* VariableDataPrototype | VARIABLE-DATA-PROTOTYPE
720

821
## [v0.5.1] - 2023-11-09
922

examples/xml/constant/data/constants.arxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
<SHORT-NAME>RecordConstant</SHORT-NAME>
121121
<VALUE-SPEC>
122122
<RECORD-VALUE-SPECIFICATION>
123-
<SHORT-LABEL>Label4</SHORT-LABEL>
123+
<SHORT-LABEL>Label5</SHORT-LABEL>
124124
<FIELDS>
125125
<TEXT-VALUE-SPECIFICATION>
126126
<VALUE>Value1</VALUE>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<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">
3+
<AR-PACKAGES>
4+
<AR-PACKAGE>
5+
<SHORT-NAME>PortInterfaces</SHORT-NAME>
6+
<ELEMENTS>
7+
<SENDER-RECEIVER-INTERFACE>
8+
<SHORT-NAME>HeadLightStatus_I</SHORT-NAME>
9+
<DATA-ELEMENTS>
10+
<VARIABLE-DATA-PROTOTYPE>
11+
<SHORT-NAME>HeadLightStatus</SHORT-NAME>
12+
<TYPE-TREF DEST="IMPLEMENTATION-DATA-TYPE">/DataTypes/ImplementationDataTypes/InactiveActive_T</TYPE-TREF>
13+
</VARIABLE-DATA-PROTOTYPE>
14+
</DATA-ELEMENTS>
15+
</SENDER-RECEIVER-INTERFACE>
16+
</ELEMENTS>
17+
</AR-PACKAGE>
18+
</AR-PACKAGES>
19+
</AUTOSAR>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""
2+
Sender-receiver port interface examples
3+
"""
4+
import os
5+
import autosar
6+
import autosar.xml.element as ar_element
7+
8+
9+
def create_interface_with_one_element():
10+
"""
11+
Creates an array implementation data type with VALUE element
12+
"""
13+
workspace = autosar.xml.Workspace()
14+
packages = dict(zip(["BaseTypes", "ImplementationDataTypes", "PortInterfaces"],
15+
workspace.make_packages("DataTypes/BaseTypes",
16+
"DataTypes/ImplementationDataTypes",
17+
"PortInterfaces")))
18+
uint8_base_type = ar_element.SwBaseType('uint8', size=8)
19+
packages["BaseTypes"].append(uint8_base_type)
20+
sw_data_def_props = ar_element.SwDataDefPropsConditional(base_type_ref=uint8_base_type.ref())
21+
inactive_active_t = ar_element.ImplementationDataType("InactiveActive_T",
22+
category="VALUE",
23+
sw_data_def_props=sw_data_def_props)
24+
packages["ImplementationDataTypes"].append(inactive_active_t)
25+
portinterface = ar_element.SenderReceiverInterface.make_simple("HeadLightStatus_I",
26+
"HeadLightStatus",
27+
type_ref=inactive_active_t.ref())
28+
packages["PortInterfaces"].append(portinterface)
29+
document_path = os.path.abspath(os.path.join(os.path.dirname(
30+
__file__), 'data', 'sender_receiver_interface.arxml'))
31+
workspace.create_document(document_path, packages="/PortInterfaces")
32+
workspace.write_documents()
33+
34+
35+
if __name__ == "__main__":
36+
create_interface_with_one_element()

0 commit comments

Comments
 (0)