/**
** \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;
}
Esempio n. 2
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);
}
Esempio n. 3
0
void init_cmd_pkt(CCSDS_CmdPkt_t *packet, uint16 mid, uint16 cmd_code){
    CFE_SB_InitMsg(packet, mid, sizeof(CCSDS_CmdPkt_t), TRUE);
    CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) packet, cmd_code);
}