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 #204, Check return value of calls to CFE_SB_Subscribe() #205

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Fix #204, Check return value of calls to CFE_SB_Subscribe()
thnkslprpt committed Oct 11, 2024
commit 8af52cf801e946ece2d88a0d2b162bf7b304654f
2 changes: 2 additions & 0 deletions fsw/inc/to_lab_eventids.h
Original file line number Diff line number Diff line change
@@ -47,6 +47,8 @@
#define TO_LAB_NOOP_INF_EID 18
#define TO_LAB_TBL_ERR_EID 19
#define TO_LAB_ENCODE_ERR_EID 20
#define TO_LAB_SUBSCRIBE_CMD_ERR_EID 21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the purpose of adding these two new event IDs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to have unique error EIDs instead of overloading a previous one.

#define TO_LAB_SUBSCRIBE_HK_ERR_EID 22

/******************************************************************************/

31 changes: 24 additions & 7 deletions fsw/src/to_lab_app.c
Original file line number Diff line number Diff line change
@@ -141,7 +141,7 @@ CFE_Status_t TO_LAB_init(void)

if (status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(TO_LAB_TBL_ERR_EID, CFE_EVS_EventType_ERROR, "L%d TO Can't register table status %i",
CFE_EVS_SendEvent(TO_LAB_TBL_ERR_EID, CFE_EVS_EventType_ERROR, "L%d TO can't register table status %i",
__LINE__, (int)status);
}
}
@@ -152,7 +152,7 @@ CFE_Status_t TO_LAB_init(void)

if (status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(TO_LAB_TBL_ERR_EID, CFE_EVS_EventType_ERROR, "L%d TO Can't load table status %i",
CFE_EVS_SendEvent(TO_LAB_TBL_ERR_EID, CFE_EVS_EventType_ERROR, "L%d TO can't load table status %i",
__LINE__, (int)status);
}
}
@@ -163,7 +163,7 @@ CFE_Status_t TO_LAB_init(void)

if (status != CFE_SUCCESS && status != CFE_TBL_INFO_UPDATED)
{
CFE_EVS_SendEvent(TO_LAB_TBL_ERR_EID, CFE_EVS_EventType_ERROR, "L%d TO Can't get table addr status %i",
CFE_EVS_SendEvent(TO_LAB_TBL_ERR_EID, CFE_EVS_EventType_ERROR, "L%d TO can't get table addr status %i",
__LINE__, (int)status);
}
}
@@ -176,22 +176,39 @@ CFE_Status_t TO_LAB_init(void)
status = CFE_SB_CreatePipe(&TO_LAB_Global.Cmd_pipe, PipeDepth, PipeName);
if (status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(TO_LAB_CR_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, "L%d TO Can't create cmd pipe status %i",
CFE_EVS_SendEvent(TO_LAB_CR_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, "L%d TO can't create cmd pipe status %i",
__LINE__, (int)status);
}
}

if (status == CFE_SUCCESS)
{

CFE_SB_Subscribe(CFE_SB_ValueToMsgId(TO_LAB_CMD_MID), TO_LAB_Global.Cmd_pipe);
status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(TO_LAB_CMD_MID), TO_LAB_Global.Cmd_pipe);
if (status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(TO_LAB_SUBSCRIBE_CMD_ERR_EID, CFE_EVS_EventType_ERROR,
"L%d TO can't subscribe to cmd mid status %i", __LINE__, (int)status);
}
}

if (status == CFE_SUCCESS)
{
CFE_SB_Subscribe(CFE_SB_ValueToMsgId(TO_LAB_SEND_HK_MID), TO_LAB_Global.Cmd_pipe);
if (status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(TO_LAB_SUBSCRIBE_HK_ERR_EID, CFE_EVS_EventType_ERROR,
"L%d TO can't subscribe to HK mid status %i", __LINE__, (int)status);
}
}

if (status == CFE_SUCCESS)
{
/* Create TO TLM pipe */
status = CFE_SB_CreatePipe(&TO_LAB_Global.Tlm_pipe, ToTlmPipeDepth, ToTlmPipeName);
if (status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(TO_LAB_TLMPIPE_ERR_EID, CFE_EVS_EventType_ERROR, "L%d TO Can't create Tlm pipe status %i",
CFE_EVS_SendEvent(TO_LAB_TLMPIPE_ERR_EID, CFE_EVS_EventType_ERROR, "L%d TO can't create Tlm pipe status %i",
__LINE__, (int)status);
}
}
@@ -212,7 +229,7 @@ CFE_Status_t TO_LAB_init(void)
if (status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(TO_LAB_SUBSCRIBE_ERR_EID, CFE_EVS_EventType_ERROR,
"L%d TO Can't subscribe to stream 0x%x status %i", __LINE__,
"L%d TO can't subscribe to stream 0x%x status %i", __LINE__,
(unsigned int)CFE_SB_MsgIdToValue(SubEntry->Stream), (int)status);
}