CCSDS
ccsds_transferframe_tc.h
Go to the documentation of this file.
1
12#ifndef _CCSDS_TRANSFERFRAME_TC_H_
13#define _CCSDS_TRANSFERFRAME_TC_H_
14
15/****************************************************************/
16/* TC Transferframes according to */
17/* */
18/* - CCSDS 232.0-B-3, - TC Space Data Link Protocol */
19/* https://public.ccsds.org/Pubs/232x0b3.pdf */
20/* */
21/* Limitations: */
22/* - The TC segment header is not supported */
23/* */
24/* Remarks: */
25/* - the sync code 0x1acffc1d is not generated */
26/* by the create() method. */
27/* */
28/****************************************************************/
29
30#include "configCCSDS.h"
31
32#ifdef configTC_TF_MAX_SIZE
33#define TC_TF_MAX_SIZE configTC_TF_MAX_SIZE
34#else
35#define TC_TF_MAX_SIZE 508
36#endif
37
38#ifdef configTC_TF_PRIM_HEADER_SIZE
39#define TC_TF_PRIM_HEADER_SIZE configTC_TF_PRIM_HEADER_SIZE
40#else
41#define TC_TF_PRIM_HEADER_SIZE 5
42#endif
43
44
45
46#include "ccsds_transferframe.h"
47
48
49namespace CCSDS
50{
51
77 {
78 public:
79
99 typedef void (TTcCallback)(void *p_Context, const bool b_BypassFlag, const bool b_CtrlCmdFlag,
100 const uint16_t u16_SpacecraftID, const uint8_t u8_VirtualChannelID,
101 const uint8_t u8_FrameSeqNumber,
102 const uint8_t *pu8_Data, const uint16_t u16_DataSize);
103
104
105 private:
106 static const int TcTfVersionNumber = 0;
107 const static uint8_t PrimaryHdrSize = TC_TF_PRIM_HEADER_SIZE;
108 const static uint16_t MaxTfSize = TC_TF_MAX_SIZE;
109 uint8_t mau8_Buffer[MaxTfSize];
110
111 void *mp_TcContext;
112 TTcCallback *mp_TcCallback;
113
114 public:
115 TransferframeTc(void *p_TcContext = NULL, TTcCallback *mp_TcCallback = NULL);
116
117 void setCallback(void *p_TcContext, TTcCallback *mp_TcCallback);
118
119
120 // TC generation
121 static uint32_t create(uint8_t *pu8_Buffer, const uint32_t u32_BufferSize,
122 const bool b_BypassFlag, const bool b_CtrlCmdFlag,
123 const uint16_t u16_SpacecraftID, const uint8_t u8_VirtualChannelID,
124 const uint8_t u8_FrameSeqNumber,
125 const uint8_t *pu8_Data, const uint16_t u16_DataSize);
126
127 private:
128 static int32_t _createPrimaryHeader(uint8_t *pu8_Buffer,
129 const bool b_BypassFlag, const bool b_CtrlCmdFlag,
130 const uint16_t u16_SpacecraftID, const uint8_t u8_VirtualChannelID,
131 const uint16_t u16_FrameLength, const uint8_t u8_FrameSeqNumber);
132
133 int32_t _processFrame(void);
134
135 private:
136 inline uint16_t _getMaxTfSize(void);
137 inline uint8_t *_getTfBufferAddr(void);
138 inline uint16_t _getPrimaryHeaderSize(void);
139 inline void _getFrameLength(void);
140 };
141
142
143}
144
145
146#endif // _CCSDS_TRANSFERFRAME_TC_H_
147
148
Include file of the Transferframe (TF) class.
Base Class for handling Transfer Frames as described in CCSDS 131.0-B-3, CCSDS 132....
Definition: ccsds_transferframe.h:57
Class for handling the Transfer Frames for Telecommand as described in CCSDS 232.0-B-3.
Definition: ccsds_transferframe_tc.h:77
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.
Definition: ccsds_transferframe_tc.cpp:66
TransferframeTc(void *p_TcContext=NULL, TTcCallback *mp_TcCallback=NULL)
Construct a new TransferframeTc object.
Definition: ccsds_transferframe_tc.cpp:26
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 receiv...
Definition: ccsds_transferframe_tc.h:99
void setCallback(void *p_TcContext, TTcCallback *mp_TcCallback)
Overwrites the context pointer and callback which were set using the constructor.
Definition: ccsds_transferframe_tc.cpp:40