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

Fix #2519, Add runtime TopicId conversion routines to SB #2520

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

jphickey
Copy link
Contributor

Checklist (Please check before submitting)

Describe the contribution
Adds the following APIs to convert TopicID to MsgID values at runtime:

  • CFE_SB_CmdTopicIdToMsgId()
  • CFE_SB_TlmTopicIdToMsgId()
  • CFE_SB_GlobalCmdTopicIdToMsgId()
  • CFE_SB_GlobalTlmTopicIdToMsgId()
  • CFE_SB_LocalCmdTopicIdToMsgId()
  • CFE_SB_LocalTlmTopicIdToMsgId()

This includes coverage tests and stubs. If the config does not define the conversions, then these return the invalid msgID value.

Fixes #2519

Testing performed
Build and run all tests

Expected behavior changes
None (new APIs are not actively called by FSW, yet)

System(s) tested on
Debian

Additional context
EDS-based builds generally deal only in Topic IDs and convert to Msg IDs at runtime. These APIs are needed as a prerequisite to that model.

Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.

* relies on the run-time conversions.
*/

#ifndef CFE_PLATFORM_CMD_TOPICID_TO_MIDV

Check notice

Code scanning / CodeQL

Conditional compilation Note

Use of conditional compilation must be kept to a minimum.
#define CFE_PLATFORM_CMD_TOPICID_TO_MIDV(x) 0
#endif

#ifndef CFE_PLATFORM_TLM_TOPICID_TO_MIDV

Check notice

Code scanning / CodeQL

Conditional compilation Note

Use of conditional compilation must be kept to a minimum.
#define CFE_PLATFORM_TLM_TOPICID_TO_MIDV(x) 0
#endif

#ifndef CFE_GLOBAL_CMD_TOPICID_TO_MIDV

Check notice

Code scanning / CodeQL

Conditional compilation Note

Use of conditional compilation must be kept to a minimum.
#define CFE_GLOBAL_CMD_TOPICID_TO_MIDV(x) 0
#endif

#ifndef CFE_GLOBAL_TLM_TOPICID_TO_MIDV

Check notice

Code scanning / CodeQL

Conditional compilation Note

Use of conditional compilation must be kept to a minimum.
uint16 TopicId;
uint16 InstanceNum;

if (!UT_Stub_GetInt32StatusCode(Context, NULL))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning

This Boolean expression is not side-effect free.
* Generated stub function for CFE_SB_CmdTopicIdToMsgId()
* ----------------------------------------------------
*/
CFE_SB_MsgId_Atom_t CFE_SB_CmdTopicIdToMsgId(uint16 TopicId, uint16 InstanceNum)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
CFE_SB_MsgId_Atom_t CFE_SB_CmdTopicIdToMsgId(uint16 TopicId, uint16 InstanceNum)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
* Default handler for CFE_SB_TlmTopicIdToMsgId coverage stub function
*
*------------------------------------------------------------*/
void UT_DefaultHandler_CFE_SB_TlmTopicIdToMsgId(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
* to pass the "CFE_SB_IsValidMsgId()" test.
*
*------------------------------------------------------------*/
static void UT_CFE_SB_FabricateMsgIdValue(UT_EntryKey_t FuncKey, bool IsCmd, uint16 TopicId, uint16 InstanceNum)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
* Default handler for CFE_SB_CmdTopicIdToMsgId coverage stub function
*
*------------------------------------------------------------*/
void UT_DefaultHandler_CFE_SB_CmdTopicIdToMsgId(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
@jphickey jphickey added the CCB:Ready Ready for discussion at the Configuration Control Board (CCB) label Feb 27, 2024
Adds the following APIs to convert TopicID to MsgID values at runtime:

 - CFE_SB_CmdTopicIdToMsgId()
 - CFE_SB_TlmTopicIdToMsgId()
 - CFE_SB_GlobalCmdTopicIdToMsgId()
 - CFE_SB_GlobalTlmTopicIdToMsgId()
 - CFE_SB_LocalCmdTopicIdToMsgId()
 - CFE_SB_LocalTlmTopicIdToMsgId()

This includes coverage tests and stubs.  If the config does not define
the conversions, then these return the invalid msgID value.
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
size_t CFE_SB_MsgHdrSize(const CFE_MSG_Message_t *MsgPtr)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
@dzbaker dzbaker added CCB:Approved Indicates code review and approval by community CCB and removed CCB:Ready Ready for discussion at the Configuration Control Board (CCB) labels Feb 29, 2024
dzbaker added a commit to nasa/cFS that referenced this pull request Feb 29, 2024
*Combines:*

cFE equuleus-rc1+dev100
osal equuleus-rc1+dev58

**Includes:**

*cFE*
- nasa/cFE#2520

*osal*
- nasa/osal#1450

Co-authored by: Joseph Hickey <[email protected]>
@dzbaker dzbaker merged commit 7bf7962 into nasa:main Feb 29, 2024
22 checks passed
dzbaker added a commit to nasa/cFS that referenced this pull request Feb 29, 2024
*Combines:*

cFE equuleus-rc1+dev100
osal equuleus-rc1+dev58

**Includes:**

*cFE*
- nasa/cFE#2520

*osal*
- nasa/osal#1450

Co-authored by: Joseph Hickey <[email protected]>
@jphickey jphickey deleted the fix-2519-topicid-conversions branch March 6, 2024 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CCB:Approved Indicates code review and approval by community CCB enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add runtime TopicID -> MsgID conversions
3 participants