repaire exe handling
This commit is contained in:
parent
54523b25d1
commit
27e46615b6
@ -12,8 +12,6 @@
|
||||
|
||||
#include "mission/devices/devicedefinitions/SpBase.h"
|
||||
|
||||
using namespace returnvalue;
|
||||
|
||||
namespace supv {
|
||||
|
||||
namespace result {
|
||||
@ -126,13 +124,16 @@ static const DeviceCommandId_t CONTINUE_UPDATE = 60;
|
||||
static const DeviceCommandId_t MEMORY_CHECK_WITH_FILE = 61;
|
||||
|
||||
/** Reply IDs */
|
||||
static const DeviceCommandId_t ACK_REPORT = 100;
|
||||
static const DeviceCommandId_t EXE_REPORT = 101;
|
||||
static const DeviceCommandId_t HK_REPORT = 102;
|
||||
static const DeviceCommandId_t BOOT_STATUS_REPORT = 103;
|
||||
static const DeviceCommandId_t LATCHUP_REPORT = 104;
|
||||
static const DeviceCommandId_t LOGGING_REPORT = 105;
|
||||
static const DeviceCommandId_t ADC_REPORT = 106;
|
||||
enum ReplyId : DeviceCommandId_t {
|
||||
ACK_REPORT = 100,
|
||||
EXE_REPORT = 101,
|
||||
HK_REPORT = 102,
|
||||
BOOT_STATUS_REPORT = 103,
|
||||
LATCHUP_REPORT = 104,
|
||||
LOGGING_REPORT = 105,
|
||||
ADC_REPORT = 106,
|
||||
UPDATE_STATUS_REPORT = 107,
|
||||
};
|
||||
|
||||
// Size of complete space packet (6 byte header + size of data + 2 byte CRC)
|
||||
static const uint16_t SIZE_ACK_REPORT = 14;
|
||||
@ -493,7 +494,7 @@ class NoPayloadPacket : public TcBase {
|
||||
|
||||
ReturnValue_t buildPacket() {
|
||||
ReturnValue_t result = checkSizeAndSerializeHeader();
|
||||
if (result != OK) {
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
return calcAndSetCrc();
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "fsfw/timemanager/Clock.h"
|
||||
|
||||
using namespace supv;
|
||||
using namespace returnvalue;
|
||||
|
||||
PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid,
|
||||
CookieIF* comCookie, Gpio uartIsolatorSwitch,
|
||||
@ -29,7 +30,7 @@ PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t u
|
||||
adcReport(this),
|
||||
powerSwitch(powerSwitch),
|
||||
supvHelper(supvHelper) {
|
||||
if (comCookie == NULL) {
|
||||
if (comCookie == nullptr) {
|
||||
sif::error << "PlocSupervisorHandler: Invalid com cookie" << std::endl;
|
||||
}
|
||||
if (supvHelper == nullptr) {
|
||||
@ -48,11 +49,6 @@ ReturnValue_t PlocSupervisorHandler::initialize() {
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
uartComIf = dynamic_cast<UartComIF*>(communicationInterface);
|
||||
if (uartComIf == nullptr) {
|
||||
sif::warning << "PlocSupervisorHandler::initialize: Invalid uart com if" << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
#ifndef TE0720_1CFA
|
||||
sdcMan = SdCardManager::instance();
|
||||
#endif /* TE0720_1CFA */
|
||||
@ -447,10 +443,9 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
using namespace supv;
|
||||
this->insertInCommandMap(GET_HK_REPORT);
|
||||
this->insertInCommandMap(START_MPSOC);
|
||||
this->insertInCommandMap(SHUTDOWN_MPSOC);
|
||||
insertInCommandMap(GET_HK_REPORT);
|
||||
insertInCommandMap(START_MPSOC);
|
||||
insertInCommandMap(SHUTDOWN_MPSOC);
|
||||
this->insertInCommandMap(SEL_MPSOC_BOOT_IMAGE);
|
||||
this->insertInCommandMap(SET_BOOT_TIMEOUT);
|
||||
this->insertInCommandMap(SET_MAX_RESTART_TRIES);
|
||||
@ -503,8 +498,7 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
|
||||
uint8_t expectedReplies,
|
||||
bool useAlternateId,
|
||||
DeviceCommandId_t alternateReplyID) {
|
||||
using namespace supv;
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
ReturnValue_t result = OK;
|
||||
|
||||
uint8_t enabledReplies = 0;
|
||||
|
||||
@ -657,13 +651,13 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t r
|
||||
switch (tmReader.getServiceId()) {
|
||||
case (static_cast<uint8_t>(supv::tm::TmtcId::ACK)):
|
||||
case (static_cast<uint8_t>(supv::tm::TmtcId::NAK)): {
|
||||
*foundLen = SIZE_ACK_REPORT;
|
||||
*foundId = ACK_REPORT;
|
||||
*foundLen = tmReader.getFullPacketLen();
|
||||
*foundId = ReplyId::ACK_REPORT;
|
||||
return OK;
|
||||
}
|
||||
case (static_cast<uint8_t>(supv::tm::TmtcId::EXEC_ACK)):
|
||||
case (static_cast<uint8_t>(supv::tm::TmtcId::EXEC_NAK)): {
|
||||
*foundLen = SIZE_EXE_REPORT;
|
||||
*foundLen = tmReader.getFullPacketLen();
|
||||
*foundId = EXE_REPORT;
|
||||
return OK;
|
||||
}
|
||||
@ -672,8 +666,8 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t r
|
||||
}
|
||||
case (Apid::HK): {
|
||||
if (tmReader.getServiceId() == static_cast<uint8_t>(supv::tm::HkId::REPORT)) {
|
||||
*foundLen = SIZE_HK_REPORT;
|
||||
*foundId = HK_REPORT;
|
||||
*foundLen = tmReader.getFullPacketLen();
|
||||
*foundId = ReplyId::HK_REPORT;
|
||||
return OK;
|
||||
} else if (tmReader.getServiceId() == static_cast<uint8_t>(supv::tm::HkId::HARDFAULTS)) {
|
||||
handleBadApidServiceCombination(SUPV_UNINIMPLEMENTED_TM, apid, tmReader.getServiceId());
|
||||
@ -684,8 +678,8 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t r
|
||||
case (Apid::BOOT_MAN): {
|
||||
if (tmReader.getServiceId() ==
|
||||
static_cast<uint8_t>(supv::tm::BootManId::BOOT_STATUS_REPORT)) {
|
||||
*foundLen = SIZE_BOOT_STATUS_REPORT;
|
||||
*foundId = BOOT_STATUS_REPORT;
|
||||
*foundLen = tmReader.getFullPacketLen();
|
||||
*foundId = ReplyId::BOOT_STATUS_REPORT;
|
||||
return OK;
|
||||
}
|
||||
break;
|
||||
@ -693,6 +687,8 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t r
|
||||
case (Apid::MEM_MAN): {
|
||||
if (tmReader.getServiceId() ==
|
||||
static_cast<uint8_t>(supv::tm::MemManId::UPDATE_STATUS_REPORT)) {
|
||||
*foundLen = tmReader.getFullPacketLen();
|
||||
*foundId = ReplyId::UPDATE_STATUS_REPORT;
|
||||
// TODO: I think this will be handled by the uart manager?
|
||||
// Actually, this is a bit tricky. Maybe the lower level will have two separate ring
|
||||
// buffers, one for internally handled packets and one for packets which are handled
|
||||
@ -923,7 +919,6 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
|
||||
using namespace supv;
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
|
||||
tmReader.setData(data, SIZE_ACK_REPORT);
|
||||
if (tmReader.checkCrc() != returnvalue::OK) {
|
||||
sif::error << "PlocSupervisorHandler::handleAckReport: CRC failure" << std::endl;
|
||||
nextReplyId = supv::NONE;
|
||||
@ -963,6 +958,23 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
|
||||
using namespace supv;
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
|
||||
if (tmReader.checkCrc() != OK) {
|
||||
nextReplyId = supv::NONE;
|
||||
return result::CRC_FAILURE;
|
||||
}
|
||||
ExecutionReport report(tmReader);
|
||||
result = report.parse();
|
||||
if (result != OK) {
|
||||
nextReplyId = supv::NONE;
|
||||
return result;
|
||||
}
|
||||
if (tmReader.getServiceId() == static_cast<uint8_t>(supv::tm::TmtcId::EXEC_ACK)) {
|
||||
result = handleExecutionSuccessReport(report);
|
||||
} else if (tmReader.getServiceId() == static_cast<uint8_t>(supv::tm::TmtcId::EXEC_NAK)) {
|
||||
handleExecutionFailureReport(report);
|
||||
}
|
||||
nextReplyId = supv::NONE;
|
||||
return result;
|
||||
// TODO: Fix
|
||||
// ExecutionReport exe(data, SIZE_EXE_REPORT);
|
||||
// result = exe.checkSize();
|
||||
@ -2082,7 +2094,7 @@ ReturnValue_t PlocSupervisorHandler::eventSubscription() {
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::handleExecutionSuccessReport(const uint8_t* data) {
|
||||
ReturnValue_t PlocSupervisorHandler::handleExecutionSuccessReport(ExecutionReport& report) {
|
||||
DeviceCommandId_t commandId = getPendingCommand();
|
||||
switch (commandId) {
|
||||
case supv::READ_GPIO: {
|
||||
@ -2130,11 +2142,12 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionSuccessReport(const uint8_t*
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::handleExecutionFailureReport(uint16_t statusCode) {
|
||||
void PlocSupervisorHandler::handleExecutionFailureReport(ExecutionReport& report) {
|
||||
using namespace supv;
|
||||
DeviceCommandId_t commandId = getPendingCommand();
|
||||
report.printStatusInformation();
|
||||
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
||||
triggerEvent(SUPV_EXE_FAILURE, commandId, static_cast<uint32_t>(statusCode));
|
||||
triggerEvent(SUPV_EXE_FAILURE, commandId, static_cast<uint32_t>(report.getStatusCode()));
|
||||
}
|
||||
sendFailureReport(EXE_REPORT, result::RECEIVED_EXE_FAILURE);
|
||||
disableExeReportReply();
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
||||
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
|
||||
|
||||
using supv::ExecutionReport;
|
||||
|
||||
/**
|
||||
* @brief This is the device handler for the supervisor of the PLOC which is programmed by
|
||||
* Thales.
|
||||
@ -378,8 +380,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
supv::UpdateParams& params);
|
||||
ReturnValue_t eventSubscription();
|
||||
|
||||
ReturnValue_t handleExecutionSuccessReport(const uint8_t* data);
|
||||
void handleExecutionFailureReport(uint16_t statusCode);
|
||||
ReturnValue_t handleExecutionSuccessReport(ExecutionReport& report);
|
||||
void handleExecutionFailureReport(ExecutionReport& report);
|
||||
|
||||
void printAckFailureInfo(uint16_t statusCode, DeviceCommandId_t commandId);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user