removed unused ploc commands, fix in logging report reply

This commit is contained in:
Jakob Meier
2022-05-04 12:49:43 +02:00
parent 5380ed216b
commit 475f6f1687
8 changed files with 51 additions and 69 deletions

View File

@ -416,7 +416,6 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
this->insertInCommandMap(REQUEST_ADC_REPORT);
this->insertInCommandMap(RUN_AUTO_EM_TESTS);
this->insertInCommandMap(WIPE_MRAM);
this->insertInCommandMap(PRINT_CPU_STATS);
this->insertInCommandMap(SET_GPIO);
this->insertInCommandMap(READ_GPIO);
this->insertInCommandMap(RESTART_SUPERVISOR);
@ -537,7 +536,6 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
case COPY_ADC_DATA_TO_MRAM:
case RUN_AUTO_EM_TESTS:
case WIPE_MRAM:
case PRINT_CPU_STATS:
case SET_GPIO:
case READ_GPIO:
case RESTART_SUPERVISOR:
@ -837,6 +835,9 @@ void PlocSupervisorHandler::setExecutionTimeout(DeviceCommandId_t command) {
case CONSECUTIVE_MRAM_DUMP:
executionTimeout.setTimeout(MRAM_DUMP_EXECUTION_TIMEOUT);
break;
case COPY_ADC_DATA_TO_MRAM:
executionTimeout.setTimeout(COPY_ADC_TO_MRAM_TIMEOUT);
break;
default:
executionTimeout.setTimeout(EXECUTION_DEFAULT_TIMEOUT);
break;
@ -873,13 +874,14 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
result = ack.checkApid();
switch (result) {
case SupvReturnValuesIF::CRC_FAILURE: {
// TODO: Interpretation of status field in acknowledgment report
sif::debug << "PlocSupervisorHandler::handleAckReport: Received Ack failure report"
<< std::endl;
case SupvReturnValuesIF::RECEIVED_ACK_FAILURE: {
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
sif::debug << "PlocSupervisorHandler: Received Ack failure report with status code: 0x"
<< std::hex << ack.getStatusCode() << std::endl;
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
DeviceCommandId_t commandId = getPendingCommand();
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
triggerEvent(SUPV_ACK_FAILURE, commandId);
triggerEvent(SUPV_ACK_FAILURE, commandId, static_cast<uint32_t>(ack.getStatusCode()));
}
sendFailureReport(supv::ACK_REPORT, SupvReturnValuesIF::RECEIVED_ACK_FAILURE);
disableAllReplies();
@ -930,7 +932,7 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
break;
}
case (SupvReturnValuesIF::RECEIVED_EXE_FAILURE): {
handleExecutionFailureReport();
handleExecutionFailureReport(exe.getStatusCode());
result = RETURN_OK;
break;
}
@ -1172,7 +1174,7 @@ ReturnValue_t PlocSupervisorHandler::handleLoggingReport(const uint8_t* data) {
result = verifyPacket(data, supv::SIZE_LOGGING_REPORT);
if (result == SupvReturnValuesIF::CRC_FAILURE) {
sif::error << "PlocSupervisorHandler::handleLoggingReport: Logging report has "
sif::warning << "PlocSupervisorHandler::handleLoggingReport: Logging report has "
<< "invalid crc" << std::endl;
return result;
}
@ -1853,7 +1855,21 @@ void PlocSupervisorHandler::handleExecutionSuccessReport(const uint8_t* data) {
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
sif::info << "PlocSupervisorHandler: Read GPIO TM, State: " << gpioState << std::endl;
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
handleDeviceTM(reinterpret_cast<uint8_t*>(&gpioState), sizeof(gpioState), supv::EXE_REPORT);
DeviceCommandMap::iterator iter = deviceCommandMap.find(commandId);
if (iter->second.sendReplyTo == NO_COMMAND_ID) {
return;
}
uint8_t data[sizeof(gpioState)];
size_t size = 0;
ReturnValue_t result = SerializeAdapter::serialize(
&gpioState, data, &size, sizeof(gpioState), SerializeIF::Endianness::BIG);
if (result != RETURN_OK) {
sif::debug << "PlocSupervisorHandler: Failed to deserialize GPIO state" << std::endl;
}
result = actionHelper.reportData(iter->second.sendReplyTo, commandId, data, sizeof(data));
if (result != RETURN_OK) {
sif::warning << "PlocSupervisorHandler: Read GPIO, failed to report data" << std::endl;
}
break;
}
case supv::SET_TIME_REF: {
@ -1867,13 +1883,11 @@ void PlocSupervisorHandler::handleExecutionSuccessReport(const uint8_t* data) {
}
}
void PlocSupervisorHandler::handleExecutionFailureReport() {
void PlocSupervisorHandler::handleExecutionFailureReport(uint16_t statusCode) {
using namespace supv;
DeviceCommandId_t commandId = getPendingCommand();
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
triggerEvent(SUPV_EXE_FAILURE, commandId);
} else {
sif::debug << "PlocSupervisorHandler::handleExecutionReport: Unknown command id" << std::endl;
triggerEvent(SUPV_EXE_FAILURE, commandId, static_cast<uint32_t>(statusCode));
}
sendFailureReport(EXE_REPORT, SupvReturnValuesIF::RECEIVED_EXE_FAILURE);
disableExeReportReply();