odxtools 10.2.1__py3-none-any.whl → 10.4.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 (74) hide show
  1. odxtools/cli/browse.py +4 -2
  2. odxtools/cli/compare.py +3 -3
  3. odxtools/compositecodec.py +1 -1
  4. odxtools/configdata.py +70 -0
  5. odxtools/configdatadictionaryspec.py +57 -0
  6. odxtools/configiditem.py +18 -0
  7. odxtools/configitem.py +85 -0
  8. odxtools/configrecord.py +146 -0
  9. odxtools/database.py +40 -0
  10. odxtools/dataiditem.py +18 -0
  11. odxtools/datarecord.py +132 -0
  12. odxtools/decodestate.py +1 -1
  13. odxtools/diagcommdataconnector.py +61 -0
  14. odxtools/diaglayers/diaglayer.py +9 -14
  15. odxtools/diagservice.py +10 -10
  16. odxtools/ecuconfig.py +89 -0
  17. odxtools/encryptcompressmethod.py +16 -3
  18. odxtools/externflashdata.py +21 -2
  19. odxtools/flashdata.py +40 -2
  20. odxtools/identvalue.py +16 -3
  21. odxtools/internflashdata.py +4 -0
  22. odxtools/isotp_state_machine.py +11 -11
  23. odxtools/itemvalue.py +77 -0
  24. odxtools/multipleecujob.py +178 -0
  25. odxtools/multipleecujobspec.py +142 -0
  26. odxtools/nameditemlist.py +2 -2
  27. odxtools/optionitem.py +79 -0
  28. odxtools/outputparam.py +1 -1
  29. odxtools/parameters/codedconstparameter.py +2 -3
  30. odxtools/readdiagcommconnector.py +79 -0
  31. odxtools/readparamvalue.py +52 -0
  32. odxtools/request.py +3 -3
  33. odxtools/response.py +8 -4
  34. odxtools/snrefcontext.py +2 -0
  35. odxtools/statemachine.py +3 -2
  36. odxtools/systemitem.py +23 -0
  37. odxtools/templates/diag_layer_container.odx-d.xml.jinja2 +4 -0
  38. odxtools/templates/ecu_config.odx-e.xml.jinja2 +38 -0
  39. odxtools/templates/flash.odx-f.xml.jinja2 +2 -2
  40. odxtools/templates/macros/printAdminData.xml.jinja2 +1 -1
  41. odxtools/templates/macros/printAudience.xml.jinja2 +3 -3
  42. odxtools/templates/macros/printChecksum.xml.jinja2 +1 -1
  43. odxtools/templates/macros/printCompuMethod.xml.jinja2 +2 -2
  44. odxtools/templates/macros/printConfigData.xml.jinja2 +39 -0
  45. odxtools/templates/macros/printConfigDataDictionarySpec.xml.jinja2 +22 -0
  46. odxtools/templates/macros/printConfigItems.xml.jinja2 +66 -0
  47. odxtools/templates/macros/printConfigRecord.xml.jinja2 +73 -0
  48. odxtools/templates/macros/printDOP.xml.jinja2 +5 -6
  49. odxtools/templates/macros/printDataRecord.xml.jinja2 +35 -0
  50. odxtools/templates/macros/printDiagCommDataConnector.xml.jinja2 +66 -0
  51. odxtools/templates/macros/printDiagDataDictionarySpec.xml.jinja2 +107 -0
  52. odxtools/templates/macros/printDiagLayer.xml.jinja2 +11 -97
  53. odxtools/templates/macros/printElementId.xml.jinja2 +2 -0
  54. odxtools/templates/macros/printExpectedIdent.xml.jinja2 +1 -1
  55. odxtools/templates/macros/printFlashdata.xml.jinja2 +2 -2
  56. odxtools/templates/macros/printFunctionalClass.xml.jinja2 +4 -4
  57. odxtools/templates/macros/printItemValue.xml.jinja2 +31 -0
  58. odxtools/templates/macros/printMultipleEcuJob.xml.jinja2 +77 -0
  59. odxtools/templates/macros/printOwnIdent.xml.jinja2 +1 -1
  60. odxtools/templates/macros/printSecurity.xml.jinja2 +4 -4
  61. odxtools/templates/macros/printSegment.xml.jinja2 +1 -1
  62. odxtools/templates/multiple-ecu-job-spec.odx-m.xml.jinja2 +51 -0
  63. odxtools/validbasevariant.py +62 -0
  64. odxtools/validityfor.py +16 -3
  65. odxtools/variantmatcher.py +4 -4
  66. odxtools/version.py +2 -2
  67. odxtools/writediagcommconnector.py +77 -0
  68. odxtools/writepdxfile.py +58 -27
  69. {odxtools-10.2.1.dist-info → odxtools-10.4.0.dist-info}/METADATA +2 -1
  70. {odxtools-10.2.1.dist-info → odxtools-10.4.0.dist-info}/RECORD +74 -45
  71. {odxtools-10.2.1.dist-info → odxtools-10.4.0.dist-info}/WHEEL +1 -1
  72. {odxtools-10.2.1.dist-info → odxtools-10.4.0.dist-info}/entry_points.txt +0 -0
  73. {odxtools-10.2.1.dist-info → odxtools-10.4.0.dist-info}/licenses/LICENSE +0 -0
  74. {odxtools-10.2.1.dist-info → odxtools-10.4.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,66 @@
1
+ 1{#- -*- mode: sgml; tab-width: 1; indent-tabs-mode: nil -*-
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ -#}
5
+
6
+ {%- import('macros/printAdminData.xml.jinja2') as pad %}
7
+ {%- import('macros/printElementId.xml.jinja2') as peid %}
8
+ {%- import('macros/printConfigItems.xml.jinja2') as pcits %}
9
+ {%- import('macros/printSpecialData.xml.jinja2') as psd %}
10
+
11
+ {%- macro printDiagCommDataConnector(connector) -%}
12
+ <DIAG-COMM-DATA-CONNECTOR>
13
+ <UNCOMPRESSED-SIZE>{{connector.uncompressed_size}}</UNCOMPRESSED-SIZE>
14
+ {%- set num_nibbles = (connector.source_start_address.bit_length() + 7) // 8 * 2 %}
15
+ <SOURCE-START-ADDRESS>{{ ("%%0%dX" | format(num_nibbles | int)) | format(connector.source_start_address | int) }}</SOURCE-START-ADDRESS>
16
+ {%- if connector.read_diag_comm_connector is not none %}
17
+ {%- set rdcc = connector.read_diag_comm_connector %}
18
+ <READ-DIAG-COMM-CONNECTOR>
19
+ {%- if rdcc.read_param_values %}
20
+ <READ-PARAM-VALUES>
21
+ {%- for rpv in rdcc.read_param_values %}
22
+ <READ-PARAM-VALUE {{ make_xml_attrib("SEMANTIC", rpv.semantic) }}>
23
+ <PHYS-CONSTANT-VALUE>{{ rpv.phys_constant_value | e }}</PHYS-CONSTANT-VALUE>
24
+ {%- if rpv.in_param_if_snref is not none %}
25
+ <IN-PARAM-IF-SNREF SHORT-NAME="{{rpv.in_param_if_snref}}" />
26
+ {%- endif %}
27
+ {%- if rpv.in_param_if_snpathref is not none %}
28
+ <IN-PARAM-IF-SNPATHREF SHORT-NAME-PATH="{{rpv.in_param_if_snpathref}}" />
29
+ {%- endif %}
30
+ </READ-PARAM-VALUE>
31
+ {%- endfor %}
32
+ </READ-PARAM-VALUES>
33
+ {%- endif %}
34
+ {%- if rdcc.read_diag_comm_ref is not none %}
35
+ <READ-DIAG-COMM-REF {{make_ref_attribs(rdcc.read_diag_comm_ref)}} />
36
+ {%- endif %}
37
+ {%- if rdcc.read_diag_comm_snref is not none %}
38
+ <READ-DIAG-COMM-SNREF SHORT-NAME="{{rdcc.read_diag_comm_snref}}" />
39
+ {%- endif %}
40
+ {%- if rdcc.read_data_snref is not none %}
41
+ <READ-DATA-SNREF SHORT-NAME="{{rdcc.read_data_snref}}" />
42
+ {%- endif %}
43
+ {%- if rdcc.read_data_snpathref is not none %}
44
+ <READ-DATA-SNPATHREF SHORT-NAME-PATH="{{rdcc.read_data_snpathref}}" />
45
+ {%- endif %}
46
+ </READ-DIAG-COMM-CONNECTOR>
47
+ {%- endif %}
48
+ {%- if connector.write_diag_comm_connector is not none %}
49
+ {%- set wdcc = connector.write_diag_comm_connector %}
50
+ <WRITE-DIAG-COMM-CONNECTOR>
51
+ {%- if wdcc.write_diag_comm_ref is not none %}
52
+ <WRITE-DIAG-COMM-REF {{make_ref_attribs(wdcc.write_diag_comm_ref)}} />
53
+ {%- endif %}
54
+ {%- if wdcc.write_diag_comm_snref is not none %}
55
+ <WRITE-DIAG-COMM-SNREF SHORT-NAME="{{wdcc.write_diag_comm_snref}}" />
56
+ {%- endif %}
57
+ {%- if wdcc.write_data_snref is not none %}
58
+ <WRITE-DATA-SNREF SHORT-NAME="{{wdcc.write_data_snref}}" />
59
+ {%- endif %}
60
+ {%- if wdcc.write_data_snpathref is not none %}
61
+ <WRITE-DATA-SNPATHREF SHORT-NAME-PATH="{{wdcc.write_data_snpathref}}" />
62
+ {%- endif %}
63
+ </WRITE-DIAG-COMM-CONNECTOR>
64
+ {%- endif %}
65
+ </DIAG-COMM-DATA-CONNECTOR>
66
+ {%- endmacro -%}
@@ -0,0 +1,107 @@
1
+ {#- -*- mode: sgml; tab-width: 1; indent-tabs-mode: nil -*-
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ -#}
5
+
6
+ {%- import('macros/printAdminData.xml.jinja2') as pad %}
7
+ {%- import('macros/printDOP.xml.jinja2') as pdop %}
8
+ {%- import('macros/printTable.xml.jinja2') as pt %}
9
+ {%- import('macros/printStructure.xml.jinja2') as pst %}
10
+ {%- import('macros/printEndOfPdu.xml.jinja2') as peopdu %}
11
+ {%- import('macros/printStaticField.xml.jinja2') as psf %}
12
+ {%- import('macros/printDynamicLengthField.xml.jinja2') as pdlf %}
13
+ {%- import('macros/printDynamicEndmarkerField.xml.jinja2') as pdemf %}
14
+ {%- import('macros/printMux.xml.jinja2') as pm %}
15
+ {%- import('macros/printEnvData.xml.jinja2') as ped %}
16
+ {%- import('macros/printEnvDataDesc.xml.jinja2') as pedd %}
17
+ {%- import('macros/printUnitSpec.xml.jinja2') as punit %}
18
+ {%- import('macros/printSpecialData.xml.jinja2') as psd %}
19
+
20
+ {%- macro printDiagDataDictionarySpec(ddds) -%}
21
+ <DIAG-DATA-DICTIONARY-SPEC>
22
+ {%- if ddds.admin_data is not none %}
23
+ {{- pad.printAdminData(ddds.admin_data)|indent(2) }}
24
+ {%- endif %}
25
+ {%- if ddds.dtc_dops %}
26
+ <DTC-DOPS>
27
+ {%- for dop in ddds.dtc_dops -%}
28
+ {{ pdop.printDtcDop(dop)|indent(4) }}
29
+ {%- endfor %}
30
+ </DTC-DOPS>
31
+ {%- endif %}
32
+ {%- if ddds.env_data_descs %}
33
+ <ENV-DATA-DESCS>
34
+ {%- for env_data_desc in ddds.env_data_descs -%}
35
+ {{ pedd.printEnvDataDesc(env_data_desc)|indent(4) }}
36
+ {%- endfor %}
37
+ </ENV-DATA-DESCS>
38
+ {%- endif %}
39
+ {%- if ddds.data_object_props %}
40
+ <DATA-OBJECT-PROPS>
41
+ {%- for dop in ddds.data_object_props %}
42
+ {{- pdop.printDataObjectProp(dop)|indent(4) }}
43
+ {%- endfor %}
44
+ </DATA-OBJECT-PROPS>
45
+ {%- endif %}
46
+ {%- if ddds.structures %}
47
+ <STRUCTURES>
48
+ {%- for st in ddds.structures %}
49
+ {{ pst.printStructure(st)|indent(4) }}
50
+ {%- endfor %}
51
+ </STRUCTURES>
52
+ {%- endif %}
53
+ {%- if ddds.static_fields %}
54
+ <STATIC-FIELDS>
55
+ {%- for sf in ddds.static_fields %}
56
+ {{ psf.printStaticField(sf)|indent(4) }}
57
+ {%- endfor %}
58
+ </STATIC-FIELDS>
59
+ {%- endif %}
60
+ {%- if ddds.dynamic_length_fields %}
61
+ <DYNAMIC-LENGTH-FIELDS>
62
+ {%- for dlf in ddds.dynamic_length_fields %}
63
+ {{ pdlf.printDynamicLengthField(dlf)|indent(4) }}
64
+ {%- endfor %}
65
+ </DYNAMIC-LENGTH-FIELDS>
66
+ {%- endif %}
67
+ {%- if ddds.dynamic_endmarker_fields %}
68
+ <DYNAMIC-ENDMARKER-FIELDS>
69
+ {%- for demf in ddds.dynamic_endmarker_fields %}
70
+ {{ pdemf.printDynamicEndmarkerField(demf)|indent(4) }}
71
+ {%- endfor %}
72
+ </DYNAMIC-ENDMARKER-FIELDS>
73
+ {%- endif %}
74
+ {%- if ddds.end_of_pdu_fields %}
75
+ <END-OF-PDU-FIELDS>
76
+ {%- for eopdu in ddds.end_of_pdu_fields %}
77
+ {{ peopdu.printEndOfPdu(eopdu)|indent(4) }}
78
+ {%- endfor %}
79
+ </END-OF-PDU-FIELDS>
80
+ {%- endif %}
81
+ {%- if ddds.muxs %}
82
+ <MUXS>
83
+ {%- for mux in ddds.muxs %}
84
+ {{ pm.printMux(mux)|indent(4) }}
85
+ {%- endfor %}
86
+ </MUXS>
87
+ {%- endif %}
88
+ {%- if ddds.env_datas %}
89
+ <ENV-DATAS>
90
+ {%- for env_data in ddds.env_datas %}
91
+ {{ ped.printEnvData(env_data)|indent(4) }}
92
+ {%- endfor %}
93
+ </ENV-DATAS>
94
+ {%- endif %}
95
+ {%- if ddds.unit_spec %}
96
+ {{ punit.printUnitSpec(ddds.unit_spec)|indent(2) }}
97
+ {%- endif %}
98
+ {%- if ddds.tables %}
99
+ <TABLES>
100
+ {%- for table in ddds.tables -%}
101
+ {{ pt.printTable(table)|indent(4) }}
102
+ {%- endfor %}
103
+ </TABLES>
104
+ {%- endif %}
105
+ {{- psd.printSpecialDataGroups(ddds.sdgs)|indent(2, first=True) }}
106
+ </DIAG-DATA-DICTIONARY-SPEC>
107
+ {%- endmacro -%}
@@ -4,18 +4,10 @@
4
4
  -#}
5
5
 
6
6
  {%- import('macros/printElementId.xml.jinja2') as peid %}
7
- {%- import('macros/printDOP.xml.jinja2') as pdop %}
8
- {%- import('macros/printTable.xml.jinja2') as pt %}
7
+ {%- import('macros/printAdminData.xml.jinja2') as pad %}
8
+ {%- import('macros/printCompanyData.xml.jinja2') as pcd %}
9
9
  {%- import('macros/printFunctionalClass.xml.jinja2') as pfc %}
10
- {%- import('macros/printStructure.xml.jinja2') as pst %}
11
- {%- import('macros/printEndOfPdu.xml.jinja2') as peopdu %}
12
- {%- import('macros/printStaticField.xml.jinja2') as psf %}
13
- {%- import('macros/printDynamicLengthField.xml.jinja2') as pdlf %}
14
- {%- import('macros/printDynamicEndmarkerField.xml.jinja2') as pdemf %}
15
- {%- import('macros/printMux.xml.jinja2') as pm %}
16
- {%- import('macros/printEnvData.xml.jinja2') as ped %}
17
- {%- import('macros/printEnvDataDesc.xml.jinja2') as pedd %}
18
- {%- import('macros/printUnitSpec.xml.jinja2') as punit %}
10
+ {%- import('macros/printDiagDataDictionarySpec.xml.jinja2') as pddds %}
19
11
  {%- import('macros/printService.xml.jinja2') as ps %}
20
12
  {%- import('macros/printSingleEcuJob.xml.jinja2') as psej %}
21
13
  {%- import('macros/printRequest.xml.jinja2') as prq %}
@@ -25,8 +17,6 @@
25
17
  {%- import('macros/printSubComponent.xml.jinja2') as psubcomp %}
26
18
  {%- import('macros/printLibrary.xml.jinja2') as plib %}
27
19
  {%- import('macros/printSpecialData.xml.jinja2') as psd %}
28
- {%- import('macros/printEcuVariantPattern.xml.jinja2') as pvpat %}
29
- {%- import('macros/printAdminData.xml.jinja2') as pad %}
30
20
 
31
21
  {%- macro printDiagLayerAttribs(dl) -%}
32
22
  {#- #} {{-peid.printElementIdAttribs(dl)}}{# -#}
@@ -54,90 +44,7 @@
54
44
  </FUNCT-CLASSS>
55
45
  {%- endif %}
56
46
  {%- if dlr.diag_data_dictionary_spec is not none %}
57
- {%- set ddds = dlr.diag_data_dictionary_spec %}
58
- <DIAG-DATA-DICTIONARY-SPEC>
59
- {%- if ddds.dtc_dops %}
60
- <DTC-DOPS>
61
- {%- for dop in ddds.dtc_dops -%}
62
- {{ pdop.printDtcDop(dop)|indent(3) }}
63
- {%- endfor %}
64
- </DTC-DOPS>
65
- {%- endif %}
66
- {%- if ddds.env_data_descs %}
67
- <ENV-DATA-DESCS>
68
- {%- for env_data_desc in ddds.env_data_descs -%}
69
- {{ pedd.printEnvDataDesc(env_data_desc)|indent(3) }}
70
- {%- endfor %}
71
- </ENV-DATA-DESCS>
72
- {%- endif %}
73
- {%- if ddds.data_object_props %}
74
- <DATA-OBJECT-PROPS>
75
- {%- for dop in ddds.data_object_props %}
76
- {{- pdop.printDataObjectProp(dop)|indent(3) }}
77
- {%- endfor %}
78
- </DATA-OBJECT-PROPS>
79
- {%- endif %}
80
- {%- if ddds.structures %}
81
- <STRUCTURES>
82
- {%- for st in ddds.structures %}
83
- {{ pst.printStructure(st)|indent(3) }}
84
- {%- endfor %}
85
- </STRUCTURES>
86
- {%- endif %}
87
- {%- if ddds.static_fields %}
88
- <STATIC-FIELDS>
89
- {%- for sf in ddds.static_fields %}
90
- {{ psf.printStaticField(sf)|indent(3) }}
91
- {%- endfor %}
92
- </STATIC-FIELDS>
93
- {%- endif %}
94
- {%- if ddds.dynamic_length_fields %}
95
- <DYNAMIC-LENGTH-FIELDS>
96
- {%- for dlf in ddds.dynamic_length_fields %}
97
- {{ pdlf.printDynamicLengthField(dlf)|indent(3) }}
98
- {%- endfor %}
99
- </DYNAMIC-LENGTH-FIELDS>
100
- {%- endif %}
101
- {%- if ddds.dynamic_endmarker_fields %}
102
- <DYNAMIC-ENDMARKER-FIELDS>
103
- {%- for demf in ddds.dynamic_endmarker_fields %}
104
- {{ pdemf.printDynamicEndmarkerField(demf)|indent(3) }}
105
- {%- endfor %}
106
- </DYNAMIC-ENDMARKER-FIELDS>
107
- {%- endif %}
108
- {%- if ddds.end_of_pdu_fields %}
109
- <END-OF-PDU-FIELDS>
110
- {%- for eopdu in ddds.end_of_pdu_fields %}
111
- {{ peopdu.printEndOfPdu(eopdu)|indent(3) }}
112
- {%- endfor %}
113
- </END-OF-PDU-FIELDS>
114
- {%- endif %}
115
- {%- if ddds.muxs %}
116
- <MUXS>
117
- {%- for mux in ddds.muxs %}
118
- {{ pm.printMux(mux)|indent(3) }}
119
- {%- endfor %}
120
- </MUXS>
121
- {%- endif %}
122
- {%- if ddds.env_datas %}
123
- <ENV-DATAS>
124
- {%- for env_data in ddds.env_datas %}
125
- {{ ped.printEnvData(env_data)|indent(3) }}
126
- {%- endfor %}
127
- </ENV-DATAS>
128
- {%- endif %}
129
- {%- if ddds.unit_spec %}
130
- {{ punit.printUnitSpec(ddds.unit_spec)|indent(2) }}
131
- {%- endif %}
132
- {%- if ddds.tables %}
133
- <TABLES>
134
- {%- for table in ddds.tables -%}
135
- {{ pt.printTable(table)|indent(3) }}
136
- {%- endfor %}
137
- </TABLES>
138
- {%- endif %}
139
- {{- psd.printSpecialDataGroups(ddds.sdgs)|indent(2, first=True) }}
140
- </DIAG-DATA-DICTIONARY-SPEC>
47
+ {{ pddds.printDiagDataDictionarySpec(dlr.diag_data_dictionary_spec) }}
141
48
  {%- endif %}
142
49
  {%- if dlr.diag_comms_raw %}
143
50
  <DIAG-COMMS>
@@ -191,6 +98,13 @@
191
98
  {%- endfor %}
192
99
  </GLOBAL-NEG-RESPONSES>
193
100
  {%- endif %}
101
+ {%- if dlr.import_refs %}
102
+ <IMPORT-REFS>
103
+ {%- for ir in dlr.import_refs %}
104
+ <IMPORT-REF {{make_ref_attribs(ir)}} />
105
+ {%- endfor %}
106
+ </IMPORT-REFS>
107
+ {%- endif %}
194
108
  {%- if dlr.state_charts %}
195
109
  <STATE-CHARTS>
196
110
  {%- for sc in dlr.state_charts %}
@@ -6,7 +6,9 @@
6
6
  {%- import('macros/printDescription.xml.jinja2') as pd %}
7
7
 
8
8
  {%- macro printElementIdAttribs(obj) -%}
9
+ {%- if obj.odx_id is defined %}
9
10
  {#- #} {{- make_xml_attrib("ID", obj.odx_id.local_id) }}
11
+ {%- endif %}
10
12
  {#- #} {{- make_xml_attrib("OID", getattr(obj, "oid", none)) -}}
11
13
  {%- endmacro -%}
12
14
 
@@ -14,7 +14,7 @@
14
14
  {%- if ident_value.value_type is not none %}
15
15
  {#- #} TYPE="{{ ident_value.value_type.value }}"
16
16
  {%- endif %}
17
- {#- #}>{{ident_value.value}}</IDENT-VALUE>
17
+ {#- #}>{{ident_value.value_raw}}</IDENT-VALUE>
18
18
  {%- endfor %}
19
19
  </IDENT-VALUES>
20
20
  </EXPECTED-IDENT>
@@ -30,10 +30,10 @@
30
30
  {%- if flashdata.encrypt_compress_method.value_type is not none %}
31
31
  {#- #} TYPE="{{ flashdata.encrypt_compress_method.value_type.value }}"
32
32
  {%- endif %}
33
- {#- #}>{{flashdata.encrypt_compress_method.value}}</ENCRYPT-COMPRESS-METHOD>
33
+ {#- #}>{{flashdata.encrypt_compress_method.value_raw}}</ENCRYPT-COMPRESS-METHOD>
34
34
  {%- endif %}
35
35
  {%- if flashdata.datafile is defined %}
36
- <DATAFILE {{ make_bool_xml_attrib("LATEBOUND-DATAFILE", flashdata.latebound_datafile) }}>
36
+ <DATAFILE {{ make_bool_xml_attrib("LATEBOUND-DATAFILE", flashdata.datafile.latebound_datafile) }}>
37
37
  {#- #}{{flashdata.datafile.value}}
38
38
  {#- #}</DATAFILE>
39
39
  {%- elif flashdata.data is defined %}
@@ -9,9 +9,9 @@
9
9
 
10
10
  {%- macro printFunctionalClass(fc) -%}
11
11
  <FUNCT-CLASS {{-peid.printElementIdAttribs(fc)}}>
12
- {{ peid.printElementIdSubtags(fc)|indent(1) }}
13
- {%- if fc.admin_data is not none -%}
14
- {{ pad.printAdminData(fc.admin_data)|indent(1) }}
15
- {%- endif -%}
12
+ {{ peid.printElementIdSubtags(fc)|indent(2) }}
13
+ {%- if fc.admin_data is not none %}
14
+ {{ pad.printAdminData(fc.admin_data)|indent(2) }}
15
+ {%- endif %}
16
16
  </FUNCT-CLASS>
17
17
  {%- endmacro -%}
@@ -0,0 +1,31 @@
1
+ 1{#- -*- mode: sgml; tab-width: 1; indent-tabs-mode: nil -*-
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ -#}
5
+
6
+ {%- import('macros/printAudience.xml.jinja2') as paud %}
7
+ {%- import('macros/printSpecialData.xml.jinja2') as psd %}
8
+
9
+ {%- macro printItemValue(item_value) -%}
10
+ <ITEM-VALUE>
11
+ {%- if item_value.phys_constant_value is not none %}
12
+ <PHYS-CONSTANT-VALUE>{{item_value.phys_constant_value | e}}</PHYS-CONSTANT-VALUE>
13
+ {%- endif %}
14
+ {%- if item_value.meaning is not none %}
15
+ <MEANING {{- make_xml_attrib("TI", item_value.meaning.text_identifier) }}>{{item_value.meaning|e}}</MEANING>
16
+ {%- endif %}
17
+ {%- if item_value.key is not none %}
18
+ <KEY>{{item_value.key | e}}</KEY>
19
+ {%- endif %}
20
+ {%- if item_value.rule is not none %}
21
+ <RULE>{{item_value.rule | e}}</RULE>
22
+ {%- endif %}
23
+ {%- if item_value.description is not none %}
24
+ <DESCRIPTION {{- make_xml_attrib("TI", item_value.description.text_identifier) }}>{{item_value.description|e}}</DESCRIPTION>
25
+ {%- endif %}
26
+ {{- psd.printSpecialDataGroups(item_value.sdgs)|indent(2, first=True) }}{#- #}
27
+ {%- if item_value.audience is not none %}
28
+ {{ paud.printAudience(item_value.audience) | indent(2) }}
29
+ {%- endif %}
30
+ </ITEM-VALUE>
31
+ {%- endmacro -%}
@@ -0,0 +1,77 @@
1
+ 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/printCompuMethod.xml.jinja2') as pcm %}
10
+ {%- import('macros/printAudience.xml.jinja2') as paud %}
11
+
12
+ {%- macro printMultipleEcuJob(multiple_ecu_job) -%}
13
+ <MULTIPLE-ECU-JOB {{peid.printElementIdAttribs(multiple_ecu_job)}}
14
+ {{-make_xml_attrib("SEMANTIC", multiple_ecu_job.semantic)}}
15
+ {{-make_bool_xml_attrib("IS-EXECUTABLE", multiple_ecu_job.is_executable_raw)}}>
16
+ {{peid.printElementIdSubtags(multiple_ecu_job)|indent(2) }}
17
+ {%- if multiple_ecu_job.admin_data is not none %}
18
+ {{- pad.printAdminData(multiple_ecu_job.admin_data)|indent(2) }}
19
+ {%- endif %}
20
+ {{- psd.printSpecialDataGroups(multiple_ecu_job.sdgs)|indent(2, first=True) }}{#- #}
21
+ {%- if multiple_ecu_job.functional_class_refs %}
22
+ <FUNCT-CLASS-REFS>
23
+ {%- for fc_ref in multiple_ecu_job.functional_class_refs %}
24
+ <FUNCT-CLASS-REF {{make_ref_attribs(fc_ref)}} />
25
+ {%- endfor %}
26
+ </FUNCT-CLASS-REFS>
27
+ {%- endif %}
28
+ <PROG-CODES>
29
+ {%- for pc in multiple_ecu_job.prog_codes %}
30
+ {{pcm.printProgCode(pc)|indent(4)}}
31
+ {%- endfor %}
32
+ </PROG-CODES>
33
+ {%- if multiple_ecu_job.input_params %}
34
+ <INPUT-PARAMS>
35
+ {%- for ip in multiple_ecu_job.input_params %}
36
+ <INPUT-PARAM {{ peid.printElementIdAttribs(ip) }} {{make_xml_attrib("SEMANTIC", ip.semantic)}}>
37
+ {{peid.printElementIdSubtags(ip)|indent(4)}}
38
+ {%- if ip.physical_default_value is not none %}
39
+ <PHYSICAL-DEFAULT-VALUE>{{ip.physical_default_value | e}}</PHYSICAL-DEFAULT-VALUE>
40
+ {%- endif %}
41
+ <DOP-BASE-REF {{make_ref_attribs(ip.dop_base_ref)}} />
42
+ </INPUT-PARAM>
43
+ {%- endfor %}
44
+ </INPUT-PARAMS>
45
+ {%- endif %}
46
+ {%- if multiple_ecu_job.output_params %}
47
+ <OUTPUT-PARAMS>
48
+ {%- for op in multiple_ecu_job.output_params %}
49
+ <OUTPUT-PARAM {{ peid.printElementIdAttribs(op) }} {{make_xml_attrib("SEMANTIC", op.semantic)}}>
50
+ {{peid.printElementIdSubtags(op)|indent(4)}}
51
+ <DOP-BASE-REF {{make_ref_attribs(op.dop_base_ref)}} />
52
+ </OUTPUT-PARAM>
53
+ {%- endfor %}
54
+ </OUTPUT-PARAMS>
55
+ {%- endif %}
56
+ {%- if multiple_ecu_job.neg_output_params %}
57
+ <NEG-OUTPUT-PARAMS>
58
+ {%- for nop in multiple_ecu_job.neg_output_params %}
59
+ <NEG-OUTPUT-PARAM {{ peid.printElementIdAttribs(nop) }}>
60
+ {{peid.printElementIdSubtags(nop)|indent(4)}}
61
+ <DOP-BASE-REF {{make_ref_attribs(nop.dop_base_ref)}} />
62
+ </NEG-OUTPUT-PARAM>
63
+ {%- endfor %}
64
+ </NEG-OUTPUT-PARAMS>
65
+ {%- endif %}
66
+ {%- if multiple_ecu_job.diag_layer_refs %}
67
+ <DIAG-LAYER-REFS>
68
+ {%- for dl_ref in multiple_ecu_job.diag_layer_refs %}
69
+ <DIAG-LAYER-REF {{make_ref_attribs(dl_ref)}} />
70
+ {%- endfor %}
71
+ </DIAG-LAYER-REFS>
72
+ {%- endif %}
73
+ {%- if multiple_ecu_job.audience is not none %}
74
+ {{ paud.printAudience(multiple_ecu_job.audience) | indent(2) }}
75
+ {%- endif %}
76
+ </MULTIPLE-ECU-JOB>
77
+ {%- endmacro -%}
@@ -12,6 +12,6 @@
12
12
  {%- if own_ident.ident_value.value_type is not none %}
13
13
  {#- #} TYPE="{{ own_ident.ident_value.value_type.value }}"
14
14
  {%- endif %}
15
- {#- #}>{{own_ident.ident_value.value}}</IDENT-VALUE>
15
+ {#- #}>{{own_ident.ident_value.value_raw}}</IDENT-VALUE>
16
16
  </OWN-IDENT>
17
17
  {%- endmacro -%}
@@ -10,28 +10,28 @@
10
10
  {%- if security.security_method.value_type is not none %}
11
11
  {#- #} TYPE="{{ security.security_method.value_type.value }}"
12
12
  {%- endif %}
13
- {#- #}>{{security.security_method.value}}</SECURITY-METHOD>
13
+ {#- #}>{{security.security_method.value_raw}}</SECURITY-METHOD>
14
14
  {%- endif %}
15
15
  {%- if security.fw_signature is not none %}
16
16
  <FW-SIGNATURE
17
17
  {%- if security.fw_signature.value_type is not none %}
18
18
  {#- #} TYPE="{{ security.fw_signature.value_type.value }}"
19
19
  {%- endif %}
20
- {#- #}>{{security.fw_signature.value}}</FW-SIGNATURE>
20
+ {#- #}>{{security.fw_signature.value_raw}}</FW-SIGNATURE>
21
21
  {%- endif %}
22
22
  {%- if security.fw_checksum is not none %}
23
23
  <FW-CHECKSUM
24
24
  {%- if security.fw_checksum.value_type is not none %}
25
25
  {#- #} TYPE="{{ security.fw_checksum.value_type.value }}"
26
26
  {%- endif %}
27
- {#- #}>{{security.fw_checksum.value}}</FW-CHECKSUM>
27
+ {#- #}>{{security.fw_checksum.value_raw}}</FW-CHECKSUM>
28
28
  {%- endif %}
29
29
  {%- if security.validity_for is not none %}
30
30
  <VALIDITY-FOR
31
31
  {%- if security.validity_for.value_type is not none %}
32
32
  {#- #} TYPE="{{ security.validity_for.value_type.value }}"
33
33
  {%- endif %}
34
- {#- #}>{{security.validity_for.value}}</VALIDITY-FOR>
34
+ {#- #}>{{security.validity_for.value_raw}}</VALIDITY-FOR>
35
35
  {%- endif %}
36
36
  </SECURITY>
37
37
  {%- endmacro -%}
@@ -25,7 +25,7 @@
25
25
  {%- if segment.encrypt_compress_method.value_type is not none %}
26
26
  {#- #} TYPE="{{ segment.encrypt_compress_method.value_type.value }}"
27
27
  {%- endif %}
28
- {#- #}>{{segment.encrypt_compress_method.value}}</ENCRYPT-COMPRESS-METHOD>
28
+ {#- #}>{{segment.encrypt_compress_method.value_raw | e}}</ENCRYPT-COMPRESS-METHOD>
29
29
  {%- endif %}
30
30
  </SEGMENT>
31
31
  {%- endmacro -%}
@@ -0,0 +1,51 @@
1
+ {#- -*- mode: sgml; tab-width: 1; indent-tabs-mode: nil -*-
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ #
5
+ # This template writes an .odx-f file containing descriptions of firmware
6
+ # blobs that can be flashed to ECUs.
7
+ -#}
8
+ {%- import('macros/printOdxCategory.xml.jinja2') as poc %}
9
+ {%- import('macros/printMultipleEcuJob.xml.jinja2') as pmecuj %}
10
+ {%- import('macros/printDiagDataDictionarySpec.xml.jinja2') as pddds %}
11
+ {%- import('macros/printFunctionalClass.xml.jinja2') as pfc %}
12
+ {%- import('macros/printAudience.xml.jinja2') as paud %}
13
+ {#- -#}
14
+
15
+ <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
16
+ <!-- Written using odxtools {{odxtools_version}} -->
17
+ <ODX MODEL-VERSION="2.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="odx.xsd">
18
+ {{- set_category_docfrag(multiple_ecu_job_spec.short_name, "MULTIPLE-ECU-JOB-SPEC") }}
19
+ <MULTIPLE-ECU-JOB-SPEC {{- poc.printOdxCategoryAttribs(multiple_ecu_job_spec) }}>
20
+ {{- poc.printOdxCategorySubtags(multiple_ecu_job_spec)|indent(4) }}
21
+ <MULTIPLE-ECU-JOBS>
22
+ {%- for mecuj in multiple_ecu_job_spec.multiple_ecu_jobs %}
23
+ {{ pmecuj.printMultipleEcuJob(mecuj) | indent(6) }}
24
+ {%- endfor %}
25
+ </MULTIPLE-ECU-JOBS>
26
+ {%- if multiple_ecu_job_spec.diag_data_dictionary_spec is not none %}
27
+ {{ pddds.printDiagDataDictionarySpec(multiple_ecu_job_spec.diag_data_dictionary_spec) }}
28
+ {%- endif %}
29
+ {%- if multiple_ecu_job_spec.functional_classes %}
30
+ <FUNCT-CLASSS>
31
+ {%- for fc in multiple_ecu_job_spec.functional_classes %}
32
+ {{ pfc.printFunctionalClass(fc)|indent(6) }}
33
+ {%- endfor%}
34
+ </FUNCT-CLASSS>
35
+ {%- endif %}
36
+ {%- if multiple_ecu_job_spec.additional_audiences %}
37
+ <ADDITIONAL-AUDIENCES>
38
+ {%- for audience in multiple_ecu_job_spec.additional_audiences %}
39
+ {{ paud.printAdditionalAudience(audience) | indent(6) }}
40
+ {%- endfor %}
41
+ </ADDITIONAL-AUDIENCES>
42
+ {%- endif %}
43
+ {%- if multiple_ecu_job_spec.import_refs %}
44
+ <IMPORT-REFS>
45
+ {%- for ir in multiple_ecu_job_spec.import_refs %}
46
+ <IMPORT-REF {{make_ref_attribs(ir)}} />
47
+ {%- endfor %}
48
+ </IMPORT-REFS>
49
+ {%- endif %}
50
+ </MULTIPLE-ECU-JOB-SPEC>
51
+ </ODX>
@@ -0,0 +1,62 @@
1
+ # SPDX-License-Identifier: MIT
2
+ from dataclasses import dataclass
3
+ from itertools import chain
4
+ from typing import Any
5
+ from xml.etree import ElementTree
6
+
7
+ from .diaglayers.basevariant import BaseVariant
8
+ from .diaglayers.ecuvariant import EcuVariant
9
+ from .exceptions import odxrequire
10
+ from .nameditemlist import NamedItemList
11
+ from .odxdoccontext import OdxDocContext
12
+ from .odxlink import OdxLinkDatabase, OdxLinkId, resolve_snref
13
+ from .snrefcontext import SnRefContext
14
+
15
+
16
+ @dataclass(kw_only=True)
17
+ class ValidBaseVariant:
18
+ ecu_variant_snrefs: list[str]
19
+ base_variant_snref: str
20
+
21
+ @property
22
+ def ecu_variants(self) -> NamedItemList[EcuVariant]:
23
+ return self._ecu_variants
24
+
25
+ @property
26
+ def base_variant(self) -> BaseVariant:
27
+ return self._base_variant
28
+
29
+ @staticmethod
30
+ def from_et(et_element: ElementTree.Element, context: OdxDocContext) -> "ValidBaseVariant":
31
+ ecu_variant_snrefs = []
32
+ for ecuv_snref_elem in et_element.iterfind("ECU-VARIANT-SNREFS/ECU-VARIANT-SNREF"):
33
+ ecu_variant_snrefs.append(odxrequire(ecuv_snref_elem.attrib["SHORT-NAME"]))
34
+
35
+ basev_snref_elem = odxrequire(et_element.find("BASE-VARIANT-SNREF"))
36
+ base_variant_snref = odxrequire(basev_snref_elem.attrib["SHORT-NAME"])
37
+
38
+ return ValidBaseVariant(
39
+ ecu_variant_snrefs=ecu_variant_snrefs, base_variant_snref=base_variant_snref)
40
+
41
+ def __post_init__(self) -> None:
42
+ self._ecu_variants: NamedItemList[EcuVariant]
43
+ self._base_variant: BaseVariant
44
+
45
+ def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
46
+ result: dict[OdxLinkId, Any] = {}
47
+ return result
48
+
49
+ def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
50
+ pass
51
+
52
+ def _resolve_snrefs(self, context: SnRefContext) -> None:
53
+ db = odxrequire(context.database)
54
+
55
+ ecu_variants = chain(*[dlc.ecu_variants for dlc in db.diag_layer_containers])
56
+ base_variants = chain(*[dlc.base_variants for dlc in db.diag_layer_containers])
57
+
58
+ self._ecu_variants = NamedItemList[EcuVariant]()
59
+ for ev_snref in self.ecu_variant_snrefs:
60
+ self._ecu_variants.append(resolve_snref(ev_snref, ecu_variants, EcuVariant))
61
+
62
+ self._base_variant = resolve_snref(self.base_variant_snref, base_variants, BaseVariant)
odxtools/validityfor.py CHANGED
@@ -5,17 +5,26 @@ from xml.etree import ElementTree
5
5
 
6
6
  from .exceptions import odxraise, odxrequire
7
7
  from .odxdoccontext import OdxDocContext
8
+ from .odxtypes import AtomicOdxType, DataType
8
9
  from .sessionsubelemtype import SessionSubElemType
9
10
 
10
11
 
11
12
  @dataclass(kw_only=True)
12
13
  class ValidityFor:
13
- value: str
14
+ value_raw: str
14
15
  value_type: SessionSubElemType
15
16
 
17
+ @property
18
+ def value(self) -> AtomicOdxType:
19
+ return self._value
20
+
21
+ @property
22
+ def data_type(self) -> DataType:
23
+ return self._data_type
24
+
16
25
  @staticmethod
17
26
  def from_et(et_element: ElementTree.Element, context: OdxDocContext) -> "ValidityFor":
18
- value = et_element.text or ""
27
+ value_raw = et_element.text or ""
19
28
 
20
29
  value_type_str = odxrequire(et_element.get("TYPE"))
21
30
  try:
@@ -25,6 +34,10 @@ class ValidityFor:
25
34
  odxraise(f"Encountered unknown SESSION-SUB-ELEM-TYPE type '{value_type_str}'")
26
35
 
27
36
  return ValidityFor(
28
- value=value,
37
+ value_raw=value_raw,
29
38
  value_type=value_type,
30
39
  )
40
+
41
+ def __post_init__(self) -> None:
42
+ self._data_type = DataType(self.value_type.value)
43
+ self._value = self._data_type.from_string(self.value_raw.strip())