set application data function added

This commit is contained in:
Robin Müller 2020-05-15 15:30:29 +02:00
parent 69237bc2e8
commit 684da2b8d5
3 changed files with 20 additions and 5 deletions

View File

@ -14,7 +14,8 @@ uint8_t SpacePacketBase::getPacketVersionNumber( void ) {
return (this->data->header.packet_id_h & 0b11100000) >> 5; return (this->data->header.packet_id_h & 0b11100000) >> 5;
} }
void SpacePacketBase::initSpacePacketHeader(bool isTelecommand, bool hasSecondaryHeader, uint16_t apid, uint16_t sequenceCount) { void SpacePacketBase::initSpacePacketHeader(bool isTelecommand,
bool hasSecondaryHeader, uint16_t apid, uint16_t sequenceCount) {
//reset header to zero: //reset header to zero:
memset(data,0, sizeof(this->data->header) ); memset(data,0, sizeof(this->data->header) );
//Set TC/TM bit. //Set TC/TM bit.

View File

@ -46,9 +46,16 @@ void TcPacketBase::setErrorControl() {
(&tcData->data)[size + 1] = (crc) & 0X00FF; // CRCL (&tcData->data)[size + 1] = (crc) & 0X00FF; // CRCL
} }
void TcPacketBase::setData(const uint8_t* p_Data) { void TcPacketBase::setData(const uint8_t* pData) {
SpacePacketBase::setData(p_Data); SpacePacketBase::setData(pData);
tcData = (TcPacketPointer*) p_Data; tcData = (TcPacketPointer*) pData;
}
void TcPacketBase::setApplicationData(const uint8_t * pData, size_t dataLen) {
SpacePacketBase::setData(pData);
tcData = (TcPacketPointer*) pData;
SpacePacketBase::setPacketDataLength(dataLen +
sizeof(PUSTcDataFieldHeader) + TcPacketBase::CRC_SIZE-1);
} }
uint8_t TcPacketBase::getSecondaryHeaderFlag() { uint8_t TcPacketBase::getSecondaryHeaderFlag() {

View File

@ -2,6 +2,7 @@
#define TCPACKETBASE_H_ #define TCPACKETBASE_H_
#include <framework/tmtcpacket/SpacePacketBase.h> #include <framework/tmtcpacket/SpacePacketBase.h>
#include <cstddef>
/** /**
* This struct defines a byte-wise structured PUS TC Data Field Header. * This struct defines a byte-wise structured PUS TC Data Field Header.
@ -175,7 +176,13 @@ public:
* *
* @param p_data A pointer to another PUS Telecommand Packet. * @param p_data A pointer to another PUS Telecommand Packet.
*/ */
void setData( const uint8_t* p_data ); void setData( const uint8_t* pData );
/**
* Set application data and corresponding length field.
* @param pData
* @param dataLen
*/
void setApplicationData(const uint8_t * pData, size_t dataLen);
/** /**
* This is a debugging helper method that prints the whole packet content * This is a debugging helper method that prints the whole packet content
* to the screen. * to the screen.