Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about PARAM-SNREF #377

Open
cmydd opened this issue Dec 20, 2024 · 7 comments
Open

about PARAM-SNREF #377

cmydd opened this issue Dec 20, 2024 · 7 comments

Comments

@cmydd
Copy link

cmydd commented Dec 20, 2024

e.g
PARAM xsi:type="VALUE" SEMANTIC="DATA">
SHORT-NAME>Param_DTCValue
LONG-NAME>DTC Value
BYTE-POSITION>2
DOP-REF DOCREF="ES_DataLibra" DOCTYPE="LAYER" ID-REF="DOP_UINTHEX3Bytes"/>
/PARAM>

ENV-DATA-DESC ID="ENVDESC_DTCExtenDataRecor">
SHORT-NAME>ENVDESC_DTCExtenDataRecor
LONG-NAME>DTC Extended Data Record
PARAM-SNREF SHORT-NAME="Param_DTCValue"/>
ENV-DATAS>

environmentdatadescription.py
line 133
if not isinstance(prev_dop, DtcDop):
DOP_UINTHEX3Bytes is touble_code.the dop is not DtcDop.

Is it correct to change it to this?

    for prev_param, prev_param_value in reversed(encode_state.journal):
        if prev_param.short_name == self.param_snref:
            dtc_param_value = prev_param_value
        dtc_param = prev_param
        prev_dop = getattr(prev_param, "dop", None)
        if not isinstance(prev_dop, DtcDop):
            continue
        dtc_dop = prev_dop

other question.
minmaxlengthtype.py
line 114
odxassert(value_len % len(termination_sequence) == 0)

if if self.termination == "END-OF-PDU",termination_sequence is None. An exception is thrown

@andlaus
Copy link
Collaborator

andlaus commented Dec 20, 2024

I read up the spec, and it indeed allows any parameter that uses a DOP with a A_UINT32 base data type while odxtools currently only allows DTC-DOPs. I'll only be able to fix this in January, though...

if if self.termination == "END-OF-PDU",termination_sequence is None. An exception is thrown

Hm, I cannot see how MinMaxLengthType.__termination_sequence() can ever return None...

@cmydd
Copy link
Author

cmydd commented Dec 21, 2024

def __termination_sequence(self) -> bytes:
    """Returns the termination byte sequence if it isn't defined."""
    # The termination sequence is actually not specified by ASAM
    # for A_BYTEFIELD but I assume it is only one byte.
    termination_sequence = b''
    if self.termination == "ZERO":
        if self.base_data_type not in [DataType.A_UNICODE2STRING]:
            termination_sequence = bytes([0x0])
        else:
            termination_sequence = bytes([0x0, 0x0])
    elif self.termination == "HEX-FF":
        if self.base_data_type not in [DataType.A_UNICODE2STRING]:
            termination_sequence = bytes([0xFF])
        else:
            termination_sequence = bytes([0xFF, 0xFF])
    return termination_sequence

if self.termination is "END-OF-PDU",__termination_sequence return None

e.g
DATA-OBJECT-PROP ID="DOP_BYTEFIELD0ToEOPBytes">
SHORT-NAME>DOP_BYTEFIELD0ToEOPBytes
LONG-NAME>BYTE FIELD 0 to EOP Bytes
DESC>
p>Bytefield beliebiger Länge (incl. 0 Bytes)


/DESC>
COMPU-METHOD>
CATEGORY>IDENTICAL
/COMPU-METHOD>
DIAG-CODED-TYPE xsi:type="MIN-MAX-LENGTH-TYPE" BASE-DATA-TYPE="A_BYTEFIELD" TERMINATION="END-OF-PDU">
MIN-LENGTH>0
/DIAG-CODED-TYPE>
PHYSICAL-TYPE BASE-DATA-TYPE="A_BYTEFIELD"/>
/DATA-OBJECT-PROP>

@cmydd
Copy link
Author

cmydd commented Dec 21, 2024

the is another issue
diaglayer.py
line 408
if not gnr_found:
raise e

if i have 3 service,One of them meets the conditions. It shouldn't be throwing an exception.

           if not gnr_found:
               continue

Whether it's correct or not

@andlaus
Copy link
Collaborator

andlaus commented Dec 21, 2024

if self.termination is "END-OF-PDU",__termination_sequence return None

doesn't it return an empty bytes object?

@andlaus
Copy link
Collaborator

andlaus commented Dec 21, 2024

if i have 3 service,One of them meets the conditions. It shouldn't be throwing an exception. [...] Whether it's correct or not

in this case, the telegram which you are trying to decode could not be interpreted by odxtools (neither as a request, nor as a response or as a global negative response). In my opinion, raising a DecodeError is well justified in this case. Most likely your ODX dataset is incomplete (i.e., does not describe all data which the ECU can send) or you are stumbling over some issues encountered during the decoding procedure and you are not using the non-strict mode.

@andlaus
Copy link
Collaborator

andlaus commented Dec 21, 2024

(as a work-around you can catch the exception in the code that calls .decode...)

@cmydd
Copy link
Author

cmydd commented Dec 23, 2024

thanks, I understand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants