important fix and clarification
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
dc024e5385
commit
2b9afbedff
@ -153,7 +153,7 @@ class TcBase : public ploc::SpTcBase, public MPSoCReturnValuesIF {
|
||||
*/
|
||||
TcBase(ploc::SpTcParams params, uint16_t apid, uint16_t sequenceCount)
|
||||
: ploc::SpTcBase(params, apid, sequenceCount) {
|
||||
spParams.setDataFieldLen(INIT_LENGTH);
|
||||
spParams.setFullPacketLen(INIT_LENGTH);
|
||||
}
|
||||
|
||||
ReturnValue_t buildPacket() { return buildPacket(nullptr, 0); }
|
||||
@ -206,7 +206,7 @@ class TcMemRead : public TcBase {
|
||||
*/
|
||||
TcMemRead(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||
: TcBase(params, apid::TC_MEM_READ, sequenceCount) {
|
||||
spParams.setPayloadLen(COMMAND_LENGTH);
|
||||
spParams.setFullPacketLen(COMMAND_LENGTH + CRC_SIZE);
|
||||
}
|
||||
|
||||
uint16_t getMemLen() const { return memLen; }
|
||||
@ -267,7 +267,7 @@ class TcMemWrite : public TcBase {
|
||||
}
|
||||
uint16_t memLen =
|
||||
*(commandData + MEM_ADDRESS_SIZE) << 8 | *(commandData + MEM_ADDRESS_SIZE + 1);
|
||||
spParams.setPayloadLen(MIN_FIXED_PAYLOAD_LENGTH + memLen * 4);
|
||||
spParams.setFullPacketLen(MIN_FIXED_PAYLOAD_LENGTH + memLen * 4 + CRC_SIZE);
|
||||
result = checkPayloadLen();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
@ -313,7 +313,7 @@ class FlashFopen : public ploc::SpTcBase {
|
||||
ReturnValue_t createPacket(std::string filename, char accessMode_) {
|
||||
accessMode = accessMode_;
|
||||
size_t nameSize = filename.size();
|
||||
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR) + sizeof(accessMode));
|
||||
spParams.setFullPacketLen(nameSize + sizeof(NULL_TERMINATOR) + sizeof(accessMode) + CRC_SIZE);
|
||||
ReturnValue_t result = checkPayloadLen();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
@ -339,7 +339,7 @@ class FlashFclose : public ploc::SpTcBase {
|
||||
|
||||
ReturnValue_t createPacket(std::string filename) {
|
||||
size_t nameSize = filename.size();
|
||||
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR));
|
||||
spParams.setFullPacketLen(nameSize + sizeof(NULL_TERMINATOR) + CRC_SIZE);
|
||||
ReturnValue_t result = checkPayloadLen();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
@ -365,7 +365,7 @@ class TcFlashWrite : public ploc::SpTcBase {
|
||||
sif::debug << "FlashWrite::createPacket: Command data too big" << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
spParams.setPayloadLen(static_cast<uint16_t>(writeLen) + 4);
|
||||
spParams.setFullPacketLen(static_cast<uint16_t>(writeLen) + 4 + CRC_SIZE);
|
||||
result = checkPayloadLen();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
@ -399,7 +399,7 @@ class TcFlashDelete : public ploc::SpTcBase {
|
||||
|
||||
ReturnValue_t buildPacket(std::string filename) {
|
||||
size_t nameSize = filename.size();
|
||||
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR));
|
||||
spParams.setFullPacketLen(nameSize + sizeof(NULL_TERMINATOR) + CRC_SIZE);
|
||||
auto res = checkPayloadLen();
|
||||
if (res != returnvalue::OK) {
|
||||
return res;
|
||||
@ -439,7 +439,7 @@ class TcReplayStart : public TcBase {
|
||||
protected:
|
||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
spParams.setPayloadLen(commandDataLen);
|
||||
spParams.setFullPacketLen(commandDataLen + CRC_SIZE);
|
||||
result = lengthCheck(commandDataLen);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
@ -500,7 +500,7 @@ class TcDownlinkPwrOn : public TcBase {
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
spParams.setPayloadLen(commandDataLen + sizeof(MAX_AMPLITUDE));
|
||||
spParams.setFullPacketLen(commandDataLen + sizeof(MAX_AMPLITUDE) + CRC_SIZE);
|
||||
result = checkPayloadLen();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
@ -571,7 +571,7 @@ class TcReplayWriteSeq : public TcBase {
|
||||
protected:
|
||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
spParams.setPayloadLen(commandDataLen + sizeof(NULL_TERMINATOR));
|
||||
spParams.setFullPacketLen(commandDataLen + sizeof(NULL_TERMINATOR) + CRC_SIZE);
|
||||
result = lengthCheck(commandDataLen);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
@ -657,7 +657,8 @@ class TcCamcmdSend : public TcBase {
|
||||
return INVALID_LENGTH;
|
||||
}
|
||||
uint16_t dataLen = static_cast<uint16_t>(commandDataLen + sizeof(CARRIAGE_RETURN));
|
||||
spParams.setPayloadLen(sizeof(dataLen) + commandDataLen + sizeof(CARRIAGE_RETURN));
|
||||
spParams.setFullPacketLen(sizeof(dataLen) + commandDataLen + sizeof(CARRIAGE_RETURN) +
|
||||
CRC_SIZE);
|
||||
auto res = checkPayloadLen();
|
||||
if (res != returnvalue::OK) {
|
||||
return res;
|
||||
|
@ -161,8 +161,6 @@ static const size_t MAX_DATA_CAPACITY = 1016;
|
||||
/** This is the maximum size of a space packet for the supervisor */
|
||||
static const size_t MAX_PACKET_SIZE = 1024;
|
||||
|
||||
static const uint8_t SPACE_PACKET_HEADER_LENGTH = 6;
|
||||
|
||||
struct UpdateParams {
|
||||
std::string file;
|
||||
uint8_t memId;
|
||||
@ -284,6 +282,29 @@ static const uint32_t ERASE_MEMORY = 60000;
|
||||
static const uint32_t UPDATE_STATUS_REPORT = 70000;
|
||||
} // namespace recv_timeout
|
||||
|
||||
static constexpr size_t TIMESTAMP_LEN = 7;
|
||||
static constexpr size_t SECONDARY_HEADER_LEN = TIMESTAMP_LEN + 1;
|
||||
static constexpr size_t CRC_LEN = 2;
|
||||
|
||||
struct SupvTcParams : public ploc::SpTcParams {
|
||||
public:
|
||||
SupvTcParams(SpacePacketCreator& creator) : ploc::SpTcParams(creator) {}
|
||||
|
||||
SupvTcParams(SpacePacketCreator& creator, uint8_t* buf, size_t maxSize)
|
||||
: ploc::SpTcParams(creator, buf, maxSize) {}
|
||||
|
||||
void setLenFromPayloadLen(size_t payloadLen) {
|
||||
setFullPacketLen(ccsds::HEADER_LEN + SECONDARY_HEADER_LEN + payloadLen + CRC_LEN);
|
||||
}
|
||||
};
|
||||
|
||||
class SupvTcBase : public ploc::SpTcBase {
|
||||
public:
|
||||
SupvTcBase(SupvTcParams params) : ploc::SpTcBase(params) {}
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class creates a space packet containing only the header data and the CRC.
|
||||
*/
|
||||
@ -297,7 +318,7 @@ class ApidOnlyPacket : public ploc::SpTcBase {
|
||||
* @note Sequence count of empty packet is always 1.
|
||||
*/
|
||||
ApidOnlyPacket(ploc::SpTcParams params, uint16_t apid) : ploc::SpTcBase(params) {
|
||||
spParams.setDataFieldLen(LENGTH_EMPTY_TC);
|
||||
spParams.setFullPacketLen(LENGTH_EMPTY_TC);
|
||||
spParams.creator.setApid(apid);
|
||||
}
|
||||
|
||||
@ -332,7 +353,7 @@ class MPSoCBootSelect : public ploc::SpTcBase {
|
||||
* @note Selection of partitions is currently not supported.
|
||||
*/
|
||||
MPSoCBootSelect(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setDataFieldLen(DATA_FIELD_LENGTH);
|
||||
spParams.setFullPacketLen(DATA_FIELD_LENGTH);
|
||||
spParams.creator.setApid(APID_SEL_MPSOC_BOOT_IMAGE);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
@ -378,7 +399,7 @@ class EnableNvms : public ploc::SpTcBase {
|
||||
* @param bp2 Partition pin 2
|
||||
*/
|
||||
EnableNvms(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setDataFieldLen(DATA_FIELD_LENGTH);
|
||||
spParams.setFullPacketLen(DATA_FIELD_LENGTH);
|
||||
spParams.creator.setApid(APID_ENABLE_NVMS);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
@ -408,7 +429,7 @@ class EnableNvms : public ploc::SpTcBase {
|
||||
class SetTimeRef : public ploc::SpTcBase {
|
||||
public:
|
||||
SetTimeRef(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setDataFieldLen(DATA_FIELD_LENGTH);
|
||||
spParams.setFullPacketLen(DATA_FIELD_LENGTH);
|
||||
spParams.creator.setApid(APID_SET_TIME_REF);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
@ -487,7 +508,7 @@ class SetBootTimeout : public ploc::SpTcBase {
|
||||
* @param timeout The boot timeout in milliseconds.
|
||||
*/
|
||||
SetBootTimeout(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setDataFieldLen(DATA_FIELD_LENGTH);
|
||||
spParams.setFullPacketLen(DATA_FIELD_LENGTH);
|
||||
spParams.creator.setApid(APID_SET_BOOT_TIMEOUT);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
@ -524,7 +545,7 @@ class SetRestartTries : public ploc::SpTcBase {
|
||||
* @param restartTries Maximum restart tries to set.
|
||||
*/
|
||||
SetRestartTries(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setDataFieldLen(DATA_FIELD_LENGTH);
|
||||
spParams.setFullPacketLen(DATA_FIELD_LENGTH);
|
||||
spParams.creator.setApid(APID_SET_MAX_RESTART_TRIES);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
@ -558,7 +579,7 @@ class DisablePeriodicHkTransmission : public ploc::SpTcBase {
|
||||
* @brief Constructor
|
||||
*/
|
||||
DisablePeriodicHkTransmission(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setDataFieldLen(DATA_FIELD_LENGTH);
|
||||
spParams.setFullPacketLen(DATA_FIELD_LENGTH);
|
||||
spParams.creator.setApid(APID_DISABLE_HK);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
@ -594,7 +615,7 @@ class LatchupAlert : public ploc::SpTcBase {
|
||||
* 3 - 3.3V, 4 - NVM_4XO, 5 - MISSION, 6 - SAFECOTS)
|
||||
*/
|
||||
LatchupAlert(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setDataFieldLen(DATA_FIELD_LENGTH);
|
||||
spParams.setFullPacketLen(DATA_FIELD_LENGTH);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
|
||||
@ -632,7 +653,7 @@ class SetAlertlimit : public ploc::SpTcBase {
|
||||
* @param dutycycle
|
||||
*/
|
||||
SetAlertlimit(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setDataFieldLen(DATA_FIELD_LENGTH);
|
||||
spParams.setFullPacketLen(DATA_FIELD_LENGTH);
|
||||
spParams.creator.setApid(APID_SET_ALERT_LIMIT);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
@ -675,7 +696,7 @@ class SetAdcEnabledChannels : public ploc::SpTcBase {
|
||||
* @param ch Defines channels to be enabled or disabled.
|
||||
*/
|
||||
SetAdcEnabledChannels(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setDataFieldLen(DATA_FIELD_LENGTH);
|
||||
spParams.setFullPacketLen(DATA_FIELD_LENGTH);
|
||||
spParams.creator.setApid(APID_SET_ADC_ENABLED_CHANNELS);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
@ -714,7 +735,7 @@ class SetAdcWindowAndStride : public ploc::SpTcBase {
|
||||
* @param stridingStepSize
|
||||
*/
|
||||
SetAdcWindowAndStride(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setDataFieldLen(DATA_FIELD_LENGTH);
|
||||
spParams.setFullPacketLen(DATA_FIELD_LENGTH);
|
||||
spParams.creator.setApid(APID_SET_ADC_WINDOW_AND_STRIDE);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
@ -754,7 +775,7 @@ class SetAdcThreshold : public ploc::SpTcBase {
|
||||
* @param threshold
|
||||
*/
|
||||
SetAdcThreshold(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setDataFieldLen(DATA_FIELD_LENGTH);
|
||||
spParams.setFullPacketLen(DATA_FIELD_LENGTH);
|
||||
spParams.creator.setApid(APID_SET_ADC_THRESHOLD);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
@ -792,7 +813,7 @@ class RunAutoEmTests : public ploc::SpTcBase {
|
||||
* @param test 1 - complete EM test, 2 - Short test (only memory readback NVM0,1,3)
|
||||
*/
|
||||
RunAutoEmTests(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setDataFieldLen(DATA_FIELD_LENGTH);
|
||||
spParams.setFullPacketLen(DATA_FIELD_LENGTH);
|
||||
spParams.creator.setApid(APID_RUN_AUTO_EM_TESTS);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
@ -834,7 +855,7 @@ class MramCmd : public ploc::SpTcBase {
|
||||
* @note The content at the stop address is excluded from the dump or wipe operation.
|
||||
*/
|
||||
MramCmd(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setDataFieldLen(DATA_FIELD_LENGTH);
|
||||
spParams.setFullPacketLen(DATA_FIELD_LENGTH);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
|
||||
@ -888,7 +909,7 @@ class SetGpio : public ploc::SpTcBase {
|
||||
* @param val
|
||||
*/
|
||||
SetGpio(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setDataFieldLen(DATA_FIELD_LENGTH);
|
||||
spParams.setFullPacketLen(DATA_FIELD_LENGTH);
|
||||
spParams.creator.setApid(APID_SET_GPIO);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
@ -932,7 +953,7 @@ class ReadGpio : public ploc::SpTcBase {
|
||||
* @param pin
|
||||
*/
|
||||
ReadGpio(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setDataFieldLen(DATA_FIELD_LENGTH);
|
||||
spParams.setFullPacketLen(DATA_FIELD_LENGTH);
|
||||
spParams.creator.setApid(APID_READ_GPIO);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
@ -1009,14 +1030,14 @@ class FactoryReset : public ploc::SpTcBase {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
spParams.setDataFieldLen(packetDataLen);
|
||||
spParams.setFullPacketLen(packetDataLen);
|
||||
}
|
||||
};
|
||||
|
||||
class SetShutdownTimeout : public ploc::SpTcBase {
|
||||
public:
|
||||
SetShutdownTimeout(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setPayloadLen(PAYLOAD_LEN);
|
||||
spParams.setFullPacketLen(PAYLOAD_LEN + 2);
|
||||
spParams.creator.setApid(APID_SET_SHUTDOWN_TIMEOUT);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
@ -1055,7 +1076,7 @@ class CheckMemory : public ploc::SpTcBase {
|
||||
* @param length Length in bytes of memory region
|
||||
*/
|
||||
CheckMemory(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setPayloadLen(PAYLOAD_LENGTH);
|
||||
spParams.setFullPacketLen(PAYLOAD_LENGTH + 2);
|
||||
spParams.creator.setApid(APID_CHECK_MEMORY);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
@ -1134,9 +1155,9 @@ class WriteMemory : public ploc::SpTcBase {
|
||||
uint8_t* updateData) {
|
||||
uint8_t* data = payloadStart;
|
||||
if (updateDataLen % 2 != 0) {
|
||||
spParams.setPayloadLen(META_DATA_LENGTH + updateDataLen + 1);
|
||||
spParams.setFullPacketLen(META_DATA_LENGTH + updateDataLen + 1 + 2);
|
||||
} else {
|
||||
spParams.setPayloadLen(META_DATA_LENGTH + updateDataLen);
|
||||
spParams.setFullPacketLen(META_DATA_LENGTH + updateDataLen + 2);
|
||||
}
|
||||
// To avoid crashes in this unexpected case
|
||||
ReturnValue_t result = checkPayloadLen();
|
||||
@ -1168,7 +1189,7 @@ class WriteMemory : public ploc::SpTcBase {
|
||||
class EraseMemory : public ploc::SpTcBase {
|
||||
public:
|
||||
EraseMemory(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setPayloadLen(PAYLOAD_LENGTH);
|
||||
spParams.setFullPacketLen(PAYLOAD_LENGTH + 2);
|
||||
spParams.creator.setApid(APID_ERASE_MEMORY);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
@ -1210,7 +1231,7 @@ class EraseMemory : public ploc::SpTcBase {
|
||||
class EnableAutoTm : public ploc::SpTcBase {
|
||||
public:
|
||||
EnableAutoTm(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setPayloadLen(PAYLOAD_LENGTH);
|
||||
spParams.setFullPacketLen(PAYLOAD_LENGTH + 2);
|
||||
spParams.creator.setApid(APID_AUTO_TM);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
@ -1235,7 +1256,7 @@ class EnableAutoTm : public ploc::SpTcBase {
|
||||
class DisableAutoTm : public ploc::SpTcBase {
|
||||
public:
|
||||
DisableAutoTm(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setPayloadLen(PAYLOAD_LENGTH);
|
||||
spParams.setFullPacketLen(PAYLOAD_LENGTH + 2);
|
||||
spParams.creator.setApid(APID_AUTO_TM);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
@ -1270,7 +1291,7 @@ class RequestLoggingData : public ploc::SpTcBase {
|
||||
};
|
||||
|
||||
RequestLoggingData(ploc::SpTcParams params) : ploc::SpTcBase(params) {
|
||||
spParams.setPayloadLen(PAYLOAD_LENGTH);
|
||||
spParams.setFullPacketLen(PAYLOAD_LENGTH + 2);
|
||||
spParams.creator.setApid(APID_REQUEST_LOGGING_DATA);
|
||||
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
|
@ -1808,11 +1808,11 @@ ReturnValue_t PlocSupervisorHandler::parseMramPackets(const uint8_t* packet, siz
|
||||
std::memcpy(spacePacketBuffer + bufferTop, packet + idx, 1);
|
||||
bufferTop += 1;
|
||||
*foundLen += 1;
|
||||
if (bufferTop >= supv::SPACE_PACKET_HEADER_LENGTH) {
|
||||
if (bufferTop >= ccsds::HEADER_LEN) {
|
||||
packetLen = readSpacePacketLength(spacePacketBuffer);
|
||||
}
|
||||
|
||||
if (bufferTop == supv::SPACE_PACKET_HEADER_LENGTH + packetLen + 1) {
|
||||
if (bufferTop == ccsds::HEADER_LEN + packetLen + 1) {
|
||||
packetInBuffer = true;
|
||||
bufferTop = 0;
|
||||
return checkMramPacketApid();
|
||||
@ -1838,7 +1838,7 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id)
|
||||
// Prepare packet for downlink
|
||||
if (packetInBuffer) {
|
||||
uint16_t packetLen = readSpacePacketLength(spacePacketBuffer);
|
||||
result = verifyPacket(spacePacketBuffer, supv::SPACE_PACKET_HEADER_LENGTH + packetLen + 1);
|
||||
result = verifyPacket(spacePacketBuffer, ccsds::HEADER_LEN + packetLen + 1);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::warning << "PlocSupervisorHandler::handleMramDumpPacket: CRC failure" << std::endl;
|
||||
return result;
|
||||
@ -1940,8 +1940,7 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpFile(DeviceCommandId_t id) {
|
||||
return SupvReturnValuesIF::MRAM_FILE_NOT_EXISTS;
|
||||
}
|
||||
std::ofstream file(activeMramFile, std::ios_base::app | std::ios_base::out);
|
||||
file.write(reinterpret_cast<const char*>(spacePacketBuffer + supv::SPACE_PACKET_HEADER_LENGTH),
|
||||
packetLen - 1);
|
||||
file.write(reinterpret_cast<const char*>(spacePacketBuffer + ccsds::HEADER_LEN), packetLen - 1);
|
||||
file.close();
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
@ -14,14 +14,12 @@ struct SpTcParams {
|
||||
SpTcParams(SpacePacketCreator& creator, uint8_t* buf, size_t maxSize)
|
||||
: creator(creator), buf(buf), maxSize(maxSize) {}
|
||||
|
||||
void setPayloadLen(size_t payloadLen_) { dataFieldLen = payloadLen_ + 2; }
|
||||
|
||||
void setDataFieldLen(size_t dataFieldLen_) { dataFieldLen = dataFieldLen_; }
|
||||
void setFullPacketLen(size_t fullPacketLen_) { fullPacketLen = fullPacketLen_; }
|
||||
|
||||
SpacePacketCreator& creator;
|
||||
uint8_t* buf = nullptr;
|
||||
size_t maxSize = 0;
|
||||
size_t dataFieldLen = 0;
|
||||
size_t fullPacketLen = 0;
|
||||
};
|
||||
|
||||
class SpTcBase {
|
||||
@ -39,7 +37,7 @@ class SpTcBase {
|
||||
}
|
||||
|
||||
void updateSpFields() {
|
||||
spParams.creator.setDataLenField(spParams.dataFieldLen - 1);
|
||||
spParams.creator.setDataLenField(spParams.fullPacketLen - 1);
|
||||
spParams.creator.setPacketType(ccsds::PacketType::TC);
|
||||
}
|
||||
|
||||
@ -50,7 +48,7 @@ class SpTcBase {
|
||||
uint16_t getApid() const { return spParams.creator.getApid(); }
|
||||
|
||||
ReturnValue_t checkPayloadLen() {
|
||||
if (ccsds::HEADER_LEN + spParams.dataFieldLen > spParams.maxSize) {
|
||||
if (ccsds::HEADER_LEN + spParams.fullPacketLen > spParams.maxSize) {
|
||||
return SerializeIF::BUFFER_TOO_SHORT;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user