diff --git a/odxtools/parameters/tablekeyparameter.py b/odxtools/parameters/tablekeyparameter.py index 824376a0..f1fba8e4 100644 --- a/odxtools/parameters/tablekeyparameter.py +++ b/odxtools/parameters/tablekeyparameter.py @@ -27,11 +27,15 @@ def __init__(self, semantic=semantic, description=description ) + self.table_ref = None + self.table_snref = None + self.table_row_ref = None + self.table_row_snref = None if table_ref: self.table_ref = table_ref - self.table_row_snref = table_row_snref + self.table_row_ref = table_row_ref elif table_snref: - self.table_ref = table_ref + self.table_snref = table_snref self.table_row_snref = table_row_snref elif table_row_ref: self.table_row_ref = table_row_ref @@ -59,3 +63,10 @@ def get_coded_value_as_bytes(self): def decode_from_pdu(self, coded_message, default_byte_position=None): raise NotImplementedError( "Decoding a TableKeyParameter is not implemented yet.") + + def resolve_references(self, parent_dl, id_lookup): + self.table = None + if self.table_snref: + self.table = parent_dl.local_diag_data_dictionary_spec.tables[self.table_snref] + elif self.table_ref: + self.table = id_lookup.get(self.table_ref) diff --git a/odxtools/structures.py b/odxtools/structures.py index 38833e49..8a8bc2e9 100644 --- a/odxtools/structures.py +++ b/odxtools/structures.py @@ -5,6 +5,8 @@ from typing import Any, List, Dict, Iterable, Optional, OrderedDict, Union import warnings +from odxtools.parameters.tablekeyparameter import TableKeyParameter + from .dataobjectproperty import DataObjectProperty, DopBase from .decodestate import DecodeState, ParameterValuePair from .encodestate import EncodeState @@ -267,6 +269,8 @@ def _resolve_references(self, parent_dl, id_lookup): for p in self.parameters: if isinstance(p, ParameterWithDOP): p.resolve_references(parent_dl, id_lookup) + if isinstance(p, TableKeyParameter): + p.resolve_references(parent_dl, id_lookup) def __message_format_lines(self, allow_unknown_lengths=False): # sort parameters