Ejemplo n.º 1
0
/**
** \brief CFE_SB_SetCmdCode stub function
**
** \par Description
**        This function is used to mimic the response of the cFE SB function
**        CFE_SB_SetCmdCode.
**
** \par Assumptions, External Events, and Notes:
**        None
**
** \returns
**        Returns either CFE_SB_WRONG_MSG_TYPE or CFE_SUCCESS.
**
******************************************************************************/
int32 CFE_SB_SetCmdCode(CFE_SB_MsgPtr_t MsgPtr, uint16 CmdCode)
{
    int32           status = CFE_SUCCESS;
    CFE_SB_CmdHdr_t *CmdHdrPtr;

    /* If msg type is telemetry, ignore the request */
    if (CCSDS_RD_TYPE(MsgPtr->Hdr) == CCSDS_TLM)
    {
        status = CFE_SB_WRONG_MSG_TYPE;
    }
    else
    {
        /* Cast the input pointer to a Cmd Msg pointer */
        CmdHdrPtr = (CFE_SB_CmdHdr_t *) MsgPtr;
        CCSDS_WR_FC(CmdHdrPtr->Sec,CmdCode);
    }

    return status;
}
Ejemplo n.º 2
0
int32 Ut_CFE_SB_SetCmdCodeHook(CFE_SB_MsgPtr_t MsgPtr,
                      uint16 CmdCode)
{
#ifdef MESSAGE_FORMAT_IS_CCSDS

    CFE_SB_CmdHdr_t     *CmdHdrPtr;

    /* if msg type is telemetry or there is no secondary hdr... */
    if((CCSDS_RD_TYPE(MsgPtr->Hdr) == CCSDS_TLM)||(CCSDS_RD_SHDR(MsgPtr->Hdr) == 0)){
        return CFE_SB_WRONG_MSG_TYPE;
    }/* end if */

    /* Cast the input pointer to a Cmd Msg pointer */
    CmdHdrPtr = (CFE_SB_CmdHdr_t *)MsgPtr;

    CCSDS_WR_FC(CmdHdrPtr->Sec,CmdCode);

    return CFE_SUCCESS;

#endif

}/* end Ut_CFE_SB_SetCmdCodeHook */