c-coderdbc icon indicating copy to clipboard operation
c-coderdbc copied to clipboard

Default Attribute Values not applied

Open fmg-richard-pearman opened this issue 2 years ago • 1 comments

Hi @astand I noticed that some of the CycleTime values for my messages were not set. After further investigation it seems that BCD file has the following entry

////////////////////////////////
//                            //
//  Attribute Default Values  //
//                            //
////////////////////////////////

BA_DEF_DEF_  "GenSigCycleTime" 33;
BA_DEF_DEF_  "GenMsgCycleTime" 33;
BA_DEF_DEF_  "GenSigSendType" "NoSigSendType";
BA_DEF_DEF_  "GenMsgSendType" "Cyclic ";
BA_DEF_DEF_  "Component_Address_Type" "NO_COMPONENT_ADDRESS";
BA_DEF_DEF_  "Component_Address" 0;

I examining the code generator and parse code and these default attribute values so not look like they are being extracted and used in the code generation.

A quick and simple fix would be to scan for these defaults and set them in the message constructor (or simular method) before parsing the messages.

fmg-richard-pearman avatar Dec 05 '22 01:12 fmg-richard-pearman

Hi @fmg-richard-pearman, thanks for the feedback! Not sure if it should be fixed somehow. This default GenMsgCycleTime is not relevant in most cases - it is almost always necessary to set cycletime for every message in the database. For me it works like this: if the message's cycle time is important it should be set explicitly, if no - do not generate cycle time and use any value from user code level. The one thing which can be probably changed here - adding a new generation option to support applying default values if user expects this behavior. I will think about it

astand avatar Dec 05 '22 10:12 astand