From e90051e221c462b8cf0409253a677e0df8459947 Mon Sep 17 00:00:00 2001 From: Avi Date: Fri, 21 Oct 2022 18:19:48 +1000 Subject: [PATCH] Fix #50, Apply consistent Event ID names to common events --- fsw/src/hs_app.c | 4 ++-- fsw/src/hs_cmds.c | 2 +- fsw/src/hs_events.h | 8 ++++---- fsw/src/hs_msgdefs.h | 26 +++++++++++++------------- fsw/src/hs_utils.c | 2 +- fsw/src/hs_utils.h | 2 +- unit-test/hs_app_tests.c | 22 +++++++++++----------- unit-test/hs_cmds_tests.c | 2 +- unit-test/hs_utils_tests.c | 2 +- 9 files changed, 35 insertions(+), 35 deletions(-) diff --git a/fsw/src/hs_app.c b/fsw/src/hs_app.c index 5c5caf9..719699f 100644 --- a/fsw/src/hs_app.c +++ b/fsw/src/hs_app.c @@ -334,7 +334,7 @@ int32 HS_AppInit(void) /* ** Application initialization event */ - CFE_EVS_SendEvent(HS_INIT_EID, CFE_EVS_EventType_INFORMATION, "HS Initialized. Version %d.%d.%d.%d", + CFE_EVS_SendEvent(HS_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "HS Initialized. Version %d.%d.%d.%d", HS_MAJOR_VERSION, HS_MINOR_VERSION, HS_REVISION, HS_MISSION_REV); return Status; @@ -356,7 +356,7 @@ int32 HS_SbInit(void) Status = CFE_SB_CreatePipe(&HS_AppData.CmdPipe, HS_CMD_PIPE_DEPTH, HS_CMD_PIPE_NAME); if (Status != CFE_SUCCESS) { - CFE_EVS_SendEvent(HS_CR_CMD_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, "Error Creating SB Command Pipe,RC=0x%08X", + CFE_EVS_SendEvent(HS_CR_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, "Error Creating SB Command Pipe,RC=0x%08X", (unsigned int)Status); return Status; } diff --git a/fsw/src/hs_cmds.c b/fsw/src/hs_cmds.c index 89f32b4..6102735 100644 --- a/fsw/src/hs_cmds.c +++ b/fsw/src/hs_cmds.c @@ -330,7 +330,7 @@ void HS_ResetCmd(const CFE_SB_Buffer_t *BufPtr) { HS_ResetCounters(); - CFE_EVS_SendEvent(HS_RESET_DBG_EID, CFE_EVS_EventType_DEBUG, "Reset counters command"); + CFE_EVS_SendEvent(HS_RESET_INF_EID, CFE_EVS_EventType_DEBUG, "Reset counters command"); } } diff --git a/fsw/src/hs_events.h b/fsw/src/hs_events.h index e9243fb..6442b4d 100644 --- a/fsw/src/hs_events.h +++ b/fsw/src/hs_events.h @@ -39,7 +39,7 @@ * This event message is issued when the CFS Health and Safety has * completed initialization. */ -#define HS_INIT_EID 1 +#define HS_INIT_INF_EID 1 /** * \brief HS Application Fatal Termination Event ID @@ -76,7 +76,7 @@ * is unable to create its command pipe via the #CFE_SB_CreatePipe * API */ -#define HS_CR_CMD_PIPE_ERR_EID 4 +#define HS_CR_PIPE_ERR_EID 4 /** * \brief HS Create Software Bus Event Pipe Failed Event ID @@ -297,7 +297,7 @@ * This event message is issued when a ground command message is received * with a message length that doesn't match the expected value. */ -#define HS_LEN_ERR_EID 22 +#define HS_CMD_LEN_ERR_EID 22 /** * \brief HS No-op Command Event ID @@ -320,7 +320,7 @@ * This event message is issued when a reset counters command has * been received. */ -#define HS_RESET_DBG_EID 24 +#define HS_RESET_INF_EID 24 /** * \brief HS Enable Application Monitoring Command Event ID diff --git a/fsw/src/hs_msgdefs.h b/fsw/src/hs_msgdefs.h index 1cd758d..69c54f6 100644 --- a/fsw/src/hs_msgdefs.h +++ b/fsw/src/hs_msgdefs.h @@ -88,7 +88,7 @@ * * \par Evidence of failure may be found in the following telemetry: * - #HS_HkPacket_t.CmdErrCount will increment - * - Error specific event message #HS_LEN_ERR_EID + * - Error specific event message #HS_CMD_LEN_ERR_EID * * \par Criticality * None @@ -110,7 +110,7 @@ * Successful execution of this command may be verified with * the following telemetry: * - #HS_HkPacket_t.CmdCount will be cleared - * - The #HS_RESET_DBG_EID debug event message will be + * - The #HS_RESET_INF_EID debug event message will be * generated when the command is executed * * \par Error Conditions @@ -119,7 +119,7 @@ * * \par Evidence of failure may be found in the following telemetry: * - #HS_HkPacket_t.CmdErrCount will increment - * - Error specific event message #HS_LEN_ERR_EID + * - Error specific event message #HS_CMD_LEN_ERR_EID * * \par Criticality * None @@ -151,7 +151,7 @@ * * \par Evidence of failure may be found in the following telemetry: * - #HS_HkPacket_t.CmdErrCount will increment - * - Error specific event message #HS_LEN_ERR_EID + * - Error specific event message #HS_CMD_LEN_ERR_EID * * \par Criticality * None @@ -183,7 +183,7 @@ * * \par Evidence of failure may be found in the following telemetry: * - #HS_HkPacket_t.CmdErrCount will increment - * - Error specific event message #HS_LEN_ERR_EID + * - Error specific event message #HS_CMD_LEN_ERR_EID * * \par Criticality * None @@ -215,7 +215,7 @@ * * \par Evidence of failure may be found in the following telemetry: * - #HS_HkPacket_t.CmdErrCount will increment - * - Error specific event message #HS_LEN_ERR_EID + * - Error specific event message #HS_CMD_LEN_ERR_EID * * \par Criticality * None @@ -247,7 +247,7 @@ * * \par Evidence of failure may be found in the following telemetry: * - #HS_HkPacket_t.CmdErrCount will increment - * - Error specific event message #HS_LEN_ERR_EID + * - Error specific event message #HS_CMD_LEN_ERR_EID * * \par Criticality * None @@ -279,7 +279,7 @@ * * \par Evidence of failure may be found in the following telemetry: * - #HS_HkPacket_t.CmdErrCount will increment - * - Error specific event message #HS_LEN_ERR_EID + * - Error specific event message #HS_CMD_LEN_ERR_EID * * \par Criticality * None @@ -311,7 +311,7 @@ * * \par Evidence of failure may be found in the following telemetry: * - #HS_HkPacket_t.CmdErrCount will increment - * - Error specific event message #HS_LEN_ERR_EID + * - Error specific event message #HS_CMD_LEN_ERR_EID * * \par Criticality * None @@ -343,7 +343,7 @@ * * \par Evidence of failure may be found in the following telemetry: * - #HS_HkPacket_t.CmdErrCount will increment - * - Error specific event message #HS_LEN_ERR_EID + * - Error specific event message #HS_CMD_LEN_ERR_EID * * \par Criticality * None @@ -375,7 +375,7 @@ * * \par Evidence of failure may be found in the following telemetry: * - #HS_HkPacket_t.CmdErrCount will increment - * - Error specific event message #HS_LEN_ERR_EID + * - Error specific event message #HS_CMD_LEN_ERR_EID * * \par Criticality * None @@ -407,7 +407,7 @@ * * \par Evidence of failure may be found in the following telemetry: * - #HS_HkPacket_t.CmdErrCount will increment - * - Error specific event message #HS_LEN_ERR_EID + * - Error specific event message #HS_CMD_LEN_ERR_EID * * \par Criticality * None @@ -439,7 +439,7 @@ * * \par Evidence of failure may be found in the following telemetry: * - #HS_HkPacket_t.CmdErrCount will increment - * - Error specific event message #HS_LEN_ERR_EID + * - Error specific event message #HS_CMD_LEN_ERR_EID * * \par Criticality * None diff --git a/fsw/src/hs_utils.c b/fsw/src/hs_utils.c index 52b94aa..c40b181 100644 --- a/fsw/src/hs_utils.c +++ b/fsw/src/hs_utils.c @@ -71,7 +71,7 @@ bool HS_VerifyMsgLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength) /* ** All other cases, increment error counter */ - CFE_EVS_SendEvent(HS_LEN_ERR_EID, CFE_EVS_EventType_ERROR, + CFE_EVS_SendEvent(HS_CMD_LEN_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid msg length: ID = 0x%08lX, CC = %d, Len = %d, Expected = %d", (unsigned long)CFE_SB_MsgIdToValue(MessageID), (int)CommandCode, (int)ActualLength, (int)ExpectedLength); diff --git a/fsw/src/hs_utils.h b/fsw/src/hs_utils.h index 50e1d65..bdd3c57 100644 --- a/fsw/src/hs_utils.h +++ b/fsw/src/hs_utils.h @@ -47,7 +47,7 @@ * \retval true Length matches expected * \retval false Length does not match expected * - * \sa #HS_LEN_ERR_EID + * \sa #HS_CMD_LEN_ERR_EID */ bool HS_VerifyMsgLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength); diff --git a/unit-test/hs_app_tests.c b/unit-test/hs_app_tests.c index cac38ef..82ff96e 100644 --- a/unit-test/hs_app_tests.c +++ b/unit-test/hs_app_tests.c @@ -300,7 +300,7 @@ void HS_AppMain_Test_NominalRcvMsgError(void) UtAssert_True(HS_AppData.EventsMonitoredCount == 1, "HS_AppData.EventsMonitoredCount == 1"); /* Verify results */ - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_INIT_EID); + UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_INIT_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventID, HS_APP_EXIT_EID); @@ -421,7 +421,7 @@ void HS_AppMain_Test_SBSubscribeEVSLongError(void) UtAssert_True(call_count_CFE_EVS_SendEvent == 3, "CFE_EVS_SendEvent was called %u time(s), expected 3", call_count_CFE_EVS_SendEvent); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_INIT_EID); + UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_INIT_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventID, HS_SUB_LONG_EVS_ERR_EID); @@ -472,7 +472,7 @@ void HS_AppMain_Test_SBSubscribeEVSShortError(void) HS_AppMain(); /* Verify results */ - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_INIT_EID); + UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_INIT_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventID, HS_SUB_SHORT_EVS_ERR_EID); @@ -557,7 +557,7 @@ void HS_AppMain_Test_StateDisabled(void) HS_AppMain(); /* Verify results */ - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_INIT_EID); + UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_INIT_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); @@ -734,7 +734,7 @@ void HS_AppInit_Test_CorruptCDSResetsPerformed(void) UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventID, HS_INIT_EID); + UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventID, HS_INIT_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventType, CFE_EVS_EventType_INFORMATION); strCmpResult = @@ -866,7 +866,7 @@ void HS_AppInit_Test_CorruptCDSNoEvent(void) UtAssert_True(HS_AppData.CurrentCPUHogState == HS_CPUHOG_DEFAULT_STATE, "HS_AppData.CurrentCPUHogState == HS_CPUHOG_DEFAULT_STATE"); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_INIT_EID); + UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_INIT_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); @@ -914,7 +914,7 @@ void HS_AppInit_Test_RestoreCDSError(void) UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventID, HS_INIT_EID); + UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventID, HS_INIT_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventType, CFE_EVS_EventType_INFORMATION); strCmpResult = @@ -970,7 +970,7 @@ void HS_AppInit_Test_DisableSavingToCDS(void) UtAssert_True(HS_AppData.CurrentCPUHogState == HS_CPUHOG_DEFAULT_STATE, "HS_AppData.CurrentCPUHogState == HS_CPUHOG_DEFAULT_STATE"); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_INIT_EID); + UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_INIT_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); strCmpResult = strncmp(ExpectedEventString[0], context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); @@ -1027,7 +1027,7 @@ void HS_AppInit_Test_SBInitError(void) /* This event message is not generated directly by the function under test, but it's useful to check for it to * ensure that an SB init error occurred rather than a TBL init error */ - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_CR_CMD_PIPE_ERR_EID); + UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_CR_PIPE_ERR_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); strCmpResult = strncmp(ExpectedEventString[0], context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); @@ -1188,7 +1188,7 @@ void HS_SbInit_Test_CreateSBCmdPipeError(void) UT_SetDataBuffer(UT_KEY(CFE_SB_CreatePipe), &PipeId, sizeof(PipeId), false); UT_SetDataBuffer(UT_KEY(CFE_SB_CreatePipe), &PipeId, sizeof(PipeId), false); - /* Set CFE_SB_CreatePipe to return -1 on first call, to generate error HS_CR_CMD_PIPE_ERR_EID */ + /* Set CFE_SB_CreatePipe to return -1 on first call, to generate error HS_CR_PIPE_ERR_EID */ UT_SetDeferredRetcode(UT_KEY(CFE_SB_CreatePipe), 1, -1); /* Execute the function being tested */ @@ -1199,7 +1199,7 @@ void HS_SbInit_Test_CreateSBCmdPipeError(void) UtAssert_BOOL_FALSE(CFE_RESOURCEID_TEST_DEFINED(HS_AppData.EventPipe)); UtAssert_BOOL_FALSE(CFE_RESOURCEID_TEST_DEFINED(HS_AppData.WakeupPipe)); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_CR_CMD_PIPE_ERR_EID); + UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_CR_PIPE_ERR_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); strCmpResult = diff --git a/unit-test/hs_cmds_tests.c b/unit-test/hs_cmds_tests.c index b9ccc2f..4493371 100644 --- a/unit-test/hs_cmds_tests.c +++ b/unit-test/hs_cmds_tests.c @@ -1570,7 +1570,7 @@ void HS_ResetCmd_Test(void) /* Verify results */ UtAssert_True(HS_AppData.CmdCount == 0, "HS_AppData.CmdCount == 0"); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_RESET_DBG_EID); + UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_RESET_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_DEBUG); strCmpResult = diff --git a/unit-test/hs_utils_tests.c b/unit-test/hs_utils_tests.c index 69990ba..7fd5dc5 100644 --- a/unit-test/hs_utils_tests.c +++ b/unit-test/hs_utils_tests.c @@ -141,7 +141,7 @@ void HS_VerifyMsgLength_Test_LengthErrorNonHK(void) UtAssert_True(HS_AppData.CmdErrCount == 1, "HS_AppData.CmdErrCount == 1"); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_LEN_ERR_EID); + UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, HS_CMD_LEN_ERR_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); strCmpResult =