Skip to content

Commit

Permalink
Merge pull request #337 from thnkslprpt/fix-336-apply-consistent-even…
Browse files Browse the repository at this point in the history
…t-id-names

Fix #336, Apply consistent Event ID names to common events
  • Loading branch information
dzbaker authored Nov 30, 2023
2 parents df516ad + 46c6a66 commit 08a2e0c
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 49 deletions.
12 changes: 6 additions & 6 deletions fsw/inc/cf_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
*
* Successful completion of application initialization
*/
#define CF_EID_INF_INIT (20)
#define CF_INIT_INF_EID (20)

/**
* \brief CF Check Table Release Address Failed Event ID
Expand Down Expand Up @@ -166,7 +166,7 @@
*
* Failure from create pipe call during engine channel initialization
*/
#define CF_EID_ERR_INIT_PIPE (31)
#define CF_CR_PIPE_ERR_EID (31)

/**
* \brief CF Channel Message Subscription Failed Event ID
Expand Down Expand Up @@ -910,7 +910,7 @@
*
* Receipt of NOOP command
*/
#define CF_EID_INF_CMD_NOOP (110)
#define CF_NOOP_INF_EID (110)

/**
* \brief CF Reset Counters Command Received Event ID
Expand All @@ -921,7 +921,7 @@
*
* Receipt and successful processing of reset counters command
*/
#define CF_EID_INF_CMD_RESET (111)
#define CF_RESET_INF_EID (111)

/**
* \brief CF Set Parameter Command Received Event ID
Expand Down Expand Up @@ -1361,7 +1361,7 @@
*
* Received command length verification failure
*/
#define CF_EID_ERR_CMD_GCMD_LEN (151)
#define CF_CMD_LEN_ERR_EID (151)

/**
* \brief CF Command Code Invalid Event ID
Expand All @@ -1372,7 +1372,7 @@
*
* Received command code unrecognized
*/
#define CF_EID_ERR_CMD_GCMD_CC (152)
#define CF_CC_ERR_EID (152)

