possible bugfix
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
Robin Müller 2022-08-15 18:58:56 +02:00
parent 232372fd96
commit e1c06ce1f5
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 12 additions and 9 deletions

View File

@ -174,7 +174,7 @@ class TcBase : public ploc::SpTcBase, public MPSoCReturnValuesIF {
} }
} }
updateFields(); updateSpFields();
res = checkSizeAndSerializeHeader(); res = checkSizeAndSerializeHeader();
if (res != result::OK) { if (res != result::OK) {
return res; return res;
@ -306,7 +306,7 @@ class FlashFopen : public ploc::SpTcBase {
*(spParams.buf + nameSize) = NULL_TERMINATOR; *(spParams.buf + nameSize) = NULL_TERMINATOR;
std::memcpy(payloadStart + nameSize + sizeof(NULL_TERMINATOR), &accessMode, sizeof(accessMode)); std::memcpy(payloadStart + nameSize + sizeof(NULL_TERMINATOR), &accessMode, sizeof(accessMode));
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR) + sizeof(accessMode)); spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR) + sizeof(accessMode));
updateFields(); updateSpFields();
return calcCrc(); return calcCrc();
} }
@ -354,7 +354,7 @@ class TcFlashWrite : public ploc::SpTcBase {
} }
std::memcpy(payloadStart + sizeof(writeLen), writeData, writeLen); std::memcpy(payloadStart + sizeof(writeLen), writeData, writeLen);
spParams.setPayloadLen(static_cast<uint16_t>(writeLen) + 4); spParams.setPayloadLen(static_cast<uint16_t>(writeLen) + 4);
updateFields(); updateSpFields();
auto res = checkSizeAndSerializeHeader(); auto res = checkSizeAndSerializeHeader();
if (res != result::OK) { if (res != result::OK) {
return res; return res;
@ -379,7 +379,7 @@ class TcFlashDelete : public ploc::SpTcBase {
std::memcpy(payloadStart, filename.c_str(), nameSize); std::memcpy(payloadStart, filename.c_str(), nameSize);
*(payloadStart + nameSize) = NULL_TERMINATOR; *(payloadStart + nameSize) = NULL_TERMINATOR;
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR)); spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR));
updateFields(); updateSpFields();
auto res = checkSizeAndSerializeHeader(); auto res = checkSizeAndSerializeHeader();
if (res != result::OK) { if (res != result::OK) {
return res; return res;

View File

@ -26,16 +26,19 @@ struct SpTcParams {
class SpTcBase { class SpTcBase {
public: public:
SpTcBase(SpTcParams params) : spParams(params) { updateFields(); } SpTcBase(SpTcParams params) : spParams(params) {
payloadStart = spParams.buf + ccsds::HEADER_LEN;
updateSpFields();
}
SpTcBase(SpTcParams params, uint16_t apid, uint16_t seqCount) : spParams(params) { SpTcBase(SpTcParams params, uint16_t apid, uint16_t seqCount) : spParams(params) {
spParams.creator.setApid(apid); spParams.creator.setApid(apid);
spParams.creator.setSeqCount(seqCount); spParams.creator.setSeqCount(seqCount);
updateFields(); payloadStart = spParams.buf + ccsds::HEADER_LEN;
updateSpFields();
} }
void updateFields() { void updateSpFields() {
payloadStart = spParams.buf + ccsds::HEADER_LEN;
spParams.creator.setDataLen(spParams.dataFieldLen - 1); spParams.creator.setDataLen(spParams.dataFieldLen - 1);
spParams.creator.setPacketType(ccsds::PacketType::TC); spParams.creator.setPacketType(ccsds::PacketType::TC);
} }
@ -55,7 +58,7 @@ class SpTcBase {
} }
ReturnValue_t serializeHeader() { ReturnValue_t serializeHeader() {
updateFields(); updateSpFields();
size_t serLen = 0; size_t serLen = 0;
return spParams.creator.serializeBe(spParams.buf, serLen, spParams.maxSize); return spParams.creator.serializeBe(spParams.buf, serLen, spParams.maxSize);
} }