it compiles again
This commit is contained in:
@ -334,7 +334,7 @@ ReturnValue_t PlocSupvHelper::eraseMemory() {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupvHelper::handlePacketTransmission(SpacePacketBase& packet,
|
||||
ReturnValue_t PlocSupvHelper::handlePacketTransmission(ploc::SpTcBase& packet,
|
||||
uint32_t timeoutExecutionReport) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
result = sendCommand(packet);
|
||||
@ -352,7 +352,7 @@ ReturnValue_t PlocSupvHelper::handlePacketTransmission(SpacePacketBase& packet,
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupvHelper::sendCommand(SpacePacketBase& packet) {
|
||||
ReturnValue_t PlocSupvHelper::sendCommand(ploc::SpTcBase& packet) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
rememberApid = packet.getApid();
|
||||
result = uartComIF->sendMessage(comCookie, packet.getFullPacket(), packet.getFullPacketLen());
|
||||
@ -366,14 +366,20 @@ ReturnValue_t PlocSupvHelper::sendCommand(SpacePacketBase& packet) {
|
||||
|
||||
ReturnValue_t PlocSupvHelper::handleAck() {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
supv::AcknowledgmentReport ackReport;
|
||||
result = handleTmReception(&ackReport, supv::SIZE_ACK_REPORT);
|
||||
|
||||
result = handleTmReception(supv::SIZE_ACK_REPORT);
|
||||
if (result != RETURN_OK) {
|
||||
triggerEvent(ACK_RECEPTION_FAILURE, result, static_cast<uint32_t>(rememberApid));
|
||||
sif::warning << "PlocSupvHelper::handleAck: Error in reception of acknowledgment report"
|
||||
<< std::endl;
|
||||
return result;
|
||||
}
|
||||
supv::AcknowledgmentReport ackReport(tmBuf.data(), tmBuf.size());
|
||||
result = ackReport.checkCrc();
|
||||
if (result != RETURN_OK) {
|
||||
triggerEvent(SUPV_REPLY_CRC_MISSMATCH, rememberApid);
|
||||
return result;
|
||||
}
|
||||
result = ackReport.checkApid();
|
||||
if (result != RETURN_OK) {
|
||||
if (result == SupvReturnValuesIF::RECEIVED_ACK_FAILURE) {
|
||||
@ -388,14 +394,20 @@ ReturnValue_t PlocSupvHelper::handleAck() {
|
||||
|
||||
ReturnValue_t PlocSupvHelper::handleExe(uint32_t timeout) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
supv::ExecutionReport exeReport;
|
||||
result = handleTmReception(&exeReport, supv::SIZE_EXE_REPORT, timeout);
|
||||
|
||||
result = handleTmReception(supv::SIZE_EXE_REPORT, timeout);
|
||||
if (result != RETURN_OK) {
|
||||
triggerEvent(EXE_RECEPTION_FAILURE, result, static_cast<uint32_t>(rememberApid));
|
||||
sif::warning << "PlocSupvHelper::handleExe: Error in reception of execution report"
|
||||
<< std::endl;
|
||||
return result;
|
||||
}
|
||||
supv::ExecutionReport exeReport(tmBuf.data(), tmBuf.size());
|
||||
result = exeReport.checkCrc();
|
||||
if (result != RETURN_OK) {
|
||||
triggerEvent(SUPV_REPLY_CRC_MISSMATCH, rememberApid);
|
||||
return result;
|
||||
}
|
||||
result = exeReport.checkApid();
|
||||
if (result != RETURN_OK) {
|
||||
if (result == SupvReturnValuesIF::RECEIVED_EXE_FAILURE) {
|
||||
@ -408,14 +420,13 @@ ReturnValue_t PlocSupvHelper::handleExe(uint32_t timeout) {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupvHelper::handleTmReception(supv::TmPacket* tmPacket, size_t remainingBytes,
|
||||
uint32_t timeout) {
|
||||
ReturnValue_t PlocSupvHelper::handleTmReception(size_t remainingBytes, uint32_t timeout) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
size_t readBytes = 0;
|
||||
size_t currentBytes = 0;
|
||||
Countdown countdown(timeout);
|
||||
while (!countdown.hasTimedOut()) {
|
||||
result = receive(tmPacket->getWholeData() + readBytes, ¤tBytes, remainingBytes);
|
||||
result = receive(tmBuf.data() + readBytes, ¤tBytes, remainingBytes);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
@ -430,11 +441,6 @@ ReturnValue_t PlocSupvHelper::handleTmReception(supv::TmPacket* tmPacket, size_t
|
||||
<< remainingBytes << " bytes" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
result = tmPacket->checkCrc();
|
||||
if (result != RETURN_OK) {
|
||||
sif::warning << "PlocSupvHelper::handleTmReception: CRC check failed" << std::endl;
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -512,10 +518,14 @@ ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
supv::UpdateStatusReport updateStatusReport;
|
||||
result = handleTmReception(&updateStatusReport,
|
||||
static_cast<size_t>(updateStatusReport.getNominalSize()),
|
||||
supv::UpdateStatusReport updateStatusReport(tmBuf.data(), tmBuf.size());
|
||||
result = handleTmReception(static_cast<size_t>(updateStatusReport.getNominalSize()),
|
||||
supv::recv_timeout::UPDATE_STATUS_REPORT);
|
||||
result = updateStatusReport.checkCrc();
|
||||
if (result != RETURN_OK) {
|
||||
sif::warning << "PlocSupvHelper::handleTmReception: CRC check failed" << std::endl;
|
||||
return result;
|
||||
}
|
||||
if (result != RETURN_OK) {
|
||||
sif::warning
|
||||
<< "PlocSupvHelper::handleCheckMemoryCommand: Failed to receive update status report"
|
||||
@ -555,7 +565,7 @@ ReturnValue_t PlocSupvHelper::handleEventBufferReception() {
|
||||
std::ofstream file(filename, std::ios_base::app | std::ios_base::out);
|
||||
uint32_t packetsRead = 0;
|
||||
size_t requestLen = 0;
|
||||
supv::TmPacket tmPacket;
|
||||
ploc::SpTmReader tmReader(tmBuf.data(), tmBuf.size());
|
||||
for (packetsRead = 0; packetsRead < NUM_EVENT_BUFFER_PACKETS; packetsRead++) {
|
||||
if (terminate) {
|
||||
triggerEvent(SUPV_EVENT_BUFFER_REQUEST_TERMINATED, packetsRead - 1);
|
||||
@ -567,22 +577,27 @@ ReturnValue_t PlocSupvHelper::handleEventBufferReception() {
|
||||
} else {
|
||||
requestLen = SIZE_EVENT_BUFFER_FULL_PACKET;
|
||||
}
|
||||
result = handleTmReception(&tmPacket, requestLen);
|
||||
result = handleTmReception(requestLen);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocSupvHelper::handleEventBufferReception: Failed while trying to read packet"
|
||||
<< " " << packetsRead + 1 << std::endl;
|
||||
file.close();
|
||||
return result;
|
||||
}
|
||||
uint16_t apid = tmPacket.getApid();
|
||||
ReturnValue_t result = tmReader.checkCrc();
|
||||
if (result != RETURN_OK) {
|
||||
triggerEvent(SUPV_REPLY_CRC_MISSMATCH, rememberApid);
|
||||
return result;
|
||||
}
|
||||
uint16_t apid = tmReader.getApid();
|
||||
if (apid != supv::APID_MRAM_DUMP_TM) {
|
||||
sif::warning << "PlocSupvHelper::handleEventBufferReception: Did not expect space packet "
|
||||
<< "with APID 0x" << std::hex << apid << std::endl;
|
||||
file.close();
|
||||
return EVENT_BUFFER_REPLY_INVALID_APID;
|
||||
}
|
||||
file.write(reinterpret_cast<const char*>(tmPacket.getPacketData()),
|
||||
tmPacket.getPayloadDataLength());
|
||||
file.write(reinterpret_cast<const char*>(tmReader.getPacketData()),
|
||||
tmReader.getPayloadDataLength());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user