-
Notifications
You must be signed in to change notification settings - Fork 104
Description
I have a pdx file which contains multiple odx files. One of them define a ecu shared data which contains some diag services, and one of them define a basevariant which only contains some definitions of tables/table rows. in ecu shared data file, there is a param definition like below:
<PARAM ID="DLC.ES_UDS_Services.ESD.ES_UDS_Services.DOP.STRUCT_Service86_03_ServiceToRespondToRecord.PA.ServiceToRespondToDID"
xsi:type="TABLE-KEY">
<SHORT-NAME>ServiceToRespondToDID</SHORT-NAME>
<LONG-NAME>ServiceToRespondToDID</LONG-NAME>
<TABLE-SNREF SHORT-NAME="TABLE_Service22_DataID"/>
</PARAM>
and in this file, there is a dummy table which short name is "TABLE_Service22_DataID":
<TABLE ID="id-59bd0afb-b95a-4e18-acca-162f2ea460cb" OID="59bd0afb-b95a-4e18-acca-162f2ea460cb" SEMANTIC="DATA-READ">
<SHORT-NAME>TABLE_Service22_DataID</SHORT-NAME>
<LONG-NAME>TABLE Service22 DataID</LONG-NAME>
<KEY-DOP-REF ID-REF="id-206979a7-32f8-412c-b2f8-93f8bfb74db6"/>
<TABLE-ROW ID="id-631ab6af-fd93-43d1-911b-a3b02d50db7e" OID="13fe66c9-9f6a-4f78-8bde-fba011a51cb7">
<SHORT-NAME>Dummy_Row</SHORT-NAME>
<LONG-NAME>Dummy Row</LONG-NAME>
<KEY>0</KEY>
</TABLE-ROW>
</TABLE>
with odxtools, this param would be parsed as a tablekey with a dummy table row in ecu shared data layer.
But in the file which contains basevariant, there is a new definition of table "TABLE_Service22_DataID" which contains real table rows. But with odxtools, the related param of base variant object is still using the dummy table.
I checked the code, and found that when resolving objects from parent, the odxtools will just get the objects from parent and will not do resolve snrefs for those objects. And as those inherited objects are the same objects as the ones of parent, doing resolve snrefs based on current context (with base variant) will also modify the objects of the parent, which shall be a new issue.
I have a workaround for it: call _resolve_snrefs on service before trying to read the details of its content based on current variant. But I still get some issues since some _resolve_snrefs lacks of resolving its children's snrefs like: BaseStructure, DiagService. So I made some code change on those files. For example, in DiagService:
def _resolve_snrefs(self, context: SnRefContext) -> None:
context.diag_service = self
super()._resolve_snrefs(context)
for cpr in self.comparam_refs:
cpr._resolve_snrefs(context)
# The named item list of communication parameters is created
# here because ComparamInstance.short_name is only valid after
# reference resolution
self._comparams = NamedItemList(self.comparam_refs)
if self._request:
self._request._resolve_snrefs(context)
for response in self._positive_responses:
response._resolve_snrefs(context)
for response in self._negative_responses:
response._resolve_snrefs(context)
context.diag_service = NoneWith this workaround, I can get the correct result. But can I get an official fix for it or is it a known issue?