Skip to content

Commit

Permalink
Fix #1397, Rename overloaded EVS_PacketID_t to EVS_EventContext_t
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Dec 3, 2023
1 parent b72dd4e commit 658c84e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions modules/evs/eds/cfe_evs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
</EntryList>
</ContainerDataType>

<ContainerDataType name="PacketID" shortDescription="Telemetry packet structures">
<ContainerDataType name="EventContext" shortDescription="Telemetry packet structures">
<EntryList>
<Entry name="AppName" type="BASE_TYPES/ApiName" shortDescription="Application name">
<LongDescription>
Expand Down Expand Up @@ -295,7 +295,7 @@

<ContainerDataType name="LongEventTlm_Payload" shortDescription="Event Message Telemetry Payload Long Format">
<EntryList>
<Entry name="PacketID" type="PacketID" shortDescription="Event packet information" />
<Entry name="EventContext" type="EventContext" shortDescription="Event packet context" />
<Entry name="Message" type="EventMessage" shortDescription="Event message string">
<LongDescription>
\cfetlmmnemonic \EVS_EVENT
Expand All @@ -306,7 +306,7 @@

<ContainerDataType name="ShortEventTlm_Payload" shortDescription="Event Message Telemetry Payload Short Format">
<EntryList>
<Entry name="PacketID" type="PacketID" shortDescription="Event packet information" />
<Entry name="EventContext" type="EventContext" shortDescription="Event packet context" />
</EntryList>
</ContainerDataType>

Expand Down
20 changes: 10 additions & 10 deletions modules/evs/fsw/src/cfe_evs_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1
/* Initialize EVS event packets */
CFE_MSG_Init(CFE_MSG_PTR(LongEventTlm.TelemetryHeader), CFE_SB_ValueToMsgId(CFE_EVS_LONG_EVENT_MSG_MID),
sizeof(LongEventTlm));
LongEventTlm.Payload.PacketID.EventID = EventID;
LongEventTlm.Payload.PacketID.EventType = EventType;
LongEventTlm.Payload.EventContext.EventID = EventID;
LongEventTlm.Payload.EventContext.EventType = EventType;

/* vsnprintf() returns the total expanded length of the formatted string */
/* vsnprintf() copies and zero terminates portion that fits in the buffer */
Expand All @@ -482,10 +482,10 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1
}

/* Obtain task and system information */
CFE_ES_GetAppName((char *)LongEventTlm.Payload.PacketID.AppName, EVS_AppDataGetID(AppDataPtr),
sizeof(LongEventTlm.Payload.PacketID.AppName));
LongEventTlm.Payload.PacketID.SpacecraftID = CFE_PSP_GetSpacecraftId();
LongEventTlm.Payload.PacketID.ProcessorID = CFE_PSP_GetProcessorId();
CFE_ES_GetAppName((char *)LongEventTlm.Payload.EventContext.AppName, EVS_AppDataGetID(AppDataPtr),
sizeof(LongEventTlm.Payload.EventContext.AppName));
LongEventTlm.Payload.EventContext.SpacecraftID = CFE_PSP_GetSpacecraftId();
LongEventTlm.Payload.EventContext.ProcessorID = CFE_PSP_GetProcessorId();

/* Set the packet timestamp */
CFE_MSG_SetMsgTime(CFE_MSG_PTR(LongEventTlm.TelemetryHeader), *TimeStamp);
Expand All @@ -512,7 +512,7 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1
CFE_MSG_Init(CFE_MSG_PTR(ShortEventTlm.TelemetryHeader), CFE_SB_ValueToMsgId(CFE_EVS_SHORT_EVENT_MSG_MID),
sizeof(ShortEventTlm));
CFE_MSG_SetMsgTime(CFE_MSG_PTR(ShortEventTlm.TelemetryHeader), *TimeStamp);
ShortEventTlm.Payload.PacketID = LongEventTlm.Payload.PacketID;
ShortEventTlm.Payload.EventContext = LongEventTlm.Payload.EventContext;
CFE_SB_TransmitMsg(CFE_MSG_PTR(ShortEventTlm.TelemetryHeader), true);
}

Expand Down Expand Up @@ -546,9 +546,9 @@ void EVS_SendViaPorts(CFE_EVS_LongEventTlm_t *EVS_PktPtr)
CFE_TIME_Print(TimeBuffer, PktTime);

snprintf(PortMessage, sizeof(PortMessage), "%s %u/%u/%s %u: %s", TimeBuffer,
(unsigned int)EVS_PktPtr->Payload.PacketID.SpacecraftID,
(unsigned int)EVS_PktPtr->Payload.PacketID.ProcessorID, EVS_PktPtr->Payload.PacketID.AppName,
(unsigned int)EVS_PktPtr->Payload.PacketID.EventID, EVS_PktPtr->Payload.Message);
(unsigned int)EVS_PktPtr->Payload.EventContext.SpacecraftID,
(unsigned int)EVS_PktPtr->Payload.EventContext.ProcessorID, EVS_PktPtr->Payload.EventContext.AppName,
(unsigned int)EVS_PktPtr->Payload.EventContext.EventID, EVS_PktPtr->Payload.Message);

if (CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT1_BIT)
{
Expand Down
18 changes: 9 additions & 9 deletions modules/evs/ut-coverage/evs_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_SEND_HK = {.MsgId = CFE_SB_

static const UT_SoftwareBusSnapshot_Entry_t UT_EVS_LONGFMT_SNAPSHOTDATA = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID),
.SnapshotOffset = offsetof(CFE_EVS_LongEventTlm_t, Payload.PacketID.EventID),
.SnapshotOffset = offsetof(CFE_EVS_LongEventTlm_t, Payload.EventContext.EventID),
.SnapshotSize = sizeof(uint16)};

