v1.14.0 #304

Merged
muellerr merged 366 commits from develop into main 2022-10-10 17:46:38 +02:00
2 changed files with 12 additions and 9 deletions
Showing only changes of commit e1c06ce1f5 - Show all commits

View File

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

View File

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