odxtools 6.7.0__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 (213) hide show
  1. odxtools/__init__.py +6 -4
  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 -240
  7. odxtools/cli/_parser_utils.py +1 -1
  8. odxtools/cli/_print_utils.py +168 -134
  9. odxtools/cli/browse.py +111 -92
  10. odxtools/cli/compare.py +90 -71
  11. odxtools/cli/list.py +24 -15
  12. odxtools/cli/snoop.py +28 -5
  13. odxtools/codec.py +211 -0
  14. odxtools/commrelation.py +122 -0
  15. odxtools/companydata.py +5 -7
  16. odxtools/companydocinfo.py +7 -8
  17. odxtools/companyrevisioninfo.py +3 -5
  18. odxtools/companyspecificinfo.py +8 -9
  19. odxtools/comparam.py +4 -6
  20. odxtools/comparaminstance.py +7 -9
  21. odxtools/comparamspec.py +16 -54
  22. odxtools/comparamsubset.py +22 -62
  23. odxtools/complexcomparam.py +5 -7
  24. odxtools/compumethods/compucodecompumethod.py +63 -0
  25. odxtools/compumethods/compuconst.py +31 -0
  26. odxtools/compumethods/compudefaultvalue.py +27 -0
  27. odxtools/compumethods/compuinternaltophys.py +56 -0
  28. odxtools/compumethods/compuinversevalue.py +7 -0
  29. odxtools/compumethods/compumethod.py +93 -12
  30. odxtools/compumethods/compuphystointernal.py +56 -0
  31. odxtools/compumethods/compurationalcoeffs.py +20 -9
  32. odxtools/compumethods/compuscale.py +30 -35
  33. odxtools/compumethods/createanycompumethod.py +28 -161
  34. odxtools/compumethods/identicalcompumethod.py +31 -6
  35. odxtools/compumethods/linearcompumethod.py +69 -189
  36. odxtools/compumethods/linearsegment.py +190 -0
  37. odxtools/compumethods/ratfunccompumethod.py +106 -0
  38. odxtools/compumethods/ratfuncsegment.py +87 -0
  39. odxtools/compumethods/scalelinearcompumethod.py +132 -26
  40. odxtools/compumethods/scaleratfunccompumethod.py +113 -0
  41. odxtools/compumethods/tabintpcompumethod.py +119 -99
  42. odxtools/compumethods/texttablecompumethod.py +107 -43
  43. odxtools/createanydiagcodedtype.py +10 -67
  44. odxtools/database.py +167 -87
  45. odxtools/dataobjectproperty.py +15 -25
  46. odxtools/decodestate.py +9 -15
  47. odxtools/description.py +47 -0
  48. odxtools/determinenumberofitems.py +4 -5
  49. odxtools/diagcodedtype.py +36 -106
  50. odxtools/diagcomm.py +24 -12
  51. odxtools/diagdatadictionaryspec.py +33 -34
  52. odxtools/diaglayercontainer.py +46 -54
  53. odxtools/diaglayers/basevariant.py +128 -0
  54. odxtools/diaglayers/basevariantraw.py +123 -0
  55. odxtools/diaglayers/diaglayer.py +432 -0
  56. odxtools/{diaglayerraw.py → diaglayers/diaglayerraw.py} +105 -120
  57. odxtools/diaglayers/ecushareddata.py +96 -0
  58. odxtools/diaglayers/ecushareddataraw.py +87 -0
  59. odxtools/diaglayers/ecuvariant.py +124 -0
  60. odxtools/diaglayers/ecuvariantraw.py +129 -0
  61. odxtools/diaglayers/functionalgroup.py +110 -0
  62. odxtools/diaglayers/functionalgroupraw.py +106 -0
  63. odxtools/{diaglayer.py → diaglayers/hierarchyelement.py} +209 -448
  64. odxtools/diaglayers/hierarchyelementraw.py +58 -0
  65. odxtools/diaglayers/protocol.py +64 -0
  66. odxtools/diaglayers/protocolraw.py +91 -0
  67. odxtools/diagnostictroublecode.py +8 -9
  68. odxtools/diagservice.py +56 -43
  69. odxtools/diagvariable.py +113 -0
  70. odxtools/docrevision.py +5 -7
  71. odxtools/dopbase.py +15 -17
  72. odxtools/dtcdop.py +168 -50
  73. odxtools/dynamicendmarkerfield.py +134 -0
  74. odxtools/dynamiclengthfield.py +41 -37
  75. odxtools/dyndefinedspec.py +177 -0
  76. odxtools/dynenddopref.py +38 -0
  77. odxtools/ecuvariantmatcher.py +6 -7
  78. odxtools/element.py +13 -15
  79. odxtools/encodestate.py +199 -22
  80. odxtools/endofpdufield.py +31 -18
  81. odxtools/environmentdata.py +8 -1
  82. odxtools/environmentdatadescription.py +198 -38
  83. odxtools/exceptions.py +11 -2
  84. odxtools/field.py +10 -10
  85. odxtools/functionalclass.py +3 -5
  86. odxtools/inputparam.py +3 -12
  87. odxtools/leadinglengthinfotype.py +37 -18
  88. odxtools/library.py +66 -0
  89. odxtools/loadfile.py +64 -0
  90. odxtools/matchingparameter.py +3 -3
  91. odxtools/message.py +0 -7
  92. odxtools/minmaxlengthtype.py +61 -33
  93. odxtools/modification.py +3 -5
  94. odxtools/multiplexer.py +128 -73
  95. odxtools/multiplexercase.py +13 -14
  96. odxtools/multiplexerdefaultcase.py +15 -12
  97. odxtools/multiplexerswitchkey.py +4 -5
  98. odxtools/nameditemlist.py +29 -5
  99. odxtools/negoutputparam.py +3 -5
  100. odxtools/odxcategory.py +83 -0
  101. odxtools/odxlink.py +60 -51
  102. odxtools/odxtypes.py +37 -5
  103. odxtools/outputparam.py +4 -15
  104. odxtools/parameterinfo.py +218 -67
  105. odxtools/parameters/codedconstparameter.py +16 -24
  106. odxtools/parameters/dynamicparameter.py +5 -4
  107. odxtools/parameters/lengthkeyparameter.py +60 -26
  108. odxtools/parameters/matchingrequestparameter.py +23 -11
  109. odxtools/parameters/nrcconstparameter.py +45 -46
  110. odxtools/parameters/parameter.py +54 -56
  111. odxtools/parameters/parameterwithdop.py +15 -25
  112. odxtools/parameters/physicalconstantparameter.py +15 -18
  113. odxtools/parameters/reservedparameter.py +6 -2
  114. odxtools/parameters/systemparameter.py +55 -11
  115. odxtools/parameters/tableentryparameter.py +3 -2
  116. odxtools/parameters/tablekeyparameter.py +103 -49
  117. odxtools/parameters/tablestructparameter.py +47 -48
  118. odxtools/parameters/valueparameter.py +16 -20
  119. odxtools/paramlengthinfotype.py +52 -32
  120. odxtools/parentref.py +16 -2
  121. odxtools/physicaldimension.py +3 -8
  122. odxtools/progcode.py +26 -11
  123. odxtools/protstack.py +3 -5
  124. odxtools/py.typed +0 -0
  125. odxtools/relateddoc.py +7 -9
  126. odxtools/request.py +120 -10
  127. odxtools/response.py +123 -23
  128. odxtools/scaleconstr.py +3 -3
  129. odxtools/servicebinner.py +1 -1
  130. odxtools/singleecujob.py +12 -10
  131. odxtools/snrefcontext.py +29 -0
  132. odxtools/specialdata.py +3 -5
  133. odxtools/specialdatagroup.py +7 -9
  134. odxtools/specialdatagroupcaption.py +3 -6
  135. odxtools/standardlengthtype.py +80 -14
  136. odxtools/state.py +3 -5
  137. odxtools/statechart.py +13 -19
  138. odxtools/statetransition.py +7 -17
  139. odxtools/staticfield.py +31 -25
  140. odxtools/subcomponent.py +288 -0
  141. odxtools/swvariable.py +21 -0
  142. odxtools/table.py +7 -8
  143. odxtools/tablerow.py +19 -11
  144. odxtools/teammember.py +3 -5
  145. odxtools/templates/comparam-spec.odx-c.xml.jinja2 +4 -24
  146. odxtools/templates/comparam-subset.odx-cs.xml.jinja2 +5 -26
  147. odxtools/templates/diag_layer_container.odx-d.xml.jinja2 +15 -31
  148. odxtools/templates/{index.xml.xml.jinja2 → index.xml.jinja2} +1 -1
  149. odxtools/templates/macros/printAudience.xml.jinja2 +1 -1
  150. odxtools/templates/macros/printBaseVariant.xml.jinja2 +53 -0
  151. odxtools/templates/macros/printCompanyData.xml.jinja2 +4 -7
  152. odxtools/templates/macros/printComparam.xml.jinja2 +6 -4
  153. odxtools/templates/macros/printComparamRef.xml.jinja2 +5 -12
  154. odxtools/templates/macros/printCompuMethod.xml.jinja2 +147 -0
  155. odxtools/templates/macros/printDOP.xml.jinja2 +27 -133
  156. odxtools/templates/macros/printDescription.xml.jinja2 +18 -0
  157. odxtools/templates/macros/printDiagComm.xml.jinja2 +1 -1
  158. odxtools/templates/macros/printDiagLayer.xml.jinja2 +222 -0
  159. odxtools/templates/macros/printDiagVariable.xml.jinja2 +66 -0
  160. odxtools/templates/macros/printDynDefinedSpec.xml.jinja2 +48 -0
  161. odxtools/templates/macros/printDynamicEndmarkerField.xml.jinja2 +16 -0
  162. odxtools/templates/macros/printDynamicLengthField.xml.jinja2 +1 -1
  163. odxtools/templates/macros/printEcuSharedData.xml.jinja2 +30 -0
  164. odxtools/templates/macros/printEcuVariant.xml.jinja2 +53 -0
  165. odxtools/templates/macros/printEcuVariantPattern.xml.jinja2 +1 -1
  166. odxtools/templates/macros/printElementId.xml.jinja2 +8 -3
  167. odxtools/templates/macros/printEndOfPdu.xml.jinja2 +1 -1
  168. odxtools/templates/macros/printEnvDataDesc.xml.jinja2 +1 -1
  169. odxtools/templates/macros/printFunctionalClass.xml.jinja2 +1 -1
  170. odxtools/templates/macros/printFunctionalGroup.xml.jinja2 +40 -0
  171. odxtools/templates/macros/printHierarchyElement.xml.jinja2 +24 -0
  172. odxtools/templates/macros/printLibrary.xml.jinja2 +21 -0
  173. odxtools/templates/macros/printMux.xml.jinja2 +4 -3
  174. odxtools/templates/macros/printOdxCategory.xml.jinja2 +28 -0
  175. odxtools/templates/macros/printParam.xml.jinja2 +11 -12
  176. odxtools/templates/macros/printProtStack.xml.jinja2 +1 -1
  177. odxtools/templates/macros/printProtocol.xml.jinja2 +30 -0
  178. odxtools/templates/macros/printRequest.xml.jinja2 +1 -1
  179. odxtools/templates/macros/printResponse.xml.jinja2 +1 -1
  180. odxtools/templates/macros/printService.xml.jinja2 +3 -2
  181. odxtools/templates/macros/printSingleEcuJob.xml.jinja2 +5 -26
  182. odxtools/templates/macros/printSpecialData.xml.jinja2 +1 -1
  183. odxtools/templates/macros/printState.xml.jinja2 +1 -1
  184. odxtools/templates/macros/printStateChart.xml.jinja2 +1 -1
  185. odxtools/templates/macros/printStateTransition.xml.jinja2 +1 -1
  186. odxtools/templates/macros/printStaticField.xml.jinja2 +1 -1
  187. odxtools/templates/macros/printStructure.xml.jinja2 +1 -1
  188. odxtools/templates/macros/printSubComponent.xml.jinja2 +104 -0
  189. odxtools/templates/macros/printTable.xml.jinja2 +4 -5
  190. odxtools/templates/macros/printUnitSpec.xml.jinja2 +3 -5
  191. odxtools/uds.py +2 -10
  192. odxtools/unit.py +4 -8
  193. odxtools/unitgroup.py +3 -5
  194. odxtools/unitspec.py +17 -17
  195. odxtools/utils.py +38 -20
  196. odxtools/variablegroup.py +32 -0
  197. odxtools/version.py +2 -2
  198. odxtools/{write_pdx_file.py → writepdxfile.py} +20 -10
  199. odxtools/xdoc.py +3 -5
  200. {odxtools-6.7.0.dist-info → odxtools-9.3.0.dist-info}/METADATA +20 -21
  201. odxtools-9.3.0.dist-info/RECORD +228 -0
  202. {odxtools-6.7.0.dist-info → odxtools-9.3.0.dist-info}/WHEEL +1 -1
  203. odxtools/createcompanydatas.py +0 -17
  204. odxtools/createsdgs.py +0 -19
  205. odxtools/load_file.py +0 -13
  206. odxtools/load_odx_d_file.py +0 -6
  207. odxtools/load_pdx_file.py +0 -8
  208. odxtools/templates/macros/printVariant.xml.jinja2 +0 -216
  209. odxtools-6.7.0.dist-info/RECORD +0 -182
  210. /odxtools/{diaglayertype.py → diaglayers/diaglayertype.py} +0 -0
  211. {odxtools-6.7.0.dist-info → odxtools-9.3.0.dist-info}/LICENSE +0 -0
  212. {odxtools-6.7.0.dist-info → odxtools-9.3.0.dist-info}/entry_points.txt +0 -0
  213. {odxtools-6.7.0.dist-info → odxtools-9.3.0.dist-info}/top_level.txt +0 -0
