CCSDS
Public Types | Public Member Functions | Static Public Member Functions | List of all members
CCSDS::TransferframeTm Class Reference

Class for handling the Transfer Frames for Telemetry as described in CCSDS 132.0-B-2. More...

#include <ccsds_transferframe_tm.h>

Inheritance diagram for CCSDS::TransferframeTm:
CCSDS::Transferframe

Public Types

typedef void() TTmCallback(void *p_Context, const uint16_t u16_SpacecraftID, const uint8_t u8_VirtualChannelID, const uint8_t u8_MasterChannelFrameCount, const uint8_t u8_VirtualChannelFrameCount, const bool b_TFSecHdrFlag, const uint16_t u16_FirstHdrPtr, const uint8_t *pu8_Data, const uint16_t u16_DataSize, const uint32_t u32_OCF)
 Declaration of the callback which shall be called if a complete telemetry transfer frame was received. More...
 

Public Member Functions

 TransferframeTm (void *p_TmContext=NULL, TTmCallback *mp_TmCallback=NULL)
 Construct a new TransferframeTm object. More...
 
void setCallback (void *p_TmContext, TTmCallback *mp_TmCallback)
 Overwrites the context pointer and callback which were set using the constructor. More...
 
- Public Member Functions inherited from CCSDS::Transferframe
void setSync (void)
 Sets the sync flag for the transfer frame processing. More...
 
int32_t process (const uint8_t *pu8_Data, const uint16_t u16_DataSize)
 The given data stream is parsed for Transfer Frames. More...
 
uint16_t getSyncErrorCount (void)
 Returns the number of sync errors. More...
 
uint16_t getChecksumErrorCount (void)
 Returns the number of checksum errors. More...
 
uint16_t getOverflowErrorCount (void)
 Returns the number of overflow errors. More...
 
void clearErrorCounters (void)
 Clears all error counters (Sync Error, Overflow Error and Checksum Error)
 
 Transferframe (void)
 Construct a new Transferframe object.
 
bool _checkCRC (void)
 

Static Public Member Functions

static uint32_t create (uint8_t *pu8_Buffer, const uint32_t u32_BufferSize, const uint16_t u16_SpacecraftID, const uint8_t u8_VirtualChannelID, const uint8_t u8_MasterChannelFrameCount, const uint8_t u8_VirtualChannelFrameCount, const uint16_t u16_FirstHdrPtr, const uint8_t *pu8_Data, const uint16_t u16_DataSize, const uint32_t u32_OCF=0)
 Creates a Telemetry Transfer Frame and writes it into the given buffer. More...
 
static uint32_t createIdle (uint8_t *pu8_Buffer, const uint32_t u32_BufferSize, const uint16_t u16_SpacecraftID, const uint8_t u8_VirtualChannelID, const uint8_t u8_MasterChannelFrameCount, const uint8_t u8_VirtualChannelFrameCount, const uint32_t u32_OCF=0)
 Creates an Idle Telemetry Transfer Frame and writes it into the given buffer. More...
 
- Static Public Member Functions inherited from CCSDS::Transferframe
static uint16_t calcCRC (const uint8_t *pu8_Buffer, const uint16_t u16_BufferSize)
 

Additional Inherited Members

- Protected Attributes inherited from CCSDS::Transferframe
uint16_t mu16_Index
 
uint16_t mu16_FrameLength
 
bool mb_Sync
 
uint16_t mu16_SyncErrorCount
 
uint16_t mu16_ChecksumErrorCount
 
uint16_t mu16_OverflowErrorCount
 
- Static Protected Attributes inherited from CCSDS::Transferframe
static const uint8_t SyncSize = TF_SYNC_SIZE
 
static const uint8_t FecfSize = 2
 
static const bool UseFECF = (TF_USE_FECF)?true:false
 

Detailed Description

Class for handling the Transfer Frames for Telemetry as described in CCSDS 132.0-B-2.

Transfer Frames in general are used to ensure a transfer from the ground to the spacecraft and vice versa, corresponding to OSI layer 2.

For downlink data, Transfer Frames with a fixed size are used. These Transfer Frames also include the Operational Control Field (OCF), which is part of the flow control mechanism for uplink data. So this field usually holds the Communications Link Control Word (CLCW) with the information about the uplink signal status or the FARM counters.

With respect to the specification, this class does not add a synchronization sequence to the head of the transfer frame. These synchronization sequence (usually 0x1ACFFC1D) must be added before sending the transfer frame to the ground is done.

With the Transfer Frame protocol, virtual channels (0 to 7) are supported. The virtual channels can be used for different sub systems within one spacecraft or different purposes. Channel 0 is usually used for real-time data of the main system. Channel 1 could be used for historic data, channels 2-6 could be used for payload systems. Virtual Channel 7 is usually reserved for IDLE data to fill up the data stream from the satellite to be continuous.

This class inherits from the Transfer Frame base class and is responsible for handling the part which is needed to create and process telemetry or downlink data.

