Skip to content

Commit

Permalink
Fix nasa#836, Replace CFE_MISSION_SPACECRAFT_ID with CFE_PSP_GetSpace…
Browse files Browse the repository at this point in the history
…craftId()
  • Loading branch information
skliper committed Aug 25, 2020
1 parent 993d556 commit 09f6662
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion modules/msg/src/cfe_msg_ccsdsext.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "cfe_msg_priv.h"
#include "cfe_msg_defaults.h"
#include "cfe_error.h"
#include "cfe_psp.h"

/* CCSDS Extended definitions */
#define CFE_MSG_EDSVER_SHIFT 11 /**< \brief CCSDS EDS version shift */
Expand All @@ -49,7 +50,7 @@ void CFE_MSG_SetDefaultCCSDSExt(CFE_MSG_Message_t *MsgPtr)

/* Default bits of the subsystem, for whatever isn't set by MsgId */
CFE_MSG_SetSubsystem(MsgPtr, (CFE_MSG_Subsystem_t)CFE_PLATFORM_DEFAULT_SUBSYS);
CFE_MSG_SetSystem(MsgPtr, (CFE_MSG_System_t)CFE_MISSION_SPACECRAFT_ID);
CFE_MSG_SetSystem(MsgPtr, (CFE_MSG_System_t)CFE_PSP_GetSpacecraftId());
}

/******************************************************************************
Expand Down
6 changes: 5 additions & 1 deletion modules/msg/unit-test-coverage/test_cfe_msg_ccsdsext.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,17 @@ void Test_MSG_Init_Ext(void)
CFE_MSG_System_t system;
CFE_MSG_Endian_t endian;
bool is_v1;
int sc_id = 0xab;

/* Get msgid version by checking if msgid sets header version */
memset(&msg, 0xFF, sizeof(msg));
ASSERT_EQ(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(0)), CFE_SUCCESS);
ASSERT_EQ(CFE_MSG_GetHeaderVersion(&msg, &hdrver), CFE_SUCCESS);
is_v1 = (hdrver == 0);

/* Set up return */
UT_SetDeferredRetcode(UT_KEY(CFE_PSP_GetSpacecraftId), 1, sc_id);

UT_Text("Set to all F's, msgid value = 0, and run with clearing");
memset(&msg, 0xFF, sizeof(msg));
msgidval_exp = 0;
Expand All @@ -83,7 +87,7 @@ void Test_MSG_Init_Ext(void)

/* Default system check */
ASSERT_EQ(CFE_MSG_GetSystem(&msg, &system), CFE_SUCCESS);
ASSERT_EQ(system, CFE_MISSION_SPACECRAFT_ID);
ASSERT_EQ(system, sc_id);

/* Default endian check */
ASSERT_EQ(CFE_MSG_GetEndian(&msg, &endian), CFE_SUCCESS);
Expand Down

0 comments on commit 09f6662

Please sign in to comment.