예제 #1
0
CFE_SB_MsgId_t Ut_CFE_SB_GetMsgIdHook(CFE_SB_MsgPtr_t MsgPtr)
{
#ifdef MESSAGE_FORMAT_IS_CCSDS

    return CCSDS_RD_SID(MsgPtr->Hdr);

#endif
}/* end Ut_CFE_SB_GetMsgIdHook */
예제 #2
0
/******************************************************************************
**  Function:  CFE_SB_GetMsgId()
**
**  Purpose:
**    Get the message ID of a message.
**
**  Arguments:
**    MsgPtr - Pointer to a CFE_SB_Msg_t
**
**  Return:
**    The Message Id in the message.
*/
CFE_SB_MsgId_t CFE_SB_GetMsgId(CFE_SB_MsgPtr_t MsgPtr)
{
#ifdef MESSAGE_FORMAT_IS_CCSDS

    return CCSDS_RD_SID(MsgPtr->Hdr);

#endif
}/* end CFE_SB_GetMsgId */
예제 #3
0
/******************************************************************************
**  Function:  UTF_put_packet_header()
**
**  Purpose:
**    Display the CCSDS header of a packet.
*/
void UTF_put_packet_header (uint8 source, CCSDS_PriHdr_t *packet)
{

    uint16              sid;
    CFE_TIME_SysTime_t  TimeFromMsg;

    sid = CCSDS_RD_SID(*packet);

    if (CCSDS_SID_TYPE(sid) == CCSDS_CMD)
	{

        if (CCSDS_SID_SHDR(sid) == CCSDS_HAS_SEC_HDR)
		{

            UTF_put_text("%s CMD: APID:%04x SEQ:%d LEN:%d FC:%d ",
                (source == UTF_SOURCE_SEND) ? ">": "<",
                CCSDS_RD_APID(*packet),
                CCSDS_RD_SEQ(*packet),
                CCSDS_RD_LEN(*packet),
                CCSDS_RD_FC(((CCSDS_CmdPkt_t *)packet)->SecHdr));
        }
        else
		{

            UTF_put_text("%s CMD: APID:%04x SEQ:%d LEN:%d ",
                (source == UTF_SOURCE_SEND) ? ">": "<",
                CCSDS_RD_APID(*packet),
                CCSDS_RD_SEQ(*packet),
                CCSDS_RD_LEN(*packet));
        }
    }
    else
	{

        if (CCSDS_SID_SHDR(sid) == CCSDS_HAS_SEC_HDR)
		{
            TimeFromMsg = CFE_SB_GetMsgTime((CFE_SB_MsgPtr_t)packet);
            UTF_put_text("%s TLM: APID:%04x SEQ:%d LEN:%d TIME:%08x %08x ",
                (source == UTF_SOURCE_SEND) ? ">": "<",
                CCSDS_RD_APID(*packet),
                CCSDS_RD_SEQ(*packet),
                CCSDS_RD_LEN(*packet),
                TimeFromMsg.Seconds,
                TimeFromMsg.Subseconds);
        }
        else
		{

            UTF_put_text("%s TLM: APID:%04x SEQ:%d LEN:%d ",
                (source == UTF_SOURCE_SEND) ? ">": "<",
                CCSDS_RD_APID(*packet),
                CCSDS_RD_SEQ(*packet),
                CCSDS_RD_LEN(*packet));
        }
    }
}
예제 #4
0
/******************************************************************************
**  Function:  UTF_put_packet()
**
**  Purpose:
**    Display a packet.
*/
void UTF_put_packet (uint8 source, CCSDS_PriHdr_t *packet)
{
    if (packet_output_disabled[CCSDS_RD_SID(*packet)])
        return;

    if (custom_packet_handlers[CCSDS_RD_SID(*packet)])
        custom_packet_handlers[CCSDS_RD_SID(*packet)](source, packet);
    else if (default_packet_handler) {
        (*default_packet_handler)(source, packet);
    }
    else {

        UTF_put_packet_header (source, packet);
        if (!packet_output_header_only [CCSDS_RD_SID(*packet)])
        {
            UTF_put_text("PKT:");
            UTF_put_data(((void *)packet), (uint16)(CCSDS_RD_LEN(*packet)), UTF_AS_WORD);
        }
        else {
            UTF_put_text("\n");
        }
    }
}
예제 #5
0
/******************************************************************************
**  Function:  CFE_SB_SetUserDataLength()
**
**  Purpose:
**    Set the length field in the hdr, given the user data length.
**
**  Arguments:
**    MsgPtr     - Pointer to a CFE_SB_Msg_t
**    DataLength - Length of the user data
**
**  Return:
**    (none)
*/
void CFE_SB_SetUserDataLength(CFE_SB_MsgPtr_t MsgPtr,uint16 DataLength)
{
#ifdef MESSAGE_FORMAT_IS_CCSDS

    uint32 TotalMsgSize, HdrSize;

    CFE_SB_MsgId_t MsgId;
    MsgId = CCSDS_RD_SID(MsgPtr->Hdr);
    HdrSize = CFE_SB_MsgHdrSize(MsgId);
    TotalMsgSize = HdrSize + DataLength;
    CCSDS_WR_LEN(MsgPtr->Hdr,TotalMsgSize);

#endif
}/* end CFE_SB_SetUserDataLength */
예제 #6
0
/******************************************************************************
**  Function:  CFE_SB_GetUserDataLength()
**
**  Purpose:
**    Get the length of the user data of a message (total size - hdrs).
**
**  Arguments:
**    MsgPtr - Pointer to a CFE_SB_Msg_t
**
**  Return:
**    Size of the message minus the headers
*/
uint16 CFE_SB_GetUserDataLength(CFE_SB_MsgPtr_t MsgPtr)
{
#ifdef MESSAGE_FORMAT_IS_CCSDS
    uint16 TotalMsgSize;
    uint16 HdrSize;

    CFE_SB_MsgId_t MsgId;
    MsgId = CCSDS_RD_SID(MsgPtr->Hdr);
    TotalMsgSize = CFE_SB_GetTotalMsgLength(MsgPtr);
    HdrSize = CFE_SB_MsgHdrSize(MsgId);

    return (TotalMsgSize - HdrSize);
#endif
}/* end CFE_SB_GetUserDataLength */
예제 #7
0
/******************************************************************************
**  Function:  CFE_SB_GetUserData()
**
**  Purpose:
**    Get a pointer to the user data portion of a message.
**
**  Arguments:
**    MsgPtr - Pointer to a CFE_SB_Msg_t
**
**  Return:
**    Pointer to the first byte after the headers
*/
void *CFE_SB_GetUserData(CFE_SB_MsgPtr_t MsgPtr)
{
#ifdef MESSAGE_FORMAT_IS_CCSDS
    uint8           *BytePtr;
    CFE_SB_MsgId_t  MsgId;
    uint16          HdrSize;

    BytePtr = (uint8 *)MsgPtr;
    MsgId = CCSDS_RD_SID(MsgPtr->Hdr);
    HdrSize = CFE_SB_MsgHdrSize(MsgId);

    return (BytePtr + HdrSize);
#endif
}/* end CFE_SB_GetUserData */
/**
** \brief CFE_SB_GetMsgId stub function
**
** \par Description
**        This function is used to mimic the response of the cFE SB function
**        CFE_SB_GetMsgId.
**
** \par Assumptions, External Events, and Notes:
**        None
**
** \returns
**        Returns the entire stream ID from the primary header.
**
******************************************************************************/
CFE_SB_MsgId_t CFE_SB_GetMsgId(CFE_SB_MsgPtr_t MsgPtr)
{
    return CCSDS_RD_SID(MsgPtr->Hdr);
}