/**
* \brief CF Write Entry To File Failed Event ID
Expand Down
44 changes: 22 additions & 22 deletions fsw/inc/cf_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ typedef enum
* Successful execution of this command may be verified with
* the following telemetry:
* - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment
* - #CF_EID_INF_CMD_NOOP
* - #CF_NOOP_INF_EID
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
*
* \par Evidence of failure may be found in the following telemetry:
* - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment
Expand Down Expand Up @@ -212,11 +212,11 @@ typedef enum
* Successful execution of this command may be verified with
* the following telemetry:
* - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment
* - #CF_EID_INF_CMD_RESET
* - #CF_RESET_INF_EID
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Invalid counter type, #CF_EID_ERR_CMD_RESET_INVALID
*
* \par Evidence of failure may be found in the following telemetry:
Expand Down Expand Up @@ -244,7 +244,7 @@ typedef enum
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Invalid parameter, #CF_EID_ERR_CMD_BAD_PARAM
* - Transaction initialization failure, #CF_EID_ERR_CMD_TX_FILE
*
Expand Down Expand Up @@ -276,7 +276,7 @@ typedef enum
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Invalid parameter, #CF_EID_ERR_CMD_BAD_PARAM
* - Playback initialization failure, #CF_EID_ERR_CMD_PLAYBACK_DIR
*
Expand Down Expand Up @@ -311,7 +311,7 @@ typedef enum
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Invalid channel number, #CF_EID_ERR_CMD_CHAN_PARAM
* - Command processing failure, #CF_EID_ERR_CMD_FREEZE
*
Expand Down Expand Up @@ -345,7 +345,7 @@ typedef enum
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Invalid channel number, #CF_EID_ERR_CMD_CHAN_PARAM
* - Command processing failure, #CF_EID_ERR_CMD_THAW
*
Expand Down Expand Up @@ -379,7 +379,7 @@ typedef enum
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Transaction not found using compound key, #CF_EID_ERR_CMD_TRANS_NOT_FOUND
* - Invalid channel number, #CF_EID_ERR_CMD_TSN_CHAN_INVALID
* - Already in requested state, #CF_EID_ERR_CMD_SUSPRES_SAME
Expand Down Expand Up @@ -415,7 +415,7 @@ typedef enum
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Transaction not found using compound key, #CF_EID_ERR_CMD_TRANS_NOT_FOUND
* - Invalid channel number, #CF_EID_ERR_CMD_TSN_CHAN_INVALID
* - Already in requested state, #CF_EID_ERR_CMD_SUSPRES_SAME
Expand Down Expand Up @@ -450,7 +450,7 @@ typedef enum
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Transaction not found using compound key, #CF_EID_ERR_CMD_TRANS_NOT_FOUND
* - Invalid channel number, #CF_EID_ERR_CMD_TSN_CHAN_INVALID
* - No matching transaction, #CF_EID_ERR_CMD_CANCEL_CHAN
Expand Down Expand Up @@ -484,7 +484,7 @@ typedef enum
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Transaction not found using compound key, #CF_EID_ERR_CMD_TRANS_NOT_FOUND
* - Invalid channel number, #CF_EID_ERR_CMD_TSN_CHAN_INVALID
* - No matching transaction, #CF_EID_ERR_CMD_ABANDON_CHAN
Expand Down Expand Up @@ -516,7 +516,7 @@ typedef enum
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Invalid configuration parameter key, #CF_EID_ERR_CMD_GETSET_PARAM
* - Invalid channel number, #CF_EID_ERR_CMD_GETSET_CHAN
* - Parameter value failed validation, #CF_EID_ERR_CMD_GETSET_VALIDATE
Expand Down Expand Up @@ -548,7 +548,7 @@ typedef enum
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Invalid configuration parameter key, #CF_EID_ERR_CMD_GETSET_PARAM
* - Invalid channel number, #CF_EID_ERR_CMD_GETSET_CHAN
*
Expand Down Expand Up @@ -579,7 +579,7 @@ typedef enum
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Invalid parameter combination, #CF_EID_ERR_CMD_WQ_ARGS
* - Invalid channel number, #CF_EID_ERR_CMD_WQ_CHAN
* - Open file to write failed, #CF_EID_ERR_CMD_WQ_OPEN
Expand Down Expand Up @@ -617,7 +617,7 @@ typedef enum
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Invalid channel number, #CF_EID_ERR_CMD_CHAN_PARAM
* - Enable dequeue failed, #CF_EID_ERR_CMD_ENABLE_DEQUEUE
*
Expand Down Expand Up @@ -650,7 +650,7 @@ typedef enum
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Invalid channel number, #CF_EID_ERR_CMD_CHAN_PARAM
* - Disable dequeue failed, #CF_EID_INF_CMD_DISABLE_DEQUEUE
*
Expand Down Expand Up @@ -689,7 +689,7 @@ typedef enum
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Invalid channel number, #CF_EID_ERR_CMD_CHAN_PARAM
* - Invalid polling directory index, #CF_EID_ERR_CMD_POLLDIR_INVALID
* - Enable directory polling failed, #CF_EID_ERR_CMD_ENABLE_POLLDIR
Expand Down Expand Up @@ -729,7 +729,7 @@ typedef enum
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Invalid channel number, #CF_EID_ERR_CMD_CHAN_PARAM
* - Invalid polling directory index, #CF_EID_ERR_CMD_POLLDIR_INVALID
* - Disable directory polling failed, #CF_EID_ERR_CMD_DISABLE_POLLDIR
Expand Down Expand Up @@ -770,7 +770,7 @@ typedef enum
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Invalid channel number, #CF_EID_ERR_CMD_CHAN_PARAM
* - Invalid purge queue argument, #CF_EID_ERR_CMD_PURGE_ARG
* - Purge queue failed, #CF_EID_ERR_CMD_PURGE_QUEUE
Expand Down Expand Up @@ -803,7 +803,7 @@ typedef enum
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Engine initialization failed, #CF_EID_ERR_CMD_ENABLE_ENGINE
* - Engine already enabled, #CF_EID_ERR_CMD_ENG_ALREADY_ENA
*
Expand Down Expand Up @@ -836,7 +836,7 @@ typedef enum
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN
* - Command packet length not as expected, #CF_CMD_LEN_ERR_EID
* - Engine already disabled, #CF_EID_ERR_CMD_ENG_ALREADY_DIS
*
* \par Evidence of failure may be found in the following telemetry:
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/cf_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ CFE_Status_t CF_Init(void)
if (status == CFE_SUCCESS)
{
status =
CFE_EVS_SendEvent(CF_EID_INF_INIT, CFE_EVS_EventType_INFORMATION, "CF Initialized. Version %d.%d.%d.%d",
CFE_EVS_SendEvent(CF_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "CF Initialized. Version %d.%d.%d.%d",
CF_MAJOR_VERSION, CF_MINOR_VERSION, CF_REVISION, CF_MISSION_REV);
if (status != CFE_SUCCESS)
{
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/cf_cfdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ CFE_Status_t CF_CFDP_InitEngine(void)
nbuf);
if (ret != CFE_SUCCESS)
{
CFE_EVS_SendEvent(CF_EID_ERR_INIT_PIPE, CFE_EVS_EventType_ERROR,
CFE_EVS_SendEvent(CF_CR_PIPE_ERR_EID, CFE_EVS_EventType_ERROR,
"CF: failed to create pipe %s, returned 0x%08lx", nbuf, (unsigned long)ret);
break;
}
Expand Down
12 changes: 6 additions & 6 deletions fsw/src/cf_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
*-----------------------------------------------------------------*/
void CF_CmdNoop(CFE_SB_Buffer_t *msg)
{
CFE_EVS_SendEvent(CF_EID_INF_CMD_NOOP, CFE_EVS_EventType_INFORMATION, "CF: No-Op received, Version %d.%d.%d.%d",
CFE_EVS_SendEvent(CF_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "CF: No-Op received, Version %d.%d.%d.%d",
CF_MAJOR_VERSION, CF_MINOR_VERSION, CF_REVISION, CF_MISSION_REV);
++CF_AppData.hk.counters.cmd;
}
Expand Down Expand Up @@ -74,8 +74,8 @@ void CF_CmdReset(CFE_SB_Buffer_t *msg)
}
else
{
CFE_EVS_SendEvent(CF_EID_INF_CMD_RESET, CFE_EVS_EventType_INFORMATION,
"CF: Received RESET COUNTERS command: %s", names[param]);
CFE_EVS_SendEvent(CF_RESET_INF_EID, CFE_EVS_EventType_INFORMATION, "CF: Received RESET COUNTERS command: %s",
names[param]);

/* if the param is CF_Reset_command, or all counters */
if ((param == CF_Reset_all) || (param == CF_Reset_command))
Expand Down Expand Up @@ -1240,16 +1240,16 @@ void CF_ProcessGroundCommand(CFE_SB_Buffer_t *msg)
}
else
{
CFE_EVS_SendEvent(CF_EID_ERR_CMD_GCMD_LEN, CFE_EVS_EventType_ERROR,
CFE_EVS_SendEvent(CF_CMD_LEN_ERR_EID, CFE_EVS_EventType_ERROR,
"CF: invalid ground command length for command 0x%02x, expected %d got %zd", cmd,
expected_lengths[cmd], len);
++CF_AppData.hk.counters.err;
}
}
else
{
CFE_EVS_SendEvent(CF_EID_ERR_CMD_GCMD_CC, CFE_EVS_EventType_ERROR,
"CF: invalid ground command packet cmd_code=0x%02x", cmd);
CFE_EVS_SendEvent(CF_CC_ERR_EID, CFE_EVS_EventType_ERROR, "CF: invalid ground command packet cmd_code=0x%02x",
cmd);
++CF_AppData.hk.counters.err;
}
}
6 changes: 3 additions & 3 deletions unit-test/cf_app_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ void Test_CF_AppMain_CFE_SB_ReceiveBuffer_Cases(void)

