diff --git a/fsw/inc/ci_lab_eventids.h b/fsw/inc/ci_lab_eventids.h index 6d25c11..19e8a64 100644 --- a/fsw/inc/ci_lab_eventids.h +++ b/fsw/inc/ci_lab_eventids.h @@ -23,17 +23,20 @@ #ifndef CI_LAB_EVENTIDS_H #define CI_LAB_EVENTIDS_H -#define CI_LAB_RESERVED_EID 0 -#define CI_LAB_SOCKETCREATE_ERR_EID 1 -#define CI_LAB_SOCKETBIND_ERR_EID 2 -#define CI_LAB_INIT_INF_EID 3 -#define CI_LAB_MID_ERR_EID 4 -#define CI_LAB_NOOP_INF_EID 5 -#define CI_LAB_RESET_INF_EID 6 -#define CI_LAB_INGEST_INF_EID 7 -#define CI_LAB_INGEST_LEN_ERR_EID 8 -#define CI_LAB_INGEST_ALLOC_ERR_EID 9 -#define CI_LAB_INGEST_SEND_ERR_EID 10 -#define CI_LAB_CMD_LEN_ERR_EID 16 +#define CI_LAB_RESERVED_EID 0 +#define CI_LAB_SOCKETCREATE_ERR_EID 1 +#define CI_LAB_SOCKETBIND_ERR_EID 2 +#define CI_LAB_INIT_INF_EID 3 +#define CI_LAB_MID_ERR_EID 4 +#define CI_LAB_NOOP_INF_EID 5 +#define CI_LAB_RESET_INF_EID 6 +#define CI_LAB_INGEST_INF_EID 7 +#define CI_LAB_INGEST_LEN_ERR_EID 8 +#define CI_LAB_INGEST_ALLOC_ERR_EID 9 +#define CI_LAB_INGEST_SEND_ERR_EID 10 +#define CI_LAB_CREATE_PIPE_ERR_EID 11 +#define CI_LAB_SB_SUBSCRIBE_CMD_ERR_EID 12 +#define CI_LAB_SB_SUBSCRIBE_HK_ERR_EID 13 +#define CI_LAB_CMD_LEN_ERR_EID 16 #endif diff --git a/fsw/src/ci_lab_app.c b/fsw/src/ci_lab_app.c index 7e4f193..522b917 100644 --- a/fsw/src/ci_lab_app.c +++ b/fsw/src/ci_lab_app.c @@ -106,11 +106,34 @@ void CI_LAB_TaskInit(void) memset(&CI_LAB_Global, 0, sizeof(CI_LAB_Global)); - CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY); + status = CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY); + if (status != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("CI_LAB: Error registering for Event Services, RC = 0x%08X\n", (unsigned int)status); + } + + status = CFE_SB_CreatePipe(&CI_LAB_Global.CommandPipe, CI_LAB_PIPE_DEPTH, "CI_LAB_CMD_PIPE"); + if (status == CFE_SUCCESS) + { + status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CI_LAB_CMD_MID), CI_LAB_Global.CommandPipe); + if (status != CFE_SUCCESS) + { + CFE_EVS_SendEvent(CI_LAB_SB_SUBSCRIBE_CMD_ERR_EID, CFE_EVS_EventType_ERROR, + "Error subscribing to SB Commands, RC = 0x%08X", (unsigned int)status); + } - CFE_SB_CreatePipe(&CI_LAB_Global.CommandPipe, CI_LAB_PIPE_DEPTH, "CI_LAB_CMD_PIPE"); - CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CI_LAB_CMD_MID), CI_LAB_Global.CommandPipe); - CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CI_LAB_SEND_HK_MID), CI_LAB_Global.CommandPipe); + status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CI_LAB_SEND_HK_MID), CI_LAB_Global.CommandPipe); + if (status != CFE_SUCCESS) + { + CFE_EVS_SendEvent(CI_LAB_SB_SUBSCRIBE_HK_ERR_EID, CFE_EVS_EventType_ERROR, + "Error subscribing to SB HK Request, RC = 0x%08X", (unsigned int)status); + } + } + else + { + CFE_EVS_SendEvent(CI_LAB_CREATE_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, + "Error creating SB Command Pipe, RC = 0x%08X", (unsigned int)status); + } status = OS_SocketOpen(&CI_LAB_Global.SocketID, OS_SocketDomain_INET, OS_SocketType_DATAGRAM); if (status != OS_SUCCESS)