Skip to content

Commit

Permalink
Merge pull request #61 from thnkslprpt/fix-60-apply-consistent-event-…
Browse files Browse the repository at this point in the history
…id-names

Fix #60, Apply consistent Event ID names to common events
  • Loading branch information
dzbaker authored Jul 15, 2024
2 parents c83933f + 012ec36 commit 8647f3d
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions fsw/inc/ds_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* This event message is issued if the Data Storage (DS) application successfully
* completes its initialization.
*/
#define DS_INIT_EID 1
#define DS_INIT_INF_EID 1

/**
* \brief DS Initialization Failed Event ID
Expand Down Expand Up @@ -242,7 +242,7 @@
* these errors so the cause is more likely to result from sending "raw"
* ground commands or on-board stored commands.
*/
#define DS_CMD_CODE_ERR_EID 21
#define DS_CC_ERR_EID 21

/**
* \brief DS Housekeeping Request Invalid Length Event ID
Expand All @@ -254,7 +254,7 @@
* This event signals the failed execution of a HK request command.
* The cause of the failure is an invalid command packet length.
*/
#define DS_HK_REQUEST_ERR_EID 22
#define DS_HKREQ_LEN_ERR_EID 22

/**
* \brief DS No-op Command Event ID
Expand All @@ -267,7 +267,7 @@
* command. The command is used primarily as an indicator that the DS
* application can receive commands and generate telemetry.
*/
#define DS_NOOP_CMD_EID 31
#define DS_NOOP_INF_EID 31

/**
* \brief DS No-op Command Invalid Length Event ID
Expand All @@ -284,15 +284,15 @@
/**
* \brief DS Reset Counters Command Event ID
*
* \par Type: DEBUG
* \par Type: INFORMATION
*
* \par Cause:
*
* This event signals the successful execution of a RESET housekeeping
* counters command. The command is used primarily to clear counters
* that have already been examined.
*/
#define DS_RESET_CMD_EID 33
#define DS_RESET_INF_EID 33

/**
* \brief DS Reset Counters Command Invalid Length Event ID
Expand Down
4 changes: 2 additions & 2 deletions fsw/inc/ds_msgdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* \par Command Verification
* Evidence of success may be found in the following telemetry:
* - #DS_HkTlm_Payload_t.CmdAcceptedCounter will increment
* - The #DS_NOOP_CMD_EID informational event message will be sent
* - The #DS_NOOP_INF_EID informational event message will be sent
*
* \par Error Conditions
* This command can fail for the following reasons:
Expand All @@ -70,7 +70,7 @@
* \par Command Verification
* Evidence of success may be found in the following telemetry:
* - #DS_HkTlm_Payload_t.CmdAcceptedCounter will reset to zero
* - The #DS_RESET_CMD_EID debug event message will be sent
* - The #DS_RESET_INF_EID debug event message will be sent
*
* \par Error Conditions
* This command can fail for the following reasons:
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/ds_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ CFE_Status_t DS_AppInitialize(void)
*/
if (Result == CFE_SUCCESS)
{
CFE_EVS_SendEvent(DS_INIT_EID, CFE_EVS_EventType_INFORMATION,
CFE_EVS_SendEvent(DS_INIT_INF_EID, CFE_EVS_EventType_INFORMATION,
"Application initialized, version %d.%d.%d.%d, data at %p", DS_MAJOR_VERSION,
DS_MINOR_VERSION, DS_REVISION, DS_MISSION_REV, (void *)&DS_AppData);
}
Expand Down
4 changes: 2 additions & 2 deletions fsw/src/ds_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void DS_NoopCmd(const CFE_SB_Buffer_t *BufPtr)
*/
DS_AppData.CmdAcceptedCounter++;

CFE_EVS_SendEvent(DS_NOOP_CMD_EID, CFE_EVS_EventType_INFORMATION, "NOOP command, Version %d.%d.%d.%d",
CFE_EVS_SendEvent(DS_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "NOOP command, Version %d.%d.%d.%d",
DS_MAJOR_VERSION, DS_MINOR_VERSION, DS_REVISION, DS_MISSION_REV);
}

Expand Down Expand Up @@ -103,7 +103,7 @@ void DS_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr)
DS_AppData.FilterTblLoadCounter = 0;
DS_AppData.FilterTblErrCounter = 0;

CFE_EVS_SendEvent(DS_RESET_CMD_EID, CFE_EVS_EventType_DEBUG, "Reset counters command");
CFE_EVS_SendEvent(DS_RESET_INF_EID, CFE_EVS_EventType_DEBUG, "Reset counters command");
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Expand Down
6 changes: 3 additions & 3 deletions fsw/src/ds_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ void DS_RemoveMIDVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)

void DS_SendHkVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
{
if (DS_VerifyLength(BufPtr, sizeof(DS_SendHkCmd_t), DS_HK_REQUEST_ERR_EID, "SEND HK"))
if (DS_VerifyLength(BufPtr, sizeof(DS_SendHkCmd_t), DS_HKREQ_LEN_ERR_EID, "SEND HK"))
{
DS_AppSendHkCmd();
}
Expand Down Expand Up @@ -562,8 +562,8 @@ void DS_AppProcessCmd(const CFE_SB_Buffer_t *BufPtr)
** DS application command with unknown command code...
*/
default:
CFE_EVS_SendEvent(DS_CMD_CODE_ERR_EID, CFE_EVS_EventType_ERROR,
"Invalid command code: MID = 0x%08X, CC = %d", DS_CMD_MID, CommandCode);
CFE_EVS_SendEvent(DS_CC_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid command code: MID = 0x%08X, CC = %d",
DS_CMD_MID, CommandCode);

DS_AppData.CmdRejectedCounter++;
break;
Expand Down
2 changes: 1 addition & 1 deletion unit-test/ds_app_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void DS_AppInitialize_Test_Nominal(void)
* are modified by subfunctions, which we're not testing here */

UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, DS_INIT_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, DS_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/ds_cmds_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void DS_NoopCmd_Test_Nominal(void)
UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1);

UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, DS_NOOP_CMD_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, DS_NOOP_INF_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);

/* Verify command struct size minus header is at least explicitly padded to 32-bit boundaries */
Expand Down Expand Up @@ -90,7 +90,7 @@ void DS_ResetCountersCmd_Test_Nominal(void)
UtAssert_ZERO(DS_AppData.FilterTblErrCounter);

UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, DS_RESET_CMD_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, DS_RESET_INF_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_DEBUG);

/* Verify command struct size minus header is at least explicitly padded to 32-bit boundaries */
Expand Down
2 changes: 1 addition & 1 deletion unit-test/ds_dispatch_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void DS_AppProcessMsg_Test_HKInvalidRequest(void)

/* Verify results */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, DS_HK_REQUEST_ERR_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, DS_HKREQ_LEN_ERR_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
}

Expand Down

0 comments on commit 8647f3d

Please sign in to comment.