/**
** \brief CFE_SB_RcvMsg stub function
**
** \par Description
**        This function is used to mimic the response of the cFE SB function
**        CFE_SB_RcvMsg.  It returns one successful command, then fails on a
**        subsequent call.
**
** \par Assumptions, External Events, and Notes:
**        None
**
** \returns
**        Returns CFE_SUCCESS on the first call, then -1 on the second.
**
******************************************************************************/
int32 CFE_SB_RcvMsg(CFE_SB_MsgPtr_t *BufPtr,
                    CFE_SB_PipeId_t PipeId,
                    int32 TimeOut)
{
    int32      status = CFE_SUCCESS;
    static int NumRuns = 0;

    if (NumRuns == 0)
    {
        CFE_SB_SetMsgId(&UT_message, UT_RcvMsgId);
        CFE_SB_SetCmdCode(&UT_message, UT_RcvMsgCode);
        *BufPtr = &UT_message;
        NumRuns++;
    }
    else
    {
        if (NumRuns == 1)
        {
            status = CFE_SB_TIME_OUT;
            NumRuns++;
        }
        else
        {
            if (NumRuns == 2)
            {
                status = -1;
                NumRuns = 0;
            }
        }
    }

    return status;
}
/**
** \brief CFE_SB_InitMsg stub function
**
** \par Description
**        This function is used to mimic the response of the cFE SB function
**        CFE_SB_InitMsg.
**
** \par Assumptions, External Events, and Notes:
**        None
**
** \returns
**        This function does not return a value.
**
******************************************************************************/
void CFE_SB_InitMsg(void *MsgPtr,
                    CFE_SB_MsgId_t MsgId,
                    uint16 Length,
                    boolean Clear)
{
#ifdef UT_VERBOSE
    SNPRINTF(cMsg, UT_MAX_MESSAGE_LENGTH,
             "  CFE_SB_InitMsg called: initialized msg %d", MsgId);
    UT_Text(cMsg);
#endif
    CFE_SB_SetMsgId(MsgPtr, MsgId);
}
Example #3
0
/*
** Send a message via the software bus
*/
void UT_SendMsg(CFE_SB_MsgPtr_t msg_ptr, CFE_SB_MsgId_t id, uint16 code)
{
    CFE_SB_SetMsgId(msg_ptr, id);
    CFE_SB_SetCmdCode(msg_ptr, code);
    CFE_SB_SendMsg(msg_ptr);
}