CCSDS
|
Class for handling the Transfer Frames for Telemetry as described in CCSDS 132.0-B-2. More...
#include <ccsds_transferframe_tm.h>
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... | |
![]() | |
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 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 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.
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).
p_Context | The pointer to the context which has to be used |
u16_SpacecraftID | The souce spacecraft ID |
u8_VirtualChannelID | The virtual channel ID |
u8_MasterChannelFrameCount | The overall frame count over all virtual channels |
u8_VirtualChannelFrameCount | The channel-specific frame count |
b_TFSecHdrFlag | A flag which indicates the presence of a secondary transfer frame header |
u16_FirstHdrPtr | Offset of the first space packet within the data section |
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 |
u32_OCF | The Operational Control Field (OCF), which is part of the flow control mechanism for uplink data (can hold the Communications Link Control Word (CLCW)) |
CCSDS::TransferframeTm::TransferframeTm | ( | void * | p_TmContext = NULL , |
TTmCallback * | p_TmCallback = NULL |
||
) |
Construct a new TransferframeTm object.
p_TmContext | A pointer to the context which has to be used when a telemetry transfer frame is received |
p_TmCallback | This callback is called when a telemetry transfer frame is received |
|
static |
Creates a Telemetry 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 |
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 to 7) |
u8_MasterChannelFrameCount | The overall frame count over all virtual channels, must be increased externally |
u8_VirtualChannelFrameCount | The channel-specific frame count, must be increased externally |
u16_FirstHdrPtr | Offset of the first space packet within the data section |
pu8_Data | A pointer to the data block which shall be wrapped |
u16_DataSize | The size of the data block in bytes |
u32_OCF | The Operational Control Field (OCF), which is part of the flow control mechanism for uplink data (can hold the Communications Link Control Word (CLCW)) |
0 | No packet could be created |
|
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.
pu8_Buffer | A pointer to the buffer where the space packet shall be stored |
u32_BufferSize | The available size of the buffer |
u16_SpacecraftID | The spacecraft ID which is used for this package (12 bit) |
u8_VirtualChannelID | The virtual channel which is used for this idle frame (usually 7) |
u8_MasterChannelFrameCount | The overall frame count over all virtual channels, must be increased externally |
u8_VirtualChannelFrameCount | The channel-specific frame count, must be increased externally |
u32_OCF | The Operational Control Field (OCF), which is part of the flow control mechanism for uplink data (can hold the Communications Link Control Word (CLCW)) |
0 | No packet could be created |
void CCSDS::TransferframeTm::setCallback | ( | void * | p_TmContext, |
TTmCallback * | p_TmCallback | ||
) |
Overwrites the context pointer and callback which were set using the constructor.
p_TmContext | A pointer to the context which has to be used when a telemetry transfer frame is received |
p_TmCallback | This callback is called when a telemetry transfer frame is received |