mercedes-benz / odxtools

odxtools is a collection of utilities to interact with the diagnostic functionality of automotive electronic control units using python
MIT License
171 stars 70 forks source link

Implement dynamic endmarker fields #298

Closed andlaus closed 4 months ago

andlaus commented 4 months ago

This implements dynamic endmarker fields which, as far as I can see, is the last type of DOP which is currently missing.

Andreas Lauser <andreas.lauser@mercedes-benz.com>, on behalf of MBition GmbH. Provider Information

andlaus commented 4 months ago

@QWander: can you please check if this fixes your issue with resolving the DOP-SNREF?

QWander commented 4 months ago

@QWander: can you please check if this fixes your issue with resolving the DOP-SNREF?

I'm sorry to tell you that the problem has not been resolved, the specific error message is as follows: Traceback (most recent call last): File "odxtools\load_pdx_file.py", line 8, in load_pdx_file return Database(pdx_zip=ZipFile(pdx_file)) File "odxtools\database.py", line 91, in __init__ self.refresh() File "odxtools\database.py", line 128, in refresh dlc._finalize_init(self._odxlinks) File "odxtools\diaglayercontainer.py", line 129, in _finalize_init ecu_shared_data._finalize_init(odxlinks) File "odxtools\diaglayer.py", line 278, in _finalize_init self.diag_layer_raw._resolve_snrefs(self) File "odxtools\diaglayerraw.py", line 291, in _resolve_snrefs self.diag_data_dictionary_spec._resolve_snrefs(diag_layer) File "odxtools\diagdatadictionaryspec.py", line 232, in _resolve_snrefs structure._resolve_snrefs(diag_layer) File "odxtools\basicstructure.py", line 313, in _resolve_snrefs param._resolve_snrefs(diag_layer) File "odxtools\parameters\valueparameter.py", line 54, in _resolve_snrefs super()._resolve_snrefs(diag_layer) File "parameters\parameterwithdop.py", line 69, in _resolve_snrefs self._dop = odxrequire(ddds.all_data_object_properties.get(self.dop_snref)) File "odxtools\exceptions.py", line 76, in odxrequire odxraise(message) File "odxtools\exceptions.py", line 39, in odxraise raise error_type() odxtools.exceptions.OdxError

andlaus commented 4 months ago

I'm sorry to tell you that the problem has not been resolved, [...]

okay. I remembered that the way SNREFs are resolved currently does not work for short names which are not valid python identifiers. Does the short name of the referenced DOP happen to start with a digit?

QWander commented 4 months ago

I'm sorry to tell you that the problem has not been resolved, [...]

okay. I remembered that the way SNREFs are resolved currently does not work for short names which are not valid python identifiers. Does the short name of the referenced DOP happen to start with a digit?

self.dop_snref is BitFlag_TEXTTABLE_1Bit

andlaus commented 4 months ago

self.dop_snref is BitFlag_TEXTTABLE_1Bit

that is very peculiar: text tables should be fully supported (if they were not, none of my files would work), and the short name is also a python identifier. can you check if your diag layer contains that DOP? (i.e., does

import odxtools
odxtools.exceptions.strict_mode = False
db = odxtools.load_file("my_ecu.pdx")
ecu = db.ecus.MyEcuName
print(ecu.diag_data_dictionary_spec.data_object_props.BitFlag_TEXTTABLE_1Bit)

work?)

QWander commented 4 months ago

self.dop_snref is BitFlag_TEXTTABLE_1Bit

that is very peculiar: text tables should be fully supported (if they were not, none of my files would work), and the short name is also a python identifier. can you check if your diag layer contains that DOP? (i.e., does

import odxtools
odxtools.exceptions.strict_mode = False
db = odxtools.load_file("my_ecu.pdx")
ecu = db.ecus.MyEcuName
print(ecu.diag_data_dictionary_spec.data_object_props.BitFlag_TEXTTABLE_1Bit)

work?)

I think it's correct:

In file A, the<DATA-OBJECT-PROP>defines the<SHORT-NAME>BitFlag_TEXTTABLE_1Bit</SHORT-NAME>. In file B, use<DOP-SNREF SHORT-NAME="BitFlag_TEXTTABLE_1Bit"/>.

andlaus commented 4 months ago

are you using two separate .odx-d files or a single PDX file containing both file A and file B? if the former, that would explain your issues...

andlaus commented 4 months ago

@kayoub5: do you see any further issues with this or do you prefer to push The Green Button?