@@ -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}}"/>
@@ -0,0 +1,147 @@
1
+ {#- -*- mode: sgml; tab-width: 1; indent-tabs-mode: nil -*-
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ -#}
5
+
6
+ {%- import('macros/printElementId.xml.jinja2') as peid %}
7
+ {%- import('macros/printAdminData.xml.jinja2') as pad %}
8
+ {%- import('macros/printSpecialData.xml.jinja2') as psd %}
9
+ {%- import('macros/printDescription.xml.jinja2') as pd %}
10
+
11
+
12
+ {%- macro printLimit(tag_name, limit_obj) -%}
13
+ {%- if limit_obj is not none %}
14
+ <{{tag_name}}
15
+ {%- if limit_obj.interval_type is not none %}
16
+ {{- make_xml_attrib("INTERVAL-TYPE", limit_obj.interval_type.value) }}
17
+ {%- endif %}
18
+ {%- if limit_obj.value_raw is none %}
19
+ {#- #}/>
20
+ {%- else %}
21
+ {#- #}>{{- limit_obj.value_raw | e }}</{{tag_name}}>
22
+ {%- endif -%}
23
+ {%- endif -%}
24
+ {%- endmacro -%}
25
+
26
+ {%- macro printCompuInverseValue(civ) -%}
27
+ <COMPU-INVERSE-VALUE>
28
+ {%- if civ.v is not none %}
29
+ <V>{{civ.v}}</V>
30
+ {%- endif %}
31
+ {%- if civ.vt is not none %}
32
+ <VT>{{civ.vt | e}}</VT>
33
+ {%- endif %}
34
+ </COMPU-INVERSE-VALUE>
35
+ {%- endmacro -%}
36
+
37
+ {%- macro printCompuDefaultValue(cdv) -%}
38
+ <COMPU-DEFAULT-VALUE>
39
+ {%- if cdv.v is not none %}
40
+ <V>{{cdv.v}}</V>
41
+ {%- endif %}
42
+ {%- if cdv.vt is not none %}
43
+ <VT>{{cdv.vt | e}}</VT>
44
+ {%- endif %}
45
+ {%- if cdv.compu_inverse_value is not none %}
46
+ {{printCompuInverseValue(cdv.compu_inverse_value)}}
47
+ {%- endif %}
48
+ </COMPU-DEFAULT-VALUE>
49
+ {%- endmacro -%}
50
+
51
+ {%- macro printCompuScale(cs) -%}
52
+ <COMPU-SCALE>
53
+ {%- if cs.short_label is not none %}
54
+ <SHORT-LABEL>{{cs.short_label|e}}</SHORT-LABEL>
55
+ {%- endif %}
56
+ {{- pd.printDescription(cs.description)|indent(2, first=True) }}
57
+ {{- printLimit("LOWER-LIMIT", cs.lower_limit)|indent(2, first=True) }}
58
+ {{- printLimit("UPPER-LIMIT", cs.upper_limit)|indent(2, first=True) }}
59
+ {%- if cs.compu_inverse_value is not none %}
60
+ {{printCompuInverseValue(cs.compu_inverse_value)}}
61
+ {%- endif %}
62
+ {%- if cs.compu_const is not none %}
63
+ <COMPU-CONST>
64
+ {%- if cs.compu_const.v is not none %}
65
+ <V>{{cs.compu_const.v}}</V>
66
+ {%- endif %}
67
+ {%- if cs.compu_const.vt is not none %}
68
+ <VT>{{cs.compu_const.vt | e}}</VT>
69
+ {%- endif %}
70
+ </COMPU-CONST>
71
+ {%- endif %}
72
+ {%- set crc = cs.compu_rational_coeffs %}
73
+ {%- if crc is not none %}
74
+ <COMPU-RATIONAL-COEFFS>
75
+ <COMPU-NUMERATOR>
76
+ {%- for v in crc.numerators %}
77
+ <V>{{v}}</V>
78
+ {%- endfor %}
79
+ </COMPU-NUMERATOR>
80
+ {%- if crc.denominators %}
81
+ <COMPU-DENOMINATOR>
82
+ {%- for v in crc.denominators %}
83
+ <V>{{v}}</V>
84
+ {%- endfor %}
85
+ </COMPU-DENOMINATOR>
86
+ {%- endif %}
87
+ </COMPU-RATIONAL-COEFFS>
88
+ {%- endif %}
89
+ </COMPU-SCALE>
90
+ {%- endmacro -%}
91
+
92
+ {%- macro printProgCode(pc) -%}
93
+ <PROG-CODE>
94
+ <CODE-FILE>{{pc.code_file}}</CODE-FILE>
95
+ {%- if pc.encryption is not none %}
96
+ <ENCRYPTION>{{pc.encryption}}</ENCRYPTION>
97
+ {%- endif %}
98
+ <SYNTAX>{{pc.syntax}}</SYNTAX>
99
+ <REVISION>{{pc.revision}}</REVISION>
100
+ {%- if pc.entry_point is not none %}
101
+ <ENTRYPOINT>{{pc.entrypoint}}</ENTRYPOINT>
102
+ {%- endif %}
103
+ {%- if pc.library_refs %}
104
+ <LIBRARY-REFS>
105
+ {%- for libref in pc.library_refs %}
106
+ <LIBRARY-REF ID-REF="{{libref.ref_id}}" />
107
+ {%- endfor %}
108
+ </LIBRARY-REFS>
109
+ {%- endif %}
110
+ </PROG-CODE>
111
+ {%- endmacro -%}
112
+
113
+ {%- macro printCompuMethod(cm) -%}
114
+ <COMPU-METHOD>
115
+ <CATEGORY>{{cm.category.value}}</CATEGORY>
116
+ {%- if cm.compu_internal_to_phys is not none %}
117
+ <COMPU-INTERNAL-TO-PHYS>
118
+ <COMPU-SCALES>
119
+ {%- for cs in cm.compu_internal_to_phys.compu_scales %}
120
+ {{ printCompuScale(cs) | indent(3) }}
121
+ {%- endfor %}
122
+ </COMPU-SCALES>
123
+ {%- if cm.compu_internal_to_phys.prog_code is not none %}
124
+ {{ printProgCode(cm.compu_internal_to_phys.prog_code) | indent(3) }}
125
+ {%- endif %}
126
+ {%- if cm.compu_internal_to_phys.compu_default_value is not none %}
127
+ {{ printCompuDefaultValue(cm.compu_internal_to_phys.compu_default_value) | indent(3) }}
128
+ {%- endif %}
129
+ </COMPU-INTERNAL-TO-PHYS>
130
+ {%- endif %}
131
+ {%- if cm.compu_phys_to_internal is not none %}
132
+ <COMPU-PHYS-TO-INTERNAL>
133
+ <COMPU-SCALES>
134
+ {%- for cs in cm.compu_phys_to_internal.compu_scales %}
135
+ {{ printCompuScale(cs) | indent(3) }}
136
+ {%- endfor %}
137
+ </COMPU-SCALES>
138
+ {%- if cm.compu_phys_to_internal.prog_code is not none %}
139
+ {{ printProgCode(cm.compu_phys_to_internal.prog_code) | indent(3) }}
140
+ {%- endif %}
141
+ {%- if cm.compu_phys_to_internal.compu_default_value is not none %}
142
+ {{ printCompuDefaultValue(cm.compu_phys_to_internal.compu_default_value) | indent(3) }}
143
+ {%- endif %}
144
+ </COMPU-PHYS-TO-INTERNAL>
145
+ {%- endif %}
146
+ </COMPU-METHOD>
147
+ {%- endmacro -%}
@@ -6,6 +6,9 @@
6
6
  {%- import('macros/printElementId.xml.jinja2') as peid %}
7
7
  {%- import('macros/printAdminData.xml.jinja2') as pad %}
8
8
  {%- import('macros/printSpecialData.xml.jinja2') as psd %}
9
+ {%- import('macros/printCompuMethod.xml.jinja2') as pcm %}
10
+ {%- import('macros/printDescription.xml.jinja2') as pd %}
11
+
9
12
 
10
13
  {%- macro printDiagCodedType(dct) -%}
11
14
  <DIAG-CODED-TYPE {{-make_xml_attrib("BASE-DATA-TYPE", dct.base_data_type.value)}}
@@ -30,7 +33,6 @@
30
33
  </DIAG-CODED-TYPE>
31
34
  {%- endmacro -%}
32
35
 
33
-
34
36
  {%- macro printPhysicalType(physical_type) %}
35
37
  {%- if physical_type.display_radix is not none %}
36
38
  <PHYSICAL-TYPE BASE-DATA-TYPE="{{physical_type.base_data_type.value}}" DISPLAY-RADIX="{{physical_type.display_radix.name}}" />
@@ -43,39 +45,14 @@
43
45
  {%- endif %}
44
46
  {%- endmacro -%}
45
47
 
46
- {%- macro printLimit(tag_name, limit_obj) -%}
47
- {%- if limit_obj is not none %}
48
- <{{tag_name}}
49
- {%- if limit_obj.interval_type is not none %}
50
- {{- make_xml_attrib("INTERVAL-TYPE", limit_obj.interval_type.value) }}
51
- {%- endif %}
52
- {%- if limit_obj.value_raw is none %}
53
- {#- #}/>
54
- {%- else %}
55
- {#- #}>
56
- {%- if hasattr(limit_obj._value, 'hex') -%}
57
- {#- bytes or bytarray limit #}
58
- {{- limit_obj._value.hex().upper() }}
59
- {%- else -%}
60
- {{- limit_obj._value }}
61
- {%- endif -%}
62
- </{{tag_name}}>
63
- {%- endif -%}
64
- {%- endif -%}
65
- {%- endmacro -%}
66
-
67
48
  {%- macro printScaleConstr(sc) %}
68
49
  <SCALE-CONSTR VALIDITY="{{sc.validity.value}}">
69
50
  {%- if sc.short_label is not none %}
70
51
  <SHORT-LABEL>{{sc.short_label|e}}</SHORT-LABEL>
71
52
  {%- endif %}
72
- {%- if sc.description and sc.description.strip() %}
73
- <DESC>
74
- {{sc.description}}
75
- </DESC>
76
- {%- endif %}
77
- {{printLimit("LOWER-LIMIT", sc.lower_limit) }}
78
- {{printLimit("UPPER-LIMIT", sc.upper_limit) }}
53
+ {{pd.printDescription(sc.description)}}
54
+ {{pcm.printLimit("LOWER-LIMIT", sc.lower_limit) }}
55
+ {{pcm.printLimit("UPPER-LIMIT", sc.upper_limit) }}
79
56
  </SCALE-CONSTR>
80
57
  {%- endmacro -%}
81
58
 
@@ -85,8 +62,8 @@
85
62
  {%- else %}
86
63
  <INTERNAL-CONSTR>
87
64
  {%- endif %}
88
- {{printLimit("LOWER-LIMIT", ic.lower_limit) }}
89
- {{printLimit("UPPER-LIMIT", ic.upper_limit) }}
65
+ {{pcm.printLimit("LOWER-LIMIT", ic.lower_limit) }}
66
+ {{pcm.printLimit("UPPER-LIMIT", ic.upper_limit) }}
90
67
  {%- if ic.scale_constrs %}
91
68
  <SCALE-CONSTRS>
92
69
  {%- for sc in ic.scale_constrs %}
@@ -101,105 +78,6 @@
101
78
  {%- endif %}
102
79
  {%- endmacro -%}
103
80
 
104
- {%- macro printCompuMethod(cm) -%}
105
- <COMPU-METHOD>
106
- <CATEGORY>{{cm.category}}</CATEGORY>
107
- {%- if cm.category == "TEXTTABLE" %}
108
- <COMPU-INTERNAL-TO-PHYS>
109
- <COMPU-SCALES>
110
- {%- for cs in cm.internal_to_phys %}
111
- <COMPU-SCALE>
112
- {%- if cs.short_label and cs.short_label.strip() %}
113
- <SHORT-LABEL>{{cs.short_label|e}}</SHORT-LABEL>
114
- {%- endif %}
115
- {%- if cs.description and cs.description.strip() %}
116
- <DESC>
117
- {{cs.description}}
118
- </DESC>
119
- {%- endif %}
120
- {{printLimit("LOWER-LIMIT", cs.lower_limit) }}
121
- {{printLimit("UPPER-LIMIT", cs.upper_limit) }}
122
- {%- if cs.compu_inverse_value is not none %}
123
- <COMPU-INVERSE-VALUE>
124
- <V>{{cs.compu_inverse_value}}</V>
125
- </COMPU-INVERSE-VALUE>
126
- {%- endif %}
127
- <COMPU-CONST>
128
- <VT>{{cs.compu_const | e}}</VT>
129
- </COMPU-CONST>
130
- </COMPU-SCALE>
131
- {%- endfor %}
132
- </COMPU-SCALES>
133
- {%- if cm.compu_default_value is not none %}
134
- <COMPU-DEFAULT-VALUE>
135
- <VT>{{cm.compu_default_value.compu_const}}</VT>
136
- {%- if cm.compu_default_value.compu_inverse_value is not none %}
137
- <COMPU-INVERSE-VALUE>
138
- <V>{{cm.compu_default_value.compu_inverse_value}}</V>
139
- </COMPU-INVERSE-VALUE>
140
- {%- endif %}
141
- </COMPU-DEFAULT-VALUE>
142
- {%- endif %}
143
- </COMPU-INTERNAL-TO-PHYS>
144
- {%- elif cm.category == "LINEAR" %}
145
- <COMPU-INTERNAL-TO-PHYS>
146
- <COMPU-SCALES>
147
- <COMPU-SCALE>
148
- {{printLimit("LOWER-LIMIT", cm.internal_lower_limit) }}
149
- {{printLimit("UPPER-LIMIT", cm.internal_upper_limit) }}
150
- <COMPU-RATIONAL-COEFFS>
151
- <COMPU-NUMERATOR>
152
- <V>{{cm.offset}}</V>
153
- <V>{{cm.factor}}</V>
154
- </COMPU-NUMERATOR>
155
- {%- if cm.denominator != 1 %}
156
- <COMPU-DENOMINATOR>
157
- <V>{{cm.denominator}}</V>
158
- </COMPU-DENOMINATOR>
159
- {%- endif %}
160
- </COMPU-RATIONAL-COEFFS>
161
- </COMPU-SCALE>
162
- </COMPU-SCALES>
163
- </COMPU-INTERNAL-TO-PHYS>
164
- {%- elif cm.category == "SCALE-LINEAR" %}
165
- <COMPU-INTERNAL-TO-PHYS>
166
- <COMPU-SCALES>
167
- {%- for lm in cm.linear_methods %}
168
- <COMPU-SCALE>
169
- {{printLimit("LOWER-LIMIT", lm.internal_lower_limit) }}
170
- {{printLimit("UPPER-LIMIT", lm.internal_upper_limit) }}
171
- <COMPU-RATIONAL-COEFFS>
172
- <COMPU-NUMERATOR>
173
- <V>{{lm.offset}}</V>
174
- <V>{{lm.factor}}</V>
175
- </COMPU-NUMERATOR>
176
- {%- if lm.denominator != 1 %}
177
- <COMPU-DENOMINATOR>
178
- <V>{{lm.denominator}}</V>
179
- </COMPU-DENOMINATOR>
180
- {%- endif %}
181
- </COMPU-RATIONAL-COEFFS>
182
- </COMPU-SCALE>
183
- {%- endfor %}
184
- </COMPU-SCALES>
185
- </COMPU-INTERNAL-TO-PHYS>
186
- {%- elif cm.category == "TAB-INTP" %}
187
- <COMPU-INTERNAL-TO-PHYS>
188
- <COMPU-SCALES>
189
- {%- for idx in range( cm.internal_points | length ) %}
190
- <COMPU-SCALE>
191
- <LOWER-LIMIT>{{ cm.internal_points[idx] }}</LOWER-LIMIT>
192
- <COMPU-CONST>
193
- <V>{{ cm.physical_points[idx] }}</V>
194
- </COMPU-CONST>
195
- </COMPU-SCALE>
196
- {%- endfor %}
197
- </COMPU-SCALES>
198
- </COMPU-INTERNAL-TO-PHYS>
199
- {%- endif %}
200
- </COMPU-METHOD>
201
- {%- endmacro -%}
202
-
203
81
  {%- macro printDopBaseAttribs(dop) %}
204
82
  {{- make_xml_attrib("ID", dop.odx_id.local_id) }}
205
83
  {{- make_xml_attrib("OID", dop.oid) }}
@@ -225,7 +103,7 @@
225
103
  {%- macro printDataObjectProp(dop) %}
226
104
  <DATA-OBJECT-PROP {{- printDopBaseAttribs(dop) }}>
227
105
  {{- printDopBaseSubtags(dop) }}
228
- {{- printCompuMethod(dop.compu_method)|indent(1) }}
106
+ {{- pcm.printCompuMethod(dop.compu_method)|indent(1) }}
229
107
  {{- printDiagCodedType(dop.diag_coded_type)|indent(1) }}
230
108
  {{- printPhysicalType(dop.physical_type)|indent(1) }}
231
109
  {%- if dop.internal_constr %}
@@ -246,13 +124,13 @@
246
124
  {{- printDopBaseSubtags(dop)|indent(1) }}
247
125
  {{- printDiagCodedType(dop.diag_coded_type)|indent(1) }}
248
126
  {{- printPhysicalType(dop.physical_type)|indent(1) }}
249
- {{- printCompuMethod(dop.compu_method)|indent(1) }}
127
+ {{- pcm.printCompuMethod(dop.compu_method)|indent(1) }}
250
128
  <DTCS>
251
129
  {%- for dtc in dop.dtcs_raw %}
252
130
  {%- if hasattr(dtc, "ref_id") %}
253
131
  <DTC-REF ID-REF="{{dtc.ref_id}}" />
254
132
  {%- else %}
255
- <DTC ID="{{dtc.odx_id.local_id}}">
133
+ <DTC {{-peid.printElementIdAttribs(dtc)}}>
256
134
  <SHORT-NAME>{{dtc.short_name}}</SHORT-NAME>
257
135
  <TROUBLE-CODE>{{dtc.trouble_code}}</TROUBLE-CODE>
258
136
  {%- if dtc.display_trouble_code is not none %}
@@ -267,5 +145,21 @@
267
145
  {%- endif %}
268
146
  {%- endfor %}
269
147
  </DTCS>
148
+ {%- if dop.linked_dtc_dops_raw %}
149
+ <LINKED-DTC-DOPS>
150
+ {%- for linked_dtc_dop in dop.linked_dtc_dops_raw %}
151
+ <LINKED-DTC-DOP>
152
+ {%- if linked_dtc_dop.not_inherited_dtc_snrefs %}
153
+ <NOT-INHERITED-DTC-SNREFS>
154
+ {%- for ni_snref in linked_dtc_dop.not_inherited_dtc_snrefs %}
155
+ <NOT-INHERITED-DTC-SNREF SHORT-NAME="{{ni_snref}}" />
156
+ {%- endfor %}
157
+ </NOT-INHERITED-DTC-SNREFS>
158
+ {%- endif %}
159
+ <DTC-DOP-REF ID-REF="{{linked_dtc_dop.dtc_dop_ref.ref_id}}" />
160
+ </LINKED-DTC-DOP>
161
+ {%- endfor %}
162
+ </LINKED-DTC-DOPS>
163
+ {%- endif %}
270
164
  </DTC-DOP>
271
165
  {%- endmacro -%}
@@ -0,0 +1,18 @@
1
+ {#- -*- mode: sgml; tab-width: 1; sgml-basic-offset: 1; indent-tabs-mode: nil -*-
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ -#}
5
+
6
+ {%- macro printDescription(desc) %}
7
+ {%- if desc is not none %}
8
+ <DESC {{- make_xml_attrib("TI", desc.text_identifier)}}>{{desc.text}}
9
+ {%- if desc.external_docs %}
10
+ <EXTERNAL-DOCS>
11
+ {%- for ed in desc.external_docs %}
12
+ <EXTERNAL-DOC HREF="{{ed}}" />
13
+ {%- endfor %}
14
+ </EXTERNAL-DOCS>
15
+ {%- endif -%}
16
+ </DESC>
17
+ {%- endif %}
18
+ {%- endmacro %}
@@ -9,7 +9,7 @@
9
9
  {%- import('macros/printSpecialData.xml.jinja2') as psd %}
10
10
 
11
11
  {%- macro printDiagCommAttribs(dc) -%}
12
- ID="{{dc.odx_id.local_id}}"
12
+ {{-peid.printElementIdAttribs(dc)}}
13
13
  {{-make_xml_attrib("SEMANTIC", dc.semantic)}}
14
14
  {{-make_xml_attrib("DIAGNOSTIC-CLASS", dc.diagnostic_class and dc.diagnostic_class.value)}}
15
15
  {{-make_bool_xml_attrib("IS-MANDATORY", dc.is_mandatory_raw)}}