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

Either BASIC-STRUCTURE-REF or BASIC-STRUCTURE-SNREF is required for END-OF-PDU-FIELD #88

Merged
merged 4 commits into from
Nov 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions odxtools/endofpdufield.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2022 MBition GmbH

from typing import TYPE_CHECKING, Any, List, Union
from typing import TYPE_CHECKING, List, Union

from .utils import read_description_from_odx
from .odxlink import OdxLinkRef, OdxLinkId, OdxDocFragment, OdxLinkDatabase
Expand Down Expand Up @@ -119,13 +119,12 @@ def read_end_of_pdu_field_from_odx(et_element, doc_frags: List[OdxDocFragment])
description = read_description_from_odx(et_element.find("DESC"))

structure_ref = OdxLinkRef.from_et(et_element.find("BASIC-STRUCTURE-REF"), doc_frags)
assert structure_ref is not None
structure_snref = None

structure_snref = None
if et_element.find("BASIC-STRUCTURE-SNREF") is not None:
structure_ref = None
structure_snref = et_element.find(
"BASIC-STRUCTURE-SNREF").get("SHORT-NAME")
assert (structure_ref is not None) or (structure_snref is not None)

if et_element.find("ENV-DATA-DESC-REF") is not None:
structure_ref = OdxLinkRef.from_et(et_element.get("ENV-DATA-DESC-REF"), doc_frags)
Expand Down