TMTC Packet Base improvements #80
|
@ -52,10 +52,10 @@ void TcPacketBase::setData(const uint8_t* pData) {
|
|||
}
|
||||
|
||||
void TcPacketBase::setApplicationData(const uint8_t * pData, uint16_t dataLen) {
|
||||
|
||||
SpacePacketBase::setData(pData);
|
||||
tcData = (TcPacketPointer*) pData;
|
||||
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.
|
||||
// packet data length is actual size of data field minus 1
|
||||
SpacePacketBase::setPacketDataLength(dataLen +
|
||||
sizeof(PUSTcDataFieldHeader) + TcPacketBase::CRC_SIZE-1);
|
||||
sizeof(PUSTcDataFieldHeader) + TcPacketBase::CRC_SIZE - 1);
|
||||
}
|
||||
|
||||
uint8_t TcPacketBase::getSecondaryHeaderFlag() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user
The getter is called "getApplicationData", we should keep the names the same.