The size of the Transfer Frame is fix within a mission. Since source packets can be larger, sequence flags are used for segmentation of the downlink data. In case the included source packet is smaller than the available space in the transfer frame, the frame must be filled up with idle source packets.

Member Typedef Documentation

◆ TTmCallback

CCSDS::TransferframeTm::TTmCallback

Declaration of the callback which shall be called if a complete telemetry transfer frame was received.

The implementation of this callback shall handle the telemetry transfer frame. It shall implement the Frame Acceptance and Reporting Mechanism (FARM) as well as further processing of the embedded protocol (usually space packets).

Parameters
p_ContextThe pointer to the context which has to be used
u16_SpacecraftIDThe souce spacecraft ID
u8_VirtualChannelIDThe virtual channel ID
u8_MasterChannelFrameCountThe overall frame count over all virtual channels
u8_VirtualChannelFrameCountThe channel-specific frame count
b_TFSecHdrFlagA flag which indicates the presence of a secondary transfer frame header
u16_FirstHdrPtrOffset of the first space packet within the data section
pu8_DataA pointer to the data block which holds the content of the package
u16_DataSizeThe size of the data block in bytes
u32_OCFThe Operational Control Field (OCF), which is part of the flow control mechanism for uplink data (can hold the Communications Link Control Word (CLCW))

Constructor & Destructor Documentation

◆ TransferframeTm()

CCSDS::TransferframeTm::TransferframeTm ( void *  p_TmContext = NULL,
TTmCallback p_TmCallback = NULL 
)

Construct a new TransferframeTm object.

Parameters
p_TmContextA pointer to the context which has to be used when a telemetry transfer frame is received
p_TmCallbackThis callback is called when a telemetry transfer frame is received

Member Function Documentation

◆ create()

uint32_t CCSDS::TransferframeTm::create ( uint8_t *  pu8_Buffer,
const uint32_t  u32_BufferSize,
const uint16_t  u16_SpacecraftID,
const uint8_t  u8_VirtualChannelID,
const uint8_t  u8_MasterChannelFrameCount,
const uint8_t  u8_VirtualChannelFrameCount,
const uint16_t  u16_FirstHdrPtr,
const uint8_t *  pu8_Data,
const uint16_t  u16_DataSize,
const uint32_t  u32_OCF = 0 
)
static

Creates a Telemetry Transfer Frame and writes it into the given buffer.

Parameters
pu8_BufferA pointer to the buffer where the space packet shall be stored
u32_BufferSizeThe available size of the buffer
u16_SpacecraftIDThe spacecraft ID which is used for this package (12 bit)
u8_VirtualChannelIDThe virtual channel which is used for this package (0 to 7)
u8_MasterChannelFrameCountThe overall frame count over all virtual channels, must be increased externally
u8_VirtualChannelFrameCountThe channel-specific frame count, must be increased externally
u16_FirstHdrPtrOffset of the first space packet within the data section
pu8_DataA pointer to the data block which shall be wrapped
u16_DataSizeThe size of the data block in bytes
u32_OCFThe Operational Control Field (OCF), which is part of the flow control mechanism for uplink data (can hold the Communications Link Control Word (CLCW))
Return values
0No packet could be created
Returns
The size of the created packet in bytes as uint32_t

◆ createIdle()

uint32_t CCSDS::TransferframeTm::createIdle ( uint8_t *  pu8_Buffer,
const uint32_t  u32_BufferSize,
const uint16_t  u16_SpacecraftID,
const uint8_t  u8_VirtualChannelID,
const uint8_t  u8_MasterChannelFrameCount,
const uint8_t  u8_VirtualChannelFrameCount,
const uint32_t  u32_OCF = 0 
)
static

Creates an Idle Telemetry Transfer Frame and writes it into the given buffer.

Idle Frames are used to fill up the data stream to have a continuous data flow to the ground. Usually, the virtual channel 7 is used for idle frames.

Parameters
pu8_BufferA pointer to the buffer where the space packet shall be stored
u32_BufferSizeThe available size of the buffer
u16_SpacecraftIDThe spacecraft ID which is used for this package (12 bit)
u8_VirtualChannelIDThe virtual channel which is used for this idle frame (usually 7)
u8_MasterChannelFrameCountThe overall frame count over all virtual channels, must be increased externally
u8_VirtualChannelFrameCountThe channel-specific frame count, must be increased externally
u32_OCFThe Operational Control Field (OCF), which is part of the flow control mechanism for uplink data (can hold the Communications Link Control Word (CLCW))
Return values
0No packet could be created
Returns
The size of the created packet in bytes as uint32_t

◆ setCallback()

void CCSDS::TransferframeTm::setCallback ( void *  p_TmContext,
TTmCallback p_TmCallback 
)

Overwrites the context pointer and callback which were set using the constructor.

Parameters
p_TmContextA pointer to the context which has to be used when a telemetry transfer frame is received
p_TmCallbackThis callback is called when a telemetry transfer frame is received

The documentation for this class was generated from the following files: