odxtools 6.6.1__py3-none-any.whl → 9.3.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.
Files changed (222) hide show
  1. odxtools/__init__.py +7 -5
  2. odxtools/additionalaudience.py +3 -5
  3. odxtools/admindata.py +5 -7
  4. odxtools/audience.py +10 -13
  5. odxtools/basecomparam.py +3 -5
  6. odxtools/basicstructure.py +55 -241
  7. odxtools/cli/_parser_utils.py +16 -1
  8. odxtools/cli/_print_utils.py +169 -134
  9. odxtools/cli/browse.py +127 -103
  10. odxtools/cli/compare.py +114 -87
  11. odxtools/cli/decode.py +2 -1
  12. odxtools/cli/dummy_sub_parser.py +3 -1
  13. odxtools/cli/find.py +2 -1
  14. odxtools/cli/list.py +26 -16
  15. odxtools/cli/main.py +1 -0
  16. odxtools/cli/snoop.py +32 -6
  17. odxtools/codec.py +211 -0
  18. odxtools/commrelation.py +122 -0
  19. odxtools/companydata.py +5 -7
  20. odxtools/companydocinfo.py +7 -8
  21. odxtools/companyrevisioninfo.py +3 -5
  22. odxtools/companyspecificinfo.py +8 -9
  23. odxtools/comparam.py +4 -6
  24. odxtools/comparaminstance.py +14 -14
  25. odxtools/comparamspec.py +16 -54
  26. odxtools/comparamsubset.py +22 -62
  27. odxtools/complexcomparam.py +5 -7
  28. odxtools/compumethods/compucodecompumethod.py +63 -0
  29. odxtools/compumethods/compuconst.py +31 -0
  30. odxtools/compumethods/compudefaultvalue.py +27 -0
  31. odxtools/compumethods/compuinternaltophys.py +56 -0
  32. odxtools/compumethods/compuinversevalue.py +7 -0
  33. odxtools/compumethods/compumethod.py +94 -15
  34. odxtools/compumethods/compuphystointernal.py +56 -0
  35. odxtools/compumethods/compurationalcoeffs.py +20 -9
  36. odxtools/compumethods/compuscale.py +67 -32
  37. odxtools/compumethods/createanycompumethod.py +31 -172
  38. odxtools/compumethods/identicalcompumethod.py +31 -6
  39. odxtools/compumethods/limit.py +70 -36
  40. odxtools/compumethods/linearcompumethod.py +70 -181
  41. odxtools/compumethods/linearsegment.py +190 -0
  42. odxtools/compumethods/ratfunccompumethod.py +106 -0
  43. odxtools/compumethods/ratfuncsegment.py +87 -0
  44. odxtools/compumethods/scalelinearcompumethod.py +132 -26
  45. odxtools/compumethods/scaleratfunccompumethod.py +113 -0
  46. odxtools/compumethods/tabintpcompumethod.py +123 -92
  47. odxtools/compumethods/texttablecompumethod.py +117 -57
  48. odxtools/createanydiagcodedtype.py +10 -67
  49. odxtools/database.py +167 -87
  50. odxtools/dataobjectproperty.py +25 -32
  51. odxtools/decodestate.py +14 -17
  52. odxtools/description.py +47 -0
  53. odxtools/determinenumberofitems.py +4 -5
  54. odxtools/diagcodedtype.py +37 -106
  55. odxtools/diagcomm.py +24 -12
  56. odxtools/diagdatadictionaryspec.py +120 -96
  57. odxtools/diaglayercontainer.py +46 -54
  58. odxtools/diaglayers/basevariant.py +128 -0
  59. odxtools/diaglayers/basevariantraw.py +123 -0
  60. odxtools/diaglayers/diaglayer.py +432 -0
  61. odxtools/{diaglayerraw.py → diaglayers/diaglayerraw.py} +105 -120
  62. odxtools/diaglayers/diaglayertype.py +42 -0
  63. odxtools/diaglayers/ecushareddata.py +96 -0
  64. odxtools/diaglayers/ecushareddataraw.py +87 -0
  65. odxtools/diaglayers/ecuvariant.py +124 -0
  66. odxtools/diaglayers/ecuvariantraw.py +129 -0
  67. odxtools/diaglayers/functionalgroup.py +110 -0
  68. odxtools/diaglayers/functionalgroupraw.py +106 -0
  69. odxtools/{diaglayer.py → diaglayers/hierarchyelement.py} +273 -472
  70. odxtools/diaglayers/hierarchyelementraw.py +58 -0
  71. odxtools/diaglayers/protocol.py +64 -0
  72. odxtools/diaglayers/protocolraw.py +91 -0
  73. odxtools/diagnostictroublecode.py +8 -9
  74. odxtools/diagservice.py +57 -44
  75. odxtools/diagvariable.py +113 -0
  76. odxtools/docrevision.py +5 -7
  77. odxtools/dopbase.py +15 -15
  78. odxtools/dtcdop.py +170 -50
  79. odxtools/dynamicendmarkerfield.py +134 -0
  80. odxtools/dynamiclengthfield.py +47 -42
  81. odxtools/dyndefinedspec.py +177 -0
  82. odxtools/dynenddopref.py +38 -0
  83. odxtools/ecuvariantmatcher.py +6 -7
  84. odxtools/element.py +13 -15
  85. odxtools/encodestate.py +199 -22
  86. odxtools/endofpdufield.py +31 -18
  87. odxtools/environmentdata.py +8 -1
  88. odxtools/environmentdatadescription.py +198 -36
  89. odxtools/exceptions.py +11 -2
  90. odxtools/field.py +10 -10
  91. odxtools/functionalclass.py +3 -5
  92. odxtools/inputparam.py +3 -12
  93. odxtools/internalconstr.py +14 -5
  94. odxtools/isotp_state_machine.py +14 -6
  95. odxtools/leadinglengthinfotype.py +37 -18
  96. odxtools/library.py +66 -0
  97. odxtools/loadfile.py +64 -0
  98. odxtools/matchingparameter.py +3 -3
  99. odxtools/message.py +0 -7
  100. odxtools/minmaxlengthtype.py +61 -33
  101. odxtools/modification.py +3 -5
  102. odxtools/multiplexer.py +135 -75
  103. odxtools/multiplexercase.py +39 -18
  104. odxtools/multiplexerdefaultcase.py +15 -12
  105. odxtools/multiplexerswitchkey.py +4 -5
  106. odxtools/nameditemlist.py +33 -8
  107. odxtools/negoutputparam.py +3 -5
  108. odxtools/odxcategory.py +83 -0
  109. odxtools/odxlink.py +62 -53
  110. odxtools/odxtypes.py +93 -8
  111. odxtools/outputparam.py +5 -16
  112. odxtools/parameterinfo.py +219 -61
  113. odxtools/parameters/codedconstparameter.py +45 -32
  114. odxtools/parameters/createanyparameter.py +19 -193
  115. odxtools/parameters/dynamicparameter.py +25 -4
  116. odxtools/parameters/lengthkeyparameter.py +83 -25
  117. odxtools/parameters/matchingrequestparameter.py +48 -18
  118. odxtools/parameters/nrcconstparameter.py +76 -54
  119. odxtools/parameters/parameter.py +97 -73
  120. odxtools/parameters/parameterwithdop.py +41 -38
  121. odxtools/parameters/physicalconstantparameter.py +41 -20
  122. odxtools/parameters/reservedparameter.py +36 -18
  123. odxtools/parameters/systemparameter.py +74 -7
  124. odxtools/parameters/tableentryparameter.py +47 -7
  125. odxtools/parameters/tablekeyparameter.py +142 -55
  126. odxtools/parameters/tablestructparameter.py +79 -58
  127. odxtools/parameters/valueparameter.py +39 -21
  128. odxtools/paramlengthinfotype.py +56 -33
  129. odxtools/parentref.py +20 -3
  130. odxtools/physicaldimension.py +3 -8
  131. odxtools/progcode.py +26 -11
  132. odxtools/protstack.py +3 -5
  133. odxtools/py.typed +0 -0
  134. odxtools/relateddoc.py +7 -9
  135. odxtools/request.py +120 -10
  136. odxtools/response.py +123 -23
  137. odxtools/scaleconstr.py +14 -8
  138. odxtools/servicebinner.py +1 -1
  139. odxtools/singleecujob.py +12 -10
  140. odxtools/snrefcontext.py +29 -0
  141. odxtools/specialdata.py +3 -5
  142. odxtools/specialdatagroup.py +7 -9
  143. odxtools/specialdatagroupcaption.py +3 -6
  144. odxtools/standardlengthtype.py +80 -14
  145. odxtools/state.py +3 -5
  146. odxtools/statechart.py +13 -19
  147. odxtools/statetransition.py +8 -18
  148. odxtools/staticfield.py +107 -0
  149. odxtools/subcomponent.py +288 -0
  150. odxtools/swvariable.py +21 -0
  151. odxtools/table.py +9 -9
  152. odxtools/tablerow.py +30 -15
  153. odxtools/teammember.py +3 -5
  154. odxtools/templates/comparam-spec.odx-c.xml.jinja2 +4 -24
  155. odxtools/templates/comparam-subset.odx-cs.xml.jinja2 +5 -26
  156. odxtools/templates/diag_layer_container.odx-d.xml.jinja2 +15 -31
  157. odxtools/templates/{index.xml.xml.jinja2 → index.xml.jinja2} +1 -1
  158. odxtools/templates/macros/printAudience.xml.jinja2 +1 -1
  159. odxtools/templates/macros/printBaseVariant.xml.jinja2 +53 -0
  160. odxtools/templates/macros/printCompanyData.xml.jinja2 +4 -7
  161. odxtools/templates/macros/printComparam.xml.jinja2 +6 -4
  162. odxtools/templates/macros/printComparamRef.xml.jinja2 +5 -12
  163. odxtools/templates/macros/printCompuMethod.xml.jinja2 +147 -0
  164. odxtools/templates/macros/printDOP.xml.jinja2 +27 -137
  165. odxtools/templates/macros/printDescription.xml.jinja2 +18 -0
  166. odxtools/templates/macros/printDiagComm.xml.jinja2 +1 -1
  167. odxtools/templates/macros/printDiagLayer.xml.jinja2 +222 -0
  168. odxtools/templates/macros/printDiagVariable.xml.jinja2 +66 -0
  169. odxtools/templates/macros/printDynDefinedSpec.xml.jinja2 +48 -0
  170. odxtools/templates/macros/printDynamicEndmarkerField.xml.jinja2 +16 -0
  171. odxtools/templates/macros/printDynamicLengthField.xml.jinja2 +1 -1
  172. odxtools/templates/macros/printEcuSharedData.xml.jinja2 +30 -0
  173. odxtools/templates/macros/printEcuVariant.xml.jinja2 +53 -0
  174. odxtools/templates/macros/printEcuVariantPattern.xml.jinja2 +1 -1
  175. odxtools/templates/macros/printElementId.xml.jinja2 +8 -3
  176. odxtools/templates/macros/printEndOfPdu.xml.jinja2 +1 -1
  177. odxtools/templates/macros/printEnvDataDesc.xml.jinja2 +1 -1
  178. odxtools/templates/macros/printFunctionalClass.xml.jinja2 +1 -1
  179. odxtools/templates/macros/printFunctionalGroup.xml.jinja2 +40 -0
  180. odxtools/templates/macros/printHierarchyElement.xml.jinja2 +24 -0
  181. odxtools/templates/macros/printLibrary.xml.jinja2 +21 -0
  182. odxtools/templates/macros/printMux.xml.jinja2 +5 -3
  183. odxtools/templates/macros/printOdxCategory.xml.jinja2 +28 -0
  184. odxtools/templates/macros/printParam.xml.jinja2 +18 -19
  185. odxtools/templates/macros/printProtStack.xml.jinja2 +1 -1
  186. odxtools/templates/macros/printProtocol.xml.jinja2 +30 -0
  187. odxtools/templates/macros/printRequest.xml.jinja2 +1 -1
  188. odxtools/templates/macros/printResponse.xml.jinja2 +1 -1
  189. odxtools/templates/macros/printService.xml.jinja2 +3 -2
  190. odxtools/templates/macros/printSingleEcuJob.xml.jinja2 +5 -26
  191. odxtools/templates/macros/printSpecialData.xml.jinja2 +1 -1
  192. odxtools/templates/macros/printState.xml.jinja2 +1 -1
  193. odxtools/templates/macros/printStateChart.xml.jinja2 +1 -1
  194. odxtools/templates/macros/printStateTransition.xml.jinja2 +1 -1
  195. odxtools/templates/macros/printStaticField.xml.jinja2 +15 -0
  196. odxtools/templates/macros/printStructure.xml.jinja2 +1 -1
  197. odxtools/templates/macros/printSubComponent.xml.jinja2 +104 -0
  198. odxtools/templates/macros/printTable.xml.jinja2 +4 -5
  199. odxtools/templates/macros/printUnitSpec.xml.jinja2 +3 -5
  200. odxtools/uds.py +2 -10
  201. odxtools/unit.py +4 -8
  202. odxtools/unitgroup.py +3 -5
  203. odxtools/unitspec.py +17 -17
  204. odxtools/utils.py +38 -20
  205. odxtools/variablegroup.py +32 -0
  206. odxtools/version.py +2 -2
  207. odxtools/{write_pdx_file.py → writepdxfile.py} +22 -12
  208. odxtools/xdoc.py +3 -5
  209. {odxtools-6.6.1.dist-info → odxtools-9.3.0.dist-info}/METADATA +44 -33
  210. odxtools-9.3.0.dist-info/RECORD +228 -0
  211. {odxtools-6.6.1.dist-info → odxtools-9.3.0.dist-info}/WHEEL +1 -1
  212. odxtools/createcompanydatas.py +0 -17
  213. odxtools/createsdgs.py +0 -19
  214. odxtools/diaglayertype.py +0 -30
  215. odxtools/load_file.py +0 -13
  216. odxtools/load_odx_d_file.py +0 -6
  217. odxtools/load_pdx_file.py +0 -8
  218. odxtools/templates/macros/printVariant.xml.jinja2 +0 -208
  219. odxtools-6.6.1.dist-info/RECORD +0 -180
  220. {odxtools-6.6.1.dist-info → odxtools-9.3.0.dist-info}/LICENSE +0 -0
  221. {odxtools-6.6.1.dist-info → odxtools-9.3.0.dist-info}/entry_points.txt +0 -0
  222. {odxtools-6.6.1.dist-info → odxtools-9.3.0.dist-info}/top_level.txt +0 -0
