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

Improve consistency in application of CFE_SB_MsgIdToValue/ValueToMsgId conversions #1945

Closed
jphickey opened this issue Sep 10, 2021 · 0 comments · Fixed by #1974 or #2001
Closed

Improve consistency in application of CFE_SB_MsgIdToValue/ValueToMsgId conversions #1945

jphickey opened this issue Sep 10, 2021 · 0 comments · Fixed by #1974 or #2001
Assignees
Milestone

Comments

@jphickey
Copy link
Contributor

Is your feature request related to a problem? Please describe.
A CFE_SB_MsgId_t value, like other IDs, is supposed to be a unique type/opaque value that identifies a message within the SB application context. Although it is currently implemented using an integer (uint32 specifically) application should not assume this. Instead, a set of macros and inline conversion functions (CFE_SB_MsgIdToValue and CFE_SB_ValueToMsgId) are provided for when the application needs to interpret the value as an integer for a valid purpose.

However, since use of this conversion is not currently enforced - there is no config option that makes MsgId into a strict type, as there is for ResourceID - so much of the newly-added code such as tests and apps, didn't completely apply it.

Describe the solution you'd like
Add conversions where they are currently missing

Describe alternatives you've considered
Preferably, the MID constants should be defined directly as a CFE_SB_MsgId_t type value, which would eliminate the need for conversions all over the runtime code. However, this breaks the switch/case paradigm used when dispatching - a case label needs to be an integer value. So although this would yield cleaner code it does have a bigger backward compatibility impact which is why it was avoided for Caelum.

Requester Info
Joseph Hickey, Vantage Systems, Inc.

@jphickey jphickey self-assigned this Sep 10, 2021
jphickey added a commit to jphickey/cFE that referenced this issue Sep 22, 2021
Correct code that was not correctly using the CFE_SB_ValueToMsgId or
CFE_SB_MsgIdToValue conversion wrappers where required to do so. This
should be used whenever the value is intentionally converted to/from
an integer.  The CFE_SB_MsgId_t type should not be assumed to be
an integer in nature.
jphickey added a commit to jphickey/cFE that referenced this issue Sep 22, 2021
Correct code that was not correctly using the CFE_SB_ValueToMsgId or
CFE_SB_MsgIdToValue conversion wrappers where required to do so. This
should be used whenever the value is intentionally converted to/from
an integer.  The CFE_SB_MsgId_t type should not be assumed to be
an integer in nature.
@astrogeco astrogeco self-assigned this Oct 28, 2021
@skliper skliper added this to the Draco milestone Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment