Skip to content

Commit

Permalink
Fix nasa#60, 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 a3bda6e commit b5e2772
Show file tree
Hide file tree
Showing 6 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_HkPacket_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_HkPacket_t.CmdAcceptedCounter will reset to zero
* - The #DS_RESET_CMD_EID debug event message will be sent
* - The #DS_RESET_INF_EID informational event message will be sent
*
* \par Error Conditions
* This command can fail for the following reasons:
Expand Down
8 changes: 4 additions & 4 deletions fsw/src/ds_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ int32 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 Expand Up @@ -311,7 +311,7 @@ void DS_AppProcessMsg(const CFE_SB_Buffer_t *BufPtr)
ExpectedLength = sizeof(DS_NoopCmd_t);
if (ExpectedLength != ActualLength)
{
CFE_EVS_SendEvent(DS_HK_REQUEST_ERR_EID, CFE_EVS_EventType_ERROR,
CFE_EVS_SendEvent(DS_HKREQ_LEN_ERR_EID, CFE_EVS_EventType_ERROR,
"Invalid HK request length: expected = %d, actual = %d", (int)ExpectedLength,
(int)ActualLength);
}
Expand Down Expand Up @@ -485,8 +485,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
4 changes: 2 additions & 2 deletions fsw/src/ds_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void DS_CmdNoop(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 @@ -132,7 +132,7 @@ void DS_CmdReset(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
4 changes: 2 additions & 2 deletions unit-test/ds_app_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,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 Expand Up @@ -399,7 +399,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
4 changes: 2 additions & 2 deletions unit-test/ds_cmds_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void DS_CmdNoop_Test_Nominal(void)
call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
UtAssert_INT32_EQ(call_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);

Expand Down Expand Up @@ -158,7 +158,7 @@ void DS_CmdReset_Test_Nominal(void)
call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
UtAssert_INT32_EQ(call_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);

Expand Down

0 comments on commit b5e2772

Please sign in to comment.