odxtools/table.py CHANGED
@@ -1,22 +1,19 @@
1
1
  # SPDX-License-Identifier: MIT
2
2
  from dataclasses import dataclass
3
- from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
3
+ from typing import Any, Dict, List, Optional, Union
4
4
  from xml.etree import ElementTree
5
5
 
6
6
  from .admindata import AdminData
7
- from .createsdgs import create_sdgs_from_et
8
7
  from .dataobjectproperty import DataObjectProperty
9
8
  from .element import IdentifiableElement
10
9
  from .exceptions import odxassert
11
10
  from .nameditemlist import NamedItemList
12
11
  from .odxlink import OdxDocFragment, OdxLinkDatabase, OdxLinkId, OdxLinkRef
12
+ from .snrefcontext import SnRefContext
13
13
  from .specialdatagroup import SpecialDataGroup
14
14
  from .tablerow import TableRow
15
15
  from .utils import dataclass_fields_asdict
16
16
 
17
- if TYPE_CHECKING:
18
- from .diaglayer import DiagLayer
19
-
20
17
 
21
18
  @dataclass
22
19
  class Table(IdentifiableElement):
@@ -45,11 +42,14 @@ class Table(IdentifiableElement):
45
42
  for sub_elem in et_element:
46
43
  if sub_elem.tag == "TABLE-ROW":
