Skip to content

Commit

Permalink
Fix nasa#59, Apply consistent Event ID names to common events
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Mar 12, 2023
1 parent 9d3daa7 commit d5e14af
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions fsw/inc/fm_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* This event message is issued after the File Manager application has
* successfully completed startup initialization.
*/
#define FM_STARTUP_EID 1
#define FM_INIT_INF_EID 1

/**
* \brief FM Initialization Register For Event Services Failed Event ID
Expand Down Expand Up @@ -71,7 +71,7 @@
* This is a fatal error that will cause the File Manager application
* to terminate.
*/
#define FM_STARTUP_CREAT_PIPE_ERR_EID 3
#define FM_CR_PIPE_ERR_EID 3

/**
* \brief FM Initialization Subscribe to HK Request Failed Event ID
Expand Down Expand Up @@ -188,7 +188,7 @@
* This event message is generated upon receipt of a housekeeping
* request command packet with an invalid length.
*/
#define FM_HK_REQ_ERR_EID 11
#define FM_HKREQ_LEN_ERR_EID 11

/**
* \brief FM No-op Command Event ID
Expand All @@ -200,7 +200,7 @@
* This event message signals the successful completion of a
* /FM_Noop command.
*/
#define FM_NOOP_CMD_EID 12
#define FM_NOOP_INF_EID 12

/**
* \brief FM No-op Command Length Invalid Event ID
Expand All @@ -227,7 +227,7 @@
* This event message signals the successful completion of a
* /FM_ResetCtrs command.
*/
#define FM_RESET_CMD_EID 14
#define FM_RESET_INF_EID 14

/**
* \brief FM Reset Counters Command Length Invalid Event ID
Expand Down
4 changes: 2 additions & 2 deletions fsw/inc/fm_msgdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* #FM_NoopCmd_t
*
* \par Command Success Verification
* - Informational event #FM_NOOP_CMD_EID will be sent
* - Informational event #FM_NOOP_INF_EID will be sent
* - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment
*
* \par Command Error Conditions
Expand Down Expand Up @@ -75,7 +75,7 @@
*
* \par Command Success Verification
* - Command counters will be set to zero (see description)
* - Debug event #FM_RESET_CMD_EID will be sent
* - Debug event #FM_RESET_INF_EID will be sent
*
* \par Command Error Conditions
* - Invalid command packet length
Expand Down
8 changes: 4 additions & 4 deletions fsw/src/fm_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ int32 FM_AppInit(void)
Result = CFE_SB_CreatePipe(&FM_GlobalData.CmdPipe, FM_APP_PIPE_DEPTH, FM_APP_PIPE_NAME);
if (Result != CFE_SUCCESS)
{
CFE_EVS_SendEvent(FM_STARTUP_CREAT_PIPE_ERR_EID, CFE_EVS_EventType_ERROR,
"%s create SB input pipe: result = 0x%08X", ErrText, (unsigned int)Result);
CFE_EVS_SendEvent(FM_CR_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, "%s create SB input pipe: result = 0x%08X",
ErrText, (unsigned int)Result);
}
else
{
Expand Down Expand Up @@ -229,7 +229,7 @@ int32 FM_AppInit(void)
FM_ChildInit();

/* Application startup event message */
CFE_EVS_SendEvent(FM_STARTUP_EID, CFE_EVS_EventType_INFORMATION,
CFE_EVS_SendEvent(FM_INIT_INF_EID, CFE_EVS_EventType_INFORMATION,
"Initialization complete: version %d.%d.%d.%d", FM_MAJOR_VERSION, FM_MINOR_VERSION,
FM_REVISION, FM_MISSION_REV);
}
Expand Down Expand Up @@ -394,7 +394,7 @@ void FM_SendHkCmd(const CFE_SB_Buffer_t *BufPtr)
FM_HousekeepingPkt_Payload_t *PayloadPtr;

/* Verify command packet length */
Result = FM_IsValidCmdPktLength(CFE_MSG_PTR(*BufPtr), sizeof(FM_SendHkCmd_t), FM_HK_REQ_ERR_EID, CmdText);
Result = FM_IsValidCmdPktLength(CFE_MSG_PTR(*BufPtr), sizeof(FM_SendHkCmd_t), FM_HKREQ_LEN_ERR_EID, CmdText);

if (Result == true)
{
Expand Down
4 changes: 2 additions & 2 deletions fsw/src/fm_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ bool FM_NoopCmd(const CFE_SB_Buffer_t *BufPtr)
/* Send command completion event (info) */
if (CommandResult == true)
{
CFE_EVS_SendEvent(FM_NOOP_CMD_EID, CFE_EVS_EventType_INFORMATION, "%s command: FM version %d.%d.%d.%d", CmdText,
CFE_EVS_SendEvent(FM_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "%s command: FM version %d.%d.%d.%d", CmdText,
FM_MAJOR_VERSION, FM_MINOR_VERSION, FM_REVISION, FM_MISSION_REV);
}

Expand Down Expand Up @@ -96,7 +96,7 @@ bool FM_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr)
FM_GlobalData.ChildCmdWarnCounter = 0;

/* Send command completion event (debug) */
CFE_EVS_SendEvent(FM_RESET_CMD_EID, CFE_EVS_EventType_DEBUG, "%s command", CmdText);
CFE_EVS_SendEvent(FM_RESET_INF_EID, CFE_EVS_EventType_DEBUG, "%s command", CmdText);
}

return CommandResult;
Expand Down
6 changes: 3 additions & 3 deletions unit-test/fm_app_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void Test_FM_AppMain_SBReceiveBufferDefaultOption(void)
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 3);
UtAssert_STUB_COUNT(CFE_ES_ExitApp, 1);
UtAssert_STUB_COUNT(CFE_SB_ReceiveBuffer, 1);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_STARTUP_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_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, FM_SB_RECEIVE_ERR_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventType, CFE_EVS_EventType_ERROR);
Expand Down Expand Up @@ -260,7 +260,7 @@ void Test_FM_AppInit_CreatePipeFail(void)
UtAssert_STUB_COUNT(CFE_EVS_Register, 1);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
UtAssert_STUB_COUNT(CFE_SB_CreatePipe, 1);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_STARTUP_CREAT_PIPE_ERR_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_CR_PIPE_ERR_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
}

Expand Down Expand Up @@ -340,7 +340,7 @@ void Test_FM_AppInit_TableInitSuccess(void)
UtAssert_STUB_COUNT(CFE_SB_CreatePipe, 1);
UtAssert_STUB_COUNT(CFE_SB_Subscribe, 2);
UtAssert_STUB_COUNT(FM_ChildInit, 1);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_STARTUP_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_INIT_INF_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);
}

Expand Down
4 changes: 2 additions & 2 deletions unit-test/fm_cmds_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void Test_FM_NoopCmd_Success(void)

UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1);

UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_NOOP_CMD_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_NOOP_INF_EID);

UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);

Expand Down Expand Up @@ -133,7 +133,7 @@ void Test_FM_ResetCountersCmd_Success(void)

UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1);

UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_RESET_CMD_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_RESET_INF_EID);

UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_DEBUG);

Expand Down

0 comments on commit d5e14af

Please sign in to comment.