dbc-codegen icon indicating copy to clipboard operation
dbc-codegen copied to clipboard

Added an id method to all message structs

Open JoNil opened this issue 1 year ago • 2 comments
trafficstars

JoNil avatar May 08 '24 12:05 JoNil

What's the value of this over accessing the public constant?

I can't speak for @JoNil, but what I was hoping to work towards is defining a trait over all messages that lets you access message_id and raw. With a goal to writing code in my project like a send<impl that_trait>(&msg) function that sends an arbitrary message struct to a CAN controller, for example.

projectgus avatar May 13 '24 23:05 projectgus

That’s a good idea, I’d merge in this trait :) this will add a teeny tiny bit of a runtime crate though which we’d need to add as a dependency. (Reminds me of #35)

On Tue, 14 May 2024 at 01:09, Angus Gratton @.***> wrote:

What's the value of this over accessing the public constant?

I can't speak for @JoNil https://github.com/JoNil, but what I was hoping to work towards is defining a trait over all messages that lets you access message_id and raw. With a goal to building things like a send(&msg) function that sends an arbitrary message struct to a CAN controller, for example.

— Reply to this email directly, view it on GitHub https://github.com/technocreatives/dbc-codegen/pull/71#issuecomment-2108956039, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAE4XZ4XRNXABIMXDIHHQTZCFB4NAVCNFSM6AAAAABHM5RWXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBYHE2TMMBTHE . You are receiving this because you commented.Message ID: @.***>

killercup avatar May 14 '24 05:05 killercup

#82 adds impls for embedded_can::Frame which has an id method. I'll go with that one :)

killercup avatar Aug 20 '24 10:08 killercup