47
44
  table_rows_raw.append(
48
- TableRow.from_et(sub_elem, doc_frags, table_ref=OdxLinkRef.from_id(odx_id)))
45
+ TableRow.tablerow_from_et(
46
+ sub_elem, doc_frags, table_ref=OdxLinkRef.from_id(odx_id)))
49
47
  elif sub_elem.tag == "TABLE-ROW-REF":
50
48
  table_rows_raw.append(OdxLinkRef.from_et(sub_elem, doc_frags))
51
49
 
52
- sdgs = create_sdgs_from_et(et_element.find("SDGS"), doc_frags)
50
+ sdgs = [
51
+ SpecialDataGroup.from_et(sdge, doc_frags) for sdge in et_element.iterfind("SDGS/SDG")
52
+ ]
53
53
 
54
54
  return Table(
55
55
  semantic=semantic,
@@ -98,7 +98,7 @@ class Table(IdentifiableElement):
98
98
 
99
99
  self._table_rows = NamedItemList(table_rows)
100
100
 
101
- def _resolve_snrefs(self, diag_layer: "DiagLayer") -> None:
101
+ def _resolve_snrefs(self, context: SnRefContext) -> None:
102
102
  for table_row_wrapper in self.table_rows_raw:
103
103
  if isinstance(table_row_wrapper, TableRow):
104
- table_row_wrapper._resolve_snrefs(diag_layer)
104
+ table_row_wrapper._resolve_snrefs(context)
odxtools/tablerow.py CHANGED
@@ -1,21 +1,20 @@
1
1
  # SPDX-License-Identifier: MIT
2
- from dataclasses import dataclass
3
- from typing import TYPE_CHECKING, Any, Dict, List, Optional
2
+ from dataclasses import dataclass, fields
3
+ from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
4
4
  from xml.etree import ElementTree
5
5
 
6
6
  from .basicstructure import BasicStructure
7
- from .createsdgs import create_sdgs_from_et
8
7
  from .dataobjectproperty import DataObjectProperty
9
8
  from .dtcdop import DtcDop
10
9
  from .element import IdentifiableElement
11
10
  from .exceptions import odxassert, odxraise, odxrequire
12
- from .odxlink import OdxDocFragment, OdxLinkDatabase, OdxLinkId, OdxLinkRef
11
+ from .odxlink import OdxDocFragment, OdxLinkDatabase, OdxLinkId, OdxLinkRef, resolve_snref
13
12
  from .odxtypes import AtomicOdxType
13
+ from .snrefcontext import SnRefContext
14
14
  from .specialdatagroup import SpecialDataGroup
15
15
  from .utils import dataclass_fields_asdict
16
16
 
17
17
  if TYPE_CHECKING:
18
- from .diaglayer import DiagLayer
19
18
  from .table import Table
20
19
 
21
20
 
@@ -51,9 +50,13 @@ class TableRow(IdentifiableElement):
51
50
  )
