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

Class for handling the telecommands as described in the Packet Utilization Standard (PUS), ECSS-E-70-41A. More...

#include <pus_tc.h>

Public Types

enum  CcsdsSecHeaderFlag { Custom = 0 , CCSDS = 1 }
 
enum  Service {
  TelecommandVerificationService = 1 , DeviceCommandDistributionService = 2 , HousekeepingAndDiagnosticDataReportingService = 3 , ParameterStatisticsReportingService = 4 ,
  EventReportingService = 5 , MemoryManagementService = 6 , NotUsed1 = 7 , FunctionManagementService = 8 ,
  TimeManagementService = 9 , NotUsed2 = 10 , OnboardOperationsSchedulingService = 11 , OnboardMonitoringService = 12 ,
  LargeDataTransferService = 13 , PacketForwardingControlService = 14 , OnboardStorageAndRetrievalService = 15 , NotUsed3 = 16 ,
  TestService = 17 , OnboardOperationsProcedureService = 18 , EventActionService = 19
}
 
typedef void() TPusTcCallback(void *p_Context, 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)
 

Public Member Functions

 tc (void *p_Context=NULL, TPusTcCallback *p_PusTcCallback=NULL)
 Construct a new PUS TC object. More...
 
int32_t process (const uint8_t *pu8_Buffer, const uint32_t u32_BufferSize)
 The given data is processed. More...
 

Static Public Member Functions

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. More...
 
static uint16_t _calcCRC (const uint8_t *pu8_Buffer, const uint16_t u16_BufferSize)
 

Detailed Description

Class for handling the telecommands as described in the Packet Utilization Standard (PUS), ECSS-E-70-41A.

Beside the description of the structure of space packets, the ECSS-E-70-41A also describes the inner structure of telecommand space packets. This class implements this inner struture. It handles the service and the subservice as well as the acknowledges for a command.

Constructor & Destructor Documentation

◆ tc()

PUS::tc::tc ( void *  p_Context = NULL,
TPusTcCallback *  p_PusTcCallback = NULL 
)

Construct a new PUS TC object.

Parameters
p_ContextA pointer to the context which has to be used when a command is received
p_PusTcCallbackThis callback is called when a command is received

Member Function Documentation

◆ create()

uint32_t PUS::tc::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 
)
static

Creates a Telecommand and writes it into the given buffer.

Parameters
pu8_SecHdrBufferA pointer to the buffer where the header (service, subservice, acknowledge requests) shall be stored
u32_SecHdrSizeThe size of the header buffer (must be at least 6)
pu8_PacketDataBufferA pointer to the buffer where the data (command parameters) shall be stored
u32_PacketDataSizeThe size of the data buffer
b_AckAccFlag if an Acceptence Report is requested
b_AckStartFlag if an Execution Start Report is requested
b_AckProgFlag if an Execution Progress Report is requested
b_AckCompFlag if an Execution Complete Report is requested
u8_ServiceThe service ID of the command
u8_SubServiceThe Subservice ID of the command
u8_SourceIDThe source ID of the command
pu8_DataCommand data (parameters)
u32_DataSizeThe size of the command data
Return values
0No packet could be created
Returns
The size of the created data (without header)

◆ process()

int32_t PUS::tc::process ( const uint8_t *  pu8_Buffer,
const uint32_t  u32_BufferSize 
)

The given data is processed.

The method can only handle complete telecommands. With the extracted information from the data buffer, the function p_PusTcCallback is called.

Parameters
pu8_BufferThe data buffer which is to extract
u32_BufferSizeThe size of the data buffer
Return values
0If the buffer was extracted successfully
-1If fhe u32_BufferSize is 0 or the pu8_Buffer is NULL

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