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