From 294e6afc88675e59f0cdd4d5f7ce3405d0b91620 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Fri, 10 Sep 2021 17:04:58 -0400 Subject: [PATCH 1/2] Fix #153, apply CFE_SB_ValueToMsgId where required Whenever an integer value is used as a CFE_SB_MsgId_t, it should go through the explicit conversion using the supplied inline function. --- fsw/src/sample_app.c | 9 +++++---- unit-test/coveragetest/coveragetest_sample_app.c | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fsw/src/sample_app.c b/fsw/src/sample_app.c index 7c3e884..317d734 100644 --- a/fsw/src/sample_app.c +++ b/fsw/src/sample_app.c @@ -163,7 +163,8 @@ int32 SAMPLE_APP_Init(void) /* ** Initialize housekeeping packet (clear user data area). */ - CFE_MSG_Init(&SAMPLE_APP_Data.HkTlm.TlmHeader.Msg, SAMPLE_APP_HK_TLM_MID, sizeof(SAMPLE_APP_Data.HkTlm)); + CFE_MSG_Init(&SAMPLE_APP_Data.HkTlm.TlmHeader.Msg, CFE_SB_ValueToMsgId(SAMPLE_APP_HK_TLM_MID), + sizeof(SAMPLE_APP_Data.HkTlm)); /* ** Create Software Bus message pipe. @@ -178,7 +179,7 @@ int32 SAMPLE_APP_Init(void) /* ** Subscribe to Housekeeping request commands */ - status = CFE_SB_Subscribe(SAMPLE_APP_SEND_HK_MID, SAMPLE_APP_Data.CommandPipe); + status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(SAMPLE_APP_SEND_HK_MID), SAMPLE_APP_Data.CommandPipe); if (status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("Sample App: Error Subscribing to HK request, RC = 0x%08lX\n", (unsigned long)status); @@ -188,7 +189,7 @@ int32 SAMPLE_APP_Init(void) /* ** Subscribe to ground command packets */ - status = CFE_SB_Subscribe(SAMPLE_APP_CMD_MID, SAMPLE_APP_Data.CommandPipe); + status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(SAMPLE_APP_CMD_MID), SAMPLE_APP_Data.CommandPipe); if (status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("Sample App: Error Subscribing to Command, RC = 0x%08lX\n", (unsigned long)status); @@ -233,7 +234,7 @@ void SAMPLE_APP_ProcessCommandPacket(CFE_SB_Buffer_t *SBBufPtr) CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MsgId); - switch (MsgId) + switch (CFE_SB_MsgIdToValue(MsgId)) { case SAMPLE_APP_CMD_MID: SAMPLE_APP_ProcessGroundCommand(SBBufPtr); diff --git a/unit-test/coveragetest/coveragetest_sample_app.c b/unit-test/coveragetest/coveragetest_sample_app.c index f6396e7..7f35eaa 100644 --- a/unit-test/coveragetest/coveragetest_sample_app.c +++ b/unit-test/coveragetest/coveragetest_sample_app.c @@ -292,7 +292,7 @@ void Test_SAMPLE_APP_ProcessCommandPacket(void) * The CFE_MSG_GetMsgId() stub uses a data buffer to hold the * message ID values to return. */ - TestMsgId = SAMPLE_APP_CMD_MID; + TestMsgId = CFE_SB_ValueToMsgId(SAMPLE_APP_CMD_MID); FcnCode = SAMPLE_APP_NOOP_CC; MsgSize = sizeof(TestMsg.Noop); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); @@ -300,7 +300,7 @@ void Test_SAMPLE_APP_ProcessCommandPacket(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &MsgSize, sizeof(MsgSize), false); SAMPLE_APP_ProcessCommandPacket(&TestMsg.SBBuf); - TestMsgId = SAMPLE_APP_SEND_HK_MID; + TestMsgId = CFE_SB_ValueToMsgId(SAMPLE_APP_SEND_HK_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); SAMPLE_APP_ProcessCommandPacket(&TestMsg.SBBuf); From a6b839d93ab93791634b2383906aa60a658a692f Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Tue, 21 Sep 2021 22:01:11 -0400 Subject: [PATCH 2/2] IC:2021-09-21, v1.2.0-rc1+dev73 --- README.md | 4 ++++ fsw/src/sample_app_version.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 29b8fe4..75cf58e 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,10 @@ sample_app is an example for how to build and link an application in cFS. See al ## Version History +### Development Build: v1.2.0-rc1+dev73 + +- Apply CFE_SB_ValueToMsgId where required +- See and ### Development Build: v1.2.0-rc1+dev66 - Implement Coding Standard in CodeQL workflow diff --git a/fsw/src/sample_app_version.h b/fsw/src/sample_app_version.h index dbd8226..b75940a 100644 --- a/fsw/src/sample_app_version.h +++ b/fsw/src/sample_app_version.h @@ -31,7 +31,7 @@ /* Development Build Macro Definitions */ -#define SAMPLE_APP_BUILD_NUMBER 66 /*!< Development Build: Number of commits since baseline */ +#define SAMPLE_APP_BUILD_NUMBER 73 /*!< Development Build: Number of commits since baseline */ #define SAMPLE_APP_BUILD_BASELINE \ "v1.2.0-rc1" /*!< Development Build: git tag that is the base for the current development */