CCSDS
|
Class for handling the Transfer Frames for Telecommand as described in CCSDS 232.0-B-3. More...
#include <ccsds_transferframe_tc.h>
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... | |
![]() | |
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 uint16_t | calcCRC (const uint8_t *pu8_Buffer, const uint16_t u16_BufferSize) |
Additional Inherited Members | |
![]() | |
uint16_t | mu16_Index |
uint16_t | mu16_FrameLength |
bool | mb_Sync |
uint16_t | mu16_SyncErrorCount |
uint16_t | mu16_ChecksumErrorCount |
uint16_t | mu16_OverflowErrorCount |
![]() | |
static const uint8_t | SyncSize = TF_SYNC_SIZE |
static const uint8_t | FecfSize = 2 |
static const bool | UseFECF = (TF_USE_FECF)?true:false |
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.
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.
p_Context | The pointer to the context which has to be used |
b_BypassFlag | Indicates 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_CtrlCmdFlag | Indicates if the packet is intended for the AD mode mechanism |
u16_SpacecraftID | The target spacecraft ID |
u8_VirtualChannelID | The virtual channel ID |
u8_FrameSeqNumber | The virtual channel specific frame sequence number |
pu8_Data | A pointer to the data block which holds the content of the package |
u16_DataSize | The size of the data block in bytes |
CCSDS::TransferframeTc::TransferframeTc | ( | void * | p_TcContext = NULL , |
TTcCallback * | p_TcCallback = NULL |
||
) |
Construct a new TransferframeTc object.
p_TcContext | A pointer to the context which has to be used when a telecommand transfer frame is received |
p_TcCallback | This callback is called when a telecommand transfer frame is received |
|
static |
Creates a Telecommand Transfer Frame and writes it into the given buffer.
pu8_Buffer | A pointer to the buffer where the space packet shall be stored |
u32_BufferSize | The available size of the buffer |
b_BypassFlag | Indicates 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_CtrlCmdFlag | Indicates if the packet is intended for the AD mode mechanism |
u16_SpacecraftID | The spacecraft ID which is used for this package (12 bit) |
u8_VirtualChannelID | The virtual channel which is used for this package (0 up to 63) |
u8_FrameSeqNumber | The channel-specific frame sequence number, must be increased externally |
pu8_Data | A pointer to the data block which shall be wrapped |
u16_DataSize | The size of the data block in bytes |
0 | No packet could be created |
void CCSDS::TransferframeTc::setCallback | ( | void * | p_TcContext, |
TTcCallback * | p_TcCallback | ||
) |
Overwrites the context pointer and callback which were set using the constructor.
p_TcContext | A pointer to the context which has to be used when a telecommand transfer frame is received |
p_TcCallback | This callback is called when a telecommand transfer frame is received |