einride/can-go

Marshall DBC frame for sending

nandra opened this issue · 2 comments

Hi,

Is there possibility with this library to create something similar like in python cantools:

db = cantools.database.load_file(my.dbc)
msg = db.get_message_by_name('My_SuperMessage')
data = msg.encode({'Sig1': int(1), 'Sig2': int(2)})
message = can.Message(is_extended_id=False, arbitration_id=msg.frame_id, data=data)
can_bus.send(message)

I found parsing method only for dbc but not encode or similar. Thanks.

I don't think we support that specific use case "out of the box" today @nandra

The main use case is to be able to read/write frames from/to socketcan and be able to generate code which allows you to work with the different types in Go.

You could probably hack something using the generated.Message interface but I doubt it will look as pretty as that

OK thanks for hint.