Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #188, Apply consistent Event ID names to common events #189

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions fsw/src/sample_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ int32 SAMPLE_APP_Init(void)
status = CFE_TBL_Load(SAMPLE_APP_Data.TblHandles[0], CFE_TBL_SRC_FILE, SAMPLE_APP_TABLE_FILE);
}

CFE_EVS_SendEvent(SAMPLE_APP_STARTUP_INF_EID, CFE_EVS_EventType_INFORMATION, "SAMPLE App Initialized.%s",
CFE_EVS_SendEvent(SAMPLE_APP_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "SAMPLE App Initialized.%s",
SAMPLE_APP_VERSION_STRING);

return CFE_SUCCESS;
Expand Down Expand Up @@ -221,7 +221,7 @@ void SAMPLE_APP_ProcessCommandPacket(CFE_SB_Buffer_t *SBBufPtr)
break;

default:
CFE_EVS_SendEvent(SAMPLE_APP_INVALID_MSGID_ERR_EID, CFE_EVS_EventType_ERROR,
CFE_EVS_SendEvent(SAMPLE_APP_MID_ERR_EID, CFE_EVS_EventType_ERROR,
"SAMPLE: invalid command packet,MID = 0x%x", (unsigned int)CFE_SB_MsgIdToValue(MsgId));
break;
}
Expand Down Expand Up @@ -269,8 +269,8 @@ void SAMPLE_APP_ProcessGroundCommand(CFE_SB_Buffer_t *SBBufPtr)

/* default case already found during FC vs length test */
default:
CFE_EVS_SendEvent(SAMPLE_APP_COMMAND_ERR_EID, CFE_EVS_EventType_ERROR,
"Invalid ground command code: CC = %d", CommandCode);
CFE_EVS_SendEvent(SAMPLE_APP_CC_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid ground command code: CC = %d",
CommandCode);
break;
}
}
Expand Down Expand Up @@ -319,7 +319,7 @@ int32 SAMPLE_APP_Noop(const SAMPLE_APP_NoopCmd_t *Msg)
{
SAMPLE_APP_Data.CmdCounter++;

CFE_EVS_SendEvent(SAMPLE_APP_COMMANDNOP_INF_EID, CFE_EVS_EventType_INFORMATION, "SAMPLE: NOOP command %s",
CFE_EVS_SendEvent(SAMPLE_APP_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "SAMPLE: NOOP command %s",
SAMPLE_APP_VERSION);

return CFE_SUCCESS;
Expand All @@ -337,7 +337,7 @@ int32 SAMPLE_APP_ResetCounters(const SAMPLE_APP_ResetCountersCmd_t *Msg)
SAMPLE_APP_Data.CmdCounter = 0;
SAMPLE_APP_Data.ErrCounter = 0;

CFE_EVS_SendEvent(SAMPLE_APP_COMMANDRST_INF_EID, CFE_EVS_EventType_INFORMATION, "SAMPLE: RESET command");
CFE_EVS_SendEvent(SAMPLE_APP_RESET_INF_EID, CFE_EVS_EventType_INFORMATION, "SAMPLE: RESET command");

return CFE_SUCCESS;
}
Expand Down Expand Up @@ -403,7 +403,7 @@ bool SAMPLE_APP_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength
CFE_MSG_GetMsgId(MsgPtr, &MsgId);
CFE_MSG_GetFcnCode(MsgPtr, &FcnCode);

CFE_EVS_SendEvent(SAMPLE_APP_LEN_ERR_EID, CFE_EVS_EventType_ERROR,
CFE_EVS_SendEvent(SAMPLE_APP_CMD_LEN_ERR_EID, CFE_EVS_EventType_ERROR,
"Invalid Msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u",
(unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, (unsigned int)ActualLength,
(unsigned int)ExpectedLength);
Expand Down
16 changes: 8 additions & 8 deletions fsw/src/sample_app_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
#ifndef SAMPLE_APP_EVENTS_H
#define SAMPLE_APP_EVENTS_H

#define SAMPLE_APP_RESERVED_EID 0
#define SAMPLE_APP_STARTUP_INF_EID 1
#define SAMPLE_APP_COMMAND_ERR_EID 2
#define SAMPLE_APP_COMMANDNOP_INF_EID 3
#define SAMPLE_APP_COMMANDRST_INF_EID 4
#define SAMPLE_APP_INVALID_MSGID_ERR_EID 5
#define SAMPLE_APP_LEN_ERR_EID 6
#define SAMPLE_APP_PIPE_ERR_EID 7
#define SAMPLE_APP_RESERVED_EID 0
#define SAMPLE_APP_INIT_INF_EID 1
#define SAMPLE_APP_CC_ERR_EID 2
#define SAMPLE_APP_NOOP_INF_EID 3
#define SAMPLE_APP_RESET_INF_EID 4
#define SAMPLE_APP_MID_ERR_EID 5
#define SAMPLE_APP_CMD_LEN_ERR_EID 6
#define SAMPLE_APP_PIPE_ERR_EID 7

#endif /* SAMPLE_APP_EVENTS_H */
14 changes: 7 additions & 7 deletions unit-test/coveragetest/coveragetest_sample_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ void Test_SAMPLE_APP_ProcessCommandPacket(void)
UT_CheckEvent_t EventTest;

memset(&TestMsg, 0, sizeof(TestMsg));
UT_CHECKEVENT_SETUP(&EventTest, SAMPLE_APP_INVALID_MSGID_ERR_EID, "SAMPLE: invalid command packet,MID = 0x%x");
UT_CHECKEVENT_SETUP(&EventTest, SAMPLE_APP_MID_ERR_EID, "SAMPLE: invalid command packet,MID = 0x%x");

/*
* The CFE_MSG_GetMsgId() stub uses a data buffer to hold the
Expand Down Expand Up @@ -355,7 +355,7 @@ void Test_SAMPLE_APP_ProcessGroundCommand(void)
Size = sizeof(TestMsg.Noop);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false);
UT_CHECKEVENT_SETUP(&EventTest, SAMPLE_APP_COMMANDNOP_INF_EID, NULL);
UT_CHECKEVENT_SETUP(&EventTest, SAMPLE_APP_NOOP_INF_EID, NULL);

SAMPLE_APP_ProcessGroundCommand(&TestMsg.SBBuf);

Expand All @@ -366,7 +366,7 @@ void Test_SAMPLE_APP_ProcessGroundCommand(void)
Size = sizeof(TestMsg.Reset);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false);
UT_CHECKEVENT_SETUP(&EventTest, SAMPLE_APP_COMMANDRST_INF_EID, NULL);
UT_CHECKEVENT_SETUP(&EventTest, SAMPLE_APP_RESET_INF_EID, NULL);

SAMPLE_APP_ProcessGroundCommand(&TestMsg.SBBuf);

Expand All @@ -386,7 +386,7 @@ void Test_SAMPLE_APP_ProcessGroundCommand(void)
/* test an invalid CC */
FcnCode = 1000;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false);
UT_CHECKEVENT_SETUP(&EventTest, SAMPLE_APP_COMMAND_ERR_EID, "Invalid ground command code: CC = %d");
UT_CHECKEVENT_SETUP(&EventTest, SAMPLE_APP_CC_ERR_EID, "Invalid ground command code: CC = %d");
SAMPLE_APP_ProcessGroundCommand(&TestMsg.SBBuf);

/*
Expand Down Expand Up @@ -443,7 +443,7 @@ void Test_SAMPLE_APP_NoopCmd(void)
memset(&TestMsg, 0, sizeof(TestMsg));

/* test dispatch of NOOP */
UT_CHECKEVENT_SETUP(&EventTest, SAMPLE_APP_COMMANDNOP_INF_EID, NULL);
UT_CHECKEVENT_SETUP(&EventTest, SAMPLE_APP_NOOP_INF_EID, NULL);

UtAssert_INT32_EQ(SAMPLE_APP_Noop(&TestMsg), CFE_SUCCESS);

Expand All @@ -464,7 +464,7 @@ void Test_SAMPLE_APP_ResetCounters(void)

memset(&TestMsg, 0, sizeof(TestMsg));

UT_CHECKEVENT_SETUP(&EventTest, SAMPLE_APP_COMMANDRST_INF_EID, "SAMPLE: RESET command");
UT_CHECKEVENT_SETUP(&EventTest, SAMPLE_APP_RESET_INF_EID, "SAMPLE: RESET command");

UtAssert_INT32_EQ(SAMPLE_APP_ResetCounters(&TestMsg), CFE_SUCCESS);

Expand Down Expand Up @@ -527,7 +527,7 @@ void Test_SAMPLE_APP_VerifyCmdLength(void)
* test a match case
*/
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &size, sizeof(size), false);
UT_CHECKEVENT_SETUP(&EventTest, SAMPLE_APP_LEN_ERR_EID,
UT_CHECKEVENT_SETUP(&EventTest, SAMPLE_APP_CMD_LEN_ERR_EID,
"Invalid Msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u");

SAMPLE_APP_VerifyCmdLength(NULL, size);
Expand Down