CCSDS
pus_tc.h
Go to the documentation of this file.
1
12#ifndef _PUS_TC_H_
13#define _PUS_TC_H_
14
15/****************************************************************/
16/* PUS TC Packet according to */
17/* */
18/* ECSS-E-70-41A - Space Packet Protocol */
19/* */
20/****************************************************************/
21
22
23namespace PUS
24{
25
26#define PUS_TC_HEADER_SIZE 6 // can act as spacepacket secondary header
27#define PUS_TC_MAX_DATA_SIZE 20
28
36 class tc
37 {
38 public:
39 enum CcsdsSecHeaderFlag
40 {
41 Custom = 0,
42 CCSDS = 1
43 };
44
45 enum Service
46 {
47 TelecommandVerificationService = 1,
48 DeviceCommandDistributionService = 2,
49 HousekeepingAndDiagnosticDataReportingService = 3,
50 ParameterStatisticsReportingService = 4,
51 EventReportingService = 5,
52 MemoryManagementService = 6,
53 NotUsed1 = 7,
54 FunctionManagementService = 8,
55 TimeManagementService = 9,
56 NotUsed2 = 10,
57 OnboardOperationsSchedulingService = 11,
58 OnboardMonitoringService = 12,
59 LargeDataTransferService = 13,
60 PacketForwardingControlService = 14,
61 OnboardStorageAndRetrievalService = 15,
62 NotUsed3 = 16,
63 TestService = 17,
64 OnboardOperationsProcedureService = 18,
65 EventActionService = 19
66 };
67
68 typedef void (TPusTcCallback)(void *p_Context,
69 const bool b_AckAcc, const bool b_AckStart, const bool b_AckProg, const bool b_AckComp,
70 const uint8_t u8_Service, const uint8_t u8_SubService,
71 const uint8_t u8_SourceID,
72 const uint8_t *pu8_Data, const uint32_t u32_DataSize);
73
74 private:
75 static const int PusTcPacketVersion = 1;
76
77 void *mp_Context;
78 TPusTcCallback *mp_PusTcCallback;
79
80
81 public:
82 tc(void *p_Context = NULL, TPusTcCallback *p_PusTcCallback = NULL);
83
84 static uint32_t create(uint8_t *pu8_SecHdrBuffer, const uint32_t u32_SecHdrSize,
85 uint8_t *pu8_PacketDataBuffer, const uint32_t u32_PacketDataSize,
86 const bool b_AckAcc, const bool b_AckStart, const bool b_AckProg, const bool b_AckComp,
87 const uint8_t u8_Service, const uint8_t u8_SubService,
88 const uint8_t u8_SourceID,
89 const uint8_t *pu8_Data, const uint32_t u32_DataSize);
90
91 // sp processing
92 int32_t process(const uint8_t *pu8_Buffer, const uint32_t u32_BufferSize);
93
94
95
96 private:
97 static int32_t _create_secondary_header(uint8_t *pu8_Buffer,
98 const bool b_AckAcc, const bool b_AckStart, const bool b_AckProg, const bool b_AckComp,
99 const uint8_t u8_Service, const uint8_t u8_SubService,
100 const uint8_t u8_SourceID, const uint16_t u16_Spare);
101
102 public:
103
104 static uint16_t _calcCRC(const uint8_t *pu8_Buffer, const uint16_t u16_BufferSize);
105
106
107 };
108
109}
110
111#endif // _PUS_TC_H_
Class for handling the telecommands as described in the Packet Utilization Standard (PUS),...
Definition: pus_tc.h:37
static uint32_t create(uint8_t *pu8_SecHdrBuffer, const uint32_t u32_SecHdrSize, uint8_t *pu8_PacketDataBuffer, const uint32_t u32_PacketDataSize, const bool b_AckAcc, const bool b_AckStart, const bool b_AckProg, const bool b_AckComp, const uint8_t u8_Service, const uint8_t u8_SubService, const uint8_t u8_SourceID, const uint8_t *pu8_Data, const uint32_t u32_DataSize)
Creates a Telecommand and writes it into the given buffer.
Definition: pus_tc.cpp:62
int32_t process(const uint8_t *pu8_Buffer, const uint32_t u32_BufferSize)
The given data is processed.
Definition: pus_tc.cpp:103
tc(void *p_Context=NULL, TPusTcCallback *p_PusTcCallback=NULL)
Construct a new PUS TC object.
Definition: pus_tc.cpp:34