CCSDSPack
C++ Library for CCSDS Space Packet manipulation. i.e. generation, extraction, analisys and more
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
PusA Class Referencefinal

Represents a PUS Type A (Telemetry) header. More...

#include <PusServices.h>

Inheritance diagram for PusA:
[legend]
Collaboration diagram for PusA:
[legend]

Public Member Functions

 PusA ()=default
 
 PusA (const uint8_t version, const uint8_t serviceType, const uint8_t serviceSubtype, const uint8_t sourceID, const uint32_t dataLength)
 Constructs a PusA object with all fields explicitly set.
 
void setDataLength (const uint16_t dataLength) override
 Sets the length of the data associated with the packet.
 
uint8_t getVersion () const
 
uint8_t getServiceType () const
 
uint8_t getServiceSubtype () const
 
uint8_t getSourceID () const
 
uint16_t getDataLength () const override
 Gets the length of the data associated with the packet if applicable.
 
uint16_t getSize () const override
 Gets the size of the header in bytes.
 
std::string getType () const override
 Retrieves the name of the packet.
 
std::vector< uint8_t > serialize () const override
 Retrieves the serialized representation of the header.
 
CCSDS::ResultBool deserialize (const std::vector< uint8_t > &data) override
 takes a buffer if data (vector uint8) and creates the header
 
- Public Member Functions inherited from CCSDS::SecondaryHeaderAbstract
virtual ~SecondaryHeaderAbstract ()=default
 

Private Attributes

uint8_t m_version {}
 
uint8_t m_serviceType {}
 
uint8_t m_serviceSubType {}
 
uint8_t m_sourceID {}
 
uint16_t m_dataLength {}
 
const std::string m_type = "PusA"
 
const uint16_t m_size = 6
 

Detailed Description

Represents a PUS Type A (Telemetry) header.

Contains fields used for telemetry data.

Field Summary:

Definition at line 19 of file PusServices.h.

Constructor & Destructor Documentation

◆ PusA() [1/2]

PusA::PusA ( )
default

◆ PusA() [2/2]

PusA::PusA ( const uint8_t  version,
const uint8_t  serviceType,
const uint8_t  serviceSubtype,
const uint8_t  sourceID,
const uint32_t  dataLength 
)
inlineexplicit

Constructs a PusA object with all fields explicitly set.

Parameters
versionPUS version (3 bits).
serviceTypeService type (8 bits).
serviceSubtypeService subtype (8 bits).
sourceIDSource identifier (8 bits).
dataLengthLength of the telemetry data (16 bits).

Definition at line 31 of file PusServices.h.

32 : m_version(version & 0x7),
33 m_serviceType(serviceType),
34 m_serviceSubType(serviceSubtype),
35 m_sourceID(sourceID), m_dataLength(dataLength) {
36 }
uint16_t m_dataLength
Definition PusServices.h:56
uint8_t m_serviceSubType
Definition PusServices.h:54
uint8_t m_sourceID
Definition PusServices.h:55
uint8_t m_version
Definition PusServices.h:52
uint8_t m_serviceType
Definition PusServices.h:53

Member Function Documentation

◆ deserialize()

CCSDS::ResultBool PusA::deserialize ( const std::vector< uint8_t > &  data)
overridevirtual

takes a buffer if data (vector uint8) and creates the header

Returns
Boolean true on success or Error.

Implements CCSDS::SecondaryHeaderAbstract.

Definition at line 4 of file PusServices.cpp.

4 {
6 "PUS-A header not correct size (size != 6 bytes)");
7
8 m_version = data[0] & 0x5;
9 m_serviceType = data[1];
10 m_serviceSubType = data[2];
11 m_sourceID = data[3];
12 m_dataLength = data[4] << 8 | data[5];
13 return true;
14}
#define RET_IF_ERR_MSG(condition, errorCode, message)
Macro to return an error with an error message if a condition is met.
const uint16_t m_size
Definition PusServices.h:59
@ INVALID_SECONDARY_HEADER_DATA
Secondary header data is invalid.
Definition CCSDSResult.h:25

