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

Class for handling the Transfer Frames for Telecommand as described in CCSDS 232.0-B-3. More...

#include <ccsds_transferframe_tc.h>

Inheritance diagram for CCSDS::TransferframeTc:
CCSDS::Transferframe

Public Types

typedef void() TTcCallback(void *p_Context, const bool b_BypassFlag, const bool b_CtrlCmdFlag, const uint16_t u16_SpacecraftID, const uint8_t u8_VirtualChannelID, const uint8_t u8_FrameSeqNumber, const uint8_t *pu8_Data, const uint16_t u16_DataSize)
 Declaration of the callback which shall be called if a complete telecommand transfer frame was received. More...
 

Public Member Functions

 TransferframeTc (void *p_TcContext=NULL, TTcCallback *mp_TcCallback=NULL)
 Construct a new TransferframeTc object. More...
 
void setCallback (void *p_TcContext, TTcCallback *mp_TcCallback)
 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 bool b_BypassFlag, const bool b_CtrlCmdFlag, const uint16_t u16_SpacecraftID, const uint8_t u8_VirtualChannelID, const uint8_t u8_FrameSeqNumber, const uint8_t *pu8_Data, const uint16_t u16_DataSize)
 Creates a Telecommand 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 Telecommand as described in CCSDS 232.0-B-3.

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 Uplink Data (such as telecommands or software update data blocks), a flow control mechanism and an error detection mechanism is implemented in this protocol. This layer does not have a synchronization mechanism, so it is common to embed transfer frames in Communications Link Transmission Units (CLTUs, see CCSDS 231.0-B-3).

With the Transfer Frame protocol, virtual channels are supported. Each frame has a virtual channel ID (0 up to 63, depending on the configuration), which could for e.g. address different subsystems within the same spacecraft. Each virtual channel comes with its own flow control mechanism. Attention: Telemetry Transfer Frames only support virtual channels 0 to 7.

This class inherits from the Transfer Frame base class and is responsible for handling the part which is needed to create and process telecommands or uplink data (configuration files, software update, ...).

The size of the Transfer Frame may vary and depends on the information which are to be transfered. The maximum size is limmited to 1024 bytes by the protocol including the header and the CRC. Since source packets can be larger, sequence flags are used for segmentation of the uplink data.

Member Typedef Documentation

◆ TTcCallback

CCSDS::TransferframeTc::TTcCallback

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

The implementation of this callback shall handle the telecommand transfer frame. It shall implement the Frame Acceptance and Reporting Mechanism (FARM) as well as further processing of the embedded protocol (usually space packets) or forwarding the packet to another target.

Parameters
p_ContextThe pointer to the context which has to be used
b_BypassFlagIndicates if the command was sent in AD mode (BypassFlag is false) with handling of the Frame Acceptance and Reporting Mechanism (FARM) or in BD mode (BypassFlag is true, each packet shall be accepted onboard)
b_CtrlCmdFlagIndicates if the packet is intended for the AD mode mechanism
u16_SpacecraftIDThe target spacecraft ID
u8_VirtualChannelIDThe virtual channel ID
u8_FrameSeqNumberThe virtual channel specific frame sequence number
pu8_DataA pointer to the data block which holds the content of the package
u16_DataSizeThe size of the data block in bytes

Constructor & Destructor Documentation

◆ TransferframeTc()

CCSDS::TransferframeTc::TransferframeTc ( void *  p_TcContext = NULL,
TTcCallback p_TcCallback = NULL 
)

Construct a new TransferframeTc object.

Parameters
p_TcContextA pointer to the context which has to be used when a telecommand transfer frame is received
p_TcCallbackThis callback is called when a telecommand transfer frame is received

Member Function Documentation

◆ create()

uint32_t CCSDS::TransferframeTc::create ( uint8_t *  pu8_Buffer,
const uint32_t  u32_BufferSize,
const bool  b_BypassFlag,
const bool  b_CtrlCmdFlag,
const uint16_t  u16_SpacecraftID,
const uint8_t  u8_VirtualChannelID,
const uint8_t  u8_FrameSeqNumber,
const uint8_t *  pu8_Data,
const uint16_t  u16_DataSize 
)
static

Creates a Telecommand 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
b_BypassFlagIndicates if the command shall be sent in AD mode (BypassFlag must be false) with handling of the Frame Acceptance and Reporting Mechanism (FARM) or in BD mode (BypassFlag must be true, each packet shall be accepted onboard)
b_CtrlCmdFlagIndicates if the packet is intended for the AD mode mechanism
u16_SpacecraftIDThe spacecraft ID which is used for this package (12 bit)
u8_VirtualChannelIDThe virtual channel which is used for this package (0 up to 63)
u8_FrameSeqNumberThe channel-specific frame sequence number, must be increased externally
pu8_DataA pointer to the data block which shall be wrapped
u16_DataSizeThe size of the data block in bytes
Return values
0No packet could be created
Returns
The size of the created packet in bytes as uint32_t

◆ setCallback()

void CCSDS::TransferframeTc::setCallback ( void *  p_TcContext,
TTcCallback p_TcCallback 
)

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

Parameters
p_TcContextA pointer to the context which has to be used when a telecommand transfer frame is received
p_TcCallbackThis callback is called when a telecommand transfer frame is received

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