armodel 1.4.0__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/__init__.py +2 -1
- armodel/cli/arxml_dump_cli.py +9 -7
- armodel/cli/arxml_format_cli.py +72 -0
- armodel/cli/connector_update_cli.py +11 -4
- armodel/data_models/__init__.py +0 -0
- armodel/data_models/sw_connector.py +22 -0
- armodel/lib/data_analyzer.py +1 -1
- armodel/models/__init__.py +3 -2
- armodel/models/annotation.py +20 -0
- armodel/models/ar_object.py +163 -18
- armodel/models/ar_package.py +228 -24
- armodel/models/ar_ref.py +85 -6
- armodel/models/bsw_module_template.py +113 -27
- armodel/models/calibration.py +107 -4
- armodel/models/common_structure.py +142 -52
- armodel/models/communication.py +10 -1
- armodel/models/data_def_properties.py +16 -0
- armodel/models/data_dictionary.py +46 -9
- armodel/models/data_prototype.py +24 -5
- armodel/models/datatype.py +69 -20
- armodel/models/end_to_end_protection.py +67 -0
- 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 +44 -18
- armodel/models/global_constraints.py +4 -4
- armodel/models/implementation.py +79 -32
- armodel/models/internal_behavior.py +63 -0
- armodel/models/m2_msr.py +6 -4
- armodel/models/mode_declaration.py +8 -0
- armodel/models/multilanguage_data.py +42 -0
- armodel/models/per_instance_memory.py +14 -0
- armodel/models/port_interface.py +27 -4
- armodel/models/port_prototype.py +57 -19
- armodel/models/record_layout.py +118 -0
- armodel/models/rpt_scenario.py +20 -0
- armodel/models/service_mapping.py +11 -0
- armodel/models/service_needs.py +48 -0
- armodel/models/sw_component.py +293 -45
- 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 +248 -0
- armodel/parser/arxml_parser.py +1571 -844
- armodel/parser/connector_xlsx_parser.py +190 -0
- armodel/parser/excel_parser.py +18 -0
- armodel/tests/test_armodel/models/test_ar_object.py +152 -0
- armodel/tests/test_armodel/models/test_ar_package.py +1 -1
- armodel/tests/test_armodel/models/test_common_structure.py +2 -2
- armodel/tests/test_armodel/models/test_data_dictionary.py +7 -7
- armodel/tests/test_armodel/models/test_data_prototype.py +3 -3
- armodel/tests/test_armodel/models/test_datatype.py +11 -11
- armodel/tests/test_armodel/models/test_general_structure.py +1 -1
- armodel/tests/test_armodel/models/test_implementation.py +26 -0
- armodel/tests/test_armodel/models/test_m2_msr.py +4 -4
- armodel/tests/test_armodel/models/test_port_interface.py +5 -5
- armodel/tests/test_armodel/parser/test_arxml_parser.py +15 -0
- armodel/tests/test_armodel/parser/test_parse_bswmd.py +74 -42
- armodel/tests/test_armodel/parser/test_sw_components.py +93 -0
- armodel/writer/abstract_arxml_writer.py +123 -0
- armodel/writer/arxml_writer.py +1701 -358
- {armodel-1.4.0.dist-info → armodel-1.5.0.dist-info}/METADATA +114 -3
- armodel-1.5.0.dist-info/RECORD +91 -0
- {armodel-1.4.0.dist-info → armodel-1.5.0.dist-info}/WHEEL +1 -1
- {armodel-1.4.0.dist-info → armodel-1.5.0.dist-info}/entry_points.txt +2 -0
- armodel-1.4.0.dist-info/RECORD +0 -60
- {armodel-1.4.0.dist-info → armodel-1.5.0.dist-info}/LICENSE +0 -0
- {armodel-1.4.0.dist-info → armodel-1.5.0.dist-info}/top_level.txt +0 -0
armodel/parser/arxml_parser.py
CHANGED
|
@@ -1,255 +1,164 @@
|
|
|
1
|
-
from
|
|
1
|
+
from typing import List
|
|
2
|
+
import xml.etree.ElementTree as ET
|
|
3
|
+
|
|
4
|
+
from armodel.models.fibex.fibex_4_multiplatform import FrameMapping, IPduMapping, ISignalMapping
|
|
5
|
+
|
|
6
|
+
from ..models.fibex.fibex_core import Frame
|
|
7
|
+
from ..models.internal_behavior import IncludedDataTypeSet
|
|
8
|
+
from ..models.timing import ExecutionOrderConstraint, TimingExtension
|
|
9
|
+
from ..models.bsw_module_template import BswModeSenderPolicy
|
|
10
|
+
from ..models.port_interface import ModeSwitchInterface, PortInterface
|
|
11
|
+
from ..models.common_structure import IncludedModeDeclarationGroupSet, MemorySection, ModeDeclarationGroup, ModeDeclarationGroupPrototype, ModeRequestTypeMap
|
|
12
|
+
from ..models.implementation import BswImplementation, EngineeringObject
|
|
13
|
+
from ..models.general_structure import MultilanguageReferrable
|
|
14
|
+
from ..models.multilanguage_data import LOverviewParagraph, MultiLanguageOverviewParagraph, LLongName, MultilanguageLongName
|
|
15
|
+
from ..models.data_def_properties import ValueList
|
|
16
|
+
from ..models.record_layout import SwRecordLayoutGroup, SwRecordLayoutGroupContent, SwRecordLayoutV
|
|
17
|
+
from ..models.datatype import ApplicationArrayDataType, ApplicationCompositeDataType, ApplicationDataType, AutosarDataType, BaseTypeDirectDefinition
|
|
18
|
+
from ..models.calibration import SwAxisGrouped, SwAxisIndividual, SwCalprmAxis, SwCalprmAxisSet
|
|
19
|
+
from ..models.communication import CompositeNetworkRepresentation
|
|
20
|
+
from ..models.end_to_end_protection import EndToEndDescription, EndToEndProtection, EndToEndProtectionSet, EndToEndProtectionVariablePrototype
|
|
21
|
+
from ..models.service_mapping import RoleBasedPortAssignment
|
|
22
|
+
from ..models.ar_package import AUTOSAR, ARPackage
|
|
23
|
+
from ..models.ar_object import ARLiteral
|
|
24
|
+
from ..models.service_needs import RoleBasedDataAssignment
|
|
25
|
+
from ..models.ar_ref import ApplicationCompositeElementInPortInterfaceInstanceRef, InnerPortGroupInCompositionInstanceRef, RModeGroupInAtomicSWCInstanceRef, VariableDataPrototypeInSystemInstanceRef, VariableInAtomicSWCTypeInstanceRef, AutosarParameterRef
|
|
26
|
+
from ..models.sw_component import AtomicSwComponentType, CompositionSwComponentType, ModeAccessPoint, PortAPIOption, PortDefinedArgumentValue, PortGroup, ServiceDependency, SwComponentType, SwcServiceDependency
|
|
27
|
+
from ..models.data_prototype import ApplicationCompositeElementDataPrototype, AutosarDataPrototype, DataPrototype, ParameterDataPrototype
|
|
28
|
+
from ..models.port_prototype import ModeSwitchReceiverComSpec, QueuedReceiverComSpec
|
|
29
|
+
from ..models.annotation import Annotation, GeneralAnnotation
|
|
2
30
|
from ..models.global_constraints import InternalConstrs, DataConstr, DataConstrRule, PhysConstrs
|
|
3
31
|
|
|
4
|
-
from ..models import
|
|
5
|
-
from ..models import SwcInternalBehavior, RunnableEntity, RTEEvent, VariableAccess, ServerCallPoint, OperationInvokedEvent, DataReceivedEvent, RVariableInAtomicSwcInstanceRef
|
|
32
|
+
from ..models import SwcInternalBehavior, RunnableEntity, RTEEvent, ServerCallPoint, OperationInvokedEvent, DataReceivedEvent, RVariableInAtomicSwcInstanceRef
|
|
6
33
|
from ..models import SwcModeSwitchEvent, RModeInAtomicSwcInstanceRef
|
|
7
|
-
from ..models import
|
|
34
|
+
from ..models import AutosarVariableRef, POperationInAtomicSwcInstanceRef, ROperationInAtomicSwcInstanceRef
|
|
8
35
|
from ..models import ImplementationDataType, SwDataDefProps, SwPointerTargetProps, DataTypeMappingSet, DataTypeMap, ImplementationDataTypeElement
|
|
9
|
-
from ..models import
|
|
10
|
-
from ..models import ReceiverComSpec, ClientComSpec, NonqueuedReceiverComSpec
|
|
11
|
-
from ..models import SenderComSpec, NonqueuedSenderComSpec
|
|
36
|
+
from ..models import RPortPrototype, PPortPrototype
|
|
37
|
+
from ..models import ReceiverComSpec, ClientComSpec, NonqueuedReceiverComSpec
|
|
38
|
+
from ..models import SenderComSpec, NonqueuedSenderComSpec, ServerComSpec
|
|
12
39
|
from ..models import SenderReceiverInterface, ClientServerInterface, ClientServerOperation, ArgumentDataPrototype
|
|
13
|
-
from ..models import
|
|
40
|
+
from ..models import Identifiable, AdminData, Sdg, Sd
|
|
14
41
|
from ..models import AssemblySwConnector, PPortInCompositionInstanceRef, RPortInCompositionInstanceRef
|
|
15
42
|
from ..models import DelegationSwConnector
|
|
16
|
-
from ..models import CompuMethod, CompuScale,
|
|
43
|
+
from ..models import CompuMethod, CompuScale, CompuScales, Compu, CompuConst, CompuConstTextContent, CompuScaleConstantContents, CompuScaleRationalFormula, CompuRationalCoeffs, CompuNominatorDenominator
|
|
17
44
|
from ..models import InternalBehavior, ExecutableEntity
|
|
18
45
|
from ..models import Implementation, Code, AutosarEngineeringObject, ResourceConsumption
|
|
19
46
|
from ..models import TransmissionAcknowledgementRequest
|
|
20
|
-
from ..models import
|
|
47
|
+
from ..models import BswModuleDescription, BswInternalBehavior, BswModuleEntity, BswScheduleEvent, SwcBswMapping, SwcBswRunnableMapping
|
|
21
48
|
from ..models import ValueSpecification, ApplicationValueSpecification, TextValueSpecification, NumericalValueSpecification, ArrayValueSpecification, ConstantReference
|
|
22
|
-
from ..models import
|
|
49
|
+
from ..models import RecordValueSpecification
|
|
23
50
|
from ..models import ApplicationRecordDataType
|
|
24
51
|
from ..models import SwValueCont, SwValues
|
|
25
|
-
from ..models import ARBoolean, ARLiteral
|
|
26
|
-
from ..models import BaseType
|
|
27
|
-
|
|
28
|
-
from typing import List
|
|
29
|
-
from colorama import Fore
|
|
30
|
-
import xml.etree.ElementTree as ET
|
|
31
|
-
import re
|
|
32
|
-
import logging
|
|
33
|
-
|
|
34
|
-
class ARXMLParser:
|
|
35
|
-
def __init__(self, options = None):
|
|
36
|
-
self.nsmap = {"xmlns": "http://autosar.org/schema/r4.0"}
|
|
37
|
-
self.options = {}
|
|
38
|
-
self.options['warning'] = False
|
|
39
|
-
self.logger = logging.getLogger()
|
|
40
|
-
|
|
41
|
-
self._processOptions(options=options)
|
|
42
|
-
|
|
43
|
-
def _processOptions(self, options):
|
|
44
|
-
if options:
|
|
45
|
-
if 'warning' in options:
|
|
46
|
-
self.options['warning'] = options['warning']
|
|
47
52
|
|
|
48
|
-
|
|
49
|
-
if (self.options['warning'] == True):
|
|
50
|
-
self.logger.error(Fore.RED + error_msg + Fore.WHITE)
|
|
51
|
-
else:
|
|
52
|
-
raise ValueError(error_msg)
|
|
53
|
-
|
|
54
|
-
def getPureTagName(self, tag):
|
|
55
|
-
return re.sub(r'\{[\w:\/.]+\}(\w+)', r'\1', tag)
|
|
56
|
-
|
|
57
|
-
def readChildElement(self, short_name: str, element: ET.Element, key: str) -> str:
|
|
58
|
-
child_element = element.find("./xmlns:%s" % key, self.nsmap)
|
|
59
|
-
if (child_element != None):
|
|
60
|
-
return child_element.text
|
|
61
|
-
self._raiseError("The attribute %s of <%s> has not been defined" % (key, short_name))
|
|
53
|
+
from .abstract_arxml_parser import AbstractARXMLParser
|
|
62
54
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
literal = ARLiteral()
|
|
73
|
-
self.readElementAttributes(child_element, literal)
|
|
74
|
-
literal.value = child_element.text
|
|
75
|
-
return literal
|
|
76
|
-
self._raiseError("The attribute %s of <%s> has not been defined" % (key, short_name))
|
|
77
|
-
|
|
78
|
-
def readChildOptionalElementLiteral(self, element: ET.Element, key: str) -> ARLiteral:
|
|
79
|
-
child_element = element.find("./xmlns:%s" % key, self.nsmap)
|
|
80
|
-
if (child_element != None):
|
|
81
|
-
self.logger.debug("readChildOptionalElementLiteral : %s" % child_element.text)
|
|
82
|
-
literal = ARLiteral()
|
|
83
|
-
self.readElementAttributes(child_element, literal)
|
|
84
|
-
literal.value = child_element.text
|
|
85
|
-
return literal
|
|
86
|
-
return None
|
|
87
|
-
|
|
88
|
-
def _convertStringToBooleanValue(self, value: str) -> bool:
|
|
89
|
-
if (value == "true"):
|
|
90
|
-
return True
|
|
91
|
-
return False
|
|
92
|
-
|
|
93
|
-
def readChildElementFloatValue(self, short_name: str, element: ET.Element, key: str) -> float:
|
|
94
|
-
value = self.readChildElement(short_name, element, key)
|
|
95
|
-
if (value == None):
|
|
96
|
-
return None
|
|
97
|
-
return float(value)
|
|
98
|
-
|
|
99
|
-
def readChildElementBooleanValue(self, short_name: str, element: ET.Element, key: str) -> ARBoolean:
|
|
100
|
-
literal = self.readChildElementLiteral(short_name, element, key)
|
|
101
|
-
bool_value = ARBoolean()
|
|
102
|
-
bool_value.timestamp = literal.timestamp
|
|
103
|
-
bool_value.value = self._convertStringToBooleanValue(literal.value)
|
|
104
|
-
return bool_value
|
|
105
|
-
|
|
106
|
-
def readChildOptionalElementBooleanValue(self, element: ET.Element, key: str) -> ARBoolean:
|
|
107
|
-
literal = self.readChildOptionalElementLiteral(element, key)
|
|
108
|
-
if (literal == None):
|
|
109
|
-
return None
|
|
110
|
-
bool_value = ARBoolean()
|
|
111
|
-
bool_value.timestamp = literal.timestamp
|
|
112
|
-
bool_value.value = self._convertStringToBooleanValue(literal.value)
|
|
113
|
-
return bool_value
|
|
114
|
-
|
|
115
|
-
def _convertStringToNumberValue(self, value) -> int:
|
|
116
|
-
m = re.match(r"0x([0-9a-f]+)", value, re.I)
|
|
117
|
-
if (m):
|
|
118
|
-
return int(m.group(1), 16)
|
|
119
|
-
return int(value)
|
|
120
|
-
|
|
121
|
-
def readChildElementNumberValue(self, short_name: str, element: ET.Element, key: str) -> int:
|
|
122
|
-
value = self.readChildElement(short_name, element, key)
|
|
123
|
-
return self._convertStringToNumberValue(value)
|
|
124
|
-
|
|
125
|
-
def readChildOptionalElementNumberValue(self, element: ET.Element, key: str) -> int:
|
|
126
|
-
value = self.readChildOptionalElement(element, key)
|
|
127
|
-
if (value == None):
|
|
128
|
-
return None
|
|
129
|
-
return self._convertStringToNumberValue(value)
|
|
130
|
-
|
|
131
|
-
def readChildLimitElement(self, element: ET.Element, key: str) -> Limit:
|
|
132
|
-
child_element = element.find("./xmlns:%s" % key, self.nsmap)
|
|
133
|
-
if (child_element != None):
|
|
134
|
-
limit = Limit()
|
|
135
|
-
if ('INTERVAL-TYPE' in child_element.attrib):
|
|
136
|
-
limit.interval_type = child_element.attrib['INTERVAL-TYPE']
|
|
137
|
-
else:
|
|
138
|
-
limit.interval_type = "CLOSED"
|
|
139
|
-
limit.value = child_element.text
|
|
140
|
-
return limit
|
|
141
|
-
return None
|
|
142
|
-
|
|
143
|
-
def readShortName(self, element: ET.Element) -> str:
|
|
144
|
-
return self.readChildElement("", element, "SHORT-NAME")
|
|
55
|
+
class ARXMLParser(AbstractARXMLParser):
|
|
56
|
+
def __init__(self, options=None) -> None:
|
|
57
|
+
super().__init__(options)
|
|
58
|
+
|
|
59
|
+
def getShortName(self, element: ET.Element) -> str:
|
|
60
|
+
child_element = self.find(element, "SHORT-NAME")
|
|
61
|
+
if child_element is None:
|
|
62
|
+
raise ValueError("Short Name is required")
|
|
63
|
+
return child_element.text
|
|
145
64
|
|
|
146
65
|
def readSd(self, element: ET.Element, sdg: Sdg):
|
|
147
|
-
for child_element in
|
|
66
|
+
for child_element in self.findall(element, "./SD"):
|
|
148
67
|
sd = Sd()
|
|
149
|
-
|
|
68
|
+
if 'GID' in child_element.attrib:
|
|
69
|
+
sd.gid = child_element.attrib['GID']
|
|
150
70
|
sd.value = child_element.text
|
|
151
|
-
|
|
152
71
|
sdg.addSd(sd)
|
|
72
|
+
|
|
73
|
+
def getSdg(self, element: ET.Element) -> Sdg:
|
|
74
|
+
sdg = Sdg()
|
|
75
|
+
if 'GID' in element.attrib:
|
|
76
|
+
sdg.gid = element.attrib["GID"]
|
|
77
|
+
self.readSd(element, sdg)
|
|
78
|
+
child_element = self.find(element, "./SDG")
|
|
79
|
+
if child_element is not None:
|
|
80
|
+
sdg.sdg_contents_type = self.getSdg(child_element)
|
|
81
|
+
return sdg
|
|
153
82
|
|
|
154
|
-
def
|
|
155
|
-
for child_element in
|
|
156
|
-
|
|
157
|
-
sdg.gid = child_element.attrib["GID"]
|
|
158
|
-
self.readSd(child_element, sdg)
|
|
159
|
-
admin_data.addSdg(sdg)
|
|
83
|
+
def readSdgs(self, element: ET.Element, admin_data: AdminData):
|
|
84
|
+
for child_element in self.findall(element, "./SDGS/SDG"):
|
|
85
|
+
admin_data.addSdg(self.getSdg(child_element))
|
|
160
86
|
|
|
161
87
|
def readAdminData(self, element: ET.Element, identifiable: Identifiable):
|
|
162
|
-
child_element =
|
|
88
|
+
child_element = self.find(element, "./ADMIN-DATA")
|
|
163
89
|
if child_element is not None:
|
|
164
90
|
self.logger.debug("readAdminData")
|
|
165
91
|
admin_data = AdminData()
|
|
166
|
-
self.
|
|
92
|
+
self.readSdgs(child_element, admin_data)
|
|
167
93
|
identifiable.admin_data = admin_data
|
|
94
|
+
|
|
95
|
+
def readMultilanguageReferrable(self, element: ET.Element, referrable: MultilanguageReferrable):
|
|
96
|
+
self.readElementAttributes(element, referrable)
|
|
97
|
+
referrable.long_name = self.getMultilanguageLongName(element, "LONG-NAME")
|
|
168
98
|
|
|
169
99
|
def readIdentifiable(self, element: ET.Element, identifiable: Identifiable):
|
|
170
|
-
self.readElementAttributes(element, identifiable)
|
|
171
100
|
self.readMultilanguageReferrable(element, identifiable)
|
|
172
|
-
identifiable.category = self.
|
|
101
|
+
identifiable.category = self.getChildElementOptionalLiteral(element, "CATEGORY")
|
|
102
|
+
identifiable.desc = self.getMultiLanguageOverviewParagraph(element, "DESC")
|
|
173
103
|
self.readAdminData(element, identifiable)
|
|
174
|
-
|
|
175
|
-
def _readChildRefElementDestAndValue(self, element) -> RefType:
|
|
176
|
-
ref = RefType()
|
|
177
|
-
ref.dest = element.attrib['DEST']
|
|
178
|
-
ref.value = element.text
|
|
179
|
-
return ref
|
|
180
|
-
|
|
181
|
-
def readChildRefElement(self, short_name: str, element: ET.Element, key: str) -> RefType:
|
|
182
|
-
child_element = element.find("./xmlns:%s" % key, self.nsmap)
|
|
183
|
-
if (child_element != None):
|
|
184
|
-
return self._readChildRefElementDestAndValue(child_element)
|
|
185
|
-
self._raiseError("The attribute %s of <%s> has not been defined" % (key, short_name))
|
|
186
|
-
|
|
187
|
-
def readChildOptionalRefElement(self, element:ET.Element, key: str) -> RefType:
|
|
188
|
-
child_element = element.find("./xmlns:%s" % key, self.nsmap)
|
|
189
|
-
if (child_element != None):
|
|
190
|
-
return self._readChildRefElementDestAndValue(child_element)
|
|
191
|
-
return None
|
|
192
|
-
|
|
193
|
-
def readChildRefElementList(self, element: ET.Element, key: str) -> List[RefType]:
|
|
194
|
-
child_elements = element.findall("./xmlns:%s" % key, self.nsmap)
|
|
195
|
-
results = []
|
|
196
|
-
for child_element in child_elements:
|
|
197
|
-
ref = RefType()
|
|
198
|
-
ref.dest = child_element.attrib['DEST']
|
|
199
|
-
ref.value = child_element.text
|
|
200
|
-
results.append(ref)
|
|
201
|
-
return results
|
|
202
104
|
|
|
203
|
-
def
|
|
204
|
-
|
|
205
|
-
return element.attrib[key]
|
|
206
|
-
return None
|
|
207
|
-
|
|
208
|
-
def readMultilanguageLongName(self, element: ET.Element, long_name: MultilanguageLongName):
|
|
209
|
-
for child_element in element.findall("./xmlns:L-4", self.nsmap):
|
|
105
|
+
def readLLongName(self, element: ET.Element, long_name: MultilanguageLongName):
|
|
106
|
+
for child_element in self.findall(element, "./L-4"):
|
|
210
107
|
l4 = LLongName()
|
|
211
108
|
self.readElementAttributes(child_element, l4)
|
|
212
109
|
l4.value = child_element.text
|
|
213
110
|
if 'L' in child_element.attrib:
|
|
214
111
|
l4.l = child_element.attrib['L']
|
|
215
|
-
long_name.
|
|
112
|
+
long_name.addL4(l4)
|
|
216
113
|
|
|
217
|
-
def
|
|
218
|
-
|
|
114
|
+
def getMultilanguageLongName(self, element: ET.Element, key: str) -> MultilanguageLongName:
|
|
115
|
+
long_name = None
|
|
116
|
+
child_element = self.find(element, "./%s" % key)
|
|
219
117
|
if child_element is not None:
|
|
220
|
-
|
|
221
|
-
self.readElementAttributes(child_element,
|
|
222
|
-
self.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
118
|
+
long_name = MultilanguageLongName()
|
|
119
|
+
self.readElementAttributes(child_element, long_name)
|
|
120
|
+
self.readLLongName(child_element, long_name)
|
|
121
|
+
return long_name
|
|
122
|
+
|
|
123
|
+
def readLOverviewParagraph(self, element: ET.Element, paragraph: MultiLanguageOverviewParagraph):
|
|
124
|
+
for child_element in self.findall(element, "./L-2"):
|
|
125
|
+
l2 = LOverviewParagraph()
|
|
126
|
+
self.readElementAttributes(child_element, l2)
|
|
127
|
+
l2.value = child_element.text
|
|
128
|
+
if 'L' in child_element.attrib:
|
|
129
|
+
l2.l = child_element.attrib['L']
|
|
130
|
+
paragraph.addL2(l2)
|
|
131
|
+
|
|
132
|
+
def getMultiLanguageOverviewParagraph(self, element: ET.Element, key: str) -> MultiLanguageOverviewParagraph:
|
|
133
|
+
paragraph = None
|
|
134
|
+
child_element = element.find("./xmlns:%s" % key, self.nsmap)
|
|
135
|
+
if child_element is not None:
|
|
136
|
+
paragraph = MultiLanguageOverviewParagraph()
|
|
137
|
+
self.readElementAttributes(child_element, paragraph)
|
|
138
|
+
self.readLOverviewParagraph(child_element, paragraph)
|
|
139
|
+
return paragraph
|
|
232
140
|
|
|
233
141
|
def readAutosarVariableInImplDatatype(self, element: ET.Element, accessed_variable_ref: AutosarVariableRef):
|
|
234
142
|
child_element = element.find("./xmlns:ACCESSED-VARIABLE/xmlns:AUTOSAR-VARIABLE-IREF", self.nsmap)
|
|
235
|
-
if (child_element
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
143
|
+
if (child_element is not None):
|
|
144
|
+
autosar_variable_iref = VariableInAtomicSWCTypeInstanceRef()
|
|
145
|
+
self.readElementAttributes(child_element, autosar_variable_iref)
|
|
146
|
+
autosar_variable_iref.port_prototype_ref = self.getChildElementOptionalRefType(child_element, "PORT-PROTOTYPE-REF")
|
|
147
|
+
if autosar_variable_iref.port_prototype_ref is None:
|
|
239
148
|
self._raiseError("PORT-PROTOTYPE-REF of <%s> is empty." % accessed_variable_ref.parent.short_name)
|
|
240
|
-
|
|
241
|
-
if
|
|
149
|
+
autosar_variable_iref.target_data_prototype_ref = self.getChildElementOptionalRefType(child_element, "TARGET-DATA-PROTOTYPE-REF")
|
|
150
|
+
if autosar_variable_iref.target_data_prototype_ref is None:
|
|
242
151
|
self._raiseError("TARGET-DATA-PROTOTYPE-REF of <%s> is empty." % accessed_variable_ref.parent.short_name)
|
|
243
|
-
accessed_variable_ref.
|
|
152
|
+
accessed_variable_ref.autosar_variable_iref = autosar_variable_iref
|
|
244
153
|
|
|
245
154
|
def readLocalVariableRef(self, element, accessed_variable_ref: AutosarVariableRef):
|
|
246
155
|
child_element = element.find("./xmlns:ACCESSED-VARIABLE", self.nsmap)
|
|
247
|
-
if (child_element
|
|
248
|
-
accessed_variable_ref.local_variable_ref = self.
|
|
156
|
+
if (child_element is not None):
|
|
157
|
+
accessed_variable_ref.local_variable_ref = self.getChildElementOptionalRefType(child_element, "LOCAL-VARIABLE-REF")
|
|
249
158
|
|
|
250
159
|
def _readVariableAccesses(self, element: ET.Element, parent: RunnableEntity, key: str):
|
|
251
160
|
for child_element in element.findall("./xmlns:%s/xmlns:VARIABLE-ACCESS" % key, self.nsmap):
|
|
252
|
-
short_name = self.
|
|
161
|
+
short_name = self.getShortName(child_element)
|
|
253
162
|
|
|
254
163
|
self.logger.debug("readVariableAccesses %s" % short_name)
|
|
255
164
|
|
|
@@ -262,6 +171,9 @@ class ARXMLParser:
|
|
|
262
171
|
elif (key == "DATA-READ-ACCESSS"):
|
|
263
172
|
variable_access = parent.createDataReadAccess(short_name)
|
|
264
173
|
self.readAutosarVariableInImplDatatype(child_element, variable_access.accessed_variable_ref)
|
|
174
|
+
elif (key == "DATA-WRITE-ACCESSS"):
|
|
175
|
+
variable_access = parent.createDataWriteAccess(short_name)
|
|
176
|
+
self.readAutosarVariableInImplDatatype(child_element, variable_access.accessed_variable_ref)
|
|
265
177
|
elif (key == "DATA-SEND-POINTS"):
|
|
266
178
|
variable_access = parent.createDataSendPoint(short_name)
|
|
267
179
|
self.readAutosarVariableInImplDatatype(child_element, variable_access.accessed_variable_ref)
|
|
@@ -274,47 +186,60 @@ class ARXMLParser:
|
|
|
274
186
|
else:
|
|
275
187
|
self._raiseError("Invalid key type <%s>" % key)
|
|
276
188
|
|
|
277
|
-
|
|
189
|
+
self.readIdentifiable(child_element, variable_access)
|
|
278
190
|
|
|
279
191
|
def readBswModuleDescriptionImplementedEntry(self, element: ET.Element, parent: BswModuleDescription):
|
|
280
192
|
for child_element in element.findall("./xmlns:PROVIDED-ENTRYS/xmlns:BSW-MODULE-ENTRY-REF-CONDITIONAL", self.nsmap):
|
|
281
|
-
ref = self.
|
|
282
|
-
if (ref
|
|
283
|
-
parent.
|
|
193
|
+
ref = self.getChildElementOptionalRefType(child_element, "BSW-MODULE-ENTRY-REF")
|
|
194
|
+
if (ref is not None):
|
|
195
|
+
parent.addImplementedEntry(ref)
|
|
284
196
|
self.logger.debug("ImplementedEntry <%s> of BswModuleDescription <%s> has been added", ref.value, parent.short_name)
|
|
285
197
|
|
|
198
|
+
def readModeDeclarationGroupPrototype(self, element: ET.Element, prototype: ModeDeclarationGroupPrototype):
|
|
199
|
+
self.readIdentifiable(element, prototype)
|
|
200
|
+
prototype.type_tref = self.getChildElementOptionalRefType(element, "TYPE-TREF")
|
|
201
|
+
|
|
286
202
|
def readProvidedModeGroup(self, element: ET.Element, parent: BswModuleDescription):
|
|
287
203
|
for child_element in element.findall("./xmlns:PROVIDED-MODE-GROUPS/xmlns:MODE-DECLARATION-GROUP-PROTOTYPE", self.nsmap):
|
|
288
|
-
short_name = self.
|
|
204
|
+
short_name = self.getShortName(child_element)
|
|
289
205
|
self.logger.debug("readProvidedModeGroup %s" % short_name)
|
|
290
206
|
|
|
291
207
|
mode_group = parent.createProvidedModeGroup(short_name)
|
|
292
|
-
|
|
208
|
+
self.readModeDeclarationGroupPrototype(child_element, mode_group)
|
|
293
209
|
|
|
294
210
|
def readRequiredModeGroup(self, element: ET.Element, parent: BswModuleDescription):
|
|
295
211
|
for child_element in element.findall("./xmlns:REQUIRED-MODE-GROUPS/xmlns:MODE-DECLARATION-GROUP-PROTOTYPE", self.nsmap):
|
|
296
|
-
short_name = self.
|
|
212
|
+
short_name = self.getShortName(child_element)
|
|
297
213
|
self.logger.debug("readRequiredModeGroup %s" % short_name)
|
|
298
214
|
mode_group = parent.createProvidedModeGroup(short_name)
|
|
299
|
-
mode_group.type_tref = self.
|
|
215
|
+
mode_group.type_tref = self.getChildElementRefType(parent.short_name, child_element, "TYPE-TREF")
|
|
300
216
|
|
|
301
217
|
def readCanEnterExclusiveAreaRefs(self, element: ET.Element, entity: ExecutableEntity):
|
|
302
218
|
child_element = element.find("./xmlns:CAN-ENTER-EXCLUSIVE-AREA-REFS", self.nsmap)
|
|
303
|
-
if child_element
|
|
304
|
-
for ref in self.
|
|
219
|
+
if child_element is not None:
|
|
220
|
+
for ref in self.getChildElementRefTypeList(child_element, "./CAN-ENTER-EXCLUSIVE-AREA-REF"):
|
|
305
221
|
entity.addCanEnterExclusiveAreaRef(ref)
|
|
306
222
|
|
|
307
223
|
def readExecutableEntity(self, element: ET.Element, entity: ExecutableEntity):
|
|
224
|
+
self.logger.debug("readExecutableEntity %s" % entity.short_name)
|
|
225
|
+
self.readIdentifiable(element, entity)
|
|
308
226
|
self.readCanEnterExclusiveAreaRefs(element, entity)
|
|
227
|
+
entity.minimum_start_interval = self.getChildElementOptionalFloatValue(element, "MINIMUM-START-INTERVAL")
|
|
309
228
|
|
|
310
|
-
def
|
|
229
|
+
def readBswModuleEntityManagedModeGroup(self, element: ET.Element, entity: BswModuleEntity):
|
|
230
|
+
for child_element in self.findall(element, "./MANAGED-MODE-GROUPS/MODE-DECLARATION-GROUP-PROTOTYPE-REF-CONDITIONAL"):
|
|
231
|
+
ref_type = self.getChildElementOptionalRefType(child_element, "MODE-DECLARATION-GROUP-PROTOTYPE-REF")
|
|
232
|
+
if ref_type is not None:
|
|
233
|
+
entity.addManagedModeGroupRef(ref_type)
|
|
234
|
+
|
|
235
|
+
def readBswModuleEntity(self, element: ET.Element, entity: BswModuleEntity):
|
|
311
236
|
self.readExecutableEntity(element, entity)
|
|
312
|
-
|
|
313
|
-
|
|
237
|
+
entity.implemented_entry_ref = self.getChildElementRefType(entity.short_name, element, "IMPLEMENTED-ENTRY-REF")
|
|
238
|
+
self.readBswModuleEntityManagedModeGroup(element, entity)
|
|
314
239
|
|
|
315
240
|
def readBswCalledEntity(self, element: ET.Element, parent: BswInternalBehavior):
|
|
316
241
|
for child_element in element.findall("./xmlns:ENTITYS/xmlns:BSW-CALLED-ENTITY", self.nsmap):
|
|
317
|
-
short_name = self.
|
|
242
|
+
short_name = self.getShortName(child_element)
|
|
318
243
|
self.logger.debug("readBswCalledEntity %s" % short_name)
|
|
319
244
|
entity = parent.createBswCalledEntity(short_name)
|
|
320
245
|
|
|
@@ -322,187 +247,329 @@ class ARXMLParser:
|
|
|
322
247
|
|
|
323
248
|
def readBswSchedulableEntity(self, element: ET.Element, parent: BswInternalBehavior):
|
|
324
249
|
for child_element in element.findall("./xmlns:ENTITYS/xmlns:BSW-SCHEDULABLE-ENTITY", self.nsmap):
|
|
325
|
-
short_name = self.
|
|
250
|
+
short_name = self.getShortName(child_element)
|
|
326
251
|
self.logger.debug("readBswSchedulableEntity %s" % short_name)
|
|
327
252
|
entity = parent.createBswSchedulableEntity(short_name)
|
|
328
|
-
|
|
329
253
|
self.readBswModuleEntity(child_element, entity)
|
|
330
254
|
|
|
331
255
|
def readBswEvent(self, element: ET.Element, event: BswScheduleEvent):
|
|
332
|
-
event.
|
|
256
|
+
event.startsOnEventRef = self.getChildElementRefType(event.short_name, element, "STARTS-ON-EVENT-REF")
|
|
333
257
|
|
|
334
258
|
def readBswScheduleEvent(self, element, event: BswScheduleEvent):
|
|
335
259
|
self.readBswEvent(element, event)
|
|
336
260
|
|
|
337
261
|
def readBswModeSwitchEvent(self, element: ET.Element, parent: BswInternalBehavior):
|
|
338
262
|
for child_element in element.findall("./xmlns:EVENTS/xmlns:BSW-MODE-SWITCH-EVENT", self.nsmap):
|
|
339
|
-
short_name = self.
|
|
263
|
+
short_name = self.getShortName(child_element)
|
|
340
264
|
self.logger.debug("readBswModeSwitchEvent %s" % short_name)
|
|
341
265
|
event = parent.createBswModeSwitchEvent(short_name)
|
|
342
|
-
|
|
266
|
+
# Read the Inherit BswScheduleEvent
|
|
343
267
|
self.readBswScheduleEvent(child_element, event)
|
|
344
268
|
|
|
345
269
|
def readBswTimingEvent(self, element: ET.Element, parent: BswInternalBehavior):
|
|
346
270
|
for child_element in element.findall("./xmlns:EVENTS/xmlns:BSW-TIMING-EVENT", self.nsmap):
|
|
347
|
-
short_name = self.
|
|
271
|
+
short_name = self.getShortName(child_element)
|
|
348
272
|
self.logger.debug("readBswTimingEvent %s" % short_name)
|
|
349
273
|
event = parent.createBswTimingEvent(short_name)
|
|
350
|
-
event.period = self.
|
|
351
|
-
|
|
274
|
+
event.period = self.getChildElementOptionalFloatValue(child_element, "PERIOD")
|
|
275
|
+
# Read the Inherit BswScheduleEvent
|
|
352
276
|
self.readBswScheduleEvent(child_element, event)
|
|
353
277
|
|
|
354
278
|
def readBswDataReceivedEvent(self, element: ET.Element, parent: BswInternalBehavior):
|
|
355
279
|
for child_element in element.findall("./xmlns:EVENTS/xmlns:BSW-DATA-RECEIVED-EVENT", self.nsmap):
|
|
356
|
-
short_name = self.
|
|
280
|
+
short_name = self.getShortName(child_element)
|
|
357
281
|
self.logger.debug("readBswDataReceivedEvent %s" % short_name)
|
|
358
282
|
event = parent.createBswDataReceivedEvent(short_name)
|
|
359
|
-
event.data_ref = self.
|
|
360
|
-
|
|
283
|
+
event.data_ref = self.getChildElementRefType(parent.short_name, child_element, "DATA-REF")
|
|
284
|
+
# Read the Inherit BswScheduleEvent
|
|
361
285
|
self.readBswScheduleEvent(child_element, event)
|
|
362
286
|
|
|
363
287
|
def readBswInternalTriggerOccurredEvent(self, element: ET.Element, parent: BswInternalBehavior):
|
|
364
|
-
for child_element in
|
|
365
|
-
short_name = self.
|
|
288
|
+
for child_element in self.findall(element, "./EVENTS/BSW-INTERNAL-TRIGGER-OCCURRED-EVENT"):
|
|
289
|
+
short_name = self.getShortName(child_element)
|
|
366
290
|
self.logger.debug("readBswInternalTriggerOccurredEvent %s" % short_name)
|
|
367
291
|
event = parent.createBswInternalTriggerOccurredEvent(short_name)
|
|
368
|
-
event.event_source_ref = self.
|
|
369
|
-
|
|
292
|
+
event.event_source_ref = self.getChildElementRefType(parent.short_name, child_element, "EVENT-SOURCE-REF")
|
|
293
|
+
# Read the Inherit BswScheduleEvent
|
|
370
294
|
self.readBswScheduleEvent(child_element, event)
|
|
371
295
|
|
|
296
|
+
def getBswModeSenderPolicy(self, element: ET.Element) -> BswModeSenderPolicy:
|
|
297
|
+
policy = BswModeSenderPolicy()
|
|
298
|
+
policy.setProvidedModeGroupRef(self.getChildElementOptionalRefType(element, "PROVIDED-MODE-GROUP-REF"))
|
|
299
|
+
policy.setQueueLength(self.getChildElementOptionalNumericalValue(element, "QUEUE-LENGTH"))
|
|
300
|
+
return policy
|
|
301
|
+
|
|
302
|
+
def readBswInternalBehaviorModeSenderPolicy(self, element: ET.Element, parent: BswInternalBehavior):
|
|
303
|
+
for child_element in self.findall(element, "./MODE-SENDER-POLICYS/*"):
|
|
304
|
+
tag_name = self.getTagName(child_element)
|
|
305
|
+
if tag_name == "BSW-MODE-SENDER-POLICY":
|
|
306
|
+
parent.addModeSenderPolicy(self.getBswModeSenderPolicy(child_element))
|
|
307
|
+
else:
|
|
308
|
+
self._raiseError("Unsupported ModeSenderPolicy type <%s>." % tag_name)
|
|
309
|
+
|
|
372
310
|
def readDataTypeMappingRefs(self, element: ET.Element, behavior: InternalBehavior):
|
|
373
311
|
child_element = element.find("./xmlns:DATA-TYPE-MAPPING-REFS", self.nsmap)
|
|
374
|
-
if child_element
|
|
375
|
-
for ref in self.
|
|
312
|
+
if child_element is not None:
|
|
313
|
+
for ref in self.getChildElementRefTypeList(child_element, "./DATA-TYPE-MAPPING-REF"):
|
|
376
314
|
behavior.addDataTypeMappingRef(ref)
|
|
377
315
|
|
|
316
|
+
def readInternalBehaviorConstantMemories(self, element: ET.Element, behavior: InternalBehavior):
|
|
317
|
+
for child_element in element.findall("./xmlns:CONSTANT-MEMORYS/xmlns:PARAMETER-DATA-PROTOTYPE", self.nsmap):
|
|
318
|
+
short_name = self.getShortName(child_element)
|
|
319
|
+
prototype = behavior.createConstantMemory(short_name)
|
|
320
|
+
self.readParameterDataPrototype(child_element, prototype)
|
|
321
|
+
|
|
378
322
|
def readInternalBehavior(self, element: ET.Element, behavior: InternalBehavior):
|
|
323
|
+
self.readIdentifiable(element, behavior)
|
|
324
|
+
self.readInternalBehaviorConstantMemories(element, behavior)
|
|
379
325
|
for child_element in element.findall("./xmlns:EXCLUSIVE-AREAS/xmlns:EXCLUSIVE-AREA", self.nsmap):
|
|
380
|
-
short_name = self.
|
|
326
|
+
short_name = self.getShortName(child_element)
|
|
381
327
|
behavior.createExclusiveArea(short_name)
|
|
382
|
-
|
|
383
328
|
self.readDataTypeMappingRefs(element, behavior)
|
|
384
329
|
|
|
385
|
-
def
|
|
386
|
-
|
|
387
|
-
|
|
330
|
+
def getRoleBasedDataAssignment(self, element: ET.Element) -> RoleBasedDataAssignment:
|
|
331
|
+
assignment = RoleBasedDataAssignment()
|
|
332
|
+
assignment.role = self.getChildElementOptionalLiteral(element, "ROLE")
|
|
333
|
+
assignment.used_parameter_element = self.getAutosarParameterRef(element, "USED-PARAMETER-ELEMENT")
|
|
334
|
+
assignment.used_pim_ref = self.getChildElementOptionalRefType(element, "USED-PIM-REF")
|
|
335
|
+
return assignment
|
|
336
|
+
|
|
337
|
+
def getRoleBasedPortAssignment(self, element: ET.Element) -> RoleBasedPortAssignment:
|
|
338
|
+
assignment = RoleBasedPortAssignment()
|
|
339
|
+
assignment.port_prototype_ref = self.getChildElementOptionalRefType(element, "PORT-PROTOTYPE-REF")
|
|
340
|
+
assignment.role = self.getChildElementOptionalLiteral(element, "ROLE")
|
|
341
|
+
return assignment
|
|
342
|
+
|
|
343
|
+
def readServiceDependency(self, element: ET.Element, dependency: ServiceDependency):
|
|
344
|
+
self.readIdentifiable(element, dependency)
|
|
345
|
+
|
|
346
|
+
def readSwcServiceDependencyAssignedData(self, element: ET.Element, dependency: SwcServiceDependency):
|
|
347
|
+
for child_element in element.findall("./xmlns:ASSIGNED-DATAS/*", self.nsmap):
|
|
348
|
+
tag_name = self.getTagName(child_element.tag)
|
|
349
|
+
if (tag_name == "ROLE-BASED-DATA-ASSIGNMENT"):
|
|
350
|
+
dependency.AddAssignedData(self.getRoleBasedDataAssignment(child_element))
|
|
351
|
+
else:
|
|
352
|
+
self._raiseError("Unsupported assigned data <%s>" % tag_name)
|
|
353
|
+
|
|
354
|
+
def readSwcServiceDependencyAssignedPorts(self, element: ET.Element, dependency: SwcServiceDependency):
|
|
355
|
+
for child_element in element.findall("./xmlns:ASSIGNED-PORTS/*", self.nsmap):
|
|
356
|
+
tag_name = self.getTagName(child_element.tag)
|
|
357
|
+
if (tag_name == "ROLE-BASED-PORT-ASSIGNMENT"):
|
|
358
|
+
dependency.AddAssignedPort(self.getRoleBasedPortAssignment(child_element))
|
|
359
|
+
else:
|
|
360
|
+
self._raiseError("Unsupported assigned ports <%s>" % tag_name)
|
|
361
|
+
|
|
362
|
+
def readNvBlockNeeds(self, element: ET.Element, parent: SwcServiceDependency):
|
|
363
|
+
short_name = self.getShortName(element)
|
|
364
|
+
needs = parent.createNvBlockNeeds(short_name)
|
|
365
|
+
self.logger.debug("readNvBlockNeeds %s" % short_name)
|
|
366
|
+
needs.calc_ram_block_crc = self.getChildElementOptionalBooleanValue(element, "CALC-RAM-BLOCK-CRC")
|
|
367
|
+
needs.check_static_block_id = self.getChildElementOptionalBooleanValue(element, "CHECK-STATIC-BLOCK-ID")
|
|
368
|
+
needs.n_data_sets = self.getChildElementOptionalNumericalValue(element, "N-DATA-SETS")
|
|
369
|
+
needs.n_rom_blocks = self.getChildElementOptionalNumericalValue(element, "N-ROM-BLOCKS")
|
|
370
|
+
needs.readonly = self.getChildElementOptionalBooleanValue(element, "READONLY")
|
|
371
|
+
needs.reliability = self.getChildElementOptionalLiteral(element, "RELIABILITY")
|
|
372
|
+
needs.resistant_to_changed_sw = self.getChildElementOptionalBooleanValue(element, "RESISTANT-TO-CHANGED-SW")
|
|
373
|
+
needs.restore_at_start = self.getChildElementOptionalBooleanValue(element, "RESTORE-AT-START")
|
|
374
|
+
needs.store_at_shutdown = self.getChildElementOptionalBooleanValue(element, "STORE-AT-SHUTDOWN")
|
|
375
|
+
needs.write_only_once = self.getChildElementOptionalBooleanValue(element, "WRITE-ONLY-ONCE")
|
|
376
|
+
needs.write_verification = self.getChildElementOptionalBooleanValue(element, "WRITE-VERIFICATION")
|
|
377
|
+
needs.writing_priority = self.getChildElementOptionalLiteral(element, "WRITING-PRIORITY")
|
|
378
|
+
|
|
379
|
+
def readSwcServiceDependencyServiceNeeds(self, element: ET.Element, parent: SwcServiceDependency):
|
|
380
|
+
for child_element in element.findall("./xmlns:SERVICE-NEEDS/*", self.nsmap):
|
|
381
|
+
tag_name = self.getTagName(child_element.tag)
|
|
382
|
+
if tag_name == "NV-BLOCK-NEEDS":
|
|
383
|
+
self.readNvBlockNeeds(child_element, parent)
|
|
384
|
+
else:
|
|
385
|
+
self._raiseError("Unsupported service needs <%s>" % tag_name)
|
|
386
|
+
|
|
387
|
+
def readSwcServiceDependency(self, element: ET.Element, parent: SwcInternalBehavior):
|
|
388
|
+
short_name = self.getShortName(element)
|
|
389
|
+
dependency = parent.createSwcServiceDependency(short_name)
|
|
390
|
+
self.logger.debug("readSwcServiceDependency %s" % short_name)
|
|
391
|
+
self.readServiceDependency(element, dependency)
|
|
392
|
+
self.readSwcServiceDependencyAssignedData(element, dependency)
|
|
393
|
+
self.readSwcServiceDependencyAssignedPorts(element, dependency)
|
|
394
|
+
self.readSwcServiceDependencyServiceNeeds(element, dependency)
|
|
395
|
+
|
|
396
|
+
def readSwcInternalBehaviorServiceDependencies(self, element: ET.Element, parent: SwcInternalBehavior):
|
|
397
|
+
for child_element in element.findall("./xmlns:SERVICE-DEPENDENCYS/*", self.nsmap):
|
|
398
|
+
tag_name = self.getTagName(child_element.tag)
|
|
399
|
+
if (tag_name == "SWC-SERVICE-DEPENDENCY"):
|
|
400
|
+
self.readSwcServiceDependency(child_element, parent)
|
|
401
|
+
else:
|
|
402
|
+
self._raiseError("Unsupported Service Dependencies <%s>" % tag_name)
|
|
403
|
+
|
|
404
|
+
def getIncludedDataTypeSets(self, element: ET.Element) -> List[IncludedDataTypeSet]:
|
|
405
|
+
include_data_type_sets = []
|
|
406
|
+
for child_element in self.findall(element, "./INCLUDED-DATA-TYPE-SETS/INCLUDED-DATA-TYPE-SET"):
|
|
407
|
+
include_data_type_set = IncludedDataTypeSet()
|
|
408
|
+
self.readElementAttributes(child_element, include_data_type_set)
|
|
409
|
+
for ref_type in self.getChildElementRefTypeList(child_element, "./DATA-TYPE-REFS/DATA-TYPE-REF"):
|
|
410
|
+
include_data_type_set.addDataTypeRef(ref_type)
|
|
411
|
+
include_data_type_sets.append(include_data_type_set)
|
|
412
|
+
return include_data_type_sets
|
|
413
|
+
|
|
414
|
+
def readSwcInternalBehavior(self, element: ET.Element, parent: AtomicSwComponentType):
|
|
415
|
+
for child_element in self.findall(element, "./INTERNAL-BEHAVIORS/SWC-INTERNAL-BEHAVIOR"):
|
|
416
|
+
short_name = self.getShortName(child_element)
|
|
388
417
|
behavior = parent.createSwcInternalBehavior(short_name)
|
|
389
|
-
self.logger.debug("
|
|
418
|
+
self.logger.debug("readSwcInternalBehavior %s" % behavior.full_name)
|
|
390
419
|
|
|
391
420
|
# read the internal behavior
|
|
392
421
|
self.readInternalBehavior(child_element, behavior)
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
self.
|
|
396
|
-
self.
|
|
397
|
-
self.
|
|
422
|
+
|
|
423
|
+
# read the extra SwcInternalBehavior
|
|
424
|
+
self.readSwcInternalBehaviorRunnables(child_element, behavior)
|
|
425
|
+
self.readSwcInternalBehaviorEvents(child_element, behavior)
|
|
426
|
+
self.readSwcInternalBehaviorServiceDependencies(child_element, behavior)
|
|
398
427
|
self.readExplicitInterRunnableVariables(child_element, behavior)
|
|
428
|
+
for data_type_set in self.getIncludedDataTypeSets(child_element):
|
|
429
|
+
behavior.addIncludedDataTypeSet(data_type_set)
|
|
430
|
+
behavior.handle_termination_and_restart = self.getChildElementOptionalLiteral(child_element, "HANDLE-TERMINATION-AND-RESTART")
|
|
431
|
+
self.readPerInstanceMemories(child_element, behavior)
|
|
432
|
+
self.readPerInstanceParameters(child_element, behavior)
|
|
433
|
+
self.readPortAPIOptions(child_element, behavior)
|
|
434
|
+
behavior.supports_multiple_instantiation = self.getChildElementOptionalBooleanValue(child_element, "SUPPORTS-MULTIPLE-INSTANTIATION")
|
|
435
|
+
|
|
436
|
+
def getIncludedModeDeclarationGroupSets(self, element: ET.Element) -> List[IncludedModeDeclarationGroupSet]:
|
|
437
|
+
group_sets = []
|
|
438
|
+
for child_element in self.findall(element, "INCLUDED-MODE-DECLARATION-GROUP-SETS/INCLUDED-MODE-DECLARATION-GROUP-SET"):
|
|
439
|
+
group_set = IncludedModeDeclarationGroupSet()
|
|
440
|
+
for ref_type in self.getChildElementRefTypeList(child_element, "./MODE-DECLARATION-GROUP-REFS/MODE-DECLARATION-GROUP-REF"):
|
|
441
|
+
group_set.addModeDeclarationGroupRef(ref_type)
|
|
442
|
+
group_sets.append(group_set)
|
|
443
|
+
return group_sets
|
|
399
444
|
|
|
400
445
|
def readBswInternalBehavior(self, element: ET.Element, parent: BswModuleDescription):
|
|
401
446
|
for child_element in element.findall("./xmlns:INTERNAL-BEHAVIORS/xmlns:BSW-INTERNAL-BEHAVIOR", self.nsmap):
|
|
402
|
-
short_name = self.
|
|
447
|
+
short_name = self.getShortName(child_element)
|
|
403
448
|
behavior = parent.createBswInternalBehavior(short_name)
|
|
404
449
|
self.logger.debug("readBswInternalBehavior %s" % behavior.full_name)
|
|
405
450
|
|
|
406
451
|
# read the internal behavior
|
|
407
452
|
self.readInternalBehavior(child_element, behavior)
|
|
408
|
-
|
|
409
453
|
self.readBswCalledEntity(child_element, behavior)
|
|
410
454
|
self.readBswSchedulableEntity(child_element, behavior)
|
|
411
455
|
self.readBswModeSwitchEvent(child_element, behavior)
|
|
412
456
|
self.readBswTimingEvent(child_element, behavior)
|
|
413
457
|
self.readBswDataReceivedEvent(child_element, behavior)
|
|
414
458
|
self.readBswInternalTriggerOccurredEvent(child_element, behavior)
|
|
459
|
+
self.readBswInternalBehaviorModeSenderPolicy(child_element, behavior)
|
|
460
|
+
for group_set in self.getIncludedModeDeclarationGroupSets(child_element):
|
|
461
|
+
behavior.addIncludedModeDeclarationGroupSet(group_set)
|
|
415
462
|
|
|
416
463
|
def readBswModuleDescription(self, element: ET.Element, parent: ARPackage):
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
bsw_module_description.module_id = self.readChildElementNumberValue(short_name, child_element, "MODULE-ID")
|
|
464
|
+
short_name = self.getShortName(element)
|
|
465
|
+
bsw_module_description = parent.createBswModuleDescription(short_name)
|
|
466
|
+
bsw_module_description.module_id = self.getChildElementOptionalNumericalValue(element, "MODULE-ID")
|
|
421
467
|
|
|
422
|
-
|
|
468
|
+
self.logger.debug("readBswModuleDescription %s" % bsw_module_description.full_name)
|
|
423
469
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
470
|
+
self.readBswModuleDescriptionImplementedEntry(element, bsw_module_description)
|
|
471
|
+
self.readProvidedModeGroup(element, bsw_module_description)
|
|
472
|
+
self.readRequiredModeGroup(element, bsw_module_description)
|
|
473
|
+
self.readBswInternalBehavior(element, bsw_module_description)
|
|
428
474
|
|
|
429
475
|
def readBswModuleEntry(self, element: ET.Element, parent: ARPackage):
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
476
|
+
short_name = self.getShortName(element)
|
|
477
|
+
entry = parent.createBswModuleEntry(short_name)
|
|
478
|
+
entry.is_reentrant = self.getChildElementOptionalBooleanValue(element, "IS-REENTRANT")
|
|
479
|
+
entry.is_synchronous = self.getChildElementOptionalBooleanValue(element, "IS-SYNCHRONOUS")
|
|
480
|
+
entry.service_id = self.getChildElementOptionalNumericalValue(element, "SERVICE-ID")
|
|
481
|
+
entry.call_type = self.getChildElementOptionalLiteral(element, "CALL-TYPE")
|
|
482
|
+
entry.execution_context = self.getChildElementOptionalLiteral(element, "EXECUTION-CONTEXT")
|
|
483
|
+
entry.sw_service_impl_policy = self.getChildElementOptionalLiteral(element, "SW-SERVICE-IMPL-POLICY")
|
|
484
|
+
|
|
485
|
+
#self.logger.debug("readBswModuleEntry \n%s" % entry)
|
|
486
|
+
self.logger.debug("readBswModuleEntry %s" % entry.short_name)
|
|
487
|
+
|
|
488
|
+
def readEngineeringObject(self, element: ET.Element, engineering_obj: EngineeringObject):
|
|
489
|
+
self.readElementAttributes(element, engineering_obj)
|
|
490
|
+
engineering_obj.setShortLabel(self.getChildElementOptionalLiteral(element, "SHORT-LABEL")) \
|
|
491
|
+
.setCategory(self.getChildElementOptionalLiteral(element, "CATEGORY"))
|
|
492
|
+
|
|
493
|
+
def getAutosarEngineeringObject(self, element: ET.Element) -> AutosarEngineeringObject:
|
|
494
|
+
obj = AutosarEngineeringObject()
|
|
495
|
+
self.readEngineeringObject(element, obj)
|
|
496
|
+
self.logger.debug("getAutosarEngineeringObject %s", obj.short_label)
|
|
497
|
+
return obj
|
|
442
498
|
|
|
443
499
|
def readArtifactDescriptor(self, element: ET.Element, code_desc: Code):
|
|
444
|
-
for child_element in element.findall("./xmlns:ARTIFACT-DESCRIPTORS
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
500
|
+
for child_element in element.findall("./xmlns:ARTIFACT-DESCRIPTORS/*", self.nsmap):
|
|
501
|
+
tag_name = self.getTagName(child_element.tag)
|
|
502
|
+
if tag_name == "AUTOSAR-ENGINEERING-OBJECT":
|
|
503
|
+
code_desc.addArtifactDescriptor(self.getAutosarEngineeringObject(child_element))
|
|
504
|
+
else:
|
|
505
|
+
self._raiseError("Unsupported Artifact Descriptor <%s>" % tag_name)
|
|
449
506
|
|
|
450
|
-
self.logger.debug("readArtifactDescriptor %s", artifact_desc.short_label)
|
|
451
|
-
|
|
452
507
|
def readCodeDescriptor(self, element: ET.Element, impl: Implementation):
|
|
453
508
|
for child_element in element.findall("./xmlns:CODE-DESCRIPTORS/xmlns:CODE", self.nsmap):
|
|
454
|
-
short_name = self.
|
|
509
|
+
short_name = self.getShortName(child_element)
|
|
455
510
|
self.logger.debug("readCodeDescriptor %s" % short_name)
|
|
456
511
|
code_desc = impl.createCodeDescriptor(short_name)
|
|
512
|
+
self.readIdentifiable(child_element, code_desc)
|
|
457
513
|
self.readArtifactDescriptor(child_element, code_desc)
|
|
458
514
|
|
|
515
|
+
def readMemorySectionOptions(self, element: ET.Element, section: MemorySection):
|
|
516
|
+
child_element = element.find("./xmlns:OPTIONS", self.nsmap)
|
|
517
|
+
if child_element is not None:
|
|
518
|
+
for value in self.getChildElementLiteralValueList(child_element, "OPTION"):
|
|
519
|
+
section.addOption(value)
|
|
520
|
+
|
|
459
521
|
def readMemorySections(self, element: ET.Element, consumption: ResourceConsumption):
|
|
460
522
|
for child_element in element.findall("./xmlns:MEMORY-SECTIONS/xmlns:MEMORY-SECTION", self.nsmap):
|
|
461
|
-
short_name = self.
|
|
523
|
+
short_name = self.getShortName(child_element)
|
|
462
524
|
memory_section = consumption.createMemorySection(short_name)
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
memory_section.
|
|
525
|
+
self.readIdentifiable(child_element, memory_section)
|
|
526
|
+
memory_section.alignment = self.getChildElementOptionalLiteral(child_element, "ALIGNMENT")
|
|
527
|
+
self.readMemorySectionOptions(child_element, memory_section)
|
|
528
|
+
memory_section.size = self.getChildElementOptionalNumericalValue(child_element, "SIZE")
|
|
529
|
+
memory_section.swAddrMethodRef = self.getChildElementOptionalRefType(child_element, "SW-ADDRMETHOD-REF")
|
|
530
|
+
memory_section.symbol = self.getChildElementOptionalLiteral(child_element, "SYMBOL")
|
|
467
531
|
self.logger.debug("readMemorySections %s" % memory_section.short_name)
|
|
468
532
|
|
|
469
533
|
def readResourceConsumption(self, element: ET.Element, impl: Implementation):
|
|
470
534
|
child_element = element.find("./xmlns:RESOURCE-CONSUMPTION", self.nsmap)
|
|
471
|
-
if (child_element
|
|
472
|
-
self.
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
535
|
+
if (child_element is not None):
|
|
536
|
+
short_name = self.getShortName(child_element)
|
|
537
|
+
consumption = ResourceConsumption(impl, short_name)
|
|
538
|
+
self.readIdentifiable(child_element, consumption)
|
|
539
|
+
self.readMemorySections(child_element, consumption)
|
|
540
|
+
impl.setResourceConsumption(consumption)
|
|
477
541
|
|
|
478
542
|
def readImplementation(self, element: ET.Element, impl: Implementation):
|
|
543
|
+
self.readIdentifiable(element, impl)
|
|
479
544
|
self.readCodeDescriptor(element, impl)
|
|
480
|
-
impl.programming_language = self.
|
|
545
|
+
impl.programming_language = self.getChildElementOptionalLiteral(element, "PROGRAMMING-LANGUAGE")
|
|
481
546
|
self.readResourceConsumption(element, impl)
|
|
482
|
-
impl.sw_version = self.
|
|
483
|
-
impl.swc_bsw_mapping_ref = self.
|
|
484
|
-
impl.
|
|
547
|
+
impl.sw_version = self.getChildElementOptionalLiteral(element, "SW-VERSION")
|
|
548
|
+
impl.swc_bsw_mapping_ref = self.getChildElementOptionalRefType(element, "SWC-BSW-MAPPING-REF")
|
|
549
|
+
impl.used_code_generator = self.getChildElementOptionalLiteral(element, "USED-CODE-GENERATOR")
|
|
550
|
+
impl.vendor_id = self.getChildElementOptionalNumericalValue(element, "VENDOR-ID")
|
|
485
551
|
|
|
486
|
-
def
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
self.readImplementation(child_element, impl)
|
|
552
|
+
def readBswImplementationVendorSpecificModuleDefRefs(self, element: ET.Element, parent: BswImplementation):
|
|
553
|
+
child_element = element.find("./xmlns:VENDOR-SPECIFIC-MODULE-DEF-REFS", self.nsmap)
|
|
554
|
+
if child_element is not None:
|
|
555
|
+
for ref in self.getChildElementRefTypeList(child_element, "./VENDOR-SPECIFIC-MODULE-DEF-REF"):
|
|
556
|
+
parent.addVendorSpecificModuleDefRef(ref)
|
|
493
557
|
|
|
494
|
-
|
|
495
|
-
|
|
558
|
+
def readBswImplementation(self, element: ET.Element, parent: ARPackage):
|
|
559
|
+
short_name = self.getShortName(element)
|
|
560
|
+
impl = parent.createBswImplementation(short_name)
|
|
561
|
+
self.logger.debug("readBswImplementation %s" % impl.short_name)
|
|
562
|
+
self.readImplementation(element, impl)
|
|
563
|
+
impl.ar_release_version = self.getChildElementOptionalLiteral(element, "AR-RELEASE-VERSION")
|
|
564
|
+
impl.behavior_ref = self.getChildElementOptionalRefType(element, "BEHAVIOR-REF")
|
|
565
|
+
self.readBswImplementationVendorSpecificModuleDefRefs(element, impl)
|
|
496
566
|
|
|
497
567
|
def readSwcImplementation(self, element: ET.Element, parent: ARPackage):
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
self.readImplementation(child_element, impl)
|
|
504
|
-
|
|
505
|
-
impl.behavior_ref = self.readChildRefElement(parent.short_name, child_element, "BEHAVIOR-REF")
|
|
568
|
+
short_name = self.getShortName(element)
|
|
569
|
+
impl = parent.createSwcImplementation(short_name)
|
|
570
|
+
self.logger.debug("readSwcImplementation %s" % impl.short_name)
|
|
571
|
+
self.readImplementation(element, impl)
|
|
572
|
+
impl.behavior_ref = self.getChildElementOptionalRefType(element, "BEHAVIOR-REF")
|
|
506
573
|
|
|
507
574
|
def readDataReceivePointByArguments(self, element, parent: RunnableEntity):
|
|
508
575
|
self._readVariableAccesses(element, parent, "DATA-RECEIVE-POINT-BY-ARGUMENTS")
|
|
@@ -513,470 +580,658 @@ class ARXMLParser:
|
|
|
513
580
|
def readDataReadAccesses(self, element: ET.Element, parent: RunnableEntity):
|
|
514
581
|
self._readVariableAccesses(element, parent, "DATA-READ-ACCESSS")
|
|
515
582
|
|
|
583
|
+
def readDataWriteAccesses(self, element: ET.Element, parent: RunnableEntity):
|
|
584
|
+
self._readVariableAccesses(element, parent, "DATA-WRITE-ACCESSS")
|
|
585
|
+
|
|
516
586
|
def readDataSendPoints(self, element: ET.Element, parent: RunnableEntity):
|
|
517
587
|
self._readVariableAccesses(element, parent, "DATA-SEND-POINTS")
|
|
518
588
|
|
|
589
|
+
def getAutosarParameterRef(self, element: ET.Element, key: str) -> AutosarParameterRef:
|
|
590
|
+
accessed_parameter = None
|
|
591
|
+
child_element = element.find("./xmlns:%s" % key, self.nsmap)
|
|
592
|
+
if child_element is not None:
|
|
593
|
+
accessed_parameter = AutosarParameterRef()
|
|
594
|
+
accessed_parameter.local_parameter_ref = self.getChildElementOptionalRefType(child_element, "LOCAL-PARAMETER-REF")
|
|
595
|
+
return accessed_parameter
|
|
596
|
+
|
|
597
|
+
def readParameterAccesses(self, element: ET.Element, parent: RunnableEntity):
|
|
598
|
+
for child_element in element.findall("./xmlns:PARAMETER-ACCESSS/xmlns:PARAMETER-ACCESS", self.nsmap):
|
|
599
|
+
short_name = self.getShortName(child_element)
|
|
600
|
+
self.logger.debug("readParameterAccesses %s" % short_name)
|
|
601
|
+
parameter_access = parent.createParameterAccess(short_name)
|
|
602
|
+
parameter_access.accessed_parameter = self.getAutosarParameterRef(child_element, "ACCESSED-PARAMETER")
|
|
603
|
+
|
|
519
604
|
def readWrittenLocalVariables(self, element: ET.Element, parent: RunnableEntity):
|
|
520
605
|
self._readVariableAccesses(element, parent, "WRITTEN-LOCAL-VARIABLES")
|
|
521
606
|
|
|
522
607
|
def readReadLocalVariables(self, element: ET.Element, parent: RunnableEntity):
|
|
523
608
|
self._readVariableAccesses(element, parent, "READ-LOCAL-VARIABLES")
|
|
524
609
|
|
|
525
|
-
def readROperationIRef(self, element: ET.Element, parent: ServerCallPoint):
|
|
526
|
-
child_element = element.find("./xmlns
|
|
527
|
-
if (child_element
|
|
610
|
+
def readROperationIRef(self, element: ET.Element, key: str, parent: ServerCallPoint):
|
|
611
|
+
child_element = element.find("./xmlns:%s" % key, self.nsmap)
|
|
612
|
+
if (child_element is not None):
|
|
528
613
|
operation_iref = ROperationInAtomicSwcInstanceRef()
|
|
529
|
-
operation_iref.context_r_port_ref = self.
|
|
530
|
-
operation_iref.target_required_operation_ref = self.
|
|
614
|
+
operation_iref.context_r_port_ref = self.getChildElementOptionalRefType(child_element, "CONTEXT-R-PORT-REF")
|
|
615
|
+
operation_iref.target_required_operation_ref = self.getChildElementOptionalRefType(child_element, "TARGET-REQUIRED-OPERATION-REF")
|
|
531
616
|
parent.operation_iref = operation_iref
|
|
532
617
|
|
|
533
618
|
def readRVariableInAtomicSwcInstanceRef(self, element: ET.Element, parent: DataReceivedEvent):
|
|
534
|
-
child_element =
|
|
535
|
-
if (child_element
|
|
619
|
+
child_element = self.find(element, "DATA-IREF")
|
|
620
|
+
if (child_element is not None):
|
|
536
621
|
data_iref = RVariableInAtomicSwcInstanceRef()
|
|
537
|
-
data_iref.context_r_port_ref = self.
|
|
538
|
-
data_iref.
|
|
622
|
+
data_iref.context_r_port_ref = self.getChildElementOptionalRefType(child_element, "CONTEXT-R-PORT-REF")
|
|
623
|
+
data_iref.target_data_element_ref = self.getChildElementOptionalRefType(child_element, "TARGET-DATA-ELEMENT-REF")
|
|
539
624
|
parent.data_iref = data_iref
|
|
540
625
|
|
|
541
626
|
def readRModeInAtomicSwcInstanceRef(self, element: ET.Element, parent: SwcModeSwitchEvent):
|
|
542
627
|
for child_element in element.findall("./xmlns:MODE-IREFS/xmlns:MODE-IREF", self.nsmap):
|
|
543
628
|
mode_iref = RModeInAtomicSwcInstanceRef()
|
|
544
|
-
mode_iref.
|
|
545
|
-
mode_iref.
|
|
546
|
-
mode_iref.
|
|
629
|
+
mode_iref.context_port_ref = self.getChildElementOptionalRefType(child_element, "CONTEXT-PORT-REF")
|
|
630
|
+
mode_iref.context_mode_declaration_group_prototype_ref = self.getChildElementRefType("", child_element, "CONTEXT-MODE-DECLARATION-GROUP-PROTOTYPE-REF")
|
|
631
|
+
mode_iref.target_mode_declaration_ref = self.getChildElementRefType("", child_element, "TARGET-MODE-DECLARATION-REF")
|
|
547
632
|
parent.addModeIRef(mode_iref)
|
|
548
633
|
|
|
549
634
|
def readSynchronousServerCallPoint(self, element: ET.Element, parent: RunnableEntity):
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
635
|
+
short_name = self.getShortName(element)
|
|
636
|
+
self.logger.debug("readSynchronousServerCallPoint %s" % short_name)
|
|
637
|
+
server_call_point = parent.createSynchronousServerCallPoint(short_name)
|
|
638
|
+
self.readIdentifiable(element, server_call_point)
|
|
639
|
+
server_call_point.timeout = self.getChildElementOptionalFloatValue(element, "TIMEOUT")
|
|
640
|
+
self.readROperationIRef(element, "OPERATION-IREF", server_call_point)
|
|
555
641
|
|
|
556
642
|
def readAsynchronousServerCallPoint(self, element: ET.Element, parent: RunnableEntity):
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
runnable.can_be_invoked_concurrently = self.readChildOptionalElement(child_element, "CAN-BE-INVOKED-CONCURRENTLY")
|
|
574
|
-
runnable.symbol = self.readChildElement(short_name, child_element, "SYMBOL")
|
|
643
|
+
short_name = self.getShortName(element)
|
|
644
|
+
self.logger.debug("readAsynchronousServerCallPoint %s" % short_name)
|
|
645
|
+
server_call_point = parent.createAsynchronousServerCallPoint(short_name)
|
|
646
|
+
self.readIdentifiable(element, server_call_point)
|
|
647
|
+
server_call_point.timeout = self.getChildElementOptionalFloatValue(element, "TIMEOUT")
|
|
648
|
+
self.readROperationIRef(element, "OPERATION-IREF", server_call_point)
|
|
649
|
+
|
|
650
|
+
def readInternalBehaviorServerCallPoint(self, element: ET.Element, parent: RunnableEntity):
|
|
651
|
+
for child_element in element.findall("./xmlns:SERVER-CALL-POINTS/*", self.nsmap):
|
|
652
|
+
tag_name = self.getTagName(child_element.tag)
|
|
653
|
+
if tag_name == "SYNCHRONOUS-SERVER-CALL-POINT":
|
|
654
|
+
self.readSynchronousServerCallPoint(child_element, parent)
|
|
655
|
+
elif tag_name == "ASYNCHRONOUS-SERVER-CALL-POINT":
|
|
656
|
+
self.readAsynchronousServerCallPoint(child_element, parent)
|
|
657
|
+
else:
|
|
658
|
+
self._raiseError("Unsupported server call point type <%s>" % tag_name)
|
|
575
659
|
|
|
660
|
+
def readInternalTriggeringPoints(self, element: ET.Element, parent: RunnableEntity):
|
|
661
|
+
for child_element in self.findall(element, "INTERNAL-TRIGGERING-POINTS/INTERNAL-TRIGGERING-POINT"):
|
|
662
|
+
short_name = self.getShortName(child_element)
|
|
663
|
+
point = parent.createInternalTriggeringPoint(short_name)
|
|
664
|
+
point.sw_impl_policy = self.getChildElementOptionalLiteral(child_element, "SW-IMPL-POLICY")
|
|
665
|
+
|
|
666
|
+
def getRModeInAtomicSwcInstanceRef(self, element: ET.Element) -> RModeInAtomicSwcInstanceRef:
|
|
667
|
+
iref = RModeInAtomicSwcInstanceRef()
|
|
668
|
+
iref.base_ref = self.getChildElementOptionalRefType(element, "BASE")
|
|
669
|
+
iref.context_port_ref = self.getChildElementOptionalRefType(element, "CONTEXT-PORT-REF")
|
|
670
|
+
iref.context_mode_declaration_group_prototype_ref = self.getChildElementOptionalRefType(element, "CONTEXT-MODE-DECLARATION-GROUP-PROTOTYPE-REF")
|
|
671
|
+
iref.target_mode_declaration_ref = self.getChildElementOptionalRefType(element, "TARGET-MODE-DECLARATION-REF")
|
|
672
|
+
return iref
|
|
673
|
+
|
|
674
|
+
def getRModeGroupInAtomicSWCInstanceRef(self, element: ET.Element) -> RModeGroupInAtomicSWCInstanceRef:
|
|
675
|
+
child_element = self.find(element, "MODE-GROUP-IREF/R-MODE-GROUP-IN-ATOMIC-SWC-INSTANCE-REF")
|
|
676
|
+
iref = None
|
|
677
|
+
if child_element is not None:
|
|
678
|
+
iref = RModeGroupInAtomicSWCInstanceRef()
|
|
679
|
+
iref.contextRPort = self.getChildElementOptionalRefType(child_element, "CONTEXT-R-PORT-REF")
|
|
680
|
+
iref.targetModeGroup = self.getChildElementOptionalRefType(child_element, "TARGET-MODE-GROUP-REF")
|
|
681
|
+
return iref
|
|
682
|
+
|
|
683
|
+
def readModeAccessPoints(self, element: ET.Element, parent: RunnableEntity):
|
|
684
|
+
for child_element in self.findall(element, "MODE-ACCESS-POINTS/MODE-ACCESS-POINT"):
|
|
685
|
+
point = ModeAccessPoint()
|
|
686
|
+
point.modeGroupIRef = self.getRModeGroupInAtomicSWCInstanceRef(child_element)
|
|
687
|
+
parent.addModeAccessPoint(point)
|
|
688
|
+
|
|
689
|
+
def readSwcInternalBehaviorRunnables(self, element: ET.Element, parent: SwcInternalBehavior):
|
|
690
|
+
for child_element in self.findall(element, "RUNNABLES/RUNNABLE-ENTITY"):
|
|
691
|
+
short_name = self.getShortName(child_element)
|
|
692
|
+
entity = parent.createRunnableEntity(short_name)
|
|
576
693
|
self.logger.debug("readRunnableEntities %s" % short_name)
|
|
577
|
-
|
|
578
|
-
self.
|
|
579
|
-
self.
|
|
580
|
-
self.
|
|
581
|
-
self.
|
|
582
|
-
|
|
583
|
-
self.
|
|
584
|
-
self.
|
|
585
|
-
self.
|
|
586
|
-
self.
|
|
694
|
+
|
|
695
|
+
self.readExecutableEntity(child_element, entity)
|
|
696
|
+
entity.canBeInvokedConcurrently = self.getChildElementOptionalBooleanValue(child_element, "CAN-BE-INVOKED-CONCURRENTLY")
|
|
697
|
+
entity.symbol = self.getChildElementOptionalLiteral(child_element, "SYMBOL")
|
|
698
|
+
entity.swAddrMethodRef = self.getChildElementOptionalRefType(child_element, "SW-ADDR-METHOD-REF")
|
|
699
|
+
|
|
700
|
+
self.readDataReceivePointByArguments(child_element, entity)
|
|
701
|
+
self.readDataReceivePointByValues(child_element, entity)
|
|
702
|
+
self.readDataReadAccesses(child_element, entity)
|
|
703
|
+
self.readDataWriteAccesses(child_element, entity)
|
|
704
|
+
self.readDataSendPoints(child_element, entity)
|
|
705
|
+
self.readParameterAccesses(child_element, entity)
|
|
706
|
+
self.readWrittenLocalVariables(child_element, entity)
|
|
707
|
+
self.readReadLocalVariables(child_element, entity)
|
|
708
|
+
self.readInternalBehaviorServerCallPoint(child_element, entity)
|
|
709
|
+
self.readInternalTriggeringPoints(child_element, entity)
|
|
710
|
+
self.readModeAccessPoints(child_element, entity)
|
|
711
|
+
|
|
712
|
+
def getRModeInAtomicSwcInstanceRef(self, element: ET.Element) -> RModeInAtomicSwcInstanceRef:
|
|
713
|
+
iref = RModeInAtomicSwcInstanceRef()
|
|
714
|
+
iref.base_ref = self.getChildElementOptionalRefType(element, "BASE")
|
|
715
|
+
iref.context_port_ref = self.getChildElementOptionalRefType(element, "CONTEXT-PORT-REF")
|
|
716
|
+
iref.context_mode_declaration_group_prototype_ref = self.getChildElementOptionalRefType(element, "CONTEXT-MODE-DECLARATION-GROUP-PROTOTYPE-REF")
|
|
717
|
+
iref.target_mode_declaration_ref = self.getChildElementOptionalRefType(element, "TARGET-MODE-DECLARATION-REF")
|
|
718
|
+
return iref
|
|
587
719
|
|
|
588
720
|
def readRTEEvent(self, element: ET.Element, event: RTEEvent):
|
|
589
|
-
|
|
721
|
+
self.readIdentifiable(element, event)
|
|
722
|
+
event.start_on_event_ref = self.getChildElementOptionalRefType(element, "START-ON-EVENT-REF")
|
|
723
|
+
for child_element in element.findall("./xmlns:DISABLED-MODE-IREFS/xmlns:DISABLED-MODE-IREF", self.nsmap):
|
|
724
|
+
iref = self.getRModeInAtomicSwcInstanceRef(child_element)
|
|
725
|
+
event.addDisabledModeIRef(iref)
|
|
590
726
|
|
|
591
727
|
def readOperationIRef(self, element: ET.Element, parent: OperationInvokedEvent):
|
|
592
728
|
child_element = element.find("./xmlns:OPERATION-IREF", self.nsmap)
|
|
593
|
-
if (child_element
|
|
729
|
+
if (child_element is not None):
|
|
594
730
|
parent.operation_iref = POperationInAtomicSwcInstanceRef()
|
|
595
|
-
parent.operation_iref.context_p_port_ref = self.
|
|
596
|
-
parent.operation_iref.target_provided_operation_ref = self.
|
|
597
|
-
|
|
598
|
-
def
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
731
|
+
parent.operation_iref.context_p_port_ref = self.getChildElementRefType(parent.short_name, child_element, "CONTEXT-P-PORT-REF")
|
|
732
|
+
parent.operation_iref.target_provided_operation_ref = self.getChildElementRefType(parent.short_name, child_element, "TARGET-PROVIDED-OPERATION-REF")
|
|
733
|
+
|
|
734
|
+
def readOperationInvokedEvent(self, element: ET.Element, parent: SwcInternalBehavior):
|
|
735
|
+
short_name = self.getShortName(element)
|
|
736
|
+
event = parent.createOperationInvokedEvent(short_name)
|
|
737
|
+
self.readOperationIRef(element, event)
|
|
738
|
+
self.readRTEEvent(element, event)
|
|
739
|
+
|
|
605
740
|
def readExplicitInterRunnableVariables(self, element: ET.Element, parent: SwcInternalBehavior):
|
|
606
741
|
for child_element in element.findall("./xmlns:EXPLICIT-INTER-RUNNABLE-VARIABLES/xmlns:VARIABLE-DATA-PROTOTYPE", self.nsmap):
|
|
607
|
-
short_name = self.
|
|
742
|
+
short_name = self.getShortName(child_element)
|
|
608
743
|
prototype = parent.createExplicitInterRunnableVariable(short_name)
|
|
609
|
-
self.
|
|
610
|
-
prototype.type_tref = self.
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
self.
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
744
|
+
prototype.sw_data_def_props = self.getSwDataDefProps(child_element, "SW-DATA-DEF-PROPS")
|
|
745
|
+
prototype.type_tref = self.getChildElementOptionalRefType(child_element, "TYPE-TREF")
|
|
746
|
+
prototype.init_value = self.getInitValue(child_element)
|
|
747
|
+
|
|
748
|
+
def readPerInstanceMemories(self, element: ET.Element, behavior: SwcInternalBehavior):
|
|
749
|
+
for child_element in element.findall("./xmlns:PER-INSTANCE-MEMORYS/xmlns:PER-INSTANCE-MEMORY", self.nsmap):
|
|
750
|
+
short_name = self.getShortName(child_element)
|
|
751
|
+
memory = behavior.createPerInstanceMemory(short_name)
|
|
752
|
+
self.readIdentifiable(child_element, memory)
|
|
753
|
+
memory.init_value = self.getChildElementOptionalLiteral(child_element, "INIT-VALUE")
|
|
754
|
+
memory.sw_data_def_props = self.getSwDataDefProps(child_element, "SW-DATA-DEF-PROPS")
|
|
755
|
+
memory.type = self.getChildElementOptionalLiteral(child_element, "TYPE")
|
|
756
|
+
memory.type_definition = self.getChildElementOptionalLiteral(child_element, "TYPE-DEFINITION")
|
|
757
|
+
|
|
758
|
+
def readAutosarDataPrototype(self, element: ET.Element, prototype: AutosarDataPrototype):
|
|
759
|
+
prototype.type_tref = self.getChildElementOptionalRefType(element, "TYPE-TREF")
|
|
760
|
+
|
|
761
|
+
def readParameterDataPrototype(self, element: ET.Element, prototype: ParameterDataPrototype):
|
|
762
|
+
self.readIdentifiable(element, prototype)
|
|
763
|
+
self.readAutosarDataPrototype(element, prototype)
|
|
764
|
+
prototype.init_value = self.getInitValue(element)
|
|
765
|
+
|
|
766
|
+
def readPerInstanceParameters(self, element: ET.Element, behavior: SwcInternalBehavior):
|
|
767
|
+
for child_element in element.findall("./xmlns:PER-INSTANCE-PARAMETERS/xmlns:PARAMETER-DATA-PROTOTYPE", self.nsmap):
|
|
768
|
+
short_name = self.getShortName(child_element)
|
|
769
|
+
prototype = behavior.createPerInstanceParameter(short_name)
|
|
770
|
+
self.readParameterDataPrototype(child_element, prototype)
|
|
771
|
+
|
|
772
|
+
def readPortDefinedArgumentValue(self, element: ET.Element) -> PortDefinedArgumentValue:
|
|
773
|
+
argument_value = PortDefinedArgumentValue()
|
|
774
|
+
child_element = element.find("./xmlns:VALUE/*", self.nsmap)
|
|
775
|
+
if child_element is not None:
|
|
776
|
+
argument_value.value = self.getValueSpecification(child_element)
|
|
777
|
+
argument_value.value_type = self.getChildElementOptionalRefType(element, "VALUE-TYPE-TREF")
|
|
778
|
+
return argument_value
|
|
779
|
+
|
|
780
|
+
def readPortAPIOptions(self, element: ET.Element, behavior: SwcInternalBehavior):
|
|
781
|
+
for child_element in element.findall("./xmlns:PORT-API-OPTIONS/xmlns:PORT-API-OPTION", self.nsmap):
|
|
782
|
+
option = PortAPIOption()
|
|
783
|
+
option.enable_take_address = self.getChildElementOptionalBooleanValue(child_element, "ENABLE-TAKE-ADDRESS")
|
|
784
|
+
option.indirect_api = self.getChildElementOptionalBooleanValue(child_element, "INDIRECT-API")
|
|
785
|
+
option.port_ref = self.getChildElementOptionalRefType(child_element, "PORT-REF")
|
|
786
|
+
for argument_value_tag in child_element.findall("./xmlns:PORT-ARG-VALUES/xmlns:PORT-DEFINED-ARGUMENT-VALUE", self.nsmap):
|
|
787
|
+
option.addPortArgValue(self.readPortDefinedArgumentValue(argument_value_tag))
|
|
788
|
+
behavior.addPortAPIOption(option)
|
|
789
|
+
|
|
790
|
+
def readTimingEvent(self, element: ET.Element, parent: SwcInternalBehavior):
|
|
791
|
+
short_name = self.getShortName(element)
|
|
792
|
+
event = parent.createTimingEvent(short_name)
|
|
793
|
+
self.readRTEEvent(element, event)
|
|
794
|
+
event.offset = self.getChildElementOptionalFloatValue(element, "OFFSET")
|
|
795
|
+
event.period = self.getChildElementOptionalFloatValue(element, "PERIOD")
|
|
630
796
|
|
|
631
797
|
def readDataReceivedEvent(self, element: ET.Element, parent: SwcInternalBehavior):
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
self.readRTEEvent(child_element, event)
|
|
637
|
-
self.readRVariableInAtomicSwcInstanceRef(child_element, event)
|
|
798
|
+
short_name = self.getShortName(element)
|
|
799
|
+
event = parent.createDataReceivedEvent(short_name)
|
|
800
|
+
self.readRTEEvent(element, event)
|
|
801
|
+
self.readRVariableInAtomicSwcInstanceRef(element, event)
|
|
638
802
|
|
|
639
803
|
def readSwcModeSwitchEvent(self, element: ET.Element, parent: SwcInternalBehavior):
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
self.readRModeInAtomicSwcInstanceRef(child_element, event)
|
|
804
|
+
short_name = self.getShortName(element)
|
|
805
|
+
event = parent.createSwcModeSwitchEvent(short_name)
|
|
806
|
+
self.readRTEEvent(element, event)
|
|
807
|
+
event.activation = self.getChildElementOptionalLiteral(element, "ACTIVATION")
|
|
808
|
+
self.readRModeInAtomicSwcInstanceRef(element, event)
|
|
646
809
|
|
|
647
810
|
def readInternalTriggerOccurredEvent(self, element: ET.Element, parent: SwcInternalBehavior):
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
811
|
+
short_name = self.getShortName(element)
|
|
812
|
+
event = parent.createInternalTriggerOccurredEvent(short_name)
|
|
813
|
+
self.readRTEEvent(element, event)
|
|
814
|
+
event.event_source_ref = self.getChildElementRefType(parent.short_name, element, "EVENT-SOURCE-REF")
|
|
815
|
+
|
|
816
|
+
def readInitEvent(self, element, parent: SwcInternalBehavior):
|
|
817
|
+
short_name = self.getShortName(element)
|
|
818
|
+
event = parent.createInitEvent(short_name)
|
|
819
|
+
self.readRTEEvent(element, event)
|
|
820
|
+
|
|
821
|
+
def readSwcInternalBehaviorEvents(self, element: ET.Element, parent: SwcInternalBehavior):
|
|
822
|
+
for child_element in element.findall("./xmlns:EVENTS/*", self.nsmap):
|
|
823
|
+
tag_name = self.getTagName(child_element.tag)
|
|
824
|
+
if tag_name == "TIMING-EVENT":
|
|
825
|
+
self.readTimingEvent(child_element, parent)
|
|
826
|
+
elif tag_name == "SWC-MODE-SWITCH-EVENT":
|
|
827
|
+
self.readSwcModeSwitchEvent(child_element, parent)
|
|
828
|
+
elif tag_name == "OPERATION-INVOKED-EVENT":
|
|
829
|
+
self.readOperationInvokedEvent(child_element, parent)
|
|
830
|
+
elif tag_name == "DATA-RECEIVED-EVENT":
|
|
831
|
+
self.readDataReceivedEvent(child_element, parent)
|
|
832
|
+
elif tag_name == "INTERNAL-TRIGGER-OCCURRED-EVENT":
|
|
833
|
+
self.readInternalTriggerOccurredEvent(child_element, parent)
|
|
834
|
+
elif tag_name == "INIT-EVENT":
|
|
835
|
+
self.readInitEvent(child_element, parent)
|
|
836
|
+
else:
|
|
837
|
+
self._raiseError("Unsupported SwcInternalBehavior Event <%s>" % tag_name)
|
|
658
838
|
|
|
659
|
-
|
|
839
|
+
def readSwPointerTargetProps(self, element: ET.Element, parent: SwDataDefProps):
|
|
840
|
+
child_element = element.find("./xmlns:SW-POINTER-TARGET-PROPS", self.nsmap)
|
|
841
|
+
if (child_element is not None):
|
|
660
842
|
sw_pointer_target_props = SwPointerTargetProps()
|
|
661
|
-
sw_pointer_target_props.target_category = self.
|
|
662
|
-
self.
|
|
843
|
+
sw_pointer_target_props.target_category = self.getChildElementOptionalLiteral(child_element, "TARGET-CATEGORY")
|
|
844
|
+
sw_pointer_target_props.sw_data_def_props = self.getSwDataDefProps(child_element, "SW-DATA-DEF-PROPS")
|
|
663
845
|
parent.sw_pointer_target_props = sw_pointer_target_props
|
|
664
846
|
|
|
665
|
-
def
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
self.
|
|
696
|
-
|
|
697
|
-
|
|
847
|
+
def readGeneralAnnotation(self, element: ET.Element, annotation: GeneralAnnotation):
|
|
848
|
+
annotation.label = self.getMultilanguageLongName(element, "LABEL")
|
|
849
|
+
|
|
850
|
+
def readAnnotations(self, element: ET.Element, props: SwDataDefProps) :
|
|
851
|
+
for child_element in element.findall("./xmlns:ANNOTATIONS/xmlns:ANNOTATION", self.nsmap):
|
|
852
|
+
annotation = Annotation()
|
|
853
|
+
self.readGeneralAnnotation(child_element, annotation)
|
|
854
|
+
props.addAnnotation(annotation)
|
|
855
|
+
|
|
856
|
+
def getSwAxisIndividual(self, element: ET.Element) -> SwAxisIndividual:
|
|
857
|
+
props = SwAxisIndividual()
|
|
858
|
+
self.readElementAttributes(element, props)
|
|
859
|
+
props.setInputVariableTypeRef(self.getChildElementOptionalRefType(element, "INPUT-VARIABLE-TYPE-REF")) \
|
|
860
|
+
.setCompuMethodRef(self.getChildElementOptionalRefType(element, "COMPU-METHOD-REF")) \
|
|
861
|
+
.setSwMaxAxisPoints(self.getChildElementOptionalNumericalValue(element, "SW-MAX-AXIS-POINTS")) \
|
|
862
|
+
.setSwMinAxisPoints(self.getChildElementOptionalNumericalValue(element, "SW-MIN-AXIS-POINTS")) \
|
|
863
|
+
.setDataConstrRef(self.getChildElementOptionalRefType(element, "DATA-CONSTR-REF"))
|
|
864
|
+
return props
|
|
865
|
+
|
|
866
|
+
def getSwAxisGrouped(self, element: ET.Element) -> SwAxisGrouped:
|
|
867
|
+
props = SwAxisGrouped()
|
|
868
|
+
props.setSharedAxisTypeRef(self.getChildElementOptionalRefType(element, "SHARED-AXIS-TYPE-REF"))
|
|
869
|
+
return props
|
|
870
|
+
|
|
871
|
+
def getSwCalprmAxis(self, element: ET.Element) -> SwCalprmAxis:
|
|
872
|
+
axis = SwCalprmAxis()
|
|
873
|
+
axis.sw_axis_index = self.getChildElementOptionalNumericalValue(element, "SW-AXIS-INDEX")
|
|
874
|
+
axis.category = self.getChildElementOptionalLiteral(element, "CATEGORY")
|
|
875
|
+
child_element = element.find("./xmlns:SW-AXIS-INDIVIDUAL", self.nsmap)
|
|
876
|
+
if child_element is not None:
|
|
877
|
+
axis.sw_calprm_axis_type_props = self.getSwAxisIndividual(child_element)
|
|
878
|
+
child_element = element.find("./xmlns:SW-AXIS-GROUPED", self.nsmap)
|
|
879
|
+
if child_element is not None:
|
|
880
|
+
axis.sw_calprm_axis_type_props = self.getSwAxisGrouped(child_element)
|
|
881
|
+
|
|
882
|
+
return axis
|
|
883
|
+
|
|
884
|
+
def getSwCalprmAxisSet(self, element: ET.Element, key: str) -> SwCalprmAxisSet:
|
|
885
|
+
set = SwCalprmAxisSet()
|
|
886
|
+
for child_element in element.findall("./xmlns:%s/*" % key, self.nsmap):
|
|
887
|
+
tag_name = self.getTagName(child_element.tag)
|
|
888
|
+
if tag_name == "SW-CALPRM-AXIS":
|
|
889
|
+
set.addSwCalprmAxis(self.getSwCalprmAxis(child_element))
|
|
890
|
+
return set
|
|
891
|
+
|
|
892
|
+
def getSwDataDefProps(self, element: ET.Element, key: str) -> SwDataDefProps:
|
|
893
|
+
child_element = element.find("./xmlns:%s" % key, self.nsmap)
|
|
894
|
+
sw_data_def_props = None
|
|
895
|
+
if child_element is not None:
|
|
896
|
+
conditional_tag = child_element.find("./xmlns:SW-DATA-DEF-PROPS-VARIANTS/xmlns:SW-DATA-DEF-PROPS-CONDITIONAL", self.nsmap)
|
|
897
|
+
if conditional_tag is not None:
|
|
898
|
+
sw_data_def_props = SwDataDefProps()
|
|
899
|
+
self.readElementAttributes(child_element, sw_data_def_props)
|
|
900
|
+
|
|
901
|
+
self.readAnnotations(conditional_tag, sw_data_def_props)
|
|
902
|
+
sw_data_def_props.baseTypeRef = self.getChildElementOptionalRefType(conditional_tag, "BASE-TYPE-REF")
|
|
903
|
+
sw_data_def_props.dataConstrRef = self.getChildElementOptionalRefType(conditional_tag, "DATA-CONSTR-REF")
|
|
904
|
+
sw_data_def_props.compuMethodRef = self.getChildElementOptionalRefType(conditional_tag, "COMPU-METHOD-REF")
|
|
905
|
+
sw_data_def_props.swImplPolicy = self.getChildElementOptionalLiteral(conditional_tag, "SW-IMPL-POLICY")
|
|
906
|
+
sw_data_def_props.implementationDataTypeRef = self.getChildElementOptionalRefType(conditional_tag, "IMPLEMENTATION-DATA-TYPE-REF")
|
|
907
|
+
sw_data_def_props.swCalibrationAccess = self.getChildElementOptionalLiteral(conditional_tag, "SW-CALIBRATION-ACCESS")
|
|
908
|
+
sw_data_def_props.swCalprmAxisSet = self.getSwCalprmAxisSet(conditional_tag, "SW-CALPRM-AXIS-SET")
|
|
909
|
+
sw_data_def_props.swRecordLayoutRef = self.getChildElementOptionalRefType(conditional_tag, "SW-RECORD-LAYOUT-REF")
|
|
910
|
+
sw_data_def_props.valueAxisDataTypeRef = self.getChildElementOptionalRefType(conditional_tag, "VALUE-AXIS-DATA-TYPE-REF")
|
|
911
|
+
sw_data_def_props.setUnitRef(self.getChildElementOptionalRefType(conditional_tag, "UNIT-REF"))
|
|
912
|
+
self.readSwPointerTargetProps(conditional_tag, sw_data_def_props)
|
|
913
|
+
self.readElementAttributes(conditional_tag, sw_data_def_props.conditional)
|
|
914
|
+
return sw_data_def_props
|
|
915
|
+
|
|
916
|
+
def readApplicationPrimitiveDataType(self, element: ET.Element, parent: ARPackage):
|
|
917
|
+
short_name = self.getShortName(element)
|
|
918
|
+
data_type = parent.createApplicationPrimitiveDataType(short_name)
|
|
919
|
+
self.logger.debug("readApplicationPrimitiveDataTypes %s" % short_name)
|
|
920
|
+
self.readIdentifiable(element, data_type)
|
|
921
|
+
data_type.sw_data_def_props = self.getSwDataDefProps(element, "SW-DATA-DEF-PROPS")
|
|
922
|
+
|
|
923
|
+
def readApplicationCompositeElementDataPrototype(self, element: ET.Element, prototype: ApplicationCompositeElementDataPrototype):
|
|
924
|
+
prototype.typeTRef = self.getChildElementOptionalRefType(element, "TYPE-TREF")
|
|
698
925
|
|
|
699
926
|
def readApplicationRecordElements(self, element: ET.Element, parent: ApplicationRecordDataType):
|
|
700
927
|
for child_element in element.findall("./xmlns:ELEMENTS/xmlns:APPLICATION-RECORD-ELEMENT", self.nsmap):
|
|
701
|
-
short_name = self.
|
|
928
|
+
short_name = self.getShortName(child_element)
|
|
702
929
|
record_element = parent.createApplicationRecordElement(short_name)
|
|
703
930
|
self.logger.debug("readApplicationRecordElements %s" % short_name)
|
|
704
931
|
self.readIdentifiable(child_element, record_element)
|
|
705
|
-
|
|
932
|
+
self.readApplicationCompositeElementDataPrototype(child_element, record_element)
|
|
706
933
|
|
|
707
934
|
def readApplicationRecordDataTypes(self, element: ET.Element, parent: ARPackage):
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
def readImplementationDataTypeElements(self, element: ET.Element, parent: ARElement):
|
|
935
|
+
short_name = self.getShortName(element)
|
|
936
|
+
data_type = parent.createApplicationRecordDataType(short_name)
|
|
937
|
+
self.logger.debug("readApplicationRecordDataTypes %s" % short_name)
|
|
938
|
+
self.readIdentifiable(element, data_type)
|
|
939
|
+
data_type.sw_data_def_props = self.getSwDataDefProps(element, "SW-DATA-DEF-PROPS")
|
|
940
|
+
self.readApplicationRecordElements(element, data_type)
|
|
941
|
+
|
|
942
|
+
def readImplementationDataTypeElements(self, element: ET.Element, parent: ImplementationDataType):
|
|
717
943
|
for child_element in element.findall("./xmlns:SUB-ELEMENTS/xmlns:IMPLEMENTATION-DATA-TYPE-ELEMENT", self.nsmap):
|
|
718
|
-
short_name = self.
|
|
944
|
+
short_name = self.getShortName(child_element)
|
|
719
945
|
type_element = parent.createImplementationDataTypeElement(short_name) # type: ImplementationDataTypeElement
|
|
720
946
|
self.readIdentifiable(child_element, type_element)
|
|
721
|
-
type_element.
|
|
722
|
-
type_element.array_size_semantics = self.
|
|
947
|
+
type_element.arraySize = self.getChildElementOptionalLiteral(child_element, "ARRAY-SIZE")
|
|
948
|
+
type_element.array_size_semantics = self.getChildElementOptionalLiteral(child_element, "ARRAY-SIZE-SEMANTICS")
|
|
723
949
|
self.readImplementationDataTypeElements(child_element, type_element)
|
|
724
|
-
self.
|
|
725
|
-
|
|
726
|
-
def
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
if (data_type.
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
self._raiseError("The category <%s> of array sub-element <%s> does not support." % (array_sub_element.category, data_type.short_name))
|
|
743
|
-
|
|
744
|
-
def readBaseTypeDirectDefinition(self, element: ET.Element, parent: BaseType):
|
|
745
|
-
parent.base_type_definition.base_type_size = int(self.readChildOptionalElement(element, "BASE-TYPE-SIZE"))
|
|
746
|
-
parent.base_type_definition.base_type_encoding = self.readChildOptionalElementLiteral(element, "BASE-TYPE-ENCODING")
|
|
747
|
-
parent.base_type_definition.native_declaration = self.readChildOptionalElementLiteral(element, "NATIVE-DECLARATION")
|
|
748
|
-
|
|
749
|
-
def readSwBaseTypes(self, element: ET.Element, parent: ARPackage):
|
|
750
|
-
for child_element in element.findall("./xmlns:ELEMENTS/xmlns:SW-BASE-TYPE", self.nsmap):
|
|
751
|
-
short_name = self.readShortName(child_element)
|
|
752
|
-
data_type = parent.createSwBaseType(short_name)
|
|
753
|
-
self.readIdentifiable(child_element, data_type)
|
|
754
|
-
self.readBaseTypeDirectDefinition(child_element, data_type)
|
|
755
|
-
|
|
756
|
-
def readClientComSpec(self, element: ET.Element, parent: RPortPrototype):
|
|
757
|
-
for child_element in element.findall("./xmlns:REQUIRED-COM-SPECS/xmlns:CLIENT-COM-SPEC", self.nsmap):
|
|
758
|
-
try:
|
|
759
|
-
com_spec = ClientComSpec()
|
|
760
|
-
self.readElementAttributes(child_element, com_spec)
|
|
761
|
-
com_spec.operation_ref = self.readChildRefElement(parent.short_name, child_element, "OPERATION-REF")
|
|
762
|
-
parent.addRequiredComSpec(com_spec)
|
|
763
|
-
except ValueError as err:
|
|
764
|
-
self.logger.error(parent.short_name + ": " + str(err))
|
|
950
|
+
type_element.sw_data_def_props = self.getSwDataDefProps(child_element, "SW-DATA-DEF-PROPS")
|
|
951
|
+
|
|
952
|
+
def readImplementationDataType(self, element: ET.Element, parent: ARPackage):
|
|
953
|
+
short_name = self.getShortName(element)
|
|
954
|
+
data_type = parent.createImplementationDataType(short_name)
|
|
955
|
+
self.readAutosarDataType(element, data_type)
|
|
956
|
+
self.readImplementationDataTypeElements(element, data_type)
|
|
957
|
+
data_type.setTypeEmitter(self.getChildElementOptionalLiteral(element, "TYPE-EMITTER"))
|
|
958
|
+
if (data_type.category == ImplementationDataType.CATEGORY_ARRAY):
|
|
959
|
+
if (len(data_type.getImplementationDataTypeElements()) < 1):
|
|
960
|
+
self._raiseError("Array Sub-Element of <%s> do not defined." % data_type.short_name)
|
|
961
|
+
array_sub_element = data_type.getImplementationDataTypeElements()[0]
|
|
962
|
+
if (array_sub_element.category == ImplementationDataType.CATEGORY_TYPE_REFERENCE):
|
|
963
|
+
data_type.setArrayElementType(array_sub_element.sw_data_def_props.implementationDataTypeRef.value)
|
|
964
|
+
elif (array_sub_element.category == ImplementationDataType.CATEGORY_TYPE_VALUE): # TODO: fix
|
|
965
|
+
return
|
|
966
|
+
else:
|
|
967
|
+
self._raiseError("The category <%s> of array sub-element <%s> does not support." % (array_sub_element.category, data_type.short_name))
|
|
765
968
|
|
|
766
|
-
def
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
self.
|
|
770
|
-
|
|
771
|
-
|
|
969
|
+
def readBaseTypeDirectDefinition(self, element: ET.Element, definition: BaseTypeDirectDefinition):
|
|
970
|
+
definition.base_type_size = self.getChildElementOptionalNumericalValue(element, "BASE-TYPE-SIZE")
|
|
971
|
+
definition.base_type_encoding = self.getChildElementOptionalLiteral(element, "BASE-TYPE-ENCODING")
|
|
972
|
+
definition.mem_alignment = self.getChildElementOptionalNumericalValue(element, "MEM-ALIGNMENT")
|
|
973
|
+
definition.native_declaration = self.getChildElementOptionalLiteral(element, "NATIVE-DECLARATION")
|
|
974
|
+
|
|
975
|
+
def readSwBaseType(self, element: ET.Element, parent: ARPackage):
|
|
976
|
+
short_name = self.getShortName(element)
|
|
977
|
+
data_type = parent.createSwBaseType(short_name)
|
|
978
|
+
self.readIdentifiable(element, data_type)
|
|
979
|
+
self.readBaseTypeDirectDefinition(element, data_type.baseTypeDefinition)
|
|
772
980
|
|
|
773
|
-
def
|
|
981
|
+
def getApplicationCompositeElementInPortInterfaceInstanceRef(self, element: ET.Element, key:str) -> ApplicationCompositeElementInPortInterfaceInstanceRef:
|
|
982
|
+
child_element = element.find("./xmlns:%s" % key, self.nsmap)
|
|
983
|
+
iref = None
|
|
984
|
+
if child_element is not None:
|
|
985
|
+
iref = ApplicationCompositeElementInPortInterfaceInstanceRef()
|
|
986
|
+
iref.root_data_prototype_ref = self.getChildElementOptionalRefType(child_element, "ROOT-DATA-PROTOTYPE-REF")
|
|
987
|
+
iref.target_data_prototype_ref = self.getChildElementOptionalRefType(child_element, "TARGET-DATA-PROTOTYPE-REF")
|
|
988
|
+
return iref
|
|
989
|
+
|
|
990
|
+
def getCompositeNetworkRepresentation(self, element: ET.Element) -> CompositeNetworkRepresentation:
|
|
991
|
+
self.logger.debug("getCompositeNetworkRepresentation")
|
|
992
|
+
representation = CompositeNetworkRepresentation()
|
|
993
|
+
representation.leaf_element_iref = self.getApplicationCompositeElementInPortInterfaceInstanceRef(element, "LEAF-ELEMENT-IREF")
|
|
994
|
+
representation.network_representation = self.getSwDataDefProps(element, "NETWORK-REPRESENTATION")
|
|
995
|
+
return representation
|
|
996
|
+
|
|
997
|
+
def readReceiverComSpec(self, element, com_spec: ReceiverComSpec):
|
|
998
|
+
self.readElementAttributes(element, com_spec)
|
|
999
|
+
for child_element in element.findall("./xmlns:COMPOSITE-NETWORK-REPRESENTATIONS/xmlns:COMPOSITE-NETWORK-REPRESENTATION", self.nsmap):
|
|
1000
|
+
com_spec.addCompositeNetworkRepresentation(self.getCompositeNetworkRepresentation(child_element))
|
|
1001
|
+
com_spec.data_element_ref = self.getChildElementOptionalRefType(element, "DATA-ELEMENT-REF")
|
|
1002
|
+
com_spec.network_representation = self.getSwDataDefProps(element, "NETWORK-REPRESENTATION")
|
|
1003
|
+
com_spec.handle_out_of_range = self.getChildElementOptionalLiteral(element, "HANDLE-OUT-OF-RANGE")
|
|
1004
|
+
com_spec.uses_end_to_end_protection = self.getChildElementOptionalBooleanValue(element, "USES-END-TO-END-PROTECTION")
|
|
1005
|
+
|
|
1006
|
+
def getSwValues(self, element: ET.Element, key: str) -> SwValues:
|
|
774
1007
|
child_element = element.find("./xmlns:%s" % key, self.nsmap) # type: ET.Element
|
|
775
1008
|
if child_element is None:
|
|
776
1009
|
return None
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
return
|
|
783
|
-
|
|
784
|
-
def
|
|
1010
|
+
sw_values = SwValues()
|
|
1011
|
+
self.readElementAttributes(child_element, sw_values)
|
|
1012
|
+
for v in self.getChildElementFloatValueList(child_element, "V"):
|
|
1013
|
+
sw_values.addV(v)
|
|
1014
|
+
sw_values.vt = self.getChildElementOptionalLiteral(child_element, "VT")
|
|
1015
|
+
return sw_values
|
|
1016
|
+
|
|
1017
|
+
def getValueList(self, element: ET.Element, key: str) -> ValueList:
|
|
1018
|
+
value_list = None
|
|
1019
|
+
child_element = element.find("./xmlns:%s" % key, self.nsmap) # type: ET.Element
|
|
1020
|
+
if child_element is not None:
|
|
1021
|
+
self.logger.debug("getValueList %s" % key)
|
|
1022
|
+
value_list = ValueList()
|
|
1023
|
+
self.readElementAttributes(child_element, value_list)
|
|
1024
|
+
value_list.v = self.getChildElementOptionalFloatValue(child_element, "V")
|
|
1025
|
+
return value_list
|
|
1026
|
+
|
|
1027
|
+
def getSwValueCont(self, element: ET.Element) -> SwValueCont:
|
|
785
1028
|
cont = None
|
|
786
1029
|
child_element = element.find("./xmlns:SW-VALUE-CONT", self.nsmap)
|
|
787
1030
|
if child_element is not None:
|
|
1031
|
+
self.logger.debug("getSwValueCont")
|
|
788
1032
|
cont = SwValueCont()
|
|
789
|
-
|
|
790
|
-
cont.
|
|
791
|
-
|
|
792
|
-
self.
|
|
1033
|
+
self.readElementAttributes(child_element, cont)
|
|
1034
|
+
cont.unit_ref = self.getChildElementOptionalRefType(child_element, "UNIT-REF")
|
|
1035
|
+
cont.sw_arraysize = self.getValueList(child_element, "SW-ARRAYSIZE")
|
|
1036
|
+
cont.sw_values_phys = self.getSwValues(child_element, "SW-VALUES-PHYS")
|
|
793
1037
|
return cont
|
|
794
1038
|
|
|
795
|
-
def readValueSpecification(self, element: ET.Element, value_spec: ValueSpecification):
|
|
796
|
-
value_spec.short_label = self.readChildOptionalElement(element, "SHORT-LABEL")
|
|
797
|
-
self.readElementAttributes(element, value_spec)
|
|
798
|
-
|
|
799
|
-
self.logger.debug("readValueSpecification")
|
|
800
|
-
|
|
801
1039
|
def readApplicationValueSpecification(self, element: ET.Element, value_spec: ApplicationValueSpecification):
|
|
802
1040
|
self.readValueSpecification(element, value_spec)
|
|
803
|
-
value_spec.category = self.
|
|
804
|
-
value_spec.sw_value_cont = self.
|
|
1041
|
+
value_spec.category = self.getChildElementOptionalLiteral(element, "CATEGORY")
|
|
1042
|
+
value_spec.sw_value_cont = self.getSwValueCont(element)
|
|
805
1043
|
|
|
806
1044
|
self.logger.debug("readApplicationValueSpecification Category %s" % value_spec.category)
|
|
807
1045
|
|
|
808
|
-
def
|
|
809
|
-
self.readValueSpecification(element, value_spec)
|
|
810
|
-
value_spec.value = self.readChildOptionalElement(element, "VALUE")
|
|
811
|
-
|
|
812
|
-
self.logger.debug("readTextValueSpecification Value: %s" % value_spec.value)
|
|
813
|
-
|
|
814
|
-
def readNumericalValueSpecification(self, element: ET.Element, value_spec: NumericalValueSpecification):
|
|
815
|
-
self.readValueSpecification(element, value_spec)
|
|
816
|
-
value_spec.value = self.readChildOptionalElement(element, "VALUE")
|
|
817
|
-
|
|
818
|
-
self.logger.debug("readNumericalValueSpecification Value: %s" % value_spec.value)
|
|
819
|
-
|
|
820
|
-
def readArrayValueSpecification(self, element: ET.Element, value_spec: ArrayValueSpecification):
|
|
821
|
-
self.readValueSpecification(element, value_spec)
|
|
822
|
-
|
|
823
|
-
child_elements = element.findall("./xmlns:ELEMENTS/xmlns:NUMERICAL-VALUE-SPECIFICATION", self.nsmap)
|
|
824
|
-
for child_element in child_elements:
|
|
825
|
-
sub_element = NumericalValueSpecification()
|
|
826
|
-
self.readNumericalValueSpecification(child_element, sub_element)
|
|
827
|
-
value_spec.add_element(sub_element)
|
|
828
|
-
|
|
829
|
-
self.logger.debug("readArrayValueSpecification")
|
|
830
|
-
|
|
831
|
-
def readConstantReference(self, element: ET.Element, value_spec: ConstantReference):
|
|
832
|
-
self.readValueSpecification(element, value_spec)
|
|
833
|
-
|
|
834
|
-
value_spec.constant_ref = self.readChildOptionalRefElement(element, "CONSTANT-REF")
|
|
835
|
-
|
|
836
|
-
def readInitValue(self, element: ET.Element) -> ValueSpecification:
|
|
1046
|
+
def getInitValue(self, element: ET.Element) -> ValueSpecification:
|
|
837
1047
|
value_spec = None
|
|
838
|
-
child_element = element.find("./xmlns:INIT-VALUE", self.nsmap)
|
|
1048
|
+
child_element = element.find("./xmlns:INIT-VALUE/*", self.nsmap)
|
|
839
1049
|
if child_element is not None:
|
|
840
|
-
self.logger.debug("
|
|
841
|
-
|
|
842
|
-
if value_spec_tag is not None:
|
|
843
|
-
value_spec = ApplicationValueSpecification()
|
|
844
|
-
self.readApplicationValueSpecification(value_spec_tag, value_spec)
|
|
845
|
-
return value_spec
|
|
846
|
-
value_spec_tag = child_element.find("./xmlns:TEXT-VALUE-SPECIFICATION", self.nsmap)
|
|
847
|
-
if value_spec_tag is not None:
|
|
848
|
-
value_spec = TextValueSpecification()
|
|
849
|
-
self.readTextValueSpecification(value_spec_tag, value_spec)
|
|
850
|
-
return value_spec
|
|
851
|
-
value_spec_tag = child_element.find("./xmlns:NUMERICAL-VALUE-SPECIFICATION", self.nsmap)
|
|
852
|
-
if value_spec_tag is not None:
|
|
853
|
-
value_spec = NumericalValueSpecification()
|
|
854
|
-
self.readNumericalValueSpecification(value_spec_tag, value_spec)
|
|
855
|
-
return value_spec
|
|
856
|
-
value_spec_tag = child_element.find("./xmlns:ARRAY-VALUE-SPECIFICATION", self.nsmap)
|
|
857
|
-
if value_spec_tag is not None:
|
|
858
|
-
value_spec = ArrayValueSpecification()
|
|
859
|
-
self.readArrayValueSpecification(value_spec_tag, value_spec)
|
|
860
|
-
return value_spec
|
|
861
|
-
value_spec_tag = child_element.find("./xmlns:CONSTANT-REFERENCE", self.nsmap)
|
|
862
|
-
if value_spec_tag is not None:
|
|
863
|
-
value_spec = ConstantReference()
|
|
864
|
-
self.readConstantReference(value_spec_tag, value_spec)
|
|
865
|
-
return value_spec
|
|
866
|
-
|
|
1050
|
+
self.logger.debug("getInitValue")
|
|
1051
|
+
value_spec = self.getValueSpecification(child_element)
|
|
867
1052
|
return value_spec
|
|
868
|
-
|
|
869
|
-
def
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
def
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
1053
|
+
|
|
1054
|
+
def getClientComSpec(self, element: ET.Element) -> ClientComSpec:
|
|
1055
|
+
com_spec = ClientComSpec()
|
|
1056
|
+
self.readElementAttributes(element, com_spec)
|
|
1057
|
+
com_spec.operationRef = self.getChildElementOptionalRefType(element, "OPERATION-REF")
|
|
1058
|
+
return com_spec
|
|
1059
|
+
|
|
1060
|
+
def getQueuedReceiverComSpec(self, element: ET.Element) -> QueuedReceiverComSpec:
|
|
1061
|
+
com_spec = QueuedReceiverComSpec()
|
|
1062
|
+
self.readElementAttributes(element, com_spec)
|
|
1063
|
+
self.readReceiverComSpec(element, com_spec)
|
|
1064
|
+
com_spec.queue_length = self.getChildElementOptionalNumericalValue(element, "QUEUE-LENGTH")
|
|
1065
|
+
return com_spec
|
|
1066
|
+
|
|
1067
|
+
def getModeSwitchReceiverComSpec(self, element: ET.Element) -> ModeSwitchReceiverComSpec:
|
|
1068
|
+
com_spec = ModeSwitchReceiverComSpec()
|
|
1069
|
+
self.readElementAttributes(element, com_spec)
|
|
1070
|
+
com_spec.modeGroupRef = self.getChildElementOptionalRefType(element, "MODE-GROUP-REF")
|
|
1071
|
+
return com_spec
|
|
1072
|
+
|
|
1073
|
+
def getNonqueuedReceiverComSpec(self, element: ET.Element) -> NonqueuedReceiverComSpec:
|
|
1074
|
+
com_spec = NonqueuedReceiverComSpec()
|
|
1075
|
+
self.readElementAttributes(element, com_spec)
|
|
1076
|
+
self.readReceiverComSpec(element, com_spec)
|
|
1077
|
+
com_spec.alive_timeout = self.getChildElementOptionalFloatValue(element, "ALIVE-TIMEOUT")
|
|
1078
|
+
com_spec.enable_updated = self.getChildElementOptionalBooleanValue(element, "ENABLE-UPDATE")
|
|
1079
|
+
com_spec.handle_never_received = self.getChildElementOptionalBooleanValue(element, "HANDLE-NEVER-RECEIVED")
|
|
1080
|
+
com_spec.handel_timeout_type = self.getChildElementOptionalLiteral(element, "HANDLE-TIMEOUT-TYPE")
|
|
1081
|
+
com_spec.init_value = self.getInitValue(element)
|
|
1082
|
+
return com_spec
|
|
1083
|
+
|
|
1084
|
+
def readRequiredComSpec(self, element: ET.Element, parent: RPortPrototype):
|
|
1085
|
+
for child_element in element.findall("./xmlns:REQUIRED-COM-SPECS/*", self.nsmap):
|
|
1086
|
+
tag_name = self.getTagName(child_element.tag)
|
|
1087
|
+
if tag_name == "NONQUEUED-RECEIVER-COM-SPEC":
|
|
1088
|
+
parent.addRequiredComSpec(self.getNonqueuedReceiverComSpec(child_element))
|
|
1089
|
+
elif tag_name == "CLIENT-COM-SPEC":
|
|
1090
|
+
parent.addRequiredComSpec(self.getClientComSpec(child_element))
|
|
1091
|
+
elif tag_name == "QUEUED-RECEIVER-COM-SPEC":
|
|
1092
|
+
parent.addRequiredComSpec(self.getQueuedReceiverComSpec(child_element))
|
|
1093
|
+
elif tag_name == "MODE-SWITCH-RECEIVER-COM-SPEC":
|
|
1094
|
+
parent.addRequiredComSpec(self.getModeSwitchReceiverComSpec(child_element))
|
|
1095
|
+
else:
|
|
1096
|
+
self._raiseError("Unsupported RequiredComSpec <%s>" % tag_name)
|
|
1097
|
+
|
|
1098
|
+
def readRPortPrototype(self, element: ET.Element, parent: AtomicSwComponentType):
|
|
1099
|
+
short_name = self.getShortName(element)
|
|
1100
|
+
self.logger.debug("readRPortPrototype %s" % short_name)
|
|
1101
|
+
prototype = parent.createRPortPrototype(short_name)
|
|
1102
|
+
self.readIdentifiable(element, prototype)
|
|
1103
|
+
prototype.required_interface_tref = self.getChildElementOptionalRefType(element, "REQUIRED-INTERFACE-TREF")
|
|
1104
|
+
|
|
1105
|
+
self.readRequiredComSpec(element, prototype)
|
|
1106
|
+
|
|
1107
|
+
def readAtomicSwComponentTypePorts(self, element: ET.Element, sw_component: AtomicSwComponentType):
|
|
1108
|
+
for child_element in element.findall("./xmlns:PORTS/*", self.nsmap):
|
|
1109
|
+
tag_name = self.getTagName(child_element)
|
|
1110
|
+
if tag_name == "P-PORT-PROTOTYPE":
|
|
1111
|
+
self.readPPortPrototype(child_element, sw_component)
|
|
1112
|
+
elif tag_name == "R-PORT-PROTOTYPE":
|
|
1113
|
+
self.readRPortPrototype(child_element, sw_component)
|
|
1114
|
+
else:
|
|
1115
|
+
self._raiseError("Unsupported Port Prototype <%s>" % tag_name)
|
|
899
1116
|
|
|
900
1117
|
def readTransmissionAcknowledgementRequest(self, element: ET.Element) -> TransmissionAcknowledgementRequest:
|
|
901
1118
|
child_element = element.find("./xmlns:TRANSMISSION-ACKNOWLEDGE", self.nsmap)
|
|
902
|
-
if (child_element
|
|
1119
|
+
if (child_element is not None):
|
|
903
1120
|
acknowledge = TransmissionAcknowledgementRequest()
|
|
904
1121
|
self.readElementAttributes(child_element, acknowledge)
|
|
905
|
-
acknowledge.timeout = self.
|
|
1122
|
+
acknowledge.timeout = self.getChildElementOptionalFloatValue(child_element, "TIMEOUT")
|
|
906
1123
|
return acknowledge
|
|
907
1124
|
return None
|
|
908
1125
|
|
|
909
|
-
def readSenderComSpec(self, element, com_spec: SenderComSpec):
|
|
910
|
-
# FIXME:
|
|
1126
|
+
def readSenderComSpec(self, element:ET.Element, com_spec: SenderComSpec):
|
|
911
1127
|
self.readElementAttributes(element, com_spec)
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
self.
|
|
915
|
-
com_spec.
|
|
1128
|
+
for child_element in element.findall("./xmlns:COMPOSITE-NETWORK-REPRESENTATIONS/xmlns:COMPOSITE-NETWORK-REPRESENTATION", self.nsmap):
|
|
1129
|
+
com_spec.addCompositeNetworkRepresentation(self.getCompositeNetworkRepresentation(child_element))
|
|
1130
|
+
com_spec.data_element_ref = self.getChildElementOptionalRefType(element, "DATA-ELEMENT-REF")
|
|
1131
|
+
com_spec.network_representation = self.getSwDataDefProps(element, "NETWORK-REPRESENTATION")
|
|
1132
|
+
com_spec.handle_out_of_range = self.getChildElementOptionalLiteral(element, "HANDLE-OUT-OF-RANGE")
|
|
916
1133
|
com_spec.transmission_acknowledge = self.readTransmissionAcknowledgementRequest(element)
|
|
917
|
-
com_spec.uses_end_to_end_protection = self.
|
|
918
|
-
|
|
919
|
-
def readNonqueuedSenderComSpec(self, element, parent: PPortPrototype):
|
|
920
|
-
for child_element in element.findall("./xmlns:PROVIDED-COM-SPECS/xmlns:NONQUEUED-SENDER-COM-SPEC", self.nsmap):
|
|
921
|
-
com_spec = NonqueuedSenderComSpec()
|
|
922
|
-
self.readSenderComSpec(child_element, com_spec)
|
|
923
|
-
|
|
924
|
-
com_spec.init_value = self.readInitValue(child_element)
|
|
925
|
-
|
|
926
|
-
parent.addProvidedComSpec(com_spec)
|
|
1134
|
+
com_spec.uses_end_to_end_protection = self.getChildElementOptionalBooleanValue(element, "USES-END-TO-END-PROTECTION")
|
|
927
1135
|
|
|
928
|
-
def
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
1136
|
+
def getNonqueuedSenderComSpec(self, element) -> NonqueuedSenderComSpec:
|
|
1137
|
+
com_spec = NonqueuedSenderComSpec()
|
|
1138
|
+
self.readSenderComSpec(element, com_spec)
|
|
1139
|
+
com_spec.init_value = self.getInitValue(element)
|
|
1140
|
+
return com_spec
|
|
1141
|
+
|
|
1142
|
+
def getServerComSpec(self, element) -> ServerComSpec:
|
|
1143
|
+
com_spec = ServerComSpec()
|
|
1144
|
+
self.readSenderComSpec(element, com_spec)
|
|
1145
|
+
com_spec.operation_ref = self.getChildElementOptionalRefType(element, "OPERATION-REF")
|
|
1146
|
+
com_spec.queue_length = self.getChildElementOptionalNumericalValue(element, "QUEUE-LENGTH")
|
|
1147
|
+
return com_spec
|
|
1148
|
+
|
|
1149
|
+
def readProvidedComSpec(self, element: ET.Element, parent: PPortPrototype):
|
|
1150
|
+
for child_element in element.findall("./xmlns:PROVIDED-COM-SPECS/*", self.nsmap):
|
|
1151
|
+
tag_name = self.getTagName(child_element.tag)
|
|
1152
|
+
if tag_name == "NONQUEUED-SENDER-COM-SPEC":
|
|
1153
|
+
parent.addProvidedComSpec(self.getNonqueuedSenderComSpec(child_element))
|
|
1154
|
+
elif tag_name == "SERVER-COM-SPEC":
|
|
1155
|
+
parent.addProvidedComSpec(self.getServerComSpec(child_element))
|
|
1156
|
+
else:
|
|
1157
|
+
self._raiseError("Unsupported RequiredComSpec <%s>" % tag_name)
|
|
1158
|
+
|
|
1159
|
+
def readPPortPrototype(self, element: ET.Element, parent: AtomicSwComponentType):
|
|
1160
|
+
short_name = self.getShortName(element)
|
|
1161
|
+
self.logger.debug("readPPortPrototype %s" % short_name)
|
|
1162
|
+
prototype = parent.createPPortPrototype(short_name)
|
|
1163
|
+
self.readIdentifiable(element, prototype)
|
|
1164
|
+
prototype.provided_interface_tref = self.getChildElementOptionalRefType(element, "PROVIDED-INTERFACE-TREF")
|
|
1165
|
+
|
|
1166
|
+
self.readProvidedComSpec(element, prototype)
|
|
1167
|
+
|
|
1168
|
+
def readPortGroupInnerGroupIRefs(self, element: ET.Element, parent: PortGroup):
|
|
1169
|
+
for child_element in element.findall("./xmlns:INNER-GROUP-IREFS/xmlns:INNER-GROUP-IREF", self.nsmap):
|
|
1170
|
+
inner_group_iref = InnerPortGroupInCompositionInstanceRef()
|
|
1171
|
+
inner_group_iref.contextRef = self.getChildElementOptionalRefType(child_element, "CONTEXT-REF")
|
|
1172
|
+
inner_group_iref.targetRef = self.getChildElementOptionalRefType(child_element, "TARGET-REF")
|
|
1173
|
+
parent.addInnerGroupIRef(inner_group_iref)
|
|
1174
|
+
|
|
1175
|
+
def readPortGroupOuterPortRefs(self, element: ET.Element, parent: PortGroup):
|
|
1176
|
+
for child_element in element.findall("./xmlns:OUTER-PORTS/xmlns:PORT-PROTOTYPE-REF-CONDITIONAL", self.nsmap):
|
|
1177
|
+
parent.addOuterPortRef(self.getChildElementOptionalRefType(child_element, "PORT-PROTOTYPE-REF"))
|
|
1178
|
+
|
|
1179
|
+
def readPortGroup(self, element: ET.Element, parent: SwComponentType):
|
|
1180
|
+
short_name = self.getShortName(element)
|
|
1181
|
+
self.logger.debug("readPortGroup %s" % short_name)
|
|
1182
|
+
port_group = parent.createPortGroup(short_name)
|
|
1183
|
+
self.readIdentifiable(element, port_group)
|
|
1184
|
+
self.readPortGroupInnerGroupIRefs(element, port_group)
|
|
1185
|
+
self.readPortGroupOuterPortRefs(element, port_group)
|
|
1186
|
+
|
|
1187
|
+
def readSwComponentTypePortGroups(self, element: ET.Element, parent: SwComponentType):
|
|
1188
|
+
for child_element in element.findall("./xmlns:PORT-GROUPS/*", self.nsmap):
|
|
1189
|
+
tag_name = self.getTagName(child_element.tag)
|
|
1190
|
+
if tag_name == "PORT-GROUP":
|
|
1191
|
+
self.readPortGroup(child_element, parent)
|
|
1192
|
+
else:
|
|
1193
|
+
self._raiseError("Unsupported Port Group type: %s" % tag_name)
|
|
937
1194
|
|
|
938
|
-
def readSwComponentType(self, element, parent: SwComponentType):
|
|
939
|
-
self.
|
|
940
|
-
self.
|
|
1195
|
+
def readSwComponentType(self, element: ET.Element, parent: SwComponentType):
|
|
1196
|
+
self.readIdentifiable(element, parent)
|
|
1197
|
+
self.readAtomicSwComponentTypePorts(element, parent)
|
|
1198
|
+
self.readSwComponentTypePortGroups(element, parent)
|
|
941
1199
|
|
|
942
1200
|
def readAtomicSwComponentType(self, element, parent: AtomicSwComponentType):
|
|
943
1201
|
self.readSwComponentType(element, parent)
|
|
944
|
-
self.
|
|
945
|
-
|
|
946
|
-
def
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
def readPPortInCompositionInstanceRef(self, element, p_port_in_composition_instance_ref: PPortInCompositionInstanceRef):
|
|
978
|
-
p_port_in_composition_instance_ref.context_component_ref = self.readChildOptionalRefElement(element, "CONTEXT-COMPONENT-REF")
|
|
979
|
-
p_port_in_composition_instance_ref.target_p_port_ref = self.readChildOptionalRefElement(element, "TARGET-P-PORT-REF")
|
|
1202
|
+
self.readSwcInternalBehavior(element, parent)
|
|
1203
|
+
|
|
1204
|
+
def readEcuAbstractionSwComponent(self, element, parent: ARPackage):
|
|
1205
|
+
short_name = self.getShortName(element)
|
|
1206
|
+
sw_component = parent.createEcuAbstractionSwComponentType(short_name)
|
|
1207
|
+
self.readAtomicSwComponentType(element, sw_component)
|
|
1208
|
+
|
|
1209
|
+
def readApplicationSwComponentTypes(self, element: ET.Element, parent: ARPackage):
|
|
1210
|
+
short_name = self.getShortName(element)
|
|
1211
|
+
sw_component = parent.createApplicationSwComponentType(short_name)
|
|
1212
|
+
self.readAtomicSwComponentType(element, sw_component)
|
|
1213
|
+
|
|
1214
|
+
def readComplexDeviceDriverSwComponentType(self, element: ET.Element, parent: ARPackage):
|
|
1215
|
+
short_name = self.getShortName(element)
|
|
1216
|
+
sw_component = parent.createComplexDeviceDriverSwComponentType(short_name)
|
|
1217
|
+
self.logger.debug("readComplexDeviceDriverSwComponentType <%s>" % short_name)
|
|
1218
|
+
self.readAtomicSwComponentType(element, sw_component)
|
|
1219
|
+
|
|
1220
|
+
def readSensorActuatorSwComponentType(self, element: ET.Element, parent: ARPackage):
|
|
1221
|
+
short_name = self.getShortName(element)
|
|
1222
|
+
sw_component = parent.createSensorActuatorSwComponentType(short_name)
|
|
1223
|
+
self.logger.debug("readSensorActuatorSwComponentType <%s>" % short_name)
|
|
1224
|
+
self.readAtomicSwComponentType(element, sw_component)
|
|
1225
|
+
|
|
1226
|
+
def readServiceSwComponentType(self, element: ET.Element, parent: ARPackage):
|
|
1227
|
+
short_name = self.getShortName(element)
|
|
1228
|
+
sw_component = parent.createServiceSwComponentType(short_name)
|
|
1229
|
+
self.logger.debug("readServiceSwComponentType <%s>" % short_name)
|
|
1230
|
+
self.readAtomicSwComponentType(element, sw_component)
|
|
1231
|
+
|
|
1232
|
+
def readPPortInCompositionInstanceRef(self, element: ET.Element, p_port_in_composition_instance_ref: PPortInCompositionInstanceRef):
|
|
1233
|
+
p_port_in_composition_instance_ref.context_component_ref = self.getChildElementOptionalRefType(element, "CONTEXT-COMPONENT-REF")
|
|
1234
|
+
p_port_in_composition_instance_ref.target_p_port_ref = self.getChildElementOptionalRefType(element, "TARGET-P-PORT-REF")
|
|
980
1235
|
|
|
981
1236
|
self.logger.debug("PPortInCompositionInstanceRef")
|
|
982
1237
|
self.logger.debug(" CONTEXT-COMPONENT-REF DEST: %s, %s"
|
|
@@ -985,8 +1240,8 @@ class ARXMLParser:
|
|
|
985
1240
|
% (p_port_in_composition_instance_ref.target_p_port_ref.dest, p_port_in_composition_instance_ref.target_p_port_ref.value))
|
|
986
1241
|
|
|
987
1242
|
def readRPortInCompositionInstanceRef(self, element, r_port_in_composition_instance_ref: RPortInCompositionInstanceRef):
|
|
988
|
-
r_port_in_composition_instance_ref.context_component_ref = self.
|
|
989
|
-
r_port_in_composition_instance_ref.target_r_port_ref = self.
|
|
1243
|
+
r_port_in_composition_instance_ref.context_component_ref = self.getChildElementOptionalRefType(element, "CONTEXT-COMPONENT-REF")
|
|
1244
|
+
r_port_in_composition_instance_ref.target_r_port_ref = self.getChildElementOptionalRefType(element, "TARGET-R-PORT-REF")
|
|
990
1245
|
|
|
991
1246
|
self.logger.debug("RPortInCompositionInstanceRef")
|
|
992
1247
|
self.logger.debug(" CONTEXT-COMPONENT-REF DEST: %s, %s"
|
|
@@ -994,44 +1249,44 @@ class ARXMLParser:
|
|
|
994
1249
|
self.logger.debug(" TARGET-P-PORT-REF DEST: %s, %s"
|
|
995
1250
|
% (r_port_in_composition_instance_ref.target_r_port_ref.dest, r_port_in_composition_instance_ref.target_r_port_ref.value))
|
|
996
1251
|
|
|
997
|
-
def readAssemblySwConnectorProviderIRef(self, element, parent: AssemblySwConnector):
|
|
1252
|
+
def readAssemblySwConnectorProviderIRef(self, element: ET.Element, parent: AssemblySwConnector):
|
|
998
1253
|
child_element = element.find("./xmlns:PROVIDER-IREF", self.nsmap)
|
|
999
|
-
if (child_element
|
|
1254
|
+
if (child_element is not None):
|
|
1000
1255
|
provide_iref = PPortInCompositionInstanceRef()
|
|
1001
1256
|
self.readElementAttributes(child_element, provide_iref)
|
|
1002
1257
|
self.readPPortInCompositionInstanceRef(child_element, provide_iref)
|
|
1003
1258
|
parent.provider_iref = provide_iref
|
|
1004
1259
|
|
|
1005
|
-
def readAssemblySwConnectorRequesterIRef(self, element, parent: AssemblySwConnector):
|
|
1260
|
+
def readAssemblySwConnectorRequesterIRef(self, element: ET.Element, parent: AssemblySwConnector):
|
|
1006
1261
|
child_element = element.find("./xmlns:REQUESTER-IREF", self.nsmap)
|
|
1007
|
-
if (child_element
|
|
1262
|
+
if (child_element is not None):
|
|
1008
1263
|
requester_iref = RPortInCompositionInstanceRef()
|
|
1009
1264
|
self.readElementAttributes(child_element, requester_iref)
|
|
1010
1265
|
self.readRPortInCompositionInstanceRef(child_element, requester_iref)
|
|
1011
1266
|
parent.requester_iref = requester_iref
|
|
1012
1267
|
|
|
1013
|
-
def readAssemblySwConnectors(self, element, parent: CompositionSwComponentType):
|
|
1268
|
+
def readAssemblySwConnectors(self, element: ET.Element, parent: CompositionSwComponentType):
|
|
1014
1269
|
for child_element in element.findall("./xmlns:CONNECTORS/xmlns:ASSEMBLY-SW-CONNECTOR", self.nsmap):
|
|
1015
|
-
short_name = self.
|
|
1270
|
+
short_name = self.getShortName(child_element)
|
|
1016
1271
|
self.logger.debug("readAssemblySwConnectors %s" % short_name)
|
|
1017
1272
|
|
|
1018
1273
|
connector = parent.createAssemblySwConnector(short_name)
|
|
1019
|
-
self.
|
|
1274
|
+
self.readIdentifiable(child_element, connector)
|
|
1020
1275
|
self.readAssemblySwConnectorProviderIRef(child_element, connector)
|
|
1021
1276
|
self.readAssemblySwConnectorRequesterIRef(child_element, connector)
|
|
1022
1277
|
|
|
1023
1278
|
def readDelegationSwConnectorInnerPortIRef(self, element, parent: DelegationSwConnector):
|
|
1024
1279
|
inner_port_iref_element = element.find("./xmlns:INNER-PORT-IREF", self.nsmap)
|
|
1025
|
-
if (inner_port_iref_element
|
|
1280
|
+
if (inner_port_iref_element is not None):
|
|
1026
1281
|
child_element = inner_port_iref_element.find("./xmlns:R-PORT-IN-COMPOSITION-INSTANCE-REF", self.nsmap)
|
|
1027
|
-
if (child_element
|
|
1282
|
+
if (child_element is not None):
|
|
1028
1283
|
r_port_in_composition_instance_ref = RPortInCompositionInstanceRef()
|
|
1029
1284
|
self.readRPortInCompositionInstanceRef(child_element, r_port_in_composition_instance_ref)
|
|
1030
1285
|
parent.inner_port_iref = r_port_in_composition_instance_ref
|
|
1031
1286
|
return
|
|
1032
1287
|
|
|
1033
1288
|
child_element = inner_port_iref_element.find("./xmlns:P-PORT-IN-COMPOSITION-INSTANCE-REF", self.nsmap)
|
|
1034
|
-
if (child_element
|
|
1289
|
+
if (child_element is not None):
|
|
1035
1290
|
p_port_in_composition_instance_ref = PPortInCompositionInstanceRef()
|
|
1036
1291
|
self.readPPortInCompositionInstanceRef(child_element, p_port_in_composition_instance_ref)
|
|
1037
1292
|
parent.inner_port_iref = p_port_in_composition_instance_ref
|
|
@@ -1041,111 +1296,131 @@ class ARXMLParser:
|
|
|
1041
1296
|
|
|
1042
1297
|
def readDelegationSwConnectors(self, element, parent: CompositionSwComponentType):
|
|
1043
1298
|
for child_element in element.findall("./xmlns:CONNECTORS/xmlns:DELEGATION-SW-CONNECTOR", self.nsmap):
|
|
1044
|
-
short_name = self.
|
|
1299
|
+
short_name = self.getShortName(child_element)
|
|
1045
1300
|
self.logger.debug("readDelegationSwConnectors %s" % short_name)
|
|
1046
1301
|
|
|
1047
1302
|
connector = parent.createDelegationSwConnector(short_name)
|
|
1048
|
-
self.
|
|
1303
|
+
self.readIdentifiable(child_element, connector)
|
|
1049
1304
|
self.readDelegationSwConnectorInnerPortIRef(child_element, connector)
|
|
1050
1305
|
|
|
1051
1306
|
if connector.inner_port_iref == None and connector.outer_port_iref == None:
|
|
1052
1307
|
self._raiseError("Invalid PortPrototype of DELEGATION-SW-CONNECTOR")
|
|
1053
1308
|
|
|
1054
|
-
connector.outer_port_ref = self.
|
|
1309
|
+
connector.outer_port_ref = self.getChildElementOptionalRefType(child_element, "OUTER-PORT-REF")
|
|
1055
1310
|
self.logger.debug("OUTER-PORT-REF DEST: %s, %s"
|
|
1056
1311
|
% (connector.outer_port_ref.dest, connector.outer_port_ref.value))
|
|
1057
1312
|
|
|
1058
1313
|
def readSwComponentPrototypes(self, element: ET.Element, parent: CompositionSwComponentType):
|
|
1059
1314
|
for child_element in element.findall("./xmlns:COMPONENTS/xmlns:SW-COMPONENT-PROTOTYPE", self.nsmap):
|
|
1060
|
-
short_name = self.
|
|
1315
|
+
short_name = self.getShortName(child_element)
|
|
1061
1316
|
self.logger.debug("readSwComponentPrototypes %s" % short_name)
|
|
1062
|
-
|
|
1063
1317
|
prototype = parent.createSwComponentPrototype(short_name)
|
|
1064
|
-
self.
|
|
1065
|
-
prototype.type_tref = self.
|
|
1318
|
+
self.readIdentifiable(child_element, prototype)
|
|
1319
|
+
prototype.type_tref = self.getChildElementOptionalRefType(child_element, "TYPE-TREF")
|
|
1066
1320
|
|
|
1067
|
-
def
|
|
1321
|
+
def readCompositionSwComponentTypeDataTypeMappingSet(self, element: ET.Element, parent: CompositionSwComponentType):
|
|
1068
1322
|
child_element = element.find("./xmlns:DATA-TYPE-MAPPING-REFS", self.nsmap)
|
|
1069
1323
|
self.logger.debug("readDataTypeMappingSet")
|
|
1070
|
-
if child_element
|
|
1071
|
-
for ref in self.
|
|
1324
|
+
if child_element is not None:
|
|
1325
|
+
for ref in self.getChildElementRefTypeList(child_element, "./DATA-TYPE-MAPPING-REF"):
|
|
1072
1326
|
parent.addDataTypeMapping(ref)
|
|
1073
1327
|
|
|
1074
|
-
def
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
self.logger.debug("readCompositionSwComponentTypes: <%s>" % short_name)
|
|
1328
|
+
def readCompositionSwComponentType(self, element: ET.Element, parent: ARPackage):
|
|
1329
|
+
short_name = self.getShortName(element)
|
|
1330
|
+
self.logger.debug("readCompositionSwComponentTypes: <%s>" % short_name)
|
|
1078
1331
|
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1332
|
+
sw_component = parent.createCompositionSwComponentType(short_name)
|
|
1333
|
+
self.readIdentifiable(element, sw_component)
|
|
1334
|
+
self.readSwComponentType(element, sw_component)
|
|
1335
|
+
self.readSwComponentPrototypes(element, sw_component)
|
|
1336
|
+
self.readAssemblySwConnectors(element, sw_component)
|
|
1337
|
+
self.readDelegationSwConnectors(element, sw_component)
|
|
1338
|
+
self.readCompositionSwComponentTypeDataTypeMappingSet(element, sw_component)
|
|
1086
1339
|
|
|
1087
|
-
|
|
1340
|
+
self.logger.debug("ReadCompositionSwComponentTypes: <%s> (Done)" % short_name)
|
|
1341
|
+
|
|
1342
|
+
def readDataTypeMaps(self, element: ET.Element, parent: DataTypeMappingSet):
|
|
1088
1343
|
for child_element in element.findall("./xmlns:DATA-TYPE-MAPS/xmlns:DATA-TYPE-MAP", self.nsmap):
|
|
1089
1344
|
data_type_map = DataTypeMap()
|
|
1090
|
-
|
|
1091
|
-
data_type_map.
|
|
1345
|
+
self.readElementAttributes(child_element, data_type_map)
|
|
1346
|
+
data_type_map.application_data_type_ref = self.getChildElementOptionalRefType(child_element, "APPLICATION-DATA-TYPE-REF")
|
|
1347
|
+
data_type_map.implementation_data_type_ref = self.getChildElementOptionalRefType(child_element, "IMPLEMENTATION-DATA-TYPE-REF")
|
|
1092
1348
|
parent.addDataTypeMap(data_type_map)
|
|
1093
1349
|
# add the data type map to global namespace
|
|
1094
1350
|
AUTOSAR.getInstance().addDataTypeMap(data_type_map)
|
|
1095
1351
|
|
|
1096
|
-
def
|
|
1097
|
-
for child_element in element.findall("./xmlns:
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
self.
|
|
1101
|
-
|
|
1102
|
-
|
|
1352
|
+
def readModeRequestTypeMaps(self, element: ET.Element, parent: DataTypeMappingSet):
|
|
1353
|
+
for child_element in element.findall("./xmlns:MODE-REQUEST-TYPE-MAPS/xmlns:MODE-REQUEST-TYPE-MAP", self.nsmap):
|
|
1354
|
+
map = ModeRequestTypeMap()
|
|
1355
|
+
self.readElementAttributes(child_element, map)
|
|
1356
|
+
map.implementation_data_type_ref = self.getChildElementOptionalRefType(child_element, "IMPLEMENTATION-DATA-TYPE-REF")
|
|
1357
|
+
map.mode_group_ref = self.getChildElementOptionalRefType(child_element, "MODE-GROUP-REF")
|
|
1358
|
+
parent.addModeRequestTypeMap(map)
|
|
1359
|
+
|
|
1360
|
+
def readDataTypeMappingSet(self, element: ET.Element, parent: ARPackage):
|
|
1361
|
+
short_name = self.getShortName(element)
|
|
1362
|
+
mapping_set = parent.createDataTypeMappingSet(short_name)
|
|
1363
|
+
self.readIdentifiable(element, mapping_set)
|
|
1364
|
+
self.readDataTypeMaps(element, mapping_set)
|
|
1365
|
+
self.readModeRequestTypeMaps(element, mapping_set)
|
|
1366
|
+
|
|
1367
|
+
def readDataElements(self, element: ET.Element, parent: SenderReceiverInterface):
|
|
1103
1368
|
for child_element in element.findall("./xmlns:DATA-ELEMENTS/xmlns:VARIABLE-DATA-PROTOTYPE", self.nsmap):
|
|
1104
|
-
short_name = self.
|
|
1369
|
+
short_name = self.getShortName(child_element)
|
|
1105
1370
|
prototype = parent.createDataElement(short_name)
|
|
1106
|
-
self.
|
|
1107
|
-
prototype.
|
|
1371
|
+
self.readIdentifiable(child_element, prototype)
|
|
1372
|
+
prototype.sw_data_def_props = self.getSwDataDefProps(child_element, "SW-DATA-DEF-PROPS")
|
|
1373
|
+
self.readAutosarDataPrototype(child_element, prototype)
|
|
1374
|
+
prototype.init_value = self.getInitValue(child_element)
|
|
1108
1375
|
|
|
1109
1376
|
def readSenderReceiverInterfaces(self, element, parent: ARPackage):
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1377
|
+
short_name = self.getShortName(element)
|
|
1378
|
+
sr_interface = parent.createSenderReceiverInterface(short_name)
|
|
1379
|
+
self.readIdentifiable(element, sr_interface)
|
|
1380
|
+
sr_interface.is_service = self.getChildElementOptionalBooleanValue(element, "IS-SERVICE")
|
|
1381
|
+
self.readDataElements(element, sr_interface)
|
|
1114
1382
|
|
|
1115
1383
|
def readArgumentDataPrototypes(self, element: ET.Element, parent: ClientServerOperation):
|
|
1116
1384
|
for child_element in element.findall("./xmlns:ARGUMENTS/xmlns:ARGUMENT-DATA-PROTOTYPE", self.nsmap):
|
|
1117
|
-
short_name = self.
|
|
1385
|
+
short_name = self.getShortName(child_element)
|
|
1118
1386
|
prototype = ArgumentDataPrototype(property, short_name)
|
|
1119
|
-
|
|
1120
|
-
prototype.
|
|
1387
|
+
self.readIdentifiable(child_element, prototype)
|
|
1388
|
+
prototype.sw_data_def_props = self.getSwDataDefProps(child_element, "SW-DATA-DEF-PROPS")
|
|
1389
|
+
prototype.type_tref = self.getChildElementOptionalRefType(child_element, "TYPE-TREF")
|
|
1390
|
+
prototype.direction = self.getChildElementOptionalLiteral(child_element, "DIRECTION")
|
|
1121
1391
|
parent.addArgumentDataPrototype(prototype)
|
|
1122
1392
|
|
|
1123
1393
|
def readPossibleErrorRefs(self, element: ET.Element, parent: ClientServerOperation):
|
|
1124
1394
|
child_element = element.find("./xmlns:POSSIBLE-ERROR-REFS", self.nsmap)
|
|
1125
|
-
if child_element
|
|
1126
|
-
for ref in self.
|
|
1395
|
+
if child_element is not None:
|
|
1396
|
+
for ref in self.getChildElementRefTypeList(child_element, "./POSSIBLE-ERROR-REF"):
|
|
1127
1397
|
parent.addPossibleErrorRef(ref)
|
|
1128
1398
|
|
|
1129
1399
|
def readOperations(self, element: ET.Element, parent: ClientServerInterface):
|
|
1130
1400
|
for child_element in element.findall("./xmlns:OPERATIONS/xmlns:CLIENT-SERVER-OPERATION", self.nsmap):
|
|
1131
|
-
short_name = self.
|
|
1401
|
+
short_name = self.getShortName(child_element)
|
|
1132
1402
|
operation = parent.createOperation(short_name)
|
|
1403
|
+
self.readIdentifiable(child_element, operation)
|
|
1133
1404
|
self.readArgumentDataPrototypes(child_element, operation)
|
|
1134
1405
|
self.readPossibleErrorRefs(child_element, operation)
|
|
1135
1406
|
|
|
1136
1407
|
def readPossibleErrors(self, element: ET.Element, parent: ClientServerInterface):
|
|
1137
1408
|
for child_element in element.findall("./xmlns:POSSIBLE-ERRORS/xmlns:APPLICATION-ERROR", self.nsmap):
|
|
1138
|
-
short_name = self.
|
|
1409
|
+
short_name = self.getShortName(child_element)
|
|
1139
1410
|
error = parent.createApplicationError(short_name)
|
|
1140
|
-
error.error_code = self.
|
|
1411
|
+
error.error_code = self.getChildElementOptionalNumericalValue(child_element, "ERROR-CODE")
|
|
1412
|
+
|
|
1413
|
+
def readPortInterface(self, element: ET.Element, port_interface: PortInterface):
|
|
1414
|
+
port_interface.is_service = self.getChildElementOptionalBooleanValue(element, "IS-SERVICE")
|
|
1415
|
+
port_interface.serviceKind = self.getChildElementOptionalLiteral(element, "SERVICE-KIND")
|
|
1141
1416
|
|
|
1142
|
-
def
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1417
|
+
def readClientServerInterface(self, element: ET.Element, parent: ARPackage):
|
|
1418
|
+
short_name = self.getShortName(element)
|
|
1419
|
+
cs_interface = parent.createClientServerInterface(short_name)
|
|
1420
|
+
self.readIdentifiable(element, cs_interface)
|
|
1421
|
+
self.readPortInterface(element, cs_interface)
|
|
1422
|
+
self.readOperations(element, cs_interface)
|
|
1423
|
+
self.readPossibleErrors(element, cs_interface)
|
|
1149
1424
|
|
|
1150
1425
|
def readCompuConst(self, element: ET.Element, parent: CompuScale):
|
|
1151
1426
|
child_element = element.find("./xmlns:COMPU-CONST/xmlns:VT", self.nsmap)
|
|
@@ -1154,8 +1429,9 @@ class ARXMLParser:
|
|
|
1154
1429
|
contents = CompuScaleConstantContents()
|
|
1155
1430
|
contents.compu_const = CompuConst()
|
|
1156
1431
|
contents.compu_const.compu_const_content_type = CompuConstTextContent()
|
|
1157
|
-
contents.compu_const.compu_const_content_type.vt =
|
|
1158
|
-
|
|
1432
|
+
contents.compu_const.compu_const_content_type.vt = ARLiteral()
|
|
1433
|
+
contents.compu_const.compu_const_content_type.vt.setValue(child_element.text)
|
|
1434
|
+
parent.compuScaleContents = contents
|
|
1159
1435
|
|
|
1160
1436
|
def readCompuNominatorDenominator(self, element: ET.Element, key: str, parent: CompuNominatorDenominator):
|
|
1161
1437
|
for child_element in element.findall("./xmlns:%s/xmlns:V" % key, self.nsmap):
|
|
@@ -1172,7 +1448,7 @@ class ARXMLParser:
|
|
|
1172
1448
|
contents.compu_rational_coeffs.compu_numerator = CompuNominatorDenominator()
|
|
1173
1449
|
self.readCompuNominatorDenominator(child_element, "COMPU-DENOMINATOR", contents.compu_rational_coeffs.compu_denominator)
|
|
1174
1450
|
self.readCompuNominatorDenominator(child_element, "COMPU-NUMERATOR", contents.compu_rational_coeffs.compu_numerator)
|
|
1175
|
-
parent.
|
|
1451
|
+
parent.compuScaleContents = contents
|
|
1176
1452
|
|
|
1177
1453
|
def readCompuScaleContents(self, element: ET.Element, parent: CompuScale):
|
|
1178
1454
|
self.readCompuConst(element, parent)
|
|
@@ -1181,165 +1457,615 @@ class ARXMLParser:
|
|
|
1181
1457
|
def readCompuScales(self, element: ET.Element, parent: CompuScales):
|
|
1182
1458
|
for child_element in element.findall('./xmlns:COMPU-SCALES/xmlns:COMPU-SCALE', self.nsmap):
|
|
1183
1459
|
compu_scale = CompuScale()
|
|
1184
|
-
|
|
1185
|
-
compu_scale.
|
|
1460
|
+
self.readElementAttributes(child_element, compu_scale)
|
|
1461
|
+
compu_scale.symbol = self.getChildElementOptionalLiteral(child_element, "SYMBOL")
|
|
1462
|
+
compu_scale.lowerLimit = self.getChildLimitElement(child_element, "LOWER-LIMIT")
|
|
1463
|
+
compu_scale.upperLimit = self.getChildLimitElement(child_element, "UPPER-LIMIT")
|
|
1186
1464
|
self.readCompuScaleContents(child_element, compu_scale)
|
|
1187
1465
|
parent.addCompuScale(compu_scale)
|
|
1188
1466
|
|
|
1189
1467
|
def readCompuInternalToPhys(self, element: ET.Element, parent: CompuMethod):
|
|
1190
1468
|
child_element = element.find("./xmlns:COMPU-INTERNAL-TO-PHYS", self.nsmap)
|
|
1191
|
-
if (child_element
|
|
1469
|
+
if (child_element is not None):
|
|
1192
1470
|
parent.compu_internal_to_phys = Compu()
|
|
1193
1471
|
self.readElementAttributes(child_element, parent.compu_internal_to_phys)
|
|
1194
1472
|
parent.compu_internal_to_phys.compu_content = CompuScales()
|
|
1195
1473
|
self.readCompuScales(child_element, parent.compu_internal_to_phys.compu_content)
|
|
1196
1474
|
|
|
1197
|
-
def
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
self.readCompuInternalToPhys(child_element, compu_method)
|
|
1475
|
+
def readCompuMethod(self, element: ET.Element, parent: ARPackage):
|
|
1476
|
+
short_name = self.getShortName(element)
|
|
1477
|
+
self.logger.debug("readCompuMethods %s" % short_name)
|
|
1478
|
+
compu_method = parent.createCompuMethod(short_name)
|
|
1479
|
+
self.readIdentifiable(element, compu_method)
|
|
1480
|
+
compu_method.unit_ref = self.getChildElementOptionalRefType(element, "UNIT-REF")
|
|
1481
|
+
self.readCompuInternalToPhys(element, compu_method)
|
|
1205
1482
|
|
|
1206
1483
|
def readSwcBswRunnableMappings(self, element: ET.Element, parent: SwcBswMapping):
|
|
1207
1484
|
for child_element in element.findall("./xmlns:RUNNABLE-MAPPINGS/xmlns:SWC-BSW-RUNNABLE-MAPPING", self.nsmap):
|
|
1208
1485
|
mapping = SwcBswRunnableMapping()
|
|
1209
|
-
mapping.
|
|
1210
|
-
mapping.
|
|
1486
|
+
mapping.bswEntityRef = self.getChildElementOptionalRefType(child_element, "BSW-ENTITY-REF")
|
|
1487
|
+
mapping.swcRunnableRef = self.getChildElementOptionalRefType(child_element, "SWC-RUNNABLE-REF")
|
|
1211
1488
|
parent.addRunnableMapping(mapping)
|
|
1212
1489
|
|
|
1213
1490
|
def readSwcBswMappings(self, element: ET.Element, parent: ARPackage):
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
swc_bsw_mapping.swc_behavior_ref = self.readChildOptionalRefElement(child_element, "SWC-BEHAVIOR-REF")
|
|
1491
|
+
short_name = self.getShortName(element)
|
|
1492
|
+
self.logger.debug("readSwcBswMappings %s" % short_name)
|
|
1493
|
+
swc_bsw_mapping = parent.createSwcBswMapping(short_name)
|
|
1494
|
+
swc_bsw_mapping.bswBehaviorRef = self.getChildElementOptionalRefType(element, "BSW-BEHAVIOR-REF")
|
|
1495
|
+
self.readSwcBswRunnableMappings(element, swc_bsw_mapping)
|
|
1496
|
+
swc_bsw_mapping.swcBehaviorRef = self.getChildElementOptionalRefType(element, "SWC-BEHAVIOR-REF")
|
|
1221
1497
|
|
|
1222
1498
|
def readValueSpecification(self, element: ET.Element, value_spec: ValueSpecification):
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
child_element = element.find("./xmlns:SW-VALUE-CONT", self.nsmap)
|
|
1227
|
-
if child_element is not None:
|
|
1228
|
-
sw_value_cont = SwValueCont()
|
|
1229
|
-
sw_value_cont.unit_ref = self.readChildOptionalRefElement(child_element, "UNIT-REF")
|
|
1230
|
-
sw_value_cont.sw_values_phys = self.readSwValues(child_element, "SW-VALUES-PHYS")
|
|
1231
|
-
spec.sw_value_cont = sw_value_cont
|
|
1499
|
+
self.readElementAttributes(element, value_spec)
|
|
1500
|
+
value_spec.short_label = self.getChildElementOptionalLiteral(element, "SHORT-LABEL")
|
|
1501
|
+
self.logger.debug("readValueSpecification")
|
|
1232
1502
|
|
|
1233
|
-
def
|
|
1503
|
+
def getApplicationValueSpecification(self, element: ET.Element) -> ApplicationValueSpecification:
|
|
1504
|
+
self.logger.debug("getApplicationValueSpecification")
|
|
1234
1505
|
value_spec = ApplicationValueSpecification()
|
|
1235
1506
|
self.readValueSpecification(element, value_spec)
|
|
1236
|
-
value_spec.category = self.
|
|
1237
|
-
self.
|
|
1507
|
+
value_spec.category = self.getChildElementOptionalLiteral(element, "CATEGORY")
|
|
1508
|
+
value_spec.sw_value_cont = self.getSwValueCont(element)
|
|
1509
|
+
return value_spec
|
|
1510
|
+
|
|
1511
|
+
def getNumericalValueSpecification(self, element: ET.Element) -> NumericalValueSpecification:
|
|
1512
|
+
self.logger.debug("getNumericalValueSpecification")
|
|
1513
|
+
value_spec = NumericalValueSpecification()
|
|
1514
|
+
self.readValueSpecification(element, value_spec)
|
|
1515
|
+
value_spec.value = self.getChildElementOptionalFloatValue(element, "VALUE")
|
|
1516
|
+
return value_spec
|
|
1517
|
+
|
|
1518
|
+
def getTextValueSpecification(self, element: ET.Element) -> TextValueSpecification:
|
|
1519
|
+
self.logger.debug("getTextValueSpecification")
|
|
1520
|
+
value_spec = TextValueSpecification()
|
|
1521
|
+
self.readValueSpecification(element, value_spec)
|
|
1522
|
+
value_spec.value = self.getChildElementOptionalLiteral(element, "VALUE")
|
|
1523
|
+
return value_spec
|
|
1524
|
+
|
|
1525
|
+
def getArrayValueSpecification(self, element: ET.Element) -> ArrayValueSpecification:
|
|
1526
|
+
self.logger.debug("getArrayValueSpecification")
|
|
1527
|
+
value_spec = ArrayValueSpecification()
|
|
1528
|
+
self.readValueSpecification(element, value_spec)
|
|
1529
|
+
child_elements = element.findall("./xmlns:ELEMENTS/*", self.nsmap)
|
|
1530
|
+
for child_element in child_elements:
|
|
1531
|
+
value_spec.add_element(self.getValueSpecification(child_element))
|
|
1532
|
+
return value_spec
|
|
1533
|
+
|
|
1534
|
+
def getConstantReference(self, element: ET.Element) -> ConstantReference:
|
|
1535
|
+
self.logger.debug("getConstantReference")
|
|
1536
|
+
value_spec = ConstantReference()
|
|
1537
|
+
self.readValueSpecification(element, value_spec)
|
|
1538
|
+
value_spec.constant_ref = self.getChildElementOptionalRefType(element, "CONSTANT-REF")
|
|
1539
|
+
return value_spec
|
|
1540
|
+
|
|
1541
|
+
def getValueSpecification(self, element: ET.Element) -> ValueSpecification:
|
|
1542
|
+
tag_name = self.getTagName(element.tag)
|
|
1543
|
+
if tag_name == "APPLICATION-VALUE-SPECIFICATION":
|
|
1544
|
+
value_spec = self.getApplicationValueSpecification(element)
|
|
1545
|
+
elif tag_name == "RECORD-VALUE-SPECIFICATION":
|
|
1546
|
+
value_spec = self.getRecordValueSpecification(element)
|
|
1547
|
+
elif tag_name == "NUMERICAL-VALUE-SPECIFICATION":
|
|
1548
|
+
value_spec = self.getNumericalValueSpecification(element)
|
|
1549
|
+
elif tag_name == "ARRAY-VALUE-SPECIFICATION":
|
|
1550
|
+
value_spec = self.getArrayValueSpecification(element)
|
|
1551
|
+
elif tag_name == "TEXT-VALUE-SPECIFICATION":
|
|
1552
|
+
value_spec = self.getTextValueSpecification(element)
|
|
1553
|
+
elif tag_name == "CONSTANT-REFERENCE":
|
|
1554
|
+
value_spec = self.getConstantReference(element)
|
|
1555
|
+
else:
|
|
1556
|
+
raise NotImplementedError("Unsupported RecordValueSpecificationField %s" % tag_name)
|
|
1238
1557
|
return value_spec
|
|
1239
1558
|
|
|
1240
1559
|
def readRecordValueSpecificationFields(self, element: ET.Element, spec: RecordValueSpecification):
|
|
1241
1560
|
for child_element in element.findall("./xmlns:FIELDS/*", self.nsmap):
|
|
1242
|
-
|
|
1243
|
-
value_spec = self.readApplicationValueSpecification(child_element)
|
|
1244
|
-
elif child_element.tag == "{http://autosar.org/schema/r4.0}RECORD-VALUE-SPECIFICATION":
|
|
1245
|
-
value_spec = self.readRecordValueSpecification(child_element)
|
|
1246
|
-
else:
|
|
1247
|
-
raise NotImplementedError("Unsupported VALUE-SPEC %s" % child_element.tag)
|
|
1248
|
-
spec.add_field(value_spec)
|
|
1561
|
+
spec.add_field(self.getValueSpecification(child_element))
|
|
1249
1562
|
|
|
1250
|
-
def
|
|
1563
|
+
def getRecordValueSpecification(self, element: ET.Element) -> RecordValueSpecification:
|
|
1251
1564
|
value_spec = RecordValueSpecification()
|
|
1252
1565
|
self.readValueSpecification(element, value_spec)
|
|
1253
1566
|
self.readRecordValueSpecificationFields(element, value_spec)
|
|
1254
1567
|
return value_spec
|
|
1255
1568
|
|
|
1256
1569
|
def readConstantSpecification(self, element: ET.Element, parent: ARPackage):
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
if value_spec_tag.tag == "{http://autosar.org/schema/r4.0}APPLICATION-VALUE-SPECIFICATION":
|
|
1264
|
-
spec.value_spec = self.readApplicationValueSpecification(value_spec_tag)
|
|
1265
|
-
elif value_spec_tag.tag == "{http://autosar.org/schema/r4.0}RECORD-VALUE-SPECIFICATION":
|
|
1266
|
-
spec.value_spec = self.readRecordValueSpecification(value_spec_tag)
|
|
1267
|
-
else:
|
|
1268
|
-
raise NotImplementedError("Unsupported VALUE-SPEC %s" % value_spec_tag.tag)
|
|
1570
|
+
short_name = self.getShortName(element)
|
|
1571
|
+
self.logger.debug("readConstantSpecification %s" % short_name)
|
|
1572
|
+
spec = parent.createConstantSpecification(short_name)
|
|
1573
|
+
self.readIdentifiable(element, spec)
|
|
1574
|
+
for value_spec_tag in element.findall("./xmlns:VALUE-SPEC/*", self.nsmap):
|
|
1575
|
+
spec.value_spec = self.getValueSpecification(value_spec_tag)
|
|
1269
1576
|
|
|
1270
1577
|
def readInternalConstrs(self, element: ET.Element, parent: DataConstrRule):
|
|
1271
1578
|
child_element = element.find("./xmlns:INTERNAL-CONSTRS", self.nsmap)
|
|
1272
1579
|
if child_element is not None:
|
|
1273
1580
|
constrs = InternalConstrs()
|
|
1274
|
-
|
|
1275
|
-
constrs.
|
|
1276
|
-
|
|
1581
|
+
self.readElementAttributes(child_element, constrs)
|
|
1582
|
+
constrs.lower_limit = self.getChildLimitElement(child_element, "LOWER-LIMIT")
|
|
1583
|
+
constrs.upper_limit = self.getChildLimitElement(child_element, "UPPER-LIMIT")
|
|
1584
|
+
parent.internalConstrs = constrs
|
|
1277
1585
|
|
|
1278
1586
|
def readPhysConstrs(self, element: ET.Element, parent: DataConstrRule):
|
|
1279
1587
|
child_element = element.find("./xmlns:PHYS-CONSTRS", self.nsmap)
|
|
1280
1588
|
if child_element is not None:
|
|
1281
1589
|
constrs = PhysConstrs()
|
|
1282
|
-
|
|
1283
|
-
constrs.
|
|
1284
|
-
constrs.
|
|
1285
|
-
|
|
1590
|
+
self.readElementAttributes(child_element, constrs)
|
|
1591
|
+
constrs.lower_limit = self.getChildLimitElement(child_element, "LOWER-LIMIT")
|
|
1592
|
+
constrs.upper_limit = self.getChildLimitElement(child_element, "UPPER-LIMIT")
|
|
1593
|
+
constrs.unit_ref = self.getChildElementOptionalRefType(child_element, "UNIT-REF")
|
|
1594
|
+
parent.physConstrs = constrs
|
|
1286
1595
|
|
|
1287
1596
|
def readDataConstrRule(self, element: ET.Element, parent: DataConstr):
|
|
1288
1597
|
for child_element in element.findall("./xmlns:DATA-CONSTR-RULES/xmlns:DATA-CONSTR-RULE", self.nsmap):
|
|
1289
1598
|
self.logger.debug("readDataConstrRule")
|
|
1290
1599
|
rule = DataConstrRule()
|
|
1600
|
+
self.readElementAttributes(child_element, rule)
|
|
1601
|
+
rule.constrLevel = self.getChildElementOptionalNumericalValue(child_element, "CONSTR-LEVEL")
|
|
1291
1602
|
self.readInternalConstrs(child_element, rule)
|
|
1292
1603
|
self.readPhysConstrs(child_element, rule)
|
|
1293
1604
|
parent.addDataConstrRule(rule)
|
|
1294
1605
|
|
|
1295
1606
|
def readDataConstr(self, element: ET.Element, parent: ARPackage):
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
self.readDataConstrRule(child_element, constr)
|
|
1607
|
+
short_name = self.getShortName(element)
|
|
1608
|
+
self.logger.debug("readDataConstr %s" % short_name)
|
|
1609
|
+
constr = parent.createDataConstr(short_name)
|
|
1610
|
+
self.readIdentifiable(element, constr)
|
|
1611
|
+
self.readDataConstrRule(element, constr)
|
|
1302
1612
|
|
|
1303
1613
|
def readUnit(self, element: ET.Element, parent: ARPackage):
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1614
|
+
short_name = self.getShortName(element)
|
|
1615
|
+
self.logger.debug("readUnit %s" % short_name)
|
|
1616
|
+
unit = parent.createUnit(short_name)
|
|
1617
|
+
self.readIdentifiable(element, unit)
|
|
1618
|
+
unit.display_name = self.getChildElementOptionalLiteral(element, "DISPLAY-NAME")
|
|
1619
|
+
|
|
1620
|
+
def readEndToEndDescriptionDataId(self, element: ET.Element, parent: EndToEndDescription):
|
|
1621
|
+
child_element = element.find("./xmlns:DATA-IDS", self.nsmap)
|
|
1622
|
+
if child_element is not None:
|
|
1623
|
+
for value in self.getChildElementNumericalValueList(child_element, "DATA-ID"):
|
|
1624
|
+
parent.addDataId(value)
|
|
1625
|
+
|
|
1626
|
+
def getEndToEndDescription(self, element: ET.Element, key: str) -> EndToEndDescription:
|
|
1627
|
+
child_element = element.find("./xmlns:%s" % key, self.nsmap)
|
|
1628
|
+
desc = None
|
|
1629
|
+
if (child_element is not None):
|
|
1630
|
+
desc = EndToEndDescription()
|
|
1631
|
+
desc.category = self.getChildElementOptionalLiteral(child_element, "CATEGORY")
|
|
1632
|
+
self.readEndToEndDescriptionDataId(child_element, desc)
|
|
1633
|
+
desc.dataIdMode = self.getChildElementOptionalNumericalValue(child_element, "DATA-ID-MODE")
|
|
1634
|
+
desc.maxDeltaCounterInit = self.getChildElementOptionalNumericalValue(child_element, "MAX-DELTA-COUNTER-INIT")
|
|
1635
|
+
desc.crcOffset = self.getChildElementOptionalNumericalValue(child_element, "CRC-OFFSET")
|
|
1636
|
+
desc.counterOffset = self.getChildElementOptionalNumericalValue(child_element, "COUNTER-OFFSET")
|
|
1637
|
+
return desc
|
|
1638
|
+
|
|
1639
|
+
def getVariableDataPrototypeInSystemInstanceRef(self, element: ET.Element) -> VariableDataPrototypeInSystemInstanceRef:
|
|
1640
|
+
iref = VariableDataPrototypeInSystemInstanceRef()
|
|
1641
|
+
iref.context_component_refs = self.getChildElementOptionalRefType(element, "CONTEXT-COMPONENT-REF")
|
|
1642
|
+
iref.context_composition_ref = self.getChildElementOptionalRefType(element, "CONTEXT-COMPOSITION-REF")
|
|
1643
|
+
iref.context_port_ref = self.getChildElementOptionalRefType(element, "CONTEXT-PORT-REF")
|
|
1644
|
+
iref.target_data_prototype_ref = self.getChildElementOptionalRefType(element, "TARGET-DATA-PROTOTYPE-REF")
|
|
1645
|
+
return iref
|
|
1646
|
+
|
|
1647
|
+
def getEndToEndProtectionVariablePrototype(self, element: ET.Element) -> EndToEndProtectionVariablePrototype:
|
|
1648
|
+
prototype = EndToEndProtectionVariablePrototype()
|
|
1649
|
+
for child_element in element.findall("./xmlns:RECEIVER-IREFS/xmlns:RECEIVER-IREF", self.nsmap):
|
|
1650
|
+
prototype.addReceiverIref(self.getVariableDataPrototypeInSystemInstanceRef(child_element))
|
|
1651
|
+
child_element = element.find("./xmlns:SENDER-IREF", self.nsmap)
|
|
1652
|
+
if child_element is not None:
|
|
1653
|
+
prototype.senderIRef = self.getVariableDataPrototypeInSystemInstanceRef(child_element)
|
|
1654
|
+
return prototype
|
|
1655
|
+
|
|
1656
|
+
def readEndToEndProtectionVariablePrototypes(self, element: ET.Element, parent: EndToEndProtection):
|
|
1657
|
+
for child_element in element.findall("./xmlns:END-TO-END-PROTECTION-VARIABLE-PROTOTYPES/*", self.nsmap):
|
|
1658
|
+
tag_name = self.getTagName(child_element.tag)
|
|
1659
|
+
if tag_name == "END-TO-END-PROTECTION-VARIABLE-PROTOTYPE":
|
|
1660
|
+
parent.addEndToEndProtectionVariablePrototype(self.getEndToEndProtectionVariablePrototype(child_element))
|
|
1661
|
+
else:
|
|
1662
|
+
self._raiseError("Unsupported End To End Protection Variable Prototype <%s>" % tag_name)
|
|
1663
|
+
|
|
1664
|
+
def readEndToEndProtection(self, element: ET.Element, parent: EndToEndProtectionSet):
|
|
1665
|
+
short_name = self.getShortName(element)
|
|
1666
|
+
self.logger.debug("readEndToEndProtection %s" % short_name)
|
|
1667
|
+
protection = parent.createEndToEndProtection(short_name)
|
|
1668
|
+
self.readIdentifiable(element, protection)
|
|
1669
|
+
protection.endToEndProfile = self.getEndToEndDescription(element, "END-TO-END-PROFILE")
|
|
1670
|
+
self.readEndToEndProtectionVariablePrototypes(element, protection)
|
|
1671
|
+
|
|
1672
|
+
def readEndToEndProtections(self, element: ET.Element, parent: EndToEndProtectionSet):
|
|
1673
|
+
for child_element in element.findall("./xmlns:END-TO-END-PROTECTIONS/*", self.nsmap):
|
|
1674
|
+
tag_name = self.getTagName(child_element.tag)
|
|
1675
|
+
if tag_name == "END-TO-END-PROTECTION":
|
|
1676
|
+
self.readEndToEndProtection(child_element, parent)
|
|
1677
|
+
|
|
1678
|
+
def readEndToEndProtectionSet(self, element: ET.Element, parent: ARPackage):
|
|
1679
|
+
short_name = self.getShortName(element)
|
|
1680
|
+
self.logger.debug("readEndToEndProtectionSet %s" % short_name)
|
|
1681
|
+
protection_set = parent.createEndToEndProtectionSet(short_name)
|
|
1682
|
+
self.readEndToEndProtections(element, protection_set)
|
|
1683
|
+
|
|
1684
|
+
def readAutosarDataType(self, element: ET.Element, data_type: AutosarDataType):
|
|
1685
|
+
self.readIdentifiable(element, data_type)
|
|
1686
|
+
data_type.sw_data_def_props = self.getSwDataDefProps(element, "SW-DATA-DEF-PROPS")
|
|
1687
|
+
|
|
1688
|
+
def readApplicationDataType(self, element: ET.Element, data_type: ApplicationDataType):
|
|
1689
|
+
self.readAutosarDataType(element, data_type)
|
|
1690
|
+
|
|
1691
|
+
def readApplicationCompositeDataType(self, element: ET.Element, data_type: ApplicationCompositeDataType):
|
|
1692
|
+
self.readApplicationDataType(element, data_type)
|
|
1693
|
+
|
|
1694
|
+
def readDataPrototype(self, element: ET.Element, prototype: DataPrototype):
|
|
1695
|
+
self.readIdentifiable(element, prototype)
|
|
1696
|
+
|
|
1697
|
+
def readApplicationCompositeElementDataPrototype(self, element: ET.Element, prototype: ApplicationCompositeElementDataPrototype):
|
|
1698
|
+
self.readDataPrototype(element, prototype)
|
|
1699
|
+
prototype.typeTRef = self.getChildElementOptionalRefType(element, "TYPE-TREF")
|
|
1700
|
+
|
|
1701
|
+
def readApplicationArrayElement(self, element: ET.Element, parent: ApplicationArrayDataType):
|
|
1702
|
+
child_element = element.find("./xmlns:ELEMENT", self.nsmap)
|
|
1703
|
+
if child_element is not None:
|
|
1704
|
+
short_name = self.getShortName(child_element)
|
|
1705
|
+
self.logger.debug("readApplicationArrayElement %s" % short_name)
|
|
1706
|
+
array_element = parent.createApplicationArrayElement(short_name)
|
|
1707
|
+
self.readApplicationCompositeElementDataPrototype(child_element, array_element)
|
|
1708
|
+
array_element.setArraySizeSemantics(self.getChildElementOptionalLiteral(child_element, "ARRAY-SIZE-SEMANTICS"))
|
|
1709
|
+
array_element.setMaxNumberOfElements(self.getChildElementOptionalNumericalValue(child_element, "MAX-NUMBER-OF-ELEMENTS"))
|
|
1710
|
+
|
|
1711
|
+
def readApplicationArrayDataType(self, element: ET.Element, parent: ARPackage):
|
|
1712
|
+
short_name = self.getShortName(element)
|
|
1713
|
+
self.logger.debug("readApplicationArrayDataType %s" % short_name)
|
|
1714
|
+
data_type = parent.createApplicationArrayDataType(short_name)
|
|
1715
|
+
self.readApplicationCompositeDataType(element, data_type)
|
|
1716
|
+
self.readApplicationArrayElement(element, data_type)
|
|
1717
|
+
|
|
1718
|
+
def getSwRecordLayoutV(self, element: ET.Element, key: str) -> SwRecordLayoutV:
|
|
1719
|
+
child_element = element.find("./xmlns:%s" % key, self.nsmap)
|
|
1720
|
+
layout_v = None
|
|
1721
|
+
if child_element is not None:
|
|
1722
|
+
layout_v = SwRecordLayoutV()
|
|
1723
|
+
layout_v.setShortLabel(self.getChildElementOptionalLiteral(child_element, "SHORT-LABEL")) \
|
|
1724
|
+
.setBaseTypeRef(self.getChildElementOptionalRefType(child_element, "BASE-TYPE-REF")) \
|
|
1725
|
+
.setSwRecordLayoutVAxis(self.getChildElementOptionalNumericalValue(child_element, "SW-RECORD-LAYOUT-V-AXIS")) \
|
|
1726
|
+
.setSwRecordLayoutVProp(self.getChildElementOptionalLiteral(child_element, "SW-RECORD-LAYOUT-V-PROP")) \
|
|
1727
|
+
.setSwRecordLayoutVIndex(self.getChildElementOptionalLiteral(child_element, "SW-RECORD-LAYOUT-V-INDEX"))
|
|
1728
|
+
return layout_v
|
|
1729
|
+
|
|
1730
|
+
def getSwRecordLayoutGroup(self, element: ET.Element, key: str) -> SwRecordLayoutGroup:
|
|
1731
|
+
child_element = element.find("./xmlns:%s" % key, self.nsmap)
|
|
1732
|
+
group = None
|
|
1733
|
+
if child_element is not None:
|
|
1734
|
+
group = SwRecordLayoutGroup()
|
|
1735
|
+
group.setShortLabel(self.getChildElementOptionalLiteral(child_element, "SHORT-LABEL")) \
|
|
1736
|
+
.setCategory(self.getChildElementOptionalLiteral(child_element, "CATEGORY")) \
|
|
1737
|
+
.setSwRecordLayoutGroupAxis(self.getChildElementOptionalNumericalValue(child_element, "SW-RECORD-LAYOUT-GROUP-AXIS")) \
|
|
1738
|
+
.setSwRecordLayoutGroupIndex(self.getChildElementOptionalLiteral(child_element, "SW-RECORD-LAYOUT-GROUP-INDEX")) \
|
|
1739
|
+
.setSwRecordLayoutGroupFrom(self.getChildElementOptionalLiteral(child_element, "SW-RECORD-LAYOUT-GROUP-FROM")) \
|
|
1740
|
+
.setSwRecordLayoutGroupTo(self.getChildElementOptionalLiteral(child_element, "SW-RECORD-LAYOUT-GROUP-TO")) \
|
|
1741
|
+
|
|
1742
|
+
group_content = SwRecordLayoutGroupContent()
|
|
1743
|
+
group_content.swRecordLayoutGroup = self.getSwRecordLayoutGroup(child_element, "SW-RECORD-LAYOUT-GROUP")
|
|
1744
|
+
group_content.swRecordLayoutV = self.getSwRecordLayoutV(child_element, "SW-RECORD-LAYOUT-V")
|
|
1745
|
+
|
|
1746
|
+
if group_content.swRecordLayoutGroup is not None:
|
|
1747
|
+
group.setSwRecordLayoutGroupContentType(group_content)
|
|
1748
|
+
elif group_content.swRecordLayoutV is not None:
|
|
1749
|
+
group.setSwRecordLayoutGroupContentType(group_content)
|
|
1750
|
+
|
|
1751
|
+
return group
|
|
1752
|
+
|
|
1753
|
+
def readSwRecordLayout(self, element: ET.Element, parent: ARPackage):
|
|
1754
|
+
short_name = self.getShortName(element)
|
|
1755
|
+
self.logger.debug("readSwRecordLayout %s" % short_name)
|
|
1756
|
+
layout = parent.createSwRecordLayout(short_name)
|
|
1757
|
+
self.readIdentifiable(element, layout)
|
|
1758
|
+
layout.setSwRecordLayoutGroup(self.getSwRecordLayoutGroup(element, "SW-RECORD-LAYOUT-GROUP"))
|
|
1759
|
+
|
|
1760
|
+
def readSwAddrMethod(self, element: ET.Element, parent: ARPackage):
|
|
1761
|
+
short_name = self.getShortName(element)
|
|
1762
|
+
self.logger.debug("readSwAddrMethod %s" % short_name)
|
|
1763
|
+
layout = parent.createSwAddrMethod(short_name)
|
|
1764
|
+
|
|
1765
|
+
def readTriggerInterface(self, element: ET.Element, parent: ARPackage):
|
|
1766
|
+
short_name = self.getShortName(element)
|
|
1767
|
+
self.logger.debug("readTriggerInterface %s" % short_name)
|
|
1768
|
+
trigger_if = parent.createTriggerInterface(short_name)
|
|
1769
|
+
|
|
1770
|
+
def readModeDeclarationGroupModeDeclaration(self, element: ET.Element, parent: ModeDeclarationGroup):
|
|
1771
|
+
for child_element in element.findall("./xmlns:MODE-DECLARATIONS/xmlns:MODE-DECLARATION", self.nsmap):
|
|
1772
|
+
short_name = self.getShortName(child_element)
|
|
1773
|
+
declaration = parent.createModeDeclaration(short_name)
|
|
1774
|
+
declaration.setValue(self.getChildElementOptionalNumericalValue(child_element, "VALUE"))
|
|
1775
|
+
|
|
1776
|
+
def readModeDeclarationGroup(self, element: ET.Element, parent: ARPackage):
|
|
1777
|
+
short_name = self.getShortName(element)
|
|
1778
|
+
self.logger.debug("readModeDeclarationGroup %s" % short_name)
|
|
1779
|
+
group = parent.createModeDeclarationGroup(short_name)
|
|
1780
|
+
self.readIdentifiable(element, group)
|
|
1781
|
+
self.readModeDeclarationGroupModeDeclaration(element, group)
|
|
1782
|
+
group.setInitialModeRef(self.getChildElementOptionalRefType(element, "INITIAL-MODE-REF"))
|
|
1783
|
+
group.setOnTransitionValue(self.getChildElementOptionalNumericalValue(element, "ON-TRANSITION-VALUE"))
|
|
1784
|
+
|
|
1785
|
+
def readModeSwitchInterfaceModeGroup(self, element: ET.Element, parent: ModeSwitchInterface):
|
|
1786
|
+
child_element = self.find(element, "MODE-GROUP")
|
|
1787
|
+
if child_element is not None:
|
|
1788
|
+
short_name = self.getShortName(child_element)
|
|
1789
|
+
mode_group = parent.createModeGroup(short_name)
|
|
1790
|
+
self.readIdentifiable(child_element, mode_group)
|
|
1791
|
+
mode_group.type_tref = self.getChildElementOptionalRefType(child_element, "TYPE-TREF")
|
|
1792
|
+
|
|
1793
|
+
def readModeSwitchInterface(self, element: ET.Element, parent: ARPackage):
|
|
1794
|
+
short_name = self.getShortName(element)
|
|
1795
|
+
self.logger.debug("readModeSwitchInterface %s" % short_name)
|
|
1796
|
+
mode_interface = parent.createModeSwitchInterface(short_name)
|
|
1797
|
+
self.readPortInterface(element, mode_interface)
|
|
1798
|
+
self.readModeSwitchInterfaceModeGroup(element, mode_interface)
|
|
1799
|
+
|
|
1800
|
+
def readEOCExecutableEntityRef(self, element: ET.Element, constraint: ExecutionOrderConstraint):
|
|
1801
|
+
short_name = self.getShortName(element)
|
|
1802
|
+
self.logger.debug("readEocExecutableEntityRef %s" % short_name)
|
|
1803
|
+
entity_ref = constraint.createEOCExecutableEntityRef(short_name)
|
|
1804
|
+
self.readIdentifiable(element, entity_ref)
|
|
1805
|
+
for ref in self.getChildElementRefTypeList(element, "SUCCESSOR-REFS/SUCCESSOR-REF"):
|
|
1806
|
+
entity_ref.addSuccessorRef(ref)
|
|
1807
|
+
|
|
1808
|
+
def readExecutionOrderConstraintOrderedElement(self, element: ET.Element, constrain: ExecutionOrderConstraint):
|
|
1809
|
+
for child_element in self.findall(element, "ORDERED-ELEMENTS/*"):
|
|
1810
|
+
tag_name = self.getTagName(child_element)
|
|
1811
|
+
if tag_name == "EOC-EXECUTABLE-ENTITY-REF":
|
|
1812
|
+
self.readEOCExecutableEntityRef(child_element, constrain)
|
|
1813
|
+
else:
|
|
1814
|
+
self._raiseError("Unsupported order element <%s>." % tag_name)
|
|
1815
|
+
|
|
1816
|
+
def readExecutionOrderConstraint(self, element: ET.Element, extension: TimingExtension):
|
|
1817
|
+
short_name = self.getShortName(element)
|
|
1818
|
+
self.logger.debug("readExecutionOrderConstraint %s" % short_name)
|
|
1819
|
+
constraint = extension.createExecutionOrderConstraint(short_name)
|
|
1820
|
+
self.readIdentifiable(element, constraint)
|
|
1821
|
+
self.readExecutionOrderConstraintOrderedElement(element, constraint)
|
|
1822
|
+
|
|
1823
|
+
def readTimingExtension(self, element: ET.Element, extension: TimingExtension):
|
|
1824
|
+
for child_element in self.findall(element, "TIMING-REQUIREMENTS/*"):
|
|
1825
|
+
tag_name = self.getTagName(child_element)
|
|
1826
|
+
if tag_name == "EXECUTION-ORDER-CONSTRAINT":
|
|
1827
|
+
self.readExecutionOrderConstraint(child_element, extension)
|
|
1828
|
+
else:
|
|
1829
|
+
self._raiseError("Unsupported timing requirement <%s>" % tag_name)
|
|
1830
|
+
|
|
1831
|
+
def readSwcTiming(self, element: ET.Element, parent: ARPackage):
|
|
1832
|
+
short_name = self.getShortName(element)
|
|
1833
|
+
self.logger.debug("readSwcTiming %s" % short_name)
|
|
1834
|
+
timing = parent.createSwcTiming(short_name)
|
|
1835
|
+
self.readIdentifiable(element, timing)
|
|
1836
|
+
self.readTimingExtension(element, timing)
|
|
1837
|
+
|
|
1838
|
+
def readLinCluster(self, element: ET.Element, parent: ARPackage):
|
|
1839
|
+
short_name = self.getShortName(element)
|
|
1840
|
+
self.logger.debug("readLinCluster %s" % short_name)
|
|
1841
|
+
cluster = parent.createLinCluster(short_name)
|
|
1842
|
+
self.readIdentifiable(element, cluster)
|
|
1843
|
+
|
|
1844
|
+
def readPduToFrameMappings(self, element: ET.Element, parent: Frame):
|
|
1845
|
+
for child_element in self.findall(element, "PDU-TO-FRAME-MAPPINGS/PDU-TO-FRAME-MAPPING"):
|
|
1846
|
+
short_name = self.getShortName(child_element)
|
|
1847
|
+
self.logger.debug("readPduToFrameMapping %s" % short_name)
|
|
1848
|
+
mapping = parent.createPduToFrameMapping(short_name)
|
|
1849
|
+
self.readIdentifiable(child_element, mapping)
|
|
1850
|
+
mapping.packingByteOrder = self.getChildElementOptionalLiteral(child_element, "PACKING-BYTE-ORDER")
|
|
1851
|
+
mapping.pduRef = self.getChildElementOptionalRefType(child_element, "PDU-REF")
|
|
1852
|
+
mapping.startPosition = self.getChildElementOptionalNumericalValue(child_element, "START-POSITION")
|
|
1853
|
+
|
|
1854
|
+
def readFrame(self, element: ET.Element, frame: Frame):
|
|
1855
|
+
self.readIdentifiable(element, frame)
|
|
1856
|
+
frame.frameLength = self.getChildElementOptionalNumericalValue(element, "FRAME-LENGTH")
|
|
1857
|
+
self.readPduToFrameMappings(element, frame)
|
|
1858
|
+
|
|
1859
|
+
def readLinUnconditionalFrame(self, element: ET.Element, parent: ARPackage):
|
|
1860
|
+
short_name = self.getShortName(element)
|
|
1861
|
+
self.logger.debug("LinUnconditionalFrame %s" % short_name)
|
|
1862
|
+
frame = parent.createLinUnconditionalFrame(short_name)
|
|
1863
|
+
self.readFrame(element, frame)
|
|
1864
|
+
|
|
1865
|
+
def readNmPdu(self, element: ET.Element, parent: ARPackage):
|
|
1866
|
+
short_name = self.getShortName(element)
|
|
1867
|
+
self.logger.debug("readNmPdu %s" % short_name)
|
|
1868
|
+
pdu = parent.createNmPdu(short_name)
|
|
1869
|
+
self.readIdentifiable(element, pdu)
|
|
1870
|
+
|
|
1871
|
+
def readNPdu(self, element: ET.Element, parent: ARPackage):
|
|
1872
|
+
short_name = self.getShortName(element)
|
|
1873
|
+
self.logger.debug("readNPdu %s" % short_name)
|
|
1874
|
+
pdu = parent.createNPdu(short_name)
|
|
1875
|
+
self.readIdentifiable(element, pdu)
|
|
1876
|
+
|
|
1877
|
+
def readDcmIPdu(self, element: ET.Element, parent: ARPackage):
|
|
1878
|
+
short_name = self.getShortName(element)
|
|
1879
|
+
self.logger.debug("readDcmIPdu %s" % short_name)
|
|
1880
|
+
pdu = parent.createDcmIPdu(short_name)
|
|
1881
|
+
self.readIdentifiable(element, pdu)
|
|
1882
|
+
|
|
1883
|
+
def readNmConfig(self, element: ET.Element, parent: ARPackage):
|
|
1884
|
+
short_name = self.getShortName(element)
|
|
1885
|
+
self.logger.debug("NmConfig %s" % short_name)
|
|
1886
|
+
pdu = parent.createNmConfig(short_name)
|
|
1887
|
+
self.readIdentifiable(element, pdu)
|
|
1888
|
+
|
|
1889
|
+
def readCanTpConfig(self, element: ET.Element, parent: ARPackage):
|
|
1890
|
+
short_name = self.getShortName(element)
|
|
1891
|
+
self.logger.debug("CanTpConfig %s" % short_name)
|
|
1892
|
+
pdu = parent.createCanTpConfig(short_name)
|
|
1893
|
+
self.readIdentifiable(element, pdu)
|
|
1894
|
+
|
|
1895
|
+
def readCanFrame(self, element: ET.Element, parent: ARPackage):
|
|
1896
|
+
short_name = self.getShortName(element)
|
|
1897
|
+
self.logger.debug("CanFrame %s" % short_name)
|
|
1898
|
+
frame = parent.createCanFrame(short_name)
|
|
1899
|
+
self.readFrame(element, frame)
|
|
1900
|
+
|
|
1901
|
+
'''
|
|
1902
|
+
def getFrameMappings(self, element: ET.Element) -> List[FrameMapping]:
|
|
1903
|
+
mappings = []
|
|
1904
|
+
for child_element in self.findall(element, 'FRAME-MAPPINGS/'):
|
|
1905
|
+
mapping = FrameMapping()
|
|
1906
|
+
mapping.sourceFrameRef = self.getChildElementOptionalRefType(child_element, "SOURCE-FRAME-REF")
|
|
1907
|
+
mapping.targetFrameRef = self.getChildElementOptionalRefType(child_element, "TARGET-FRAME-REF")
|
|
1908
|
+
mappings.append(mapping)
|
|
1909
|
+
return mappings
|
|
1910
|
+
'''
|
|
1911
|
+
|
|
1912
|
+
def getISignalMappings(self, element: ET.Element) -> List[ISignalMapping]:
|
|
1913
|
+
mappings = []
|
|
1914
|
+
for child_element in self.findall(element, "SIGNAL-MAPPINGS/I-SIGNAL-MAPPING"):
|
|
1915
|
+
mapping = ISignalMapping()
|
|
1916
|
+
mapping.sourceSignalRef = self.getChildElementOptionalRefType(child_element, "SOURCE-SIGNAL-REF")
|
|
1917
|
+
mapping.targetSignalRef = self.getChildElementOptionalRefType(child_element, "TARGET-SIGNAL-REF")
|
|
1918
|
+
mappings.append(mapping)
|
|
1919
|
+
return mappings
|
|
1920
|
+
|
|
1921
|
+
'''
|
|
1922
|
+
def getIPduMappings(self, element: ET.Element) -> List[IPduMapping]:
|
|
1923
|
+
mappings = []
|
|
1924
|
+
for child_element in self.findall(element, tag_name):
|
|
1925
|
+
mapping = IPduMapping()
|
|
1926
|
+
mapping.sourceIPduRef = self.getChildElementOptionalRefType(child_element, "SOURCE-IPDU-REF")
|
|
1927
|
+
mapping.targetIPduRef = self.getChildElementOptionalRefType(child_element, "TARGET-IPDU-REF")
|
|
1928
|
+
mappings.append(mapping)
|
|
1929
|
+
return mappings
|
|
1930
|
+
'''
|
|
1931
|
+
|
|
1932
|
+
def readGateway(self, element: ET.Element, parent: ARPackage):
|
|
1933
|
+
short_name = self.getShortName(element)
|
|
1934
|
+
self.logger.debug("Gateway %s" % short_name)
|
|
1935
|
+
gateway = parent.createGateway(short_name)
|
|
1936
|
+
self.readIdentifiable(element, gateway)
|
|
1937
|
+
gateway.ecuRef = self.getChildElementOptionalRefType(element, "ECU-REF")
|
|
1938
|
+
for mapping in self.getISignalMappings(element):
|
|
1939
|
+
gateway.addSignalMapping(mapping)
|
|
1940
|
+
|
|
1941
|
+
def readISignal(self, element: ET.Element, parent: ARPackage):
|
|
1942
|
+
short_name = self.getShortName(element)
|
|
1943
|
+
self.logger.debug("ISignal %s" % short_name)
|
|
1944
|
+
signal = parent.createISignal(short_name)
|
|
1945
|
+
self.readIdentifiable(element, signal)
|
|
1946
|
+
signal.dataTypePolicy = self.getChildElementOptionalLiteral(element, "DATA-TYPE-POLICY")
|
|
1947
|
+
signal.initValue = self.getInitValue(element)
|
|
1948
|
+
signal.length = self.getChildElementOptionalNumericalValue(element, "LENGTH")
|
|
1949
|
+
signal.networkRepresentationProps = self.getSwDataDefProps(element, "NETWORK-REPRESENTATION-PROPS")
|
|
1950
|
+
signal.systemSignalRef = self.getChildElementOptionalRefType(element, "SYSTEM-SIGNAL-REF")
|
|
1951
|
+
|
|
1952
|
+
def readARPackageElements(self, element: ET.Element, parent: ARPackage):
|
|
1953
|
+
for child_element in self.findall(element, "./ELEMENTS/*"):
|
|
1954
|
+
tag_name = self.getTagName(child_element.tag)
|
|
1955
|
+
if tag_name == "COMPOSITION-SW-COMPONENT-TYPE":
|
|
1956
|
+
self.readCompositionSwComponentType(child_element, parent)
|
|
1957
|
+
elif tag_name == "COMPLEX-DEVICE-DRIVER-SW-COMPONENT-TYPE":
|
|
1958
|
+
self.readComplexDeviceDriverSwComponentType(child_element, parent)
|
|
1959
|
+
elif tag_name == "SWC-IMPLEMENTATION":
|
|
1960
|
+
self.readSwcImplementation(child_element, parent)
|
|
1961
|
+
elif tag_name == "APPLICATION-PRIMITIVE-DATA-TYPE":
|
|
1962
|
+
self.readApplicationPrimitiveDataType(child_element, parent)
|
|
1963
|
+
elif tag_name == "APPLICATION-RECORD-DATA-TYPE":
|
|
1964
|
+
self.readApplicationRecordDataTypes(child_element, parent)
|
|
1965
|
+
elif tag_name == "SW-BASE-TYPE":
|
|
1966
|
+
self.readSwBaseType(child_element, parent)
|
|
1967
|
+
elif tag_name == "COMPU-METHOD":
|
|
1968
|
+
self.readCompuMethod(child_element, parent)
|
|
1969
|
+
elif tag_name == "CONSTANT-SPECIFICATION":
|
|
1970
|
+
self.readConstantSpecification(child_element, parent)
|
|
1971
|
+
elif tag_name == "DATA-CONSTR":
|
|
1972
|
+
self.readDataConstr(child_element, parent)
|
|
1973
|
+
elif tag_name == "END-TO-END-PROTECTION-SET":
|
|
1974
|
+
self.readEndToEndProtectionSet(child_element, parent)
|
|
1975
|
+
elif tag_name == "SENDER-RECEIVER-INTERFACE":
|
|
1976
|
+
self.readSenderReceiverInterfaces(child_element, parent)
|
|
1977
|
+
elif tag_name == "UNIT":
|
|
1978
|
+
self.readUnit(child_element, parent)
|
|
1979
|
+
elif tag_name == "BSW-MODULE-DESCRIPTION":
|
|
1980
|
+
self.readBswModuleDescription(child_element, parent)
|
|
1981
|
+
elif tag_name == "BSW-MODULE-ENTRY":
|
|
1982
|
+
self.readBswModuleEntry(child_element, parent)
|
|
1983
|
+
elif tag_name == "SWC-BSW-MAPPING":
|
|
1984
|
+
self.readSwcBswMappings(child_element, parent)
|
|
1985
|
+
elif tag_name == "BSW-IMPLEMENTATION":
|
|
1986
|
+
self.readBswImplementation(child_element, parent)
|
|
1987
|
+
elif tag_name == "IMPLEMENTATION-DATA-TYPE":
|
|
1988
|
+
self.readImplementationDataType(child_element, parent)
|
|
1989
|
+
elif tag_name == "CLIENT-SERVER-INTERFACE":
|
|
1990
|
+
self.readClientServerInterface(child_element, parent)
|
|
1991
|
+
elif tag_name == "APPLICATION-SW-COMPONENT-TYPE":
|
|
1992
|
+
self.readApplicationSwComponentTypes(child_element, parent)
|
|
1993
|
+
elif tag_name == "ECU-ABSTRACTION-SW-COMPONENT-TYPE":
|
|
1994
|
+
self.readEcuAbstractionSwComponent(child_element, parent)
|
|
1995
|
+
elif tag_name == "APPLICATION-ARRAY-DATA-TYPE":
|
|
1996
|
+
self.readApplicationArrayDataType(child_element, parent)
|
|
1997
|
+
elif tag_name == "SW-RECORD-LAYOUT":
|
|
1998
|
+
self.readSwRecordLayout(child_element, parent)
|
|
1999
|
+
elif tag_name == "SW-ADDR-METHOD":
|
|
2000
|
+
self.readSwAddrMethod(child_element, parent)
|
|
2001
|
+
elif tag_name == "TRIGGER-INTERFACE":
|
|
2002
|
+
self.readTriggerInterface(child_element, parent)
|
|
2003
|
+
elif tag_name == "SERVICE-SW-COMPONENT-TYPE":
|
|
2004
|
+
self.readServiceSwComponentType(child_element, parent)
|
|
2005
|
+
elif tag_name == "SENSOR-ACTUATOR-SW-COMPONENT-TYPE":
|
|
2006
|
+
self.readSensorActuatorSwComponentType(child_element, parent)
|
|
2007
|
+
elif tag_name == "DATA-TYPE-MAPPING-SET":
|
|
2008
|
+
self.readDataTypeMappingSet(child_element, parent)
|
|
2009
|
+
elif tag_name == "MODE-DECLARATION-GROUP":
|
|
2010
|
+
self.readModeDeclarationGroup(child_element, parent)
|
|
2011
|
+
elif tag_name == "MODE-SWITCH-INTERFACE":
|
|
2012
|
+
self.readModeSwitchInterface(child_element, parent)
|
|
2013
|
+
elif tag_name == "SWC-TIMING":
|
|
2014
|
+
self.readSwcTiming(child_element, parent)
|
|
2015
|
+
elif tag_name == "LIN-CLUSTER":
|
|
2016
|
+
self.readLinCluster(child_element, parent)
|
|
2017
|
+
elif tag_name == "LIN-UNCONDITIONAL-FRAME":
|
|
2018
|
+
self.readLinUnconditionalFrame(child_element, parent)
|
|
2019
|
+
elif tag_name == "NM-PDU":
|
|
2020
|
+
self.readNmPdu(child_element, parent)
|
|
2021
|
+
elif tag_name == "N-PDU":
|
|
2022
|
+
self.readNPdu(child_element, parent)
|
|
2023
|
+
elif tag_name == "DCM-I-PDU":
|
|
2024
|
+
self.readDcmIPdu(child_element, parent)
|
|
2025
|
+
elif tag_name == "NM-CONFIG":
|
|
2026
|
+
self.readNmConfig(child_element, parent)
|
|
2027
|
+
elif tag_name == "CAN-TP-CONFIG":
|
|
2028
|
+
self.readCanTpConfig(child_element, parent)
|
|
2029
|
+
elif tag_name == "SYSTEM":
|
|
2030
|
+
pass
|
|
2031
|
+
elif tag_name == "ECU-INSTANCE":
|
|
2032
|
+
pass
|
|
2033
|
+
elif tag_name == "GATEWAY":
|
|
2034
|
+
self.readGateway(child_element, parent)
|
|
2035
|
+
elif tag_name == "I-SIGNAL-I-PDU-GROUP":
|
|
2036
|
+
pass
|
|
2037
|
+
elif tag_name == "CAN-CLUSTER":
|
|
2038
|
+
pass
|
|
2039
|
+
elif tag_name == "CAN-FRAME":
|
|
2040
|
+
self.readCanFrame(child_element, parent)
|
|
2041
|
+
elif tag_name == "I-SIGNAL":
|
|
2042
|
+
self.readISignal(child_element, parent)
|
|
2043
|
+
pass
|
|
2044
|
+
elif tag_name == "I-SIGNAL-GROUP":
|
|
2045
|
+
pass
|
|
2046
|
+
elif tag_name == "I-SIGNAL-I-PDU":
|
|
2047
|
+
pass
|
|
2048
|
+
elif tag_name == "SYSTEM-SIGNAL":
|
|
2049
|
+
pass
|
|
2050
|
+
elif tag_name == "SYSTEM-SIGNAL-GROUP":
|
|
2051
|
+
pass
|
|
2052
|
+
else:
|
|
2053
|
+
self._raiseError("Unsupported element type of ARPackage <%s>" % tag_name)
|
|
2054
|
+
#pass
|
|
2055
|
+
|
|
2056
|
+
|
|
1310
2057
|
|
|
1311
2058
|
def readARPackages(self, element: ET.Element, parent: ARPackage):
|
|
1312
2059
|
for child_element in element.findall("./xmlns:AR-PACKAGES/xmlns:AR-PACKAGE", self.nsmap):
|
|
1313
|
-
short_name = self.
|
|
2060
|
+
short_name = self.getShortName(child_element)
|
|
1314
2061
|
ar_package = parent.createARPackage(short_name)
|
|
1315
2062
|
|
|
1316
2063
|
self.logger.debug("readARPackages %s" % ar_package.full_name)
|
|
1317
2064
|
|
|
1318
|
-
self.
|
|
1319
|
-
|
|
1320
|
-
self.readSenderReceiverInterfaces(child_element, ar_package)
|
|
1321
|
-
self.readClientServerInterfaces(child_element, ar_package)
|
|
1322
|
-
self.readDataTypeMappingSets(child_element, ar_package)
|
|
2065
|
+
self.readIdentifiable(child_element, ar_package)
|
|
2066
|
+
self.readARPackageElements(child_element, ar_package)
|
|
1323
2067
|
self.readARPackages(child_element, ar_package)
|
|
1324
|
-
|
|
1325
|
-
self.readApplicationRecordDataTypes(child_element, ar_package)
|
|
1326
|
-
self.readImplementationDataTypes(child_element, ar_package)
|
|
1327
|
-
self.readSwBaseTypes(child_element, ar_package)
|
|
1328
|
-
self.readCompuMethods(child_element, ar_package)
|
|
1329
|
-
self.readEcuAbstractionSwComponents(child_element, ar_package)
|
|
1330
|
-
self.readApplicationSwComponentTypes(child_element, ar_package)
|
|
1331
|
-
self.readComplexDeviceDriverSwComponentTypes(child_element, ar_package)
|
|
1332
|
-
self.readSensorActuatorSwComponentType(child_element, ar_package)
|
|
1333
|
-
self.readServiceSwComponentTypes(child_element, ar_package)
|
|
1334
|
-
self.readCompositionSwComponentTypes(child_element, ar_package)
|
|
1335
|
-
self.readBswModuleDescription(child_element, ar_package)
|
|
1336
|
-
self.readBswModuleEntry(child_element, ar_package)
|
|
1337
|
-
self.readSwcBswMappings(child_element, ar_package)
|
|
1338
|
-
self.readBswImplementation(child_element, ar_package)
|
|
1339
|
-
self.readSwcImplementation(child_element, ar_package)
|
|
1340
|
-
self.readConstantSpecification(child_element, ar_package)
|
|
1341
|
-
self.readDataConstr(child_element, ar_package)
|
|
1342
|
-
self.readUnit(child_element, ar_package)
|
|
2068
|
+
|
|
1343
2069
|
|
|
1344
2070
|
def load(self, filename, document: AUTOSAR):
|
|
1345
2071
|
self.logger.info("Load %s ..." % filename)
|
|
@@ -1349,4 +2075,5 @@ class ARXMLParser:
|
|
|
1349
2075
|
if (self.getPureTagName(root.tag) != "AUTOSAR"):
|
|
1350
2076
|
self._raiseError("Invalid ARXML file <%s>" % filename)
|
|
1351
2077
|
|
|
2078
|
+
self.getAUTOSARInfo(root, document)
|
|
1352
2079
|
self.readARPackages(root, document)
|