Skip to content
Snippets Groups Projects
Unverified Commit 4363f72a authored by Dimitrios Stoupis's avatar Dimitrios Stoupis
Browse files

Add error handling using the new class

parent 771f2b7c
No related branches found
No related tags found
No related merge requests found
...@@ -55,21 +55,19 @@ void MemoryManagementService::RawDataMemoryManagement::loadRawData(Message &requ ...@@ -55,21 +55,19 @@ void MemoryManagementService::RawDataMemoryManagement::loadRawData(Message &requ
readData[i] = *(reinterpret_cast<uint8_t *>(startAddress) + i); readData[i] = *(reinterpret_cast<uint8_t *>(startAddress) + i);
} }
if (checksum != CRCHelper::calculateCRC(readData, dataLength)) { if (checksum != CRCHelper::calculateCRC(readData, dataLength)) {
// todo: Generate a failed completion of execution report ErrorHandler::reportError(request, ErrorHandler::ChecksumFailed);
} }
} else { } else {
// todo: Implement the fail report the correct way when all parameters known // todo: Implement the fail report the correct way when all parameters known
mainService.requestVerificationService.failExecutionVerification( mainService.requestVerificationService.failExecutionVerification(
request.packetType, true, 1, 1, 10, 6); request.packetType, true, 1, 1, 10, 6);
// todo: Send a failed of execution report ErrorHandler::reportError(request, ErrorHandler::ChecksumFailed);
} }
} else { } else {
// todo: Send a failed of execution report
// todo: Remove the print statements in the final version
// todo: The final implementation of exit on failure has to be well defined // todo: The final implementation of exit on failure has to be well defined
mainService.requestVerificationService.failExecutionVerification( mainService.requestVerificationService.failExecutionVerification(
request.packetType, true, 1, 1, 10, 6); request.packetType, true, 1, 1, 10, 6);
std::cout << "We encountered a problem validating CRC!" << std::endl; ErrorHandler::reportError(request, ErrorHandler::ChecksumFailed);
continue; // Continue to the next command continue; // Continue to the next command
} }
} }
...@@ -119,7 +117,7 @@ void MemoryManagementService::RawDataMemoryManagement::dumpRawData(Message &requ ...@@ -119,7 +117,7 @@ void MemoryManagementService::RawDataMemoryManagement::dumpRawData(Message &requ
} else { } else {
mainService.requestVerificationService.failExecutionVerification(request.packetType, mainService.requestVerificationService.failExecutionVerification(request.packetType,
true, 1, 1, 10, 6); true, 1, 1, 10, 6);
// todo: Send a failed of execution report ErrorHandler::reportError(request, ErrorHandler::AddressOutOfRange);
} }
} }
...@@ -170,7 +168,7 @@ void MemoryManagementService::RawDataMemoryManagement::checkRawData(Message &req ...@@ -170,7 +168,7 @@ void MemoryManagementService::RawDataMemoryManagement::checkRawData(Message &req
} else { } else {
mainService.requestVerificationService.failExecutionVerification(request.packetType, mainService.requestVerificationService.failExecutionVerification(request.packetType,
true, 1, 1, 10, 6); true, 1, 1, 10, 6);
// todo: Send a failed of execution report ErrorHandler::reportError(request, ErrorHandler::AddressOutOfRange);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment