EFeru / DbcParser

.NET CAN bus dbc file parser
MIT License
76 stars 28 forks source link

EnumCustomProperty value is defined as integer index in dbc file #47

Closed Brainy0207 closed 1 year ago

Brainy0207 commented 1 year ago

I copied the relevant lines from a sample J1939 file:

BO_ 2364540158 EEC1: 8 Vector__XXX
 SG_ EngineSpeed : 24|16@1+ (0.125,0) [0|8031.875] "rpm" Vector__XXX

BA_DEF_ BO_  "VFrameFormat" ENUM  "StandardCAN","ExtendedCAN","reserved","J1939PG";

BA_DEF_DEF_  "VFrameFormat" "J1939PG";

BA_ "VFrameFormat" BO_ 2364540158 3;

It seems the enum value for the message is specified by an integer index into the enum definition. The current implementation just assumes a string value and copies the index as value into the property.

I couldn't find any solid information how enum values are supposed to be specified, but this is the way CANdb++ writes the dbc file. I will try to provide a PR to handle this correctly.