52
51
 
53
52
  @staticmethod
54
- def from_et( # type: ignore[override]
55
- et_element: ElementTree.Element, doc_frags: List[OdxDocFragment], *,
56
- table_ref: OdxLinkRef) -> "TableRow":
53
+ def from_et(et_element: ElementTree.Element, doc_frags: List[OdxDocFragment]) -> Any:
54
+ raise RuntimeError(
55
+ "Calling TableRow.from_et() is not allowed. Use TableRow.tablerow_from_et().")
56
+
57
+ @staticmethod
58
+ def tablerow_from_et(et_element: ElementTree.Element, doc_frags: List[OdxDocFragment], *,
59
+ table_ref: OdxLinkRef) -> "TableRow":
57
60
  """Reads a TABLE-ROW."""
58
61
  kwargs = dataclass_fields_asdict(IdentifiableElement.from_et(et_element, doc_frags))
59
62
  semantic = et_element.get("SEMANTIC")
@@ -66,7 +69,9 @@ class TableRow(IdentifiableElement):
66
69
  dop_snref: Optional[str] = None
67
70
  if (dop_snref_elem := et_element.find("DATA-OBJECT-PROP-SNREF")) is not None:
68
71
  dop_snref = dop_snref_elem.attrib["SHORT-NAME"]
69
- sdgs = create_sdgs_from_et(et_element.find("SDGS"), doc_frags)
72
+ sdgs = [
73
+ SpecialDataGroup.from_et(sdge, doc_frags) for sdge in et_element.iterfind("SDGS/SDG")
74
+ ]
70
75
 
