Skip to content

Implement support for the VEHICLE-INFORMATION-SPEC category #436

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

Merged
merged 4 commits into from
Jul 10, 2025

Conversation

andlaus
Copy link
Member

@andlaus andlaus commented Jul 7, 2025

VEHICLE-INFORMATION-SPEC is used to describe how a given vehicle can be identified in a semi-automatic way. Also, it describes the vehicle's network topology, i.e., how communication with the vehicle's ECUs can be achieved for networking architectures involving gateways. This is described in section 7.3.10 of the ASAM version of the standard.

Andreas Lauser <[email protected]>, on behalf of MBition GmbH.
Provider Information

andlaus added 3 commits July 7, 2025 12:14
`VEHICLE-INFORMATION-SPEC` is used to describe how a given vehicle can
be identified in a semi-automatic way. Also, it describes the
vehicle's network topology, i.e., how communication with the vehicle's
ECUs can be achieved for networking architectures involving
gateways. This is described in section 7.3.10 of the ASAM version of
the standard.

Signed-off-by: Andreas Lauser <[email protected]>
Approved-by: Michael Hahn <[email protected]>
Signed-off-by: Andreas Lauser <[email protected]>
Approved-by: Michael Hahn <[email protected]>
Signed-off-by: Andreas Lauser <[email protected]>
Approved-by: Michael Hahn <[email protected]>
@andlaus andlaus requested a review from kayoub5 July 7, 2025 10:17

doc_frags = (OdxDocFragment(doc_name="vehicle_info_test", doc_type=DocType.VEHICLE_INFO_SPEC),)

vehicle_info_spec_xml_str = """<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to move it to its own file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to keep the unit tests as self contained as possible. The tests for flashing, variant coding and multiple ecu jobs follow the same pattern..

vehicle_info_spec_tpl = jinja_env.get_template("vehicle_info_spec.odx-v.xml.jinja2")
for vehicle_info_spec in database.vehicle_info_specs:
zf_file_name = f"{vehicle_info_spec.short_name}.odx-v"
zf_file_cdate = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need to re-create the date each time?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean the need to call strftime() or the fact that it always uses datetime.now()?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line zf_file_cdate = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S") can be moved out of the for loop

Copy link
Member Author

@andlaus andlaus Jul 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in principle yes, but since the loop body deals with the file in question and this does not come with performance implications, the loop body should handle all properties related to the current file IMO. (also, this makes it easier to handle the dates of individual files if we ever decided to keep track of them...)



@dataclass(kw_only=True)
class ModelYear(InfoComponent):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks wrong, sub-classing InfoComponent each time, without added value

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the added value is that isinstance() can be used to distinguish these objects and thus it is much clearer to ensure that stuff like ECU-CONFIG-REF points to an EcuConfig object. (I thought about using type aliases like the derivatives of ValidityFor, but IMO using a separate class is better for the mentioned reasons and it should be considered to change the ValidityFor family to use separate classes as well.)

we tried to print the enum object which could not be created which means that the snake ate its own tail...

thanks to [at]kayoub5 for pointing this out.

Signed-off-by: Andreas Lauser <[email protected]>
@andlaus andlaus force-pushed the vehicle_info_spec branch from d1d12be to dd9e133 Compare July 7, 2025 12:24
@andlaus
Copy link
Member Author

andlaus commented Jul 10, 2025

@kayoub5: do you still see any showstoppers here?

@kayoub5
Copy link
Collaborator

kayoub5 commented Jul 10, 2025

@kayoub5: do you still see any showstoppers here?

Nothing else from my side

@andlaus
Copy link
Member Author

andlaus commented Jul 10, 2025

okay, let's merge this then. thanks for your review!

@andlaus andlaus merged commit 4c64bd7 into mercedes-benz:main Jul 10, 2025
7 checks passed
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

Successfully merging this pull request may close these issues.

2 participants