armodel 1.4.3__py3-none-any.whl → 1.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- armodel/cli/arxml_dump_cli.py +1 -1
- armodel/models/ar_package.py +131 -23
- armodel/models/ar_ref.py +28 -5
- armodel/models/bsw_module_template.py +29 -14
- armodel/models/common_structure.py +38 -23
- armodel/models/fibex/__init__.py +0 -0
- armodel/models/fibex/can_communication.py +6 -0
- armodel/models/fibex/fibex_4_multiplatform.py +145 -0
- armodel/models/fibex/fibex_core.py +341 -0
- armodel/models/fibex/lin_communication.py +17 -0
- armodel/models/fibex/lin_topology.py +7 -0
- armodel/models/general_structure.py +19 -3
- armodel/models/implementation.py +4 -5
- armodel/models/internal_behavior.py +63 -0
- armodel/models/mode_declaration.py +8 -0
- armodel/models/port_prototype.py +20 -2
- armodel/models/rpt_scenario.py +20 -0
- armodel/models/sw_component.py +99 -36
- armodel/models/system_template/__init__.py +0 -0
- armodel/models/system_template/network_management.py +7 -0
- armodel/models/system_template/transport_protocols.py +7 -0
- armodel/models/timing.py +91 -0
- armodel/parser/abstract_arxml_parser.py +1 -1
- armodel/parser/arxml_parser.py +329 -72
- armodel/tests/test_armodel/models/test_data_prototype.py +1 -1
- armodel/tests/test_armodel/models/test_datatype.py +7 -7
- armodel/tests/test_armodel/models/test_port_interface.py +5 -5
- armodel/tests/test_armodel/parser/test_parse_bswmd.py +13 -5
- armodel/tests/test_armodel/parser/test_sw_components.py +4 -4
- armodel/writer/arxml_writer.py +250 -21
- {armodel-1.4.3.dist-info → armodel-1.5.0.dist-info}/METADATA +25 -1
- {armodel-1.4.3.dist-info → armodel-1.5.0.dist-info}/RECORD +36 -23
- {armodel-1.4.3.dist-info → armodel-1.5.0.dist-info}/LICENSE +0 -0
- {armodel-1.4.3.dist-info → armodel-1.5.0.dist-info}/WHEEL +0 -0
- {armodel-1.4.3.dist-info → armodel-1.5.0.dist-info}/entry_points.txt +0 -0
- {armodel-1.4.3.dist-info → armodel-1.5.0.dist-info}/top_level.txt +0 -0
|
@@ -42,7 +42,7 @@ class Test_M2_AUTOSARTemplates_SWComponentTemplate_Datatype_DataPrototypes:
|
|
|
42
42
|
assert(isinstance(prototype, MultilanguageReferrable))
|
|
43
43
|
assert(isinstance(prototype, Referrable))
|
|
44
44
|
|
|
45
|
-
assert(prototype.
|
|
45
|
+
assert(prototype._parent == ar_root)
|
|
46
46
|
assert(prototype.short_name == "prototype")
|
|
47
47
|
assert(prototype.type_tref is None)
|
|
48
48
|
|
|
@@ -26,7 +26,7 @@ class Test_M2_AUTOSARTemplates_CommonStructure_Implementation:
|
|
|
26
26
|
assert(isinstance(prototype, Referrable))
|
|
27
27
|
assert(isinstance(prototype, SymbolProps))
|
|
28
28
|
|
|
29
|
-
assert(prototype.
|
|
29
|
+
assert(prototype._parent == ar_root)
|
|
30
30
|
assert(prototype.short_name == "SymbolProps")
|
|
31
31
|
assert(prototype.symbol == "")
|
|
32
32
|
|
|
@@ -52,7 +52,7 @@ class Test_M2_MSR_AsamHdo_BaseTypes:
|
|
|
52
52
|
assert(isinstance(base_type, Referrable))
|
|
53
53
|
assert(isinstance(base_type, SwBaseType))
|
|
54
54
|
|
|
55
|
-
assert(base_type.
|
|
55
|
+
assert(base_type._parent == ar_root)
|
|
56
56
|
assert(base_type.short_name == "SwBaseType")
|
|
57
57
|
assert(isinstance(base_type.baseTypeDefinition, BaseTypeDirectDefinition))
|
|
58
58
|
|
|
@@ -97,7 +97,7 @@ class Test_M2_AUTOSARTemplates_SWComponentTemplate_Datatype_Datatypes:
|
|
|
97
97
|
assert(isinstance(data_type, Referrable))
|
|
98
98
|
assert(isinstance(data_type, ApplicationPrimitiveDataType))
|
|
99
99
|
|
|
100
|
-
assert(data_type.
|
|
100
|
+
assert(data_type._parent == ar_root)
|
|
101
101
|
assert(data_type.short_name == "ApplicationPrimitiveDataType")
|
|
102
102
|
assert(data_type.sw_data_def_props == None)
|
|
103
103
|
|
|
@@ -128,7 +128,7 @@ class Test_M2_AUTOSARTemplates_SWComponentTemplate_Datatype_Datatypes:
|
|
|
128
128
|
assert(isinstance(data_type, Referrable))
|
|
129
129
|
assert(isinstance(data_type, ApplicationArrayDataType))
|
|
130
130
|
|
|
131
|
-
assert(data_type.
|
|
131
|
+
assert(data_type._parent == ar_root)
|
|
132
132
|
assert(data_type.short_name == "ApplicationArrayDataType")
|
|
133
133
|
assert(data_type.dynamic_array_size_profile == None)
|
|
134
134
|
assert(data_type.element == None)
|
|
@@ -153,7 +153,7 @@ class Test_M2_AUTOSARTemplates_SWComponentTemplate_Datatype_Datatypes:
|
|
|
153
153
|
assert(isinstance(data_type, Referrable))
|
|
154
154
|
assert(isinstance(data_type, ApplicationRecordDataType))
|
|
155
155
|
|
|
156
|
-
assert(data_type.
|
|
156
|
+
assert(data_type._parent == ar_root)
|
|
157
157
|
assert(data_type.short_name == "ApplicationRecordDataType")
|
|
158
158
|
|
|
159
159
|
element = data_type.createApplicationRecordElement("element")
|
|
@@ -185,7 +185,7 @@ class Test_M2_AUTOSARTemplates_SWComponentTemplate_Datatype_Datatypes:
|
|
|
185
185
|
assert(isinstance(data_type_mapping_set, Referrable))
|
|
186
186
|
assert(isinstance(data_type_mapping_set, DataTypeMappingSet))
|
|
187
187
|
|
|
188
|
-
assert(data_type_mapping_set.
|
|
188
|
+
assert(data_type_mapping_set._parent == ar_root)
|
|
189
189
|
assert(data_type_mapping_set.short_name == "DataTypeMappingSet")
|
|
190
190
|
assert(len(data_type_mapping_set._dataTypeMaps) == 0)
|
|
191
191
|
|
|
@@ -224,7 +224,7 @@ class Test_M2_AUTOSARTemplates_CommonStructure_ImplementationDataTypes:
|
|
|
224
224
|
assert(isinstance(data_type, Referrable))
|
|
225
225
|
assert(isinstance(data_type, ImplementationDataType))
|
|
226
226
|
|
|
227
|
-
assert(data_type.
|
|
227
|
+
assert(data_type._parent == ar_root)
|
|
228
228
|
assert(data_type.short_name == "ImplementationDataType")
|
|
229
229
|
assert(data_type.sub_elements == [])
|
|
230
230
|
assert(data_type.symbol_props == None)
|
|
@@ -40,7 +40,7 @@ class Test_M2_AUTOSARTemplates_SWComponentTemplate_PortInterface:
|
|
|
40
40
|
assert(isinstance(data_if, Referrable))
|
|
41
41
|
assert(isinstance(data_if, NvDataInterface))
|
|
42
42
|
|
|
43
|
-
assert(data_if.
|
|
43
|
+
assert(data_if._parent == ar_root)
|
|
44
44
|
assert(data_if.short_name == "NvDataInterface")
|
|
45
45
|
|
|
46
46
|
def test_ParameterInterface(self):
|
|
@@ -63,7 +63,7 @@ class Test_M2_AUTOSARTemplates_SWComponentTemplate_PortInterface:
|
|
|
63
63
|
assert(isinstance(data_if, Referrable))
|
|
64
64
|
assert(isinstance(data_if, ParameterInterface))
|
|
65
65
|
|
|
66
|
-
assert(data_if.
|
|
66
|
+
assert(data_if._parent == ar_root)
|
|
67
67
|
assert(data_if.short_name == "ParameterInterface")
|
|
68
68
|
|
|
69
69
|
def test_SenderReceiverInterface(self):
|
|
@@ -87,7 +87,7 @@ class Test_M2_AUTOSARTemplates_SWComponentTemplate_PortInterface:
|
|
|
87
87
|
assert(isinstance(sr_if, SenderReceiverInterface))
|
|
88
88
|
|
|
89
89
|
assert(sr_if.short_name == "sr_if")
|
|
90
|
-
assert(sr_if.
|
|
90
|
+
assert(sr_if._parent == ar_root)
|
|
91
91
|
assert(len(sr_if.getDataElements()) == 0)
|
|
92
92
|
|
|
93
93
|
element = sr_if.createDataElement("element")
|
|
@@ -117,7 +117,7 @@ class Test_M2_AUTOSARTemplates_SWComponentTemplate_PortInterface:
|
|
|
117
117
|
assert(isinstance(prototype, Referrable))
|
|
118
118
|
assert(isinstance(prototype, ArgumentDataPrototype))
|
|
119
119
|
|
|
120
|
-
assert(prototype.
|
|
120
|
+
assert(prototype._parent == ar_root)
|
|
121
121
|
assert(prototype.short_name == "ArgumentDataPrototype")
|
|
122
122
|
assert(prototype.direction == "")
|
|
123
123
|
assert(prototype.server_argument_impl_policy == "")
|
|
@@ -133,7 +133,7 @@ class Test_M2_AUTOSARTemplates_SWComponentTemplate_PortInterface:
|
|
|
133
133
|
assert(isinstance(app_error, Referrable))
|
|
134
134
|
assert(isinstance(app_error, ApplicationError))
|
|
135
135
|
|
|
136
|
-
assert(app_error.
|
|
136
|
+
assert(app_error._parent == ar_root)
|
|
137
137
|
assert(app_error.short_name == "ApplicationError")
|
|
138
138
|
|
|
139
139
|
def test_ClientServerOperation(self):
|
|
@@ -73,7 +73,7 @@ class TestBswMD:
|
|
|
73
73
|
entity = behavior.getBswSchedulableEntities()[0]
|
|
74
74
|
assert(entity.short_name == "BswM_MainFunction")
|
|
75
75
|
assert(entity.minimum_start_interval is not None)
|
|
76
|
-
assert(entity.
|
|
76
|
+
assert(entity.minimumStartIntervalMs is not None)
|
|
77
77
|
assert(len(entity.getCanEnterExclusiveAreaRefs()) == 1)
|
|
78
78
|
assert(entity.getCanEnterExclusiveAreaRefs()[0].dest == "EXCLUSIVE-AREA")
|
|
79
79
|
assert(entity.getCanEnterExclusiveAreaRefs()[0].value == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0/SCHM_BSWM_EXCLUSIVE_AREA")
|
|
@@ -153,16 +153,16 @@ class TestBswMD:
|
|
|
153
153
|
|
|
154
154
|
assert(impl.programming_language.getValue() == "C")
|
|
155
155
|
|
|
156
|
-
assert(impl.
|
|
157
|
-
assert(len(impl.
|
|
156
|
+
assert(impl.resource_consumption.short_name == "ResourceConsumption")
|
|
157
|
+
assert(len(impl.resource_consumption.getMemorySections()) == 8)
|
|
158
158
|
|
|
159
|
-
section = impl.
|
|
159
|
+
section = impl.resource_consumption.getMemorySection("CODE")
|
|
160
160
|
assert(section.short_name == "CODE")
|
|
161
161
|
assert(section.alignment == None)
|
|
162
162
|
assert(section.swAddrMethodRef.dest == "SW-ADDR-METHOD")
|
|
163
163
|
assert(section.swAddrMethodRef.value == "/AUTOSAR_MemMap/SwAddrMethods/CODE")
|
|
164
164
|
|
|
165
|
-
section = impl.
|
|
165
|
+
section = impl.resource_consumption.getMemorySection("VAR_NO_INIT_UNSPECIFIED")
|
|
166
166
|
assert(section.short_name == "VAR_NO_INIT_UNSPECIFIED")
|
|
167
167
|
assert(section.alignment.getText() == "UNSPECIFIED")
|
|
168
168
|
assert(section.swAddrMethodRef.dest == "SW-ADDR-METHOD")
|
|
@@ -188,5 +188,13 @@ class TestBswMD:
|
|
|
188
188
|
|
|
189
189
|
assert(filecmp.cmp("src/armodel/tests/test_files/SoftwareComponents.arxml", "data/generated.arxml", shallow = False) == True)
|
|
190
190
|
|
|
191
|
+
def test_bswm_bswmd_arxml_loading_and_saving(self):
|
|
192
|
+
document = AUTOSAR.getInstance()
|
|
193
|
+
document.clear()
|
|
194
|
+
parser = ARXMLParser()
|
|
195
|
+
parser.load("src/armodel/tests/test_files/BswM_Bswmd.arxml", document)
|
|
191
196
|
|
|
197
|
+
writer = ARXMLWriter()
|
|
198
|
+
writer.save("data/generated_BswM_Bswmd.arxml", document)
|
|
192
199
|
|
|
200
|
+
assert(filecmp.cmp("src/armodel/tests/test_files/BswM_Bswmd.arxml", "data/generated_BswM_Bswmd.arxml", shallow = False) == True)
|
|
@@ -75,16 +75,16 @@ class TestSWComponents:
|
|
|
75
75
|
|
|
76
76
|
assert(filecmp.cmp("src/armodel/tests/test_files/AUTOSAR_Datatypes.arxml", "data/generated_AUTOSAR_Datatypes.arxml", shallow = False) == True)
|
|
77
77
|
|
|
78
|
-
def
|
|
78
|
+
def test_bswm_mode_arxml_loading_and_saving(self):
|
|
79
79
|
document = AUTOSAR.getInstance()
|
|
80
80
|
document.clear()
|
|
81
81
|
parser = ARXMLParser()
|
|
82
|
-
parser.load("src/armodel/tests/test_files/
|
|
82
|
+
parser.load("src/armodel/tests/test_files/BswMMode.arxml", document)
|
|
83
83
|
|
|
84
84
|
writer = ARXMLWriter()
|
|
85
|
-
writer.save("data/
|
|
85
|
+
writer.save("data/generated_AUTOSAR_Datatypes.arxml", document)
|
|
86
86
|
|
|
87
|
-
assert(filecmp.cmp("src/armodel/tests/test_files/
|
|
87
|
+
assert(filecmp.cmp("src/armodel/tests/test_files/BswMMode.arxml", "data/generated_AUTOSAR_Datatypes.arxml", shallow = False) == True)
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
|
armodel/writer/arxml_writer.py
CHANGED
|
@@ -2,8 +2,16 @@ import xml.etree.cElementTree as ET
|
|
|
2
2
|
|
|
3
3
|
from typing import List
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
|
|
5
|
+
from ..models.fibex.fibex_4_multiplatform import Gateway, ISignalMapping
|
|
6
|
+
|
|
7
|
+
from ..models.fibex.can_communication import CanFrame
|
|
8
|
+
from ..models.fibex.fibex_core import DcmIPdu, Frame, ISignal, NPdu, NmPdu
|
|
9
|
+
from ..models.fibex.lin_communication import LinUnconditionalFrame
|
|
10
|
+
from ..models.fibex.lin_topology import LinCluster
|
|
11
|
+
from ..models.system_template.network_management import NmConfig
|
|
12
|
+
from ..models.system_template.transport_protocols import CanTpConfig
|
|
13
|
+
from ..models.internal_behavior import IncludedDataTypeSet, InternalBehavior
|
|
14
|
+
from ..models.timing import EOCExecutableEntityRef, ExecutionOrderConstraint, SwcTiming, TimingExtension
|
|
7
15
|
from ..models.data_def_properties import ValueList
|
|
8
16
|
from ..models.multilanguage_data import MultiLanguageOverviewParagraph, MultilanguageLongName
|
|
9
17
|
from ..models.record_layout import SwRecordLayout, SwRecordLayoutGroup, SwRecordLayoutV
|
|
@@ -12,29 +20,29 @@ from ..models.service_needs import NvBlockNeeds, RoleBasedDataAssignment
|
|
|
12
20
|
from ..models.data_prototype import ApplicationArrayElement, ApplicationCompositeElementDataPrototype, ApplicationRecordElement, AutosarDataPrototype, DataPrototype, ParameterDataPrototype, VariableDataPrototype
|
|
13
21
|
from ..models.bsw_module_template import BswCalledEntity, BswEvent, BswInternalBehavior, BswModeSenderPolicy, BswModuleDescription, BswModuleEntity, BswModuleEntry, BswSchedulableEntity, BswScheduleEvent, BswTimingEvent
|
|
14
22
|
from ..models.ar_package import AUTOSAR
|
|
15
|
-
from ..models.sw_component import ApplicationSwComponentType, AtomicSwComponentType, ComplexDeviceDriverSwComponentType, DataReceivedEvent, EcuAbstractionSwComponentType, InternalTriggerOccurredEvent, OperationInvokedEvent, ParameterAccess, PortAPIOption, PortGroup, RTEEvent, ServerCallPoint, ServiceDependency, ServiceSwComponentType, SwcModeSwitchEvent, SwcServiceDependency, SynchronousServerCallPoint, VariableAccess
|
|
23
|
+
from ..models.sw_component import ApplicationSwComponentType, AtomicSwComponentType, ComplexDeviceDriverSwComponentType, DataReceivedEvent, EcuAbstractionSwComponentType, InitEvent, InternalTriggerOccurredEvent, OperationInvokedEvent, ParameterAccess, PortAPIOption, PortGroup, RTEEvent, ServerCallPoint, ServiceDependency, ServiceSwComponentType, SwcModeSwitchEvent, SwcServiceDependency, SynchronousServerCallPoint, VariableAccess
|
|
16
24
|
from ..models.ar_package import ARPackage
|
|
17
|
-
from ..models.ar_ref import ApplicationCompositeElementInPortInterfaceInstanceRef, AutosarParameterRef, AutosarVariableRef, InnerPortGroupInCompositionInstanceRef, POperationInAtomicSwcInstanceRef, PPortInCompositionInstanceRef, RModeInAtomicSwcInstanceRef, ROperationInAtomicSwcInstanceRef, RPortInCompositionInstanceRef, RVariableInAtomicSwcInstanceRef, VariableDataPrototypeInSystemInstanceRef
|
|
25
|
+
from ..models.ar_ref import ApplicationCompositeElementInPortInterfaceInstanceRef, AutosarParameterRef, AutosarVariableRef, InnerPortGroupInCompositionInstanceRef, POperationInAtomicSwcInstanceRef, PPortInCompositionInstanceRef, RModeGroupInAtomicSWCInstanceRef, RModeInAtomicSwcInstanceRef, ROperationInAtomicSwcInstanceRef, RPortInCompositionInstanceRef, RVariableInAtomicSwcInstanceRef, RefType, VariableDataPrototypeInSystemInstanceRef
|
|
18
26
|
from ..models.calibration import SwAxisGrouped, SwAxisIndividual, SwCalprmAxis, SwCalprmAxisSet, SwValueCont, SwValues
|
|
19
|
-
from ..models.common_structure import ApplicationValueSpecification, ArrayValueSpecification, ConstantReference, ModeDeclaration, ModeDeclarationGroup, ModeDeclarationGroupPrototype, NumericalValueSpecification, RecordValueSpecification, TextValueSpecification, ValueSpecification
|
|
27
|
+
from ..models.common_structure import ApplicationValueSpecification, ArrayValueSpecification, ConstantReference, IncludedModeDeclarationGroupSet, ModeDeclaration, ModeDeclarationGroup, ModeDeclarationGroupPrototype, NumericalValueSpecification, RecordValueSpecification, TextValueSpecification, ValueSpecification
|
|
20
28
|
from ..models.communication import CompositeNetworkRepresentation, TransmissionAcknowledgementRequest
|
|
21
29
|
from ..models.data_dictionary import SwAddrMethod, SwDataDefProps
|
|
22
30
|
from ..models.datatype import ApplicationArrayDataType, ApplicationCompositeDataType, ApplicationDataType, ApplicationPrimitiveDataType, ApplicationRecordDataType, AutosarDataType, BaseTypeDirectDefinition, DataTypeMappingSet, ImplementationDataType, SwBaseType
|
|
23
31
|
from ..models.general_structure import ARElement, AdminData, Identifiable, Limit, MultilanguageReferrable, Referrable, Sdg, SwcBswMapping, SwcBswRunnableMapping
|
|
24
32
|
from ..models.m2_msr import CompuConstTextContent, CompuMethod, CompuNominatorDenominator, CompuScale, CompuScaleConstantContents, CompuScaleRationalFormula, CompuScales
|
|
25
|
-
from ..models.port_prototype import ClientComSpec, NonqueuedReceiverComSpec, NonqueuedSenderComSpec, PPortComSpec, PPortPrototype, PortPrototype, QueuedReceiverComSpec, RPortComSpec, RPortPrototype, ReceiverComSpec, SenderComSpec, ServerComSpec
|
|
33
|
+
from ..models.port_prototype import ClientComSpec, ModeSwitchReceiverComSpec, NonqueuedReceiverComSpec, NonqueuedSenderComSpec, PPortComSpec, PPortPrototype, PortPrototype, QueuedReceiverComSpec, RPortComSpec, RPortPrototype, ReceiverComSpec, SenderComSpec, ServerComSpec
|
|
26
34
|
from ..models.sw_component import AssemblySwConnector, CompositionSwComponentType, DelegationSwConnector, SwComponentPrototype, SwComponentType, SwConnector
|
|
27
35
|
from ..models.annotation import Annotation
|
|
28
36
|
from ..models.end_to_end_protection import EndToEndDescription, EndToEndProtection, EndToEndProtectionSet, EndToEndProtectionVariablePrototype
|
|
29
37
|
from ..models.port_interface import ApplicationError, ClientServerInterface, ClientServerOperation, ModeSwitchInterface, PortInterface, SenderReceiverInterface, TriggerInterface
|
|
30
38
|
from ..models.unit import Unit
|
|
31
39
|
from ..models.implementation import AutosarEngineeringObject, BswImplementation, Code, EngineeringObject, Implementation, SwcImplementation
|
|
32
|
-
from ..models.common_structure import ConstantSpecification, ExecutableEntity,
|
|
40
|
+
from ..models.common_structure import ConstantSpecification, ExecutableEntity, ResourceConsumption
|
|
33
41
|
from ..models.sw_component import RunnableEntity, SwcInternalBehavior, TimingEvent
|
|
34
42
|
from ..models.ar_object import ARLiteral
|
|
35
43
|
from ..models.global_constraints import DataConstr, InternalConstrs, PhysConstrs
|
|
36
44
|
|
|
37
|
-
|
|
45
|
+
from .abstract_arxml_writer import AbstractARXMLWriter
|
|
38
46
|
class ARXMLWriter(AbstractARXMLWriter):
|
|
39
47
|
def __init__(self, options=None) -> None:
|
|
40
48
|
super().__init__(options)
|
|
@@ -45,20 +53,25 @@ class ARXMLWriter(AbstractARXMLWriter):
|
|
|
45
53
|
|
|
46
54
|
return sub_element
|
|
47
55
|
|
|
48
|
-
def
|
|
56
|
+
def writeSds(self, parent: ET.Element, sdg: Sdg):
|
|
49
57
|
for sd in sdg.getSds():
|
|
50
58
|
sd_tag = ET.SubElement(parent, "SD")
|
|
51
59
|
sd_tag.attrib['GID'] = sd.gid
|
|
52
60
|
sd_tag.text = sd.value
|
|
53
|
-
|
|
54
|
-
def
|
|
61
|
+
|
|
62
|
+
def setSdg(self, parent: ET.Element, sdg: Sdg):
|
|
63
|
+
if sdg is not None:
|
|
64
|
+
sdg_tag = ET.SubElement(parent, "SDG")
|
|
65
|
+
sdg_tag.attrib['GID'] = sdg.gid
|
|
66
|
+
self.setSdg(sdg_tag, sdg.sdg_contents_type)
|
|
67
|
+
self.writeSds(sdg_tag, sdg)
|
|
68
|
+
|
|
69
|
+
def writeSdgs(self, parent: ET.Element, admin_data: AdminData):
|
|
55
70
|
sdgs = admin_data.getSdgs()
|
|
56
71
|
if len(sdgs) > 0:
|
|
57
72
|
sdgs_tag = ET.SubElement(parent, "SDGS")
|
|
58
73
|
for sdg in sdgs:
|
|
59
|
-
|
|
60
|
-
sdg_tag.attrib['GID'] = sdg.gid
|
|
61
|
-
self.writeSd(sdg_tag, sdg)
|
|
74
|
+
self.setSdg(sdgs_tag, sdg)
|
|
62
75
|
|
|
63
76
|
def writeChildLimitElement(self, element: ET.Element, key: str, limit: Limit):
|
|
64
77
|
if limit is not None:
|
|
@@ -101,7 +114,7 @@ class ARXMLWriter(AbstractARXMLWriter):
|
|
|
101
114
|
|
|
102
115
|
def writeAdminData(self, element: ET.Element, admin_data: AdminData):
|
|
103
116
|
element = ET.SubElement(element, "ADMIN-DATA")
|
|
104
|
-
self.
|
|
117
|
+
self.writeSdgs(element, admin_data)
|
|
105
118
|
|
|
106
119
|
def writeIdentifiable(self, element: ET.Element, identifiable: Identifiable):
|
|
107
120
|
self.writeMultilanguageReferrable(element, identifiable)
|
|
@@ -282,6 +295,12 @@ class ARXMLWriter(AbstractARXMLWriter):
|
|
|
282
295
|
self.setARObjectAttributes(child_element, com_spec)
|
|
283
296
|
self.setChildElementOptionalRefType(child_element, "OPERATION-REF", com_spec.operation_ref)
|
|
284
297
|
|
|
298
|
+
def writeModeSwitchReceiverComSpec(self, element: ET.Element, com_spec: ModeSwitchReceiverComSpec):
|
|
299
|
+
self.logger.debug("writeModeSwitchReceiverComSpec")
|
|
300
|
+
child_element = ET.SubElement(element, "MODE-SWITCH-RECEIVER-COM-SPEC")
|
|
301
|
+
self.setARObjectAttributes(child_element, com_spec)
|
|
302
|
+
self.setChildElementOptionalRefType(child_element, "MODE-GROUP-REF", com_spec.modeGroupRef)
|
|
303
|
+
|
|
285
304
|
def writeRPortComSpec(self, element: ET.Element, com_spec: RPortComSpec):
|
|
286
305
|
if isinstance(com_spec, NonqueuedReceiverComSpec):
|
|
287
306
|
self.writeNonqueuedReceiverComSpec(element, com_spec)
|
|
@@ -289,6 +308,8 @@ class ARXMLWriter(AbstractARXMLWriter):
|
|
|
289
308
|
self.writeQueuedReceiverComSpec(element, com_spec)
|
|
290
309
|
elif isinstance(com_spec, ClientComSpec):
|
|
291
310
|
self.writeClientComSpec(element, com_spec)
|
|
311
|
+
elif isinstance(com_spec, ModeSwitchReceiverComSpec):
|
|
312
|
+
self.writeModeSwitchReceiverComSpec(element, com_spec)
|
|
292
313
|
else:
|
|
293
314
|
raise ValueError("Unsupported RPortComSpec %s" % type(com_spec))
|
|
294
315
|
|
|
@@ -757,6 +778,11 @@ class ARXMLWriter(AbstractARXMLWriter):
|
|
|
757
778
|
def setInternalTriggerOccurredEvent(self, element: ET.Element, event: DataReceivedEvent):
|
|
758
779
|
pass
|
|
759
780
|
|
|
781
|
+
def setInitEvent(self, element: ET.Element, event: InitEvent):
|
|
782
|
+
if event is not None:
|
|
783
|
+
child_element = ET.SubElement(element, "INIT-EVENT")
|
|
784
|
+
self.setRTEEvent(child_element, event)
|
|
785
|
+
|
|
760
786
|
def writeRTEEvents(self, element: ET.Element, parent: SwcInternalBehavior):
|
|
761
787
|
events = parent.getRteEvents()
|
|
762
788
|
if len(events) > 0:
|
|
@@ -773,6 +799,8 @@ class ARXMLWriter(AbstractARXMLWriter):
|
|
|
773
799
|
self.setDataReceivedEvent(child_element, event)
|
|
774
800
|
elif isinstance(event, InternalTriggerOccurredEvent):
|
|
775
801
|
self.setInternalTriggerOccurredEvent(child_element, event)
|
|
802
|
+
elif isinstance(event, InitEvent):
|
|
803
|
+
self.setInitEvent(child_element, event)
|
|
776
804
|
else:
|
|
777
805
|
raise NotImplementedError("Unsupported Event <%s>" % type(event))
|
|
778
806
|
|
|
@@ -790,21 +818,31 @@ class ARXMLWriter(AbstractARXMLWriter):
|
|
|
790
818
|
refs_tag = ET.SubElement(element, "DATA-TYPE-MAPPING-REFS")
|
|
791
819
|
for ref in refs:
|
|
792
820
|
self.setChildElementOptionalRefType(refs_tag, "DATA-TYPE-MAPPING-REF", ref)
|
|
821
|
+
|
|
822
|
+
def writeInternalBehaviorConstantMemories(self, element: ET.Element, behavior: InternalBehavior):
|
|
823
|
+
memories = behavior.getConstantMemorys()
|
|
824
|
+
if len(memories) > 0:
|
|
825
|
+
child_element = ET.SubElement(element, "CONSTANT-MEMORYS")
|
|
826
|
+
for memory in memories:
|
|
827
|
+
self.writeParameterDataPrototype(child_element, memory)
|
|
793
828
|
|
|
794
829
|
def writeInternalBehavior(self, element: ET.Element, behavior: InternalBehavior):
|
|
795
830
|
self.writeIdentifiable(element, behavior)
|
|
831
|
+
self.writeInternalBehaviorConstantMemories(element, behavior)
|
|
796
832
|
self.writeDataTypeMappingRefs(element, behavior)
|
|
797
833
|
self.writeExclusiveAreas(element, behavior)
|
|
798
834
|
|
|
799
835
|
def writeExecutableEntity(self, element: ET.Element, entity: ExecutableEntity):
|
|
800
836
|
if entity is not None:
|
|
801
|
-
self.setChildElementOptionalFloatValue(element, "MINIMUM-START-INTERVAL", entity.
|
|
837
|
+
self.setChildElementOptionalFloatValue(element, "MINIMUM-START-INTERVAL", entity.minimumStartInterval)
|
|
838
|
+
self.setChildElementOptionalRefType(element, "SW-ADDR-METHOD-REF", entity.swAddrMethodRef)
|
|
802
839
|
|
|
803
840
|
def setAutosarVariableRef(self, element: ET.Element, ref: AutosarVariableRef):
|
|
804
841
|
if ref is not None:
|
|
805
842
|
child_element = ET.SubElement(element, "ACCESSED-VARIABLE")
|
|
806
843
|
if ref.autosar_variable_iref is not None:
|
|
807
844
|
child_element = ET.SubElement(child_element, "AUTOSAR-VARIABLE-IREF")
|
|
845
|
+
self.setARObjectAttributes(child_element, ref.autosar_variable_iref)
|
|
808
846
|
self.setChildElementOptionalRefType(child_element, "PORT-PROTOTYPE-REF", ref.autosar_variable_iref.port_prototype_ref)
|
|
809
847
|
self.setChildElementOptionalRefType(child_element, "TARGET-DATA-PROTOTYPE-REF", ref.autosar_variable_iref.target_data_prototype_ref)
|
|
810
848
|
if ref.local_variable_ref is not None:
|
|
@@ -896,6 +934,21 @@ class ARXMLWriter(AbstractARXMLWriter):
|
|
|
896
934
|
for access in variables:
|
|
897
935
|
self.setVariableAccess(child_element, access)
|
|
898
936
|
|
|
937
|
+
def setRModeGroupInAtomicSWCInstanceRef(self, element: ET.Element, iref: RModeGroupInAtomicSWCInstanceRef):
|
|
938
|
+
child_element = ET.SubElement(element, "R-MODE-GROUP-IN-ATOMIC-SWC-INSTANCE-REF")
|
|
939
|
+
self.setChildElementOptionalRefType(child_element, "CONTEXT-R-PORT-REF", iref.contextRPort)
|
|
940
|
+
self.setChildElementOptionalRefType(child_element, "TARGET-MODE-GROUP-REF", iref.targetModeGroup)
|
|
941
|
+
|
|
942
|
+
def writeModeAccessPoints(self, element: ET.Element, entity: RunnableEntity):
|
|
943
|
+
points = entity.getModeAccessPoints()
|
|
944
|
+
if len(points) > 0:
|
|
945
|
+
mode_access_points_tag = ET.SubElement(element, "MODE-ACCESS-POINTS")
|
|
946
|
+
for point in points:
|
|
947
|
+
child_element = ET.SubElement(mode_access_points_tag, "MODE-ACCESS-POINT")
|
|
948
|
+
if point.modeGroupIRef is not None:
|
|
949
|
+
child_element = ET.SubElement(child_element, "MODE-GROUP-IREF")
|
|
950
|
+
self.setRModeGroupInAtomicSWCInstanceRef(child_element, point.modeGroupIRef)
|
|
951
|
+
|
|
899
952
|
def writeRunnableEntity(self, element: ET.Element, entity: RunnableEntity):
|
|
900
953
|
if entity is not None:
|
|
901
954
|
child_element = ET.SubElement(element, "RUNNABLE-ENTITY")
|
|
@@ -906,6 +959,7 @@ class ARXMLWriter(AbstractARXMLWriter):
|
|
|
906
959
|
self.writeDataReceivePointByArguments(child_element, entity)
|
|
907
960
|
self.writeDataSendPoints(child_element, entity)
|
|
908
961
|
self.writeDataWriteAccesses(child_element, entity)
|
|
962
|
+
self.writeModeAccessPoints(child_element, entity)
|
|
909
963
|
self.writeReadLocalVariables(child_element, entity)
|
|
910
964
|
self.writeServerCallPoints(child_element, entity)
|
|
911
965
|
self.setChildElementOptionalLiteral(child_element, "SYMBOL", entity.symbol)
|
|
@@ -950,7 +1004,7 @@ class ARXMLWriter(AbstractARXMLWriter):
|
|
|
950
1004
|
self.setInitValue(child_element, prototype.init_value)
|
|
951
1005
|
|
|
952
1006
|
def writeParameterDataPrototypes(self, element: ET.Element, behavior: SwcInternalBehavior):
|
|
953
|
-
prototypes = behavior.
|
|
1007
|
+
prototypes = behavior.getPerInstanceParameters()
|
|
954
1008
|
if len(prototypes) > 0:
|
|
955
1009
|
child_element = ET.SubElement(element, "PER-INSTANCE-PARAMETERS")
|
|
956
1010
|
for prototype in prototypes:
|
|
@@ -1056,6 +1110,18 @@ class ARXMLWriter(AbstractARXMLWriter):
|
|
|
1056
1110
|
else:
|
|
1057
1111
|
self._raiseError("Unsupported ServiceDependency <%s>" % type(dependency))
|
|
1058
1112
|
|
|
1113
|
+
def setIncludedDataTypeSets(self, element: ET.Element, sets: List[IncludedDataTypeSet]):
|
|
1114
|
+
if len(sets) > 0:
|
|
1115
|
+
include_data_type_sets_tag = ET.SubElement(element, "INCLUDED-DATA-TYPE-SETS")
|
|
1116
|
+
for set in sets:
|
|
1117
|
+
child_element = ET.SubElement(include_data_type_sets_tag, "INCLUDED-DATA-TYPE-SET")
|
|
1118
|
+
self.setARObjectAttributes(child_element, set)
|
|
1119
|
+
type_refs = set.getDataTypeRefs()
|
|
1120
|
+
if len(type_refs) > 0:
|
|
1121
|
+
data_type_refs_tag = ET.SubElement(child_element, "DATA-TYPE-REFS")
|
|
1122
|
+
for type_ref in type_refs:
|
|
1123
|
+
self.setChildElementOptionalRefType(data_type_refs_tag, "DATA-TYPE-REF", type_ref)
|
|
1124
|
+
|
|
1059
1125
|
def writeSwcInternalBehavior(self, element: ET.Element, behavior: SwcInternalBehavior):
|
|
1060
1126
|
self.logger.debug("writeSwInternalBehavior %s" % behavior.short_name)
|
|
1061
1127
|
|
|
@@ -1064,6 +1130,7 @@ class ARXMLWriter(AbstractARXMLWriter):
|
|
|
1064
1130
|
self.writeRTEEvents(child_element, behavior)
|
|
1065
1131
|
self.writeExplicitInterRunnableVariables(child_element, behavior)
|
|
1066
1132
|
self.setChildElementOptionalLiteral(child_element, "HANDLE-TERMINATION-AND-RESTART", behavior.handle_termination_and_restart)
|
|
1133
|
+
self.setIncludedDataTypeSets(child_element, behavior.getIncludedDataTypeSets())
|
|
1067
1134
|
self.writePerInstanceMemories(child_element, behavior)
|
|
1068
1135
|
self.writeParameterDataPrototypes(child_element, behavior)
|
|
1069
1136
|
self.writePortAPIOptions(child_element, behavior)
|
|
@@ -1177,10 +1244,10 @@ class ARXMLWriter(AbstractARXMLWriter):
|
|
|
1177
1244
|
def setVariableDataPrototypeInSystemInstanceRef(self, element: ET.Element, key: str, iref: VariableDataPrototypeInSystemInstanceRef):
|
|
1178
1245
|
if iref is not None:
|
|
1179
1246
|
child_element = ET.SubElement(element, key)
|
|
1180
|
-
self.setChildElementOptionalRefType(child_element, "CONTEXT-COMPONENT-REF", iref.
|
|
1181
|
-
self.setChildElementOptionalRefType(child_element, "CONTEXT-COMPOSITION-REF", iref.
|
|
1182
|
-
self.setChildElementOptionalRefType(child_element, "CONTEXT-PORT-REF", iref.
|
|
1183
|
-
self.setChildElementOptionalRefType(child_element, "TARGET-DATA-PROTOTYPE-REF", iref.
|
|
1247
|
+
self.setChildElementOptionalRefType(child_element, "CONTEXT-COMPONENT-REF", iref.context_component_refs)
|
|
1248
|
+
self.setChildElementOptionalRefType(child_element, "CONTEXT-COMPOSITION-REF", iref.context_composition_ref)
|
|
1249
|
+
self.setChildElementOptionalRefType(child_element, "CONTEXT-PORT-REF", iref.context_port_ref)
|
|
1250
|
+
self.setChildElementOptionalRefType(child_element, "TARGET-DATA-PROTOTYPE-REF", iref.target_data_prototype_ref)
|
|
1184
1251
|
|
|
1185
1252
|
def setEndToEndProtectionVariablePrototype(self, element: ET.Element, key: str, prototype: EndToEndProtectionVariablePrototype):
|
|
1186
1253
|
if prototype is not None:
|
|
@@ -1356,12 +1423,23 @@ class ARXMLWriter(AbstractARXMLWriter):
|
|
|
1356
1423
|
else:
|
|
1357
1424
|
self._raiseError("Unsupported ModeSenderPolicy type <%s>." % type(policy))
|
|
1358
1425
|
|
|
1426
|
+
def setIncludedModeDeclarationGroupSet(self, element: ET.Element, group_set: IncludedModeDeclarationGroupSet):
|
|
1427
|
+
child_element = ET.SubElement(element, "INCLUDED-MODE-DECLARATION-GROUP-SET")
|
|
1428
|
+
|
|
1429
|
+
def writeBswInternalBehaviorIncludedModeDeclarationGroupSets(self, element: ET.Element, behavior: BswInternalBehavior):
|
|
1430
|
+
group_sets = behavior.getIncludedModeDeclarationGroupSets()
|
|
1431
|
+
if len(group_sets) > 0:
|
|
1432
|
+
child_element = ET.SubElement(element, "INCLUDED-MODE-DECLARATION-GROUP-SETS")
|
|
1433
|
+
for group_set in group_sets:
|
|
1434
|
+
self.setIncludedModeDeclarationGroupSet(child_element, group_set)
|
|
1435
|
+
|
|
1359
1436
|
def setBswInternalBehavior(self, element: ET.Element, behavior: BswInternalBehavior):
|
|
1360
1437
|
child_element = ET.SubElement(element, "BSW-INTERNAL-BEHAVIOR")
|
|
1361
1438
|
self.writeInternalBehavior(child_element, behavior)
|
|
1362
1439
|
self.writeBswInternalBehaviorBswModuleEntities(child_element, behavior)
|
|
1363
1440
|
self.writeBswInternalBehaviorBswEvents(child_element, behavior)
|
|
1364
1441
|
self.writeBswInternalBehaviorModeSenderPolicy(child_element, behavior)
|
|
1442
|
+
self.writeBswInternalBehaviorIncludedModeDeclarationGroupSets(child_element, behavior)
|
|
1365
1443
|
|
|
1366
1444
|
def writeBswModuleDescriptionInternalBehaviors(self, element: ET.Element, behaviors: List[InternalBehavior]):
|
|
1367
1445
|
if len(behaviors) > 0:
|
|
@@ -1484,6 +1562,7 @@ class ARXMLWriter(AbstractARXMLWriter):
|
|
|
1484
1562
|
for prototype in arguments:
|
|
1485
1563
|
child_element = ET.SubElement(arguments_tag, "ARGUMENT-DATA-PROTOTYPE")
|
|
1486
1564
|
self.writeIdentifiable(child_element, prototype)
|
|
1565
|
+
self.setSwDataDefProps(child_element, "SW-DATA-DEF-PROPS", prototype.sw_data_def_props)
|
|
1487
1566
|
self.setChildElementOptionalRefType(child_element, "TYPE-TREF", prototype.type_tref)
|
|
1488
1567
|
self.setChildElementOptionalLiteral(child_element, "DIRECTION", prototype.direction)
|
|
1489
1568
|
|
|
@@ -1619,6 +1698,7 @@ class ARXMLWriter(AbstractARXMLWriter):
|
|
|
1619
1698
|
maps_tag = ET.SubElement(element, "MODE-REQUEST-TYPE-MAPS")
|
|
1620
1699
|
for map in maps:
|
|
1621
1700
|
child_element = ET.SubElement(maps_tag, "MODE-REQUEST-TYPE-MAP")
|
|
1701
|
+
self.setARObjectAttributes(child_element, map)
|
|
1622
1702
|
self.setChildElementOptionalRefType(child_element, "IMPLEMENTATION-DATA-TYPE-REF", map.implementation_data_type_ref)
|
|
1623
1703
|
self.setChildElementOptionalRefType(child_element, "MODE-GROUP-REF", map.mode_group_ref)
|
|
1624
1704
|
|
|
@@ -1663,6 +1743,133 @@ class ARXMLWriter(AbstractARXMLWriter):
|
|
|
1663
1743
|
self.setPortInterface(child_element, mode_interface)
|
|
1664
1744
|
self.writeModeSwitchInterfaceModeGroup(child_element, mode_interface)
|
|
1665
1745
|
|
|
1746
|
+
def setEOCExecutableEntityRefSuccessorRefs(self, element: ET.Element, successor_refs: List[RefType]):
|
|
1747
|
+
if len(successor_refs) > 0:
|
|
1748
|
+
child_element = ET.SubElement(element, "SUCCESSOR-REFS")
|
|
1749
|
+
for successor_ref in successor_refs:
|
|
1750
|
+
self.setChildElementOptionalRefType(child_element, "SUCCESSOR-REF", successor_ref)
|
|
1751
|
+
|
|
1752
|
+
def writeEOCExecutableEntityRef(self, element: ET.Element, entity_ref: EOCExecutableEntityRef):
|
|
1753
|
+
child_element = ET.SubElement(element, "EOC-EXECUTABLE-ENTITY-REF")
|
|
1754
|
+
self.writeIdentifiable(child_element, entity_ref)
|
|
1755
|
+
self.setEOCExecutableEntityRefSuccessorRefs(child_element, entity_ref.getSuccessorRefs())
|
|
1756
|
+
|
|
1757
|
+
def writeExecutionOrderConstraintOrderedElement(self, element: ET.Element, constraint: ExecutionOrderConstraint):
|
|
1758
|
+
order_elements = constraint.getOrderedElements()
|
|
1759
|
+
if len(order_elements) > 0:
|
|
1760
|
+
child_element = ET.SubElement(element, "ORDERED-ELEMENTS")
|
|
1761
|
+
for order_element in order_elements:
|
|
1762
|
+
if isinstance(order_element, EOCExecutableEntityRef):
|
|
1763
|
+
self.writeEOCExecutableEntityRef(child_element, order_element)
|
|
1764
|
+
else:
|
|
1765
|
+
self._raiseError("Unsupported order element <%s>" % type(order_element))
|
|
1766
|
+
|
|
1767
|
+
def writeExecutionOrderConstraint(self, element: ET.Element, constraint: ExecutionOrderConstraint):
|
|
1768
|
+
self.logger.debug("writeExecutionOrderConstraint %s" % constraint.short_name)
|
|
1769
|
+
child_element = ET.SubElement(element, "EXECUTION-ORDER-CONSTRAINT")
|
|
1770
|
+
self.writeIdentifiable(child_element, constraint)
|
|
1771
|
+
self.writeExecutionOrderConstraintOrderedElement(child_element, constraint)
|
|
1772
|
+
|
|
1773
|
+
def writeTimingRequirements(self, element: ET.Element, extension: TimingExtension):
|
|
1774
|
+
requirements = extension.getTimingRequirements()
|
|
1775
|
+
if len(requirements) > 0:
|
|
1776
|
+
child_element = ET.SubElement(element, "TIMING-REQUIREMENTS")
|
|
1777
|
+
for requirement in requirements:
|
|
1778
|
+
if isinstance(requirement, ExecutionOrderConstraint):
|
|
1779
|
+
self.writeExecutionOrderConstraint(child_element, requirement)
|
|
1780
|
+
else:
|
|
1781
|
+
self._raiseError("Unsupported timing requirement <%s>" % type(requirement))
|
|
1782
|
+
|
|
1783
|
+
def writeTimingExtension(self, element: ET.Element, extension: TimingExtension):
|
|
1784
|
+
self.writeTimingRequirements(element, extension)
|
|
1785
|
+
|
|
1786
|
+
def writeSwcTiming(self, element: ET.Element, timing: SwcTiming):
|
|
1787
|
+
self.logger.debug("writeSWcTiming %s" % timing.short_name)
|
|
1788
|
+
child_element = ET.SubElement(element, "SWC-TIMING")
|
|
1789
|
+
self.writeIdentifiable(child_element, timing)
|
|
1790
|
+
self.writeTimingExtension(child_element, timing)
|
|
1791
|
+
|
|
1792
|
+
def writePduToFrameMappings(self, element: ET.Element, parent: Frame):
|
|
1793
|
+
mappings = parent.getPduToFrameMappings()
|
|
1794
|
+
if len(mappings) > 0:
|
|
1795
|
+
mappings_tags = ET.SubElement(element, "PDU-TO-FRAME-MAPPINGS")
|
|
1796
|
+
for mapping in mappings:
|
|
1797
|
+
child_element = ET.SubElement(mappings_tags, "PDU-TO-FRAME-MAPPING")
|
|
1798
|
+
self.writeIdentifiable(child_element, mapping)
|
|
1799
|
+
self.setChildElementOptionalLiteral(child_element, "PACKING-BYTE-ORDER", mapping.packingByteOrder)
|
|
1800
|
+
self.setChildElementOptionalRefType(child_element, "PDU-REF", mapping.pduRef)
|
|
1801
|
+
self.setChildElementOptionalNumericalValue(child_element, "START-POSITION", mapping.startPosition)
|
|
1802
|
+
|
|
1803
|
+
def writeFrame(self, element: ET.Element, frame: Frame):
|
|
1804
|
+
self.writeIdentifiable(element, frame)
|
|
1805
|
+
self.setChildElementOptionalNumericalValue(element, "FRAME-LENGTH", frame.frameLength)
|
|
1806
|
+
self.writePduToFrameMappings(element, frame)
|
|
1807
|
+
|
|
1808
|
+
def writeLinUnconditionalFrame(self, element: ET.Element, frame: LinUnconditionalFrame):
|
|
1809
|
+
self.logger.debug("LinUnconditionalFrame %s" % frame.short_name)
|
|
1810
|
+
child_element = ET.SubElement(element, "LIN-UNCONDITIONAL-FRAME")
|
|
1811
|
+
self.writeFrame(child_element, frame)
|
|
1812
|
+
|
|
1813
|
+
def writeNmConfig(self, element: ET.Element, config: NmConfig):
|
|
1814
|
+
self.logger.debug("NmConfig %s" % config.short_name)
|
|
1815
|
+
child_element = ET.SubElement(element, "NM-CONFIG")
|
|
1816
|
+
self.writeIdentifiable(child_element, config)
|
|
1817
|
+
|
|
1818
|
+
def writeNmPdu(self, element: ET.Element, pdu: NmPdu):
|
|
1819
|
+
self.logger.debug("NmPdu %s" % pdu.short_name)
|
|
1820
|
+
child_element = ET.SubElement(element, "NM-PDU")
|
|
1821
|
+
self.writeIdentifiable(child_element, pdu)
|
|
1822
|
+
|
|
1823
|
+
def writeNPdu(self, element: ET.Element, pdu: NPdu):
|
|
1824
|
+
self.logger.debug("NPdu %s" % pdu.short_name)
|
|
1825
|
+
child_element = ET.SubElement(element, "N-PDU")
|
|
1826
|
+
self.writeIdentifiable(child_element, pdu)
|
|
1827
|
+
|
|
1828
|
+
def writeDcmIPdu(self, element: ET.Element, pdu: DcmIPdu):
|
|
1829
|
+
self.logger.debug("DcmIPdu %s" % pdu.short_name)
|
|
1830
|
+
child_element = ET.SubElement(element, "DCM-I-PDU")
|
|
1831
|
+
self.writeIdentifiable(child_element, pdu)
|
|
1832
|
+
|
|
1833
|
+
def writeCanTpConfig(self, element: ET.Element, config: CanTpConfig):
|
|
1834
|
+
self.logger.debug("CanTpConfig %s" % config.short_name)
|
|
1835
|
+
child_element = ET.SubElement(element, "CAN-TP-CONFIG")
|
|
1836
|
+
self.writeIdentifiable(child_element, config)
|
|
1837
|
+
|
|
1838
|
+
def writeLinCluster(self, element: ET.Element, cluster: LinCluster):
|
|
1839
|
+
self.logger.debug("LinCluster %s" % cluster.short_name)
|
|
1840
|
+
child_element = ET.SubElement(element, "LIN-CLUSTER")
|
|
1841
|
+
self.writeIdentifiable(child_element, cluster)
|
|
1842
|
+
|
|
1843
|
+
def writeCanFrame(self, element: ET.Element, frame: CanFrame):
|
|
1844
|
+
self.logger.debug("CanFrame %s" % frame.short_name)
|
|
1845
|
+
child_element = ET.SubElement(element, "CAN-FRAME")
|
|
1846
|
+
self.writeFrame(child_element, frame)
|
|
1847
|
+
|
|
1848
|
+
def setISignalMappings(self, element: ET.Element, mappings: List[ISignalMapping]):
|
|
1849
|
+
if len(mappings) > 0:
|
|
1850
|
+
mappings_tag = ET.SubElement(element, "SIGNAL-MAPPINGS")
|
|
1851
|
+
for mapping in mappings:
|
|
1852
|
+
child_element = ET.SubElement(mappings_tag, "I-SIGNAL-MAPPING")
|
|
1853
|
+
self.setChildElementOptionalRefType(child_element, "SOURCE-SIGNAL-REF", mapping.sourceSignalRef)
|
|
1854
|
+
self.setChildElementOptionalRefType(child_element, "TARGET-SIGNAL-REF", mapping.targetSignalRef)
|
|
1855
|
+
|
|
1856
|
+
def writeGateway(self, element: ET.Element, gateway: Gateway):
|
|
1857
|
+
self.logger.debug("Gateway %s" % gateway.short_name)
|
|
1858
|
+
child_element = ET.SubElement(element, "GATEWAY")
|
|
1859
|
+
self.writeIdentifiable(child_element, gateway)
|
|
1860
|
+
self.setChildElementOptionalRefType(child_element, "ECU-REF", gateway.ecuRef)
|
|
1861
|
+
self.setISignalMappings(child_element, gateway.getSignalMappings())
|
|
1862
|
+
|
|
1863
|
+
def writeISignal(self, element: ET.Element, signal: ISignal):
|
|
1864
|
+
self.logger.debug("ISignal %s" % signal.short_name)
|
|
1865
|
+
child_element = ET.SubElement(element, "I-SIGNAL")
|
|
1866
|
+
self.writeIdentifiable(child_element, signal)
|
|
1867
|
+
self.setChildElementOptionalLiteral(child_element, "DATA-TYPE-POLICY", signal.dataTypePolicy)
|
|
1868
|
+
self.setInitValue(child_element, signal.initValue)
|
|
1869
|
+
self.setChildElementOptionalNumericalValue(child_element, "LENGTH", signal.length)
|
|
1870
|
+
self.setSwDataDefProps(child_element, "NETWORK-REPRESENTATION-PROPS", signal.networkRepresentationProps)
|
|
1871
|
+
self.setChildElementOptionalRefType(child_element, "SYSTEM-SIGNAL-REF", signal.systemSignalRef)
|
|
1872
|
+
|
|
1666
1873
|
def writeARPackageElement(self, element: ET.Element, ar_element: ARElement):
|
|
1667
1874
|
if isinstance(ar_element, ComplexDeviceDriverSwComponentType):
|
|
1668
1875
|
self.writeComplexDeviceDriverSwComponentType(element, ar_element)
|
|
@@ -1720,6 +1927,28 @@ class ARXMLWriter(AbstractARXMLWriter):
|
|
|
1720
1927
|
self.writeModeDeclarationGroup(element, ar_element)
|
|
1721
1928
|
elif isinstance(ar_element, ModeSwitchInterface):
|
|
1722
1929
|
self.writeModeSwitchInterface(element, ar_element)
|
|
1930
|
+
elif isinstance(ar_element, SwcTiming):
|
|
1931
|
+
self.writeSwcTiming(element, ar_element)
|
|
1932
|
+
elif isinstance(ar_element, LinUnconditionalFrame):
|
|
1933
|
+
self.writeLinUnconditionalFrame(element, ar_element)
|
|
1934
|
+
elif isinstance(ar_element, NmConfig):
|
|
1935
|
+
self.writeNmConfig(element, ar_element)
|
|
1936
|
+
elif isinstance(ar_element, NmPdu):
|
|
1937
|
+
self.writeNmPdu(element, ar_element)
|
|
1938
|
+
elif isinstance(ar_element, NPdu):
|
|
1939
|
+
self.writeNPdu(element, ar_element)
|
|
1940
|
+
elif isinstance(ar_element, DcmIPdu):
|
|
1941
|
+
self.writeDcmIPdu(element, ar_element)
|
|
1942
|
+
elif isinstance(ar_element, CanTpConfig):
|
|
1943
|
+
self.writeCanTpConfig(element, ar_element)
|
|
1944
|
+
elif isinstance(ar_element, LinCluster):
|
|
1945
|
+
self.writeLinCluster(element, ar_element)
|
|
1946
|
+
elif isinstance(ar_element, CanFrame):
|
|
1947
|
+
self.writeCanFrame(element, ar_element)
|
|
1948
|
+
elif isinstance(ar_element, Gateway):
|
|
1949
|
+
self.writeGateway(element, ar_element)
|
|
1950
|
+
elif isinstance(ar_element, ISignal):
|
|
1951
|
+
self.writeISignal(element, ar_element)
|
|
1723
1952
|
else:
|
|
1724
1953
|
raise NotImplementedError("Unsupported Elements of ARPackage <%s>" % type(ar_element))
|
|
1725
1954
|
|