◆ getDataLength()

uint16_t PusA::getDataLength ( ) const
inlineoverridevirtual

Gets the length of the data associated with the packet if applicable.

Returns
The length of the data in bytes set in the header.

Implements CCSDS::SecondaryHeaderAbstract.

Definition at line 44 of file PusServices.h.

44{ return m_dataLength; }

◆ getServiceSubtype()

uint8_t PusA::getServiceSubtype ( ) const
inline

Definition at line 42 of file PusServices.h.

42{ return m_serviceSubType; }

◆ getServiceType()

uint8_t PusA::getServiceType ( ) const
inline

Definition at line 41 of file PusServices.h.

41{ return m_serviceType; }

◆ getSize()

uint16_t PusA::getSize ( ) const
inlineoverridevirtual

Gets the size of the header in bytes.

Returns
The size of the header in bytes.

Implements CCSDS::SecondaryHeaderAbstract.

Definition at line 45 of file PusServices.h.

45{ return m_size; }

◆ getSourceID()

uint8_t PusA::getSourceID ( ) const
inline

Definition at line 43 of file PusServices.h.

43{ return m_sourceID; }

◆ getType()

std::string PusA::getType ( ) const
inlineoverridevirtual

Retrieves the name of the packet.

Returns
A vector containing the header bytes. (does not include data field)

Implements CCSDS::SecondaryHeaderAbstract.

Definition at line 46 of file PusServices.h.

46{ return m_type; }
const std::string m_type
Definition PusServices.h:58

◆ getVersion()

uint8_t PusA::getVersion ( ) const
inline

Definition at line 40 of file PusServices.h.

40{ return m_version; }

◆ serialize()

std::vector< uint8_t > PusA::serialize ( ) const
overridevirtual

Retrieves the serialized representation of the header.

Returns
A vector containing the header bytes. (does not include data field)

Implements CCSDS::SecondaryHeaderAbstract.

Definition at line 16 of file PusServices.cpp.

16 {
17 std::vector data{
18 static_cast<uint8_t>(m_version & 0x7),
22 static_cast<uint8_t>(m_dataLength >> 8 & 0xFF),
23 static_cast<uint8_t>(m_dataLength & 0xFF),
24 };
25
26 return data;
27}

◆ setDataLength()

void PusA::setDataLength ( const uint16_t  dataLength)
inlineoverridevirtual

Sets the length of the data associated with the packet.

Parameters
dataLengthLength of the data in bytes.

Implements CCSDS::SecondaryHeaderAbstract.

Definition at line 38 of file PusServices.h.

38{ m_dataLength = dataLength; }

Member Data Documentation

◆ m_dataLength

uint16_t PusA::m_dataLength {}
private

Definition at line 56 of file PusServices.h.

56{}; // Data Length 16 Length of the telemetry data in bytes

◆ m_serviceSubType

uint8_t PusA::m_serviceSubType {}
private

Definition at line 54 of file PusServices.h.

54{}; // Service Subtype 8 Subtype of the service (e.g., specific telemetry type)

◆ m_serviceType

uint8_t PusA::m_serviceType {}
private

Definition at line 53 of file PusServices.h.

53{}; // Service Type 8 Type of service (e.g., 0x01 for telemetry)

◆ m_size

const uint16_t PusA::m_size = 6
private

Definition at line 59 of file PusServices.h.

◆ m_sourceID

uint8_t PusA::m_sourceID {}
private

Definition at line 55 of file PusServices.h.

55{}; // Source ID 8 ID of the source (e.g., satellite or sensor)

◆ m_type

const std::string PusA::m_type = "PusA"
private

Definition at line 58 of file PusServices.h.

◆ m_version

uint8_t PusA::m_version {}
private

Definition at line 52 of file PusServices.h.

52{}; // Version 3 Version of the PUS standard

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