71
76
  return TableRow(
72
77
  table_ref=table_ref,
@@ -95,12 +100,15 @@ class TableRow(IdentifiableElement):
95
100
  if not isinstance(self._dop, (DataObjectProperty, DtcDop)):
96
101
  odxraise("The DOP-REF of TABLE-ROWs must reference a simple DOP!")
97
102
 
98
- self._table = odxlinks.resolve(self.table_ref)
103
+ if TYPE_CHECKING:
104
+ self._table = odxlinks.resolve(self.table_ref, Table)
105
+ else:
106
+ self._table = odxlinks.resolve(self.table_ref)
99
107
 
100
108
  for sdg in self.sdgs:
101
109
  sdg._resolve_odxlinks(odxlinks)
102
110
 
103
- def _resolve_snrefs(self, diag_layer: "DiagLayer") -> None:
111
+ def _resolve_snrefs(self, context: SnRefContext) -> None:
104
112
  # convert the raw key into the proper internal
105
113
  # representation. note that we cannot do this earlier because
106
114
  # the table's ODXLINKs must be resolved and the order of
@@ -118,15 +126,17 @@ class TableRow(IdentifiableElement):
118
126
  else:
119
127
  self._key = key_dop.physical_type.base_data_type.from_string(self.key_raw)
120
128
 
121
- ddd_spec = diag_layer.diag_data_dictionary_spec
129
+ ddd_spec = odxrequire(context.diag_layer).diag_data_dictionary_spec
122
130
 
123
131
  if self.structure_snref is not None:
124
- self._structure = odxrequire(ddd_spec.structures.get(self.structure_snref))
132
+ self._structure = resolve_snref(self.structure_snref, ddd_spec.structures,
133
+ BasicStructure)
125
134
  if self.dop_snref is not None:
126
- self._dop = odxrequire(ddd_spec.data_object_props.get(self.dop_snref))
135
+ self._dop = resolve_snref(self.dop_snref, ddd_spec.data_object_props,
136
+ DataObjectProperty)
127
137
 
128
138
  for sdg in self.sdgs:
129
- sdg._resolve_snrefs(diag_layer)
139
+ sdg._resolve_snrefs(context)
130
140
 
131
141
  @property
132
142
  def table(self) -> "Table":
@@ -147,3 +157,8 @@ class TableRow(IdentifiableElement):
147
157
  def dop(self) -> Optional[DataObjectProperty]:
148
158
  """The data object property object resolved by dop_ref."""
149
159
  return self._dop
160
+
161
+ def __reduce__(self) -> Tuple[Any, ...]:
162
+ """This ensures that the object can be correctly reconstructed during unpickling."""
163
+ state = self.__dict__.copy()
164
+ return self.__class__, tuple([getattr(self, x.name) for x in fields(self)]), state
odxtools/teammember.py CHANGED
@@ -1,16 +1,14 @@
1
1
  # SPDX-License-Identifier: MIT
2
2
  from dataclasses import dataclass
3
- from typing import TYPE_CHECKING, Any, Dict, List, Optional
3
+ from typing import Any, Dict, List, Optional
4
4
  from xml.etree import ElementTree
5
5
 
6
6
  from .element import IdentifiableElement
7
7
  from .exceptions import odxrequire
8
8
  from .odxlink import OdxDocFragment, OdxLinkDatabase, OdxLinkId
9
+ from .snrefcontext import SnRefContext
9
10
  from .utils import dataclass_fields_asdict
10
11
 
11
- if TYPE_CHECKING:
12
- from .diaglayer import DiagLayer
13
-
14
12
 
15
13
  @dataclass
16
14
  class TeamMember(IdentifiableElement):
@@ -55,5 +53,5 @@ class TeamMember(IdentifiableElement):
55
53
  def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
56
54
  pass
57
55
 
58
- def _resolve_snrefs(self, diag_layer: "DiagLayer") -> None:
56
+ def _resolve_snrefs(self, context: SnRefContext) -> None:
59
57
  pass
@@ -5,35 +5,15 @@
5
5
  # This template writes an .odx-c file for a communication
6
6
  # parameter specification.
7
7
  -#}
8
- {%- import('macros/printAdminData.xml.jinja2') as pad -%}
9
- {%- import('macros/printCompanyData.xml.jinja2') as pcd -%}
8
+ {%- import('macros/printOdxCategory.xml.jinja2') as poc %}
10
9
  {%- import('macros/printProtStack.xml.jinja2') as pps %}
11
10
  {#- -#}
12
11
 
13
12
  <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
14
- <ODX MODEL-VERSION="2.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="odx.xsd">
15
13
  <!-- Written using odxtools {{odxtools_version}} -->
16
- <COMPARAM-SPEC ID="{{comparam_spec.odx_id.local_id}}">
17
- <SHORT-NAME>{{comparam_spec.short_name}}</SHORT-NAME>
18
- {%- if comparam_spec.long_name is not none %}
19
- <LONG-NAME>{{comparam_spec.long_name|e}}</LONG-NAME>
20
- {%- endif %}
21
- {%- if comparam_spec.description and comparam_spec.description.strip() %}
22
- <DESC>
23
- {{comparam_spec.description}}
24
- </DESC>
25
- {%- endif %}
26
- {%- if comparam_spec.admin_data is not none %}
27
- {{- pad.printAdminData(comparam_spec.admin_data) | indent(3) }}
28
- {%- endif %}
29
- {%- if comparam_spec.company_datas %}
30
- <COMPANY-DATAS>
31
- {%- for cd in comparam_spec.company_datas %}
32
- {{- pcd.printCompanyData(cd) | indent(5) -}}
33
- {%- endfor %}
34
- </COMPANY-DATAS>
35
- {%- endif %}
36
-
14
+ <ODX MODEL-VERSION="2.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="odx.xsd">
15
+ <COMPARAM-SPEC {{- poc.printOdxCategoryAttribs(comparam_spec) }}>
16
+ {{- poc.printOdxCategorySubtags(comparam_spec)|indent(3) }}
37
17
  {%- if comparam_spec.prot_stacks %}
38
18
  <PROT-STACKS>
39
19
  {%- for ps in comparam_spec.prot_stacks %}
@@ -5,39 +5,18 @@
5
5
  # This template writes an .odx-cs file for a communication
6
6
  # parameter subset.
7
7
  -#}
8
+ {%- import('macros/printOdxCategory.xml.jinja2') as poc %}
8
9
  {%- import('macros/printComparam.xml.jinja2') as pcp -%}
9
- {%- import('macros/printAdminData.xml.jinja2') as pad -%}
10
- {%- import('macros/printCompanyData.xml.jinja2') as pcd -%}
11
10
  {%- import('macros/printDOP.xml.jinja2') as pdop %}
12
11
  {%- import('macros/printUnitSpec.xml.jinja2') as pus %}
13
- {%- import('macros/printSpecialData.xml.jinja2') as psd %}
12
+ {%- import('macros/printDescription.xml.jinja2') as pd %}
14
13
  {#- -#}
15
14
 
16
15
  <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
17
- <ODX MODEL-VERSION="2.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="odx.xsd">
18
16
  <!-- Written using odxtools {{odxtools_version}} -->
19
- <COMPARAM-SUBSET ID="{{comparam_subset.odx_id.local_id}}"
20
- CATEGORY="{{comparam_subset.category}}" >
21
- <SHORT-NAME>{{comparam_subset.short_name}}</SHORT-NAME>
22
- {%- if comparam_subset.long_name is not none %}
23
- <LONG-NAME>{{comparam_subset.long_name|e}}</LONG-NAME>
24
- {%- endif %}
25
- {%- if comparam_subset.description and comparam_subset.description.strip() %}
26
- <DESC>
27
- {{comparam_subset.description}}
28
- </DESC>
29
- {%- endif %}
30
- {%- if comparam_subset.admin_data is not none %}
31
- {{- pad.printAdminData(comparam_subset.admin_data) | indent(3) }}
32
- {%- endif %}
33
- {%- if comparam_subset.company_datas %}
34
- <COMPANY-DATAS>
35
- {%- for cd in comparam_subset.company_datas %}
36
- {{- pcd.printCompanyData(cd) | indent(5, first=True) }}
37
- {%- endfor %}
38
- </COMPANY-DATAS>
39
- {%- endif %}
40
- {{- psd.printSpecialDataGroups(comparam_subset.sdgs)|indent(3, first=True) }}
17
+ <ODX MODEL-VERSION="2.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="odx.xsd">
18
+ <COMPARAM-SUBSET {{- poc.printOdxCategoryAttribs(comparam_subset) }} {{make_xml_attrib("CATEGORY", comparam_subset.category)}}>
19
+ {{- poc.printOdxCategorySubtags(comparam_subset)|indent(3) }}
41
20
  {%- if comparam_subset.comparams %}
42
21
  <COMPARAMS>
43
22
  {%- for cp in comparam_subset.comparams %}
@@ -2,68 +2,52 @@
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
4
  -#}
5
- {%- import('macros/printVariant.xml.jinja2') as pv -%}
6
- {%- import('macros/printAdminData.xml.jinja2') as pad -%}
7
- {%- import('macros/printCompanyData.xml.jinja2') as pcd -%}
8
- {%- import('macros/printSpecialData.xml.jinja2') as psd %}
5
+ {%- import('macros/printOdxCategory.xml.jinja2') as poc %}
6
+ {%- import('macros/printEcuSharedData.xml.jinja2') as pecusd -%}
7
+ {%- import('macros/printProtocol.xml.jinja2') as pprot %}
8
+ {%- import('macros/printFunctionalGroup.xml.jinja2') as pfuncgroup %}
9
+ {%- import('macros/printEcuSharedData.xml.jinja2') as pecusd %}
10
+ {%- import('macros/printBaseVariant.xml.jinja2') as pbv %}
11
+ {%- import('macros/printEcuVariant.xml.jinja2') as pecuv %}
9
12
  {#- -#}
10
13
 
11
14
  <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
15
+ <!-- Written using odxtools {{odxtools_version}} -->
12
16
  <ODX MODEL-VERSION="2.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="odx.xsd">
13
- <!-- Written using odxtools {{odxtools_version}} -->
14
- <DIAG-LAYER-CONTAINER ID="{{dlc.odx_id.local_id}}">
15
- <SHORT-NAME>{{dlc.short_name}}</SHORT-NAME>
16
- {%- if dlc.long_name %}
17
- <LONG-NAME>{{dlc.long_name|e}}</LONG-NAME>
18
- {%- endif %}
19
- {%- if dlc.description %}
20
- <DESC>
21
- {{dlc.description}}
22
- </DESC>
23
- {%- endif %}
24
- {%- if dlc.admin_data %}
25
- {{pad.printAdminData(dlc.admin_data)|indent(2)}}
26
- {%- endif %}
27
- {%- if dlc.company_datas %}
28
- <COMPANY-DATAS>
29
- {%- for cd in dlc.company_datas %}
30
- {{pcd.printCompanyData(cd)|indent(3)}}
31
- {%- endfor %}
32
- </COMPANY-DATAS>
33
- {%- endif %}
34
- {{- psd.printSpecialDataGroups(dlc.sdgs)|indent(2, first=True) }}
17
+ <DIAG-LAYER-CONTAINER {{- poc.printOdxCategoryAttribs(dlc) }}>
18
+ {{- poc.printOdxCategorySubtags(dlc)|indent(3) }}
35
19
  {%- if dlc.protocols %}
36
20
  <PROTOCOLS>
37
21
  {%- for dl in dlc.protocols %}
38
- {{pv.printVariant(dl)|indent(3)}}
22
+ {{pprot.printProtocol(dl)|indent(3)}}
39
23
  {%- endfor %}
40
24
  </PROTOCOLS>
41
25
  {%- endif %}
42
26
  {%- if dlc.functional_groups %}
43
27
  <FUNCTIONAL-GROUPS>
44
28
  {%- for dl in dlc.functional_groups %}
45
- {{pv.printVariant(dl)|indent(3)}}
29
+ {{pfuncgroup.printFunctionalGroup(dl)|indent(3)}}
46
30
  {%- endfor %}
47
31
  </FUNCTIONAL-GROUPS>
48
32
  {%- endif %}
49
33
  {%- if dlc.ecu_shared_datas %}
50
34
  <ECU-SHARED-DATAS>
51
35
  {%- for dl in dlc.ecu_shared_datas %}
52
- {{pv.printVariant(dl)|indent(3)}}
36
+ {{pecusd.printEcuSharedData(dl)|indent(3)}}
53
37
  {%- endfor %}
54
38
  </ECU-SHARED-DATAS>
55
39
  {%- endif %}
56
40
  {%- if dlc.base_variants %}
57
41
  <BASE-VARIANTS>
58
42
  {%- for dl in dlc.base_variants %}
59
- {{pv.printVariant(dl)|indent(3)}}
43
+ {{pbv.printBaseVariant(dl)|indent(3)}}
60
44
  {%- endfor %}
61
45
  </BASE-VARIANTS>
62
46
  {%- endif %}
63
47
  {%- if dlc.ecu_variants %}
64
48
  <ECU-VARIANTS>
65
49
  {%- for dl in dlc.ecu_variants %}
66
- {{pv.printVariant(dl)|indent(3)}}
50
+ {{pecuv.printEcuVariant(dl)|indent(3)}}
67
51
  {%- endfor %}
68
52
  </ECU-VARIANTS>
69
53
  {%- endif %}
@@ -4,7 +4,7 @@
4
4
  -#}
5
5
  <?xml version="1.0" encoding="UTF-8"?>
6
6
  <CATALOG xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" F-DTD-VERSION="ODX-2.2.0" xsi:noNamespaceSchemaLocation="odx-cc.xsd">
7
- <SHORT-NAME>{{ecu_name}}</SHORT-NAME>
7
+ <SHORT-NAME>{{database.short_name}}</SHORT-NAME>
8
8
  <ABLOCKS>
9
9
  {%- for file_name, creation_date, mime_type in file_index %}
10
10
  <ABLOCK UPD="UNCHANGED">
@@ -6,7 +6,7 @@
6
6
  {%- import('macros/printElementId.xml.jinja2') as peid %}
7
7
 
8
8
  {%- macro printAdditionalAudience(audience) -%}
9
- <ADDITIONAL-AUDIENCE ID="{{audience.odx_id.local_id}}">
9
+ <ADDITIONAL-AUDIENCE {{-peid.printElementIdAttribs(audience)}}>
10
10
  {{ peid.printElementIdSubtags(audience)|indent(1) }}
11
11
  </ADDITIONAL-AUDIENCE>
12
12
  {%- endmacro -%}
@@ -0,0 +1,53 @@
1
+ {#- -*- mode: sgml; tab-width: 2; indent-tabs-mode: nil -*-
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ -#}
5
+
6
+ {%- import('macros/printHierarchyElement.xml.jinja2') as phe %}
7
+ {%- import('macros/printComparamRef.xml.jinja2') as pcom %}
8
+ {%- import('macros/printParentRef.xml.jinja2') as pparref %}
9
+
10
+ {%- macro printBaseVariant(base_variant) -%}
11
+ <BASE-VARIANT {{- phe.printHierarchyElementAttribs(base_variant) -}}>
12
+ {{ phe.printHierarchyElementSubtags(base_variant) | indent(2) }}
13
+ {%- set dlr = base_variant.base_variant_raw %}
14
+
15
+ {%- if dlr.diag_variables %}
16
+ <DIAG-VARIABLES>
17
+ {%- for dv in dlr.diag_variables -%}
18
+ {{ pdv.printDiagVariable(dv)|indent(4) }}
19
+ {%- endfor -%}
20
+ </DIAG-VARIABLES>
21
+ {%- endif %}
22
+
23
+ {%- if dlr.variable_groups %}
24
+ <VARIABLE-GROUPS>
25
+ {%- for vg in dlr.variable_groups -%}
26
+ {{ pdv.printVariableGroup(vg)|indent(4) }}
27
+ {%- endfor -%}
28
+ </VARIABLE-GROUPS>
29
+ {%- endif %}
30
+
31
+ {%- if dlr.dyn_defined_spec %}
32
+ {{ pdynspec.printPrintDefinedSpec(dlr.dyn_defined_spec)|indent(4) }}
33
+ {%- endif %}
34
+
35
+ {#
36
+ {%- if dlr.base_variant_patterns %}
37
+ <BASE-VARIANT-PATTERNS>
38
+ {%- for vp in dlr.base_variant_patterns -%}
39
+ {{ pvpat.printBaseVariantPattern(vp)|indent(4) }}
40
+ {%- endfor -%}
41
+ </BASE-VARIANT-PATTERNS>
42
+ {%- endif %}
43
+ #}
44
+
45
+ {%- if dlr.parent_refs %}
46
+ <PARENT-REFS>
47
+ {%- for parent in dlr.parent_refs -%}
48
+ {{ pparref.printParentRef(parent)|indent(4) }}
49
+ {%- endfor %}
50
+ </PARENT-REFS>
51
+ {%- endif %}
52
+ </BASE-VARIANT>
53
+ {%- endmacro %}
@@ -5,9 +5,10 @@
5
5
 
6
6
  {%- import('macros/printElementId.xml.jinja2') as peid %}
7
7
  {%- import('macros/printSpecialData.xml.jinja2') as psd %}
8
+ {%- import('macros/printDescription.xml.jinja2') as pd %}
8
9
 
9
10
  {%- macro printCompanyData(company_data) %}
10
- <COMPANY-DATA ID="{{company_data.odx_id.local_id}}">
11
+ <COMPANY-DATA {{-peid.printElementIdAttribs(company_data)}}>
11
12
  {{ peid.printElementIdSubtags(company_data)|indent(1) }}
12
13
  {%- if company_data.roles is not none %}
13
14
  <ROLES>
@@ -19,7 +20,7 @@
19
20
  {%- if company_data.team_members is not none %}
20
21
  <TEAM-MEMBERS>
21
22
  {%- for team_member in company_data.team_members %}
22
- <TEAM-MEMBER ID="{{team_member.odx_id.local_id}}">
23
+ <TEAM-MEMBER {{-peid.printElementIdAttribs(team_member)}}>
23
24
  {{ peid.printElementIdSubtags(team_member)|indent(3) }}
24
25
  {%- if team_member.roles is not none %}
25
26
  <ROLES>
@@ -81,11 +82,7 @@
81
82
  {%- endif %}
82
83
  </XDOC>
83
84
  {%- endif %}
84
- {%- if rd.description is not none %}
85
- <DESC>
86
- {{rd.description}}
87
- </DESC>
88
- {%- endif %}
85
+ {{pd.printDescription(rd.description)}}
89
86
  </RELATED-DOC>
90
87
  {%- endfor %}
91
88
  </RELATED-DOCS>
@@ -38,19 +38,21 @@
38
38
  {%- endmacro %}
39
39
 
40
40
  {%- macro printSimpleComparam(cp) %}
41
- <COMPARAM ID="{{cp.odx_id.local_id}}"
41
+ <COMPARAM {{-peid.printElementIdAttribs(cp)}}
42
42
  PARAM-CLASS="{{cp.param_class}}"
43
43
  CPTYPE="{{cp.cptype.value}}"
44
44
  {{make_xml_attrib("DISPLAY-LEVEL", cp.display_level)}}{#- #}
45
45
  CPUSAGE="{{cp.cpusage.value}}">
46
46
  {{ peid.printElementIdSubtags(cp)|indent(1) }}
47
- <PHYSICAL-DEFAULT-VALUE>{{cp.physical_default_value}}</PHYSICAL-DEFAULT-VALUE>
47
+ {%- if cp.physical_default_value is not none %}
48
+ <PHYSICAL-DEFAULT-VALUE>{{cp.physical_default_value | e}}</PHYSICAL-DEFAULT-VALUE>
49
+ {%- endif %}
48
50
  <DATA-OBJECT-PROP-REF ID-REF="{{cp.dop_ref.ref_id}}" />
49
51
  </COMPARAM>
50
52
  {%- endmacro %}
51
53
 
52
54
  {%- macro printComplexComparam(cp) %}
53
- <COMPLEX-COMPARAM ID="{{cp.odx_id.local_id}}"
55
+ <COMPLEX-COMPARAM {{-peid.printElementIdAttribs(cp)}}
54
56
  PARAM-CLASS="{{cp.param_class}}"
55
57
  CPTYPE="{{cp.cptype.value}}"
56
58
  {{make_xml_attrib("DISPLAY-LEVEL", cp.display_level)}}{#- #}
@@ -61,7 +63,7 @@
61
63
  {%- for sub_cp in cp.subparams %}
62
64
  {{- printAnyComparam(sub_cp) | indent(1, first=True) }}
63
65
  {%- endfor %}
64
- {%- if cp.physical_default_value is not none %}
66
+ {%- if cp.physical_default_value is not none %}
65
67
  {{ printComplexValue(cp.physical_default_value, "COMPLEX-PHYSICAL-DEFAULT-VALUE") | indent(1) }}
66
68
  {%- endif %}
67
69
  </COMPLEX-COMPARAM>
@@ -3,6 +3,7 @@
3
3
  # SPDX-License-Identifier: MIT
4
4
  -#}
5
5
  {%- import('macros/printComparam.xml.jinja2') as pcp %}
6
+ {%- import('macros/printDescription.xml.jinja2') as pd %}
6
7
  {#- -#}
7
8
 
8
9
  {%- macro printComparamRef(cp) %}
@@ -11,27 +12,19 @@
11
12
  DOCTYPE="COMPARAM-SUBSET">
12
13
  {%- if cp.value is string %}
13
14
  <SIMPLE-VALUE>{{cp.value}}</SIMPLE-VALUE>
14
- {%- if cp.description %}
15
- <DESC>{{cp.description}}</DESC>
16
- {%- endif %}
15
+ {{ pd.printDescription(cp.description) }}
17
16
  {%- elif cp.value is iterable %}
18
17
  {%- if hasattr(cp.value, "hex") %}
19
18
  {#- the value has a hex() method. assume that is a bytes or bytestring #}
20
19
  <SIMPLE-VALUE>{{cp.value.hex().upper()}}</SIMPLE-VALUE>
21
- {%- if cp.description %}
22
- <DESC>{{cp.description}}</DESC>
23
- {%- endif %}
20
+ {{ pd.printDescription(cp.description) }}
24
21
  {%- else %}
25
22
  {{ pcp.printComplexValue(cp.value)|indent(1) }}
26
- {%- if cp.description %}
27
- <DESC>{{cp.description}}</DESC>
28
- {%- endif %}
23
+ {{ pd.printDescription(cp.description) }}
29
24
  {%- endif %}
30
25
  {%- else %}
31
26
  <SIMPLE-VALUE>{{cp.value}}</SIMPLE-VALUE>
32
- {%- if cp.description %}
33
- <DESC>{{cp.description}}</DESC>
34
- {%- endif %}
27
+ {{ pd.printDescription(cp.description) }}
35
28
  {%- endif %}
36
29
  {%- if cp.prot_stack_snref is not none %}
37
30
  <PROT-STACK-SNREF SHORT-NAME="{{cp.prot_stack_snref}}"/>