/* Event from CF_Init and CF_AppMain */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 2);
UtAssert_UINT32_EQ(UT_CF_CapturedEventIDs[0], CF_EID_INF_INIT);
UtAssert_UINT32_EQ(UT_CF_CapturedEventIDs[0], CF_INIT_INF_EID);
UtAssert_UINT32_EQ(UT_CF_CapturedEventIDs[1], CF_EID_ERR_INIT_MSG_RECV);

/* Reset, return CFE_SUCCESS from CFE_SB_ReceiveBuffer and buffer NULL */
Expand All @@ -642,7 +642,7 @@ void Test_CF_AppMain_CFE_SB_ReceiveBuffer_Cases(void)

/* Event from CF_Init and CF_AppMain */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 2);
UtAssert_UINT32_EQ(UT_CF_CapturedEventIDs[0], CF_EID_INF_INIT);
UtAssert_UINT32_EQ(UT_CF_CapturedEventIDs[0], CF_INIT_INF_EID);
UtAssert_UINT32_EQ(UT_CF_CapturedEventIDs[1], CF_EID_ERR_INIT_MSG_RECV);

/* Reset, return non-error codes and non-NULL buffer */
Expand All @@ -659,7 +659,7 @@ void Test_CF_AppMain_CFE_SB_ReceiveBuffer_Cases(void)

/* Event from CF_Init */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
UtAssert_UINT32_EQ(UT_CF_CapturedEventIDs[0], CF_EID_INF_INIT);
UtAssert_UINT32_EQ(UT_CF_CapturedEventIDs[0], CF_INIT_INF_EID);
UtAssert_STUB_COUNT(CFE_ES_RunLoop, 3);
}

Expand Down
Loading

0 comments on commit 08a2e0c

Please sign in to comment.