generic TM checker
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:43:28 +02:00
parent 7e3517d309
commit 458929957d
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 23 additions and 8 deletions

View File

@ -375,9 +375,8 @@ ReturnValue_t PlocSupvHelper::handleAck() {
return result;
}
supv::AcknowledgmentReport ackReport(tmBuf.data(), tmBuf.size());
result = ackReport.checkCrc();
if (result != RETURN_OK) {
triggerEvent(SUPV_REPLY_CRC_MISSMATCH, rememberApid);
result = checkReceivedTm(ackReport);
if(result != RETURN_OK) {
return result;
}
result = ackReport.checkApid();
@ -403,9 +402,8 @@ ReturnValue_t PlocSupvHelper::handleExe(uint32_t timeout) {
return result;
}
supv::ExecutionReport exeReport(tmBuf.data(), tmBuf.size());
result = exeReport.checkCrc();
if (result != RETURN_OK) {
triggerEvent(SUPV_REPLY_CRC_MISSMATCH, rememberApid);
result = checkReceivedTm(exeReport);
if(result != RETURN_OK) {
return result;
}
result = exeReport.checkApid();
@ -444,6 +442,20 @@ ReturnValue_t PlocSupvHelper::handleTmReception(size_t remainingBytes, uint32_t
return result;
}
ReturnValue_t PlocSupvHelper::checkReceivedTm(ploc::SpTmReader& reader) {
ReturnValue_t result = reader.checkSize();
if (result != RETURN_OK) {
triggerEvent(SUPV_REPLY_SIZE_MISSMATCH, rememberApid);
return result;
}
result = reader.checkCrc();
if (result != RETURN_OK) {
triggerEvent(SUPV_REPLY_CRC_MISSMATCH, rememberApid);
return result;
}
return result;
}
ReturnValue_t PlocSupvHelper::receive(uint8_t* data, size_t* readBytes, size_t requestBytes) {
ReturnValue_t result = RETURN_OK;
uint8_t* buffer = nullptr;
@ -585,7 +597,7 @@ ReturnValue_t PlocSupvHelper::handleEventBufferReception() {
return result;
}
ReturnValue_t result = tmReader.checkCrc();
if (result != RETURN_OK) {
if(result != RETURN_OK) {
triggerEvent(SUPV_REPLY_CRC_MISSMATCH, rememberApid);
return result;
}

View File

@ -86,7 +86,8 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
//! [EXPORT] : [COMMENT] Update procedure failed when sending packet with number P1
//! P1: Packet number for which the memory write command fails
static const Event WRITE_MEMORY_FAILED = MAKE_EVENT(19, severity::LOW);
static const Event SUPV_REPLY_CRC_MISSMATCH = MAKE_EVENT(20, severity::LOW);
static const Event SUPV_REPLY_SIZE_MISSMATCH = MAKE_EVENT(20, severity::LOW);
static const Event SUPV_REPLY_CRC_MISSMATCH = MAKE_EVENT(21, severity::LOW);
PlocSupvHelper(object_id_t objectId);
virtual ~PlocSupvHelper();
@ -225,6 +226,8 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
* failure report.
*/
ReturnValue_t handleTmReception(size_t remainingBytes, uint32_t timeout = 70000);
ReturnValue_t checkReceivedTm(ploc::SpTmReader& reader);
ReturnValue_t selectMemory();
ReturnValue_t prepareUpdate();
ReturnValue_t eraseMemory();