start fixing dev handler ack handling
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:
@ -56,18 +56,19 @@ static const ReturnValue_t PATH_DOES_NOT_EXIST = MAKE_RETURN_CODE(0xAD);
|
||||
//! [EXPORT] : [COMMENT] MRAM dump file does not exists. The file should actually already have
|
||||
//! been created with the reception of the first dump packet.
|
||||
static const ReturnValue_t MRAM_FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xAE);
|
||||
static constexpr ReturnValue_t INVALID_REPLY_LENGTH = MAKE_RETURN_CODE(0xAF);
|
||||
//! [EXPORT] : [COMMENT] Received action command has invalid length
|
||||
static const ReturnValue_t INVALID_LENGTH = MAKE_RETURN_CODE(0xAF);
|
||||
static const ReturnValue_t INVALID_LENGTH = MAKE_RETURN_CODE(0xB0);
|
||||
//! [EXPORT] : [COMMENT] Filename too long
|
||||
static const ReturnValue_t FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xB0);
|
||||
static const ReturnValue_t FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xB1);
|
||||
//! [EXPORT] : [COMMENT] Received update status report with invalid packet length field
|
||||
static const ReturnValue_t UPDATE_STATUS_REPORT_INVALID_LENGTH = MAKE_RETURN_CODE(0xB1);
|
||||
static const ReturnValue_t UPDATE_STATUS_REPORT_INVALID_LENGTH = MAKE_RETURN_CODE(0xB2);
|
||||
//! [EXPORT] : [COMMENT] Update status report does not contain expected CRC. There might be a bit
|
||||
//! flip in the update memory region.
|
||||
static const ReturnValue_t UPDATE_CRC_FAILURE = MAKE_RETURN_CODE(0xB2);
|
||||
static const ReturnValue_t UPDATE_CRC_FAILURE = MAKE_RETURN_CODE(0xB3);
|
||||
//! [EXPORT] : [COMMENT] Supervisor helper task ist currently executing a command (wait until
|
||||
//! helper tas has finished or interrupt by sending the terminate command)
|
||||
static const ReturnValue_t SUPV_HELPER_EXECUTING = MAKE_RETURN_CODE(0xB3);
|
||||
static const ReturnValue_t SUPV_HELPER_EXECUTING = MAKE_RETURN_CODE(0xB4);
|
||||
|
||||
static constexpr ReturnValue_t BUF_TOO_SMALL = MAKE_RETURN_CODE(0xC0);
|
||||
static constexpr ReturnValue_t NO_REPLY_TIMEOUT = MAKE_RETURN_CODE(0xC1);
|
||||
@ -470,6 +471,12 @@ class TmBase : public ploc::SpTmReader {
|
||||
uint8_t getServiceId() const { return getPacketData()[TIMESTAMP_LEN]; }
|
||||
|
||||
const uint8_t* getPayloadStart() const { return getPacketData() + SECONDARY_HEADER_LEN; }
|
||||
size_t getPayloadLen() const {
|
||||
if (getFullPacketLen() > SECONDARY_HEADER_LEN + ccsds::HEADER_LEN) {
|
||||
return getFullPacketLen() - SECONDARY_HEADER_LEN - ccsds::HEADER_LEN;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
bool crcOk = false;
|
||||
@ -1110,7 +1117,8 @@ class VerificationReport {
|
||||
if (readerBase.getApid() != Apid::TMTC_MAN) {
|
||||
return result::INVALID_APID;
|
||||
}
|
||||
if (readerBase.getBufSize() < MIN_PAYLOAD_LEN + 8) {
|
||||
if (readerBase.getBufSize() < MIN_TMTC_LEN + PAYLOAD_LEN or
|
||||
readerBase.getPayloadLen() < PAYLOAD_LEN) {
|
||||
sif::error << "VerificationReport: Invalid verification report, payload too small"
|
||||
<< std::endl;
|
||||
return result::BUF_TOO_SMALL;
|
||||
@ -1507,6 +1515,59 @@ class ExecutionReport : public VerificationReport {
|
||||
};
|
||||
};
|
||||
|
||||
class UpdateStatusReport {
|
||||
public:
|
||||
UpdateStatusReport(TmBase& tmReader) : tmReader(tmReader) {}
|
||||
|
||||
ReturnValue_t parse() {
|
||||
if (not tmReader.crcIsOk()) {
|
||||
return result::CRC_FAILURE;
|
||||
}
|
||||
if (tmReader.getApid() != Apid::MEM_MAN) {
|
||||
return result::INVALID_APID;
|
||||
}
|
||||
if (tmReader.getBufSize() < MIN_TMTC_LEN + PAYLOAD_LEN or
|
||||
tmReader.getPayloadLen() < PAYLOAD_LEN) {
|
||||
sif::error << "VerificationReport: Invalid verification report, payload too small"
|
||||
<< std::endl;
|
||||
return result::BUF_TOO_SMALL;
|
||||
}
|
||||
size_t remLen = PAYLOAD_LEN;
|
||||
if (remLen < PAYLOAD_LEN) {
|
||||
return result::INVALID_REPLY_LENGTH;
|
||||
}
|
||||
const uint8_t* dataFieldPtr = tmReader.getPayloadStart();
|
||||
SerializeAdapter::deSerialize(&memoryId, &dataFieldPtr, &remLen, SerializeIF::Endianness::BIG);
|
||||
SerializeAdapter::deSerialize(&n, &dataFieldPtr, &remLen, SerializeIF::Endianness::BIG);
|
||||
SerializeAdapter::deSerialize(&startAddress, &dataFieldPtr, &remLen,
|
||||
SerializeIF::Endianness::BIG);
|
||||
SerializeAdapter::deSerialize(&length, &dataFieldPtr, &remLen, SerializeIF::Endianness::BIG);
|
||||
SerializeAdapter::deSerialize(&crc, &dataFieldPtr, &remLen, SerializeIF::Endianness::BIG);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t verifyCrc(uint16_t goodCrc) const {
|
||||
if (crc != goodCrc) {
|
||||
return result::UPDATE_CRC_FAILURE;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
uint16_t getCrc() const { return crc; }
|
||||
|
||||
private:
|
||||
TmBase& tmReader;
|
||||
|
||||
// Nominal size of the space packet
|
||||
static const uint16_t PAYLOAD_LEN = 12; // header, data field and crc
|
||||
|
||||
uint8_t memoryId = 0;
|
||||
uint8_t n = 0;
|
||||
uint32_t startAddress = 0;
|
||||
uint32_t length = 0;
|
||||
uint16_t crc = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This dataset stores the boot status report of the supervisor.
|
||||
*/
|
||||
@ -1661,56 +1722,6 @@ class LoggingReport : public StaticLocalDataSet<LOGGING_RPT_SET_ENTRIES> {
|
||||
}
|
||||
};
|
||||
|
||||
class UpdateStatusReport : public ploc::SpTmReader {
|
||||
public:
|
||||
UpdateStatusReport() = default;
|
||||
UpdateStatusReport(const uint8_t* buf, size_t maxSize) : ploc::SpTmReader(buf, maxSize) {}
|
||||
|
||||
ReturnValue_t parseDataField() {
|
||||
ReturnValue_t result = lengthCheck();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
const uint8_t* dataFieldPtr = getFullData() + ccsds::HEADER_LEN;
|
||||
size_t size = 12;
|
||||
SerializeAdapter::deSerialize(&memoryId, &dataFieldPtr, &size, SerializeIF::Endianness::BIG);
|
||||
SerializeAdapter::deSerialize(&n, &dataFieldPtr, &size, SerializeIF::Endianness::BIG);
|
||||
SerializeAdapter::deSerialize(&startAddress, &dataFieldPtr, &size,
|
||||
SerializeIF::Endianness::BIG);
|
||||
SerializeAdapter::deSerialize(&length, &dataFieldPtr, &size, SerializeIF::Endianness::BIG);
|
||||
SerializeAdapter::deSerialize(&crc, &dataFieldPtr, &size, SerializeIF::Endianness::BIG);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t verifycrc(uint16_t goodCrc) const {
|
||||
if (crc != goodCrc) {
|
||||
return result::UPDATE_CRC_FAILURE;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
uint16_t getCrc() const { return crc; }
|
||||
|
||||
uint16_t getNominalSize() const { return FULL_SIZE; }
|
||||
|
||||
private:
|
||||
// Nominal size of the space packet
|
||||
static const uint16_t FULL_SIZE = 20; // header, data field and crc
|
||||
|
||||
uint8_t memoryId = 0;
|
||||
uint8_t n = 0;
|
||||
uint32_t startAddress = 0;
|
||||
uint32_t length = 0;
|
||||
uint16_t crc = 0;
|
||||
|
||||
ReturnValue_t lengthCheck() {
|
||||
if (getFullPacketLen() != FULL_SIZE) {
|
||||
return result::UPDATE_STATUS_REPORT_INVALID_LENGTH;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This dataset stores the ADC report.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user