static const UT_SoftwareBusSnapshot_Entry_t UT_EVS_SHORTFMT_SNAPSHOTDATA = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_SHORT_EVENT_MSG_MID),
.SnapshotOffset = offsetof(CFE_EVS_ShortEventTlm_t, Payload.PacketID.EventID),
.SnapshotOffset = offsetof(CFE_EVS_ShortEventTlm_t, Payload.EventContext.EventID),
.SnapshotSize = sizeof(uint16)};

typedef struct
Expand Down Expand Up @@ -700,12 +700,12 @@ void Test_Format(void)
UT_SoftwareBusSnapshot_Entry_t LongFmtSnapshotData = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID),
.SnapshotBuffer = &CapturedMsg,
.SnapshotOffset =
offsetof(CFE_EVS_LongEventTlm_t, Payload.PacketID),
offsetof(CFE_EVS_LongEventTlm_t, Payload.EventContext),
.SnapshotSize = sizeof(CapturedMsg)};
UT_SoftwareBusSnapshot_Entry_t ShortFmtSnapshotData = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_SHORT_EVENT_MSG_MID),
.SnapshotBuffer = &CapturedMsg,
.SnapshotOffset = offsetof(CFE_EVS_ShortEventTlm_t, Payload.PacketID),
.SnapshotOffset = offsetof(CFE_EVS_ShortEventTlm_t, Payload.EventContext),
.SnapshotSize = sizeof(CapturedMsg)};
EVS_AppData_t * AppDataPtr;
CFE_ES_AppId_t AppID;
Expand Down Expand Up @@ -1929,13 +1929,13 @@ void Test_Squelching(void)
if (i < CFE_PLATFORM_EVS_MAX_APP_EVENT_BURST)
{
UtAssert_UINT32_EQ(SnapshotData.Count, i + 1);
UtAssert_UINT32_EQ(CapturedTlm.Payload.PacketID.EventID, EVENT_ID);
UtAssert_UINT32_EQ(CapturedTlm.Payload.EventContext.EventID, EVENT_ID);
UtAssert_UINT32_EQ(EVS_Retval, CFE_SUCCESS);
}
else if (i == CFE_PLATFORM_EVS_MAX_APP_EVENT_BURST)
{
UtAssert_UINT32_EQ(SnapshotData.Count, i + 1);
UtAssert_UINT32_EQ(CapturedTlm.Payload.PacketID.EventID, CFE_EVS_SQUELCHED_ERR_EID);
UtAssert_UINT32_EQ(CapturedTlm.Payload.EventContext.EventID, CFE_EVS_SQUELCHED_ERR_EID);
UtAssert_UINT32_EQ(EVS_Retval, CFE_EVS_APP_SQUELCHED);
}
else
Expand All @@ -1954,7 +1954,7 @@ void Test_Squelching(void)
UT_SetDataBuffer(UT_KEY(CFE_PSP_GetTime), &InjectedTime, sizeof(InjectedTime), false);
EVS_Retval = SendEventFuncs[j](EVENT_ID);
UtAssert_UINT32_EQ(SnapshotData.Count, CFE_PLATFORM_EVS_MAX_APP_EVENT_BURST + 2);
UtAssert_UINT32_EQ(CapturedTlm.Payload.PacketID.EventID, EVENT_ID);
UtAssert_UINT32_EQ(CapturedTlm.Payload.EventContext.EventID, EVENT_ID);
UtAssert_UINT32_EQ(EVS_Retval, CFE_SUCCESS);

/*
Expand All @@ -1963,7 +1963,7 @@ void Test_Squelching(void)
UT_SetDataBuffer(UT_KEY(CFE_PSP_GetTime), &InjectedTime, sizeof(InjectedTime), false);
EVS_Retval = SendEventFuncs[j](EVENT_ID);
UtAssert_UINT32_EQ(SnapshotData.Count, CFE_PLATFORM_EVS_MAX_APP_EVENT_BURST + 3);
UtAssert_UINT32_EQ(CapturedTlm.Payload.PacketID.EventID, CFE_EVS_SQUELCHED_ERR_EID);
UtAssert_UINT32_EQ(CapturedTlm.Payload.EventContext.EventID, CFE_EVS_SQUELCHED_ERR_EID);
UtAssert_UINT32_EQ(EVS_Retval, CFE_EVS_APP_SQUELCHED);

/*
Expand All @@ -1983,7 +1983,7 @@ void Test_Squelching(void)
UT_SetDataBuffer(UT_KEY(CFE_PSP_GetTime), &InjectedTime, sizeof(InjectedTime), false);
EVS_Retval = SendEventFuncs[j](EVENT_ID);
UtAssert_UINT32_EQ(SnapshotData.Count, CFE_PLATFORM_EVS_MAX_APP_EVENT_BURST + 4);
UtAssert_UINT32_EQ(CapturedTlm.Payload.PacketID.EventID, EVENT_ID);
UtAssert_UINT32_EQ(CapturedTlm.Payload.EventContext.EventID, EVENT_ID);
UtAssert_UINT32_EQ(EVS_Retval, CFE_SUCCESS);
UtAssert_UINT32_EQ(AppDataPtr->SquelchedCount, CFE_EVS_MAX_SQUELCH_COUNT);

Expand Down

0 comments on commit 658c84e

Please sign in to comment.