bugfix for PUS A

This commit is contained in:
Robin Müller 2021-10-05 12:36:21 +02:00 committed by Robin Mueller
parent 9efe9e78d8
commit 54a6c1b0aa

View File

@ -42,32 +42,32 @@ TmPacketStoredPusA::TmPacketStoredPusA(uint16_t apid, uint8_t service,
return; return;
} }
size_t sourceDataSize = 0; size_t sourceDataSize = 0;
if (content != NULL) { if (content != nullptr) {
sourceDataSize += content->getSerializedSize(); sourceDataSize += content->getSerializedSize();
} }
if (header != NULL) { if (header != nullptr) {
sourceDataSize += header->getSerializedSize(); sourceDataSize += header->getSerializedSize();
} }
uint8_t *p_data = NULL; uint8_t *pData = nullptr;
ReturnValue_t returnValue = store->getFreeElement(&storeAddress, ReturnValue_t returnValue = store->getFreeElement(&storeAddress,
(getPacketMinimumSize() + sourceDataSize), &p_data); (getPacketMinimumSize() + sourceDataSize), &pData);
if (returnValue != store->RETURN_OK) { if (returnValue != store->RETURN_OK) {
TmPacketStoredBase::checkAndReportLostTm(); TmPacketStoredBase::checkAndReportLostTm();
return;
} }
setData(p_data); setData(pData);
initializeTmPacket(apid, service, subservice, packetSubcounter); initializeTmPacket(apid, service, subservice, packetSubcounter);
uint8_t *putDataHere = getSourceData(); uint8_t *putDataHere = getSourceData();
size_t size = 0; size_t size = 0;
if (header != NULL) { if (header != nullptr) {
header->serialize(&putDataHere, &size, sourceDataSize, header->serialize(&putDataHere, &size, sourceDataSize,
SerializeIF::Endianness::BIG); SerializeIF::Endianness::BIG);
} }
if (content != NULL) { if (content != nullptr) {
content->serialize(&putDataHere, &size, sourceDataSize, content->serialize(&putDataHere, &size, sourceDataSize,
SerializeIF::Endianness::BIG); SerializeIF::Endianness::BIG);
} }
setPacketDataLength( setPacketDataLength(sourceDataSize + sizeof(PUSTmDataFieldHeaderPusA) + CRC_SIZE - 1);
sourceDataSize + sizeof(PUSTmDataFieldHeaderPusA) + CRC_SIZE - 1);
} }
uint8_t* TmPacketStoredPusA::getAllTmData() { uint8_t* TmPacketStoredPusA::getAllTmData() {