TMTC Packet Base improvements #80
|
@ -82,7 +82,7 @@ void SpacePacketBase::setPacketDataLength( uint16_t new_length) {
|
|||
this->data->header.packet_length_l = ( new_length & 0x00FF );
|
||||
}
|
||||
|
||||
uint32_t SpacePacketBase::getFullSize() {
|
||||
size_t SpacePacketBase::getFullSize() {
|
||||
//+1 is done because size in packet data length field is: size of data field -1
|
||||
return this->getPacketDataLength() + sizeof(this->data->header) + 1;
|
||||
}
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
#define SPACEPACKETBASE_H_
|
||||
|
||||
#include <framework/tmtcpacket/ccsds_header.h>
|
||||
#include <cstddef>
|
||||
|
||||
/**
|
||||
* \defgroup tmtcpackets Space Packets
|
||||
* @defgroup tmtcpackets Space Packets
|
||||
* This is the group, where all classes associated with Telecommand and
|
||||
* Telemetry packets belong to.
|
||||
* The class hierarchy resembles the dependency between the different standards
|
||||
|
@ -167,7 +168,7 @@ public:
|
|||
* This method returns the full raw packet size.
|
||||
* @return The full size of the packet in bytes.
|
||||
*/
|
||||
uint32_t getFullSize();
|
||||
size_t getFullSize();
|
||||
|
||||
uint32_t getApidAndSequenceCount() const;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ void TcPacketBase::setData(const uint8_t* pData) {
|
|||
tcData = (TcPacketPointer*) pData;
|
||||
}
|
||||
|
||||
void TcPacketBase::setApplicationData(const uint8_t * pData, size_t dataLen) {
|
||||
void TcPacketBase::setApplicationData(const uint8_t * pData, uint16_t dataLen) {
|
||||
|
||||
SpacePacketBase::setData(pData);
|
||||
gaisser
commented
As tcData->appData is only a "fake" pointer of which we are not able to check the length, this operation is dangerous and there is no warning about it. TcPacketStored is the way the user does not have to thing about that. The whole class is only intended as Parsing Helper for a existing Packet or it is hidden behind a safe operation as in TcPacketStored. I'm not sure if we should allow setting of anything here after the constructor. As tcData->appData is only a "fake" pointer of which we are not able to check the length, this operation is dangerous and there is no warning about it. TcPacketStored is the way the user does not have to thing about that. The whole class is only intended as Parsing Helper for a existing Packet or it is hidden behind a safe operation as in TcPacketStored.
I'm not sure if we should allow setting of anything here after the constructor.
Even the setData function is interessting maybe we could make that protected as its only used in TcPacketStored.
|
||||
tcData = (TcPacketPointer*) pData;
|
||||
SpacePacketBase::setPacketDataLength(dataLen +
|
||||
|
|
|
@ -183,7 +183,7 @@ public:
|
|||
* @param pData
|
||||
* @param dataLen
|
||||
*/
|
||||
void setApplicationData(const uint8_t * pData, size_t dataLen);
|
||||
void setApplicationData(const uint8_t * pData, uint16_t dataLen);
|
||||
/**
|
||||
* This is a debugging helper method that prints the whole packet content
|
||||
* to the screen.
|
||||
|
|
Loading…
Reference in New Issue
Block a user
The getter is called "getApplicationData", we should keep the names the same.