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

Fix: Assign fixed port IDs for DSDL wrappers which have a fixed port ID assigned #99

Closed
aentinger opened this issue Feb 24, 2021 · 5 comments
Labels
help wanted Assistance from the community is especially welcome. topic: firmware Code that runs on an embedded system. type: enhancement PR to improve the project.

Comments

@aentinger
Copy link
Member

aentinger commented Feb 24, 2021

All existing DSDL wrappers stored in src/wrappers need to be checked against the DSDL specification in public_regulated_data_types. Any type that has a fixed-port ID (can be identified by a number prefixed to the type name), e.g. 409.Write.1.0.uavcan, the corresponding wrapper need to be modified as shown below:

-template <CanardPortID ID>
+template <CanardPortID ID = uavcan_file_Write_1_0_FIXED_PORT_ID_>
class Request
{
...
-template <CanardPortID ID>
+template <CanardPortID ID = uavcan_file_Write_1_0_FIXED_PORT_ID_>
class Response
{
...
@aentinger aentinger added help wanted Assistance from the community is especially welcome. topic: firmware Code that runs on an embedded system. type: enhancement PR to improve the project. labels Feb 24, 2021
@pavel-kirienko
Copy link
Member

One might want to use a type with a fixed port-ID over a non-fixed port. Why don't you just say template <CanardPortID ID = uavcan_file_Write_1_0_FIXED_PORT_ID_>?

@aentinger
Copy link
Member Author

This would work 👍 My only gripe is that the whole template concept is not future-proof when it comes to changing ports via register API during runtime. You've got a smart way out of that? (I wanted to address it only after fixing this).

@pavel-kirienko
Copy link
Member

You've got a smart way out of that?

Ah yes. Irrespective of my above comment, templates shouldn't be used here at all because port-IDs are not meant to be hard-coded.

@aentinger
Copy link
Member Author

I'll update above comment with your suggestions and let's fix the hard-coded port-id another time ;)

@aentinger
Copy link
Member Author

Fixed by #109.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Assistance from the community is especially welcome. topic: firmware Code that runs on an embedded system. type: enhancement PR to improve the project.
Projects
None yet
Development

No branches or pull requests

2 participants