clean up retvals a bit

This commit is contained in:
Robin Müller 2024-11-13 17:30:20 +01:00
parent b2177b2363
commit 66555301fa
Signed by: muellerr
GPG Key ID: A649FB78196E3849
10 changed files with 32 additions and 20 deletions

View File

@ -80,4 +80,6 @@ ReturnValue_t ExtendedControllerBase::performOperation(uint8_t opCode) {
return returnvalue::OK; return returnvalue::OK;
} }
MessageQueueId_t ExtendedControllerBase::getCommandQueue() const { return commandQueue->getId(); } MessageQueueId_t ExtendedControllerBase::getCommandQueue() const { return commandQueue->getId(); }
datapool::SharedPool *ExtendedControllerBase::getOptionalSharedPool() { return nullptr; }

View File

@ -33,6 +33,13 @@ class ExtendedControllerBase : public ControllerBase,
hk::PeriodicHelper hkHelper; hk::PeriodicHelper hkHelper;
ActionHelper actionHelper; ActionHelper actionHelper;
// Periodic HK methods, default method assumes that no shared pool is required.
virtual datapool::SharedPool* getOptionalSharedPool() override;
// Periodic HK abstract methods.
ReturnValue_t serializeHkDataset(dp::sid_t structureId, uint8_t* buf, size_t maxSize) = 0;
ReturnValue_t specifyHkDatasets(std::vector<hk::SetSpecification>& setList) = 0;
/** /**
* Implemented by child class. Handle all command messages which are * Implemented by child class. Handle all command messages which are
* not health, mode, action or housekeeping messages. * not health, mode, action or housekeeping messages.

View File

@ -16,7 +16,7 @@ using id_t = uint32_t;
static constexpr uint32_t INVALID_LPID = -1; static constexpr uint32_t INVALID_LPID = -1;
static constexpr uint8_t INTERFACE_ID = CLASS_ID::LOCAL_POOL_OWNER_IF; static constexpr uint8_t INTERFACE_ID = CLASS_ID::DATAPOOL_IF;
static constexpr ReturnValue_t POOL_ENTRY_NOT_FOUND = MAKE_RETURN_CODE(0x00); static constexpr ReturnValue_t POOL_ENTRY_NOT_FOUND = MAKE_RETURN_CODE(0x00);
static constexpr ReturnValue_t POOL_ENTRY_TYPE_CONFLICT = MAKE_RETURN_CODE(0x01); static constexpr ReturnValue_t POOL_ENTRY_TYPE_CONFLICT = MAKE_RETURN_CODE(0x01);

View File

@ -189,3 +189,5 @@ ReturnValue_t FreshDeviceHandlerBase::getParameter(uint8_t domainId, uint8_t uni
} }
return INVALID_DOMAIN_ID; return INVALID_DOMAIN_ID;
} }
datapool::SharedPool* FreshDeviceHandlerBase::getOptionalSharedPool() { return nullptr; }

View File

@ -104,6 +104,13 @@ class FreshDeviceHandlerBase : public SystemObject,
// System Object overrides. // System Object overrides.
ReturnValue_t initialize() override; ReturnValue_t initialize() override;
// Default implementation assumes that no optional shared pool is required.
virtual datapool::SharedPool* getOptionalSharedPool();
// Implemented by child, required for periodic HK.
ReturnValue_t serializeHkDataset(dp::sid_t structureId, uint8_t* buf, size_t maxSize) = 0;
ReturnValue_t specifyHkDatasets(std::vector<hk::SetSpecification>& setList) = 0;
/** /**
* Implemented by child class. Handle all command messages which are * Implemented by child class. Handle all command messages which are
* not health, mode, action or housekeeping messages. * not health, mode, action or housekeeping messages.

View File

@ -50,7 +50,6 @@ class GeneratesPeriodicHkIF {
static constexpr uint32_t INVALID_LPID = dp::INVALID_LPID; static constexpr uint32_t INVALID_LPID = dp::INVALID_LPID;
virtual ReturnValue_t serializeHkDataset(dp::sid_t structureId, uint8_t* buf, size_t maxSize) = 0; virtual ReturnValue_t serializeHkDataset(dp::sid_t structureId, uint8_t* buf, size_t maxSize) = 0;
virtual ReturnValue_t specifyHkDatasets(std::vector<hk::SetSpecification>& setList) = 0; virtual ReturnValue_t specifyHkDatasets(std::vector<hk::SetSpecification>& setList) = 0;
/** /**

View File

@ -122,9 +122,9 @@ ReturnValue_t PeriodicHelper::handleHousekeepingMessage(CommandMessage* message)
CommandMessage reply; CommandMessage reply;
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
if (result == WRONG_HK_PACKET_TYPE) { if (result == INVALID_HK_REQUEST) {
printWarningOrError(sif::OutputTypes::OUT_WARNING, "handleHousekeepingMessage", printWarningOrError(sif::OutputTypes::OUT_WARNING, "handleHousekeepingMessage",
WRONG_HK_PACKET_TYPE); INVALID_HK_REQUEST);
} }
HousekeepingMessage::setHkRequestFailureReply(&reply, sid, result); HousekeepingMessage::setHkRequestFailureReply(&reply, sid, result);
} else { } else {
@ -353,10 +353,8 @@ void PeriodicHelper::printWarningOrError(sif::OutputTypes outputType, const char
if (errorPrint == nullptr) { if (errorPrint == nullptr) {
if (error == DATASET_NOT_FOUND) { if (error == DATASET_NOT_FOUND) {
errorPrint = "Dataset not found"; errorPrint = "Dataset not found";
} else if (error == POOLOBJECT_NOT_FOUND) { } else if (error == INVALID_HK_REQUEST) {
errorPrint = "Pool Object not found"; errorPrint = "Invalid HK request";
} else if (error == WRONG_HK_PACKET_TYPE) {
errorPrint = "Wrong Packet Type";
} else if (error == returnvalue::FAILED) { } else if (error == returnvalue::FAILED) {
if (outputType == sif::OutputTypes::OUT_WARNING) { if (outputType == sif::OutputTypes::OUT_WARNING) {
errorPrint = "Generic Warning"; errorPrint = "Generic Warning";

View File

@ -49,15 +49,6 @@ class PeriodicHelper : public PeriodicHelperIF {
friend class SharedPoolAttorney; friend class SharedPoolAttorney;
public: public:
static constexpr uint8_t INTERFACE_ID = CLASS_ID::HOUSEKEEPING_MANAGER;
static constexpr ReturnValue_t QUEUE_OR_DESTINATION_INVALID = MAKE_RETURN_CODE(0);
static constexpr ReturnValue_t WRONG_HK_PACKET_TYPE = MAKE_RETURN_CODE(1);
static constexpr ReturnValue_t REPORTING_STATUS_UNCHANGED = MAKE_RETURN_CODE(2);
static constexpr ReturnValue_t PERIODIC_HELPER_INVALID = MAKE_RETURN_CODE(3);
static constexpr ReturnValue_t POOLOBJECT_NOT_FOUND = MAKE_RETURN_CODE(4);
static constexpr ReturnValue_t DATASET_NOT_FOUND = MAKE_RETURN_CODE(5);
/** /**
* This constructor is used by a class which wants to implement * This constructor is used by a class which wants to implement
* a personal local data pool. The queueToUse can be supplied if it * a personal local data pool. The queueToUse can be supplied if it

View File

@ -11,6 +11,12 @@
namespace hk { namespace hk {
static constexpr uint8_t INTERFACE_ID = CLASS_ID::PERIODIC_HK_IF;
static constexpr ReturnValue_t DATASET_NOT_FOUND = MAKE_RETURN_CODE(0);
static constexpr ReturnValue_t QUEUE_OR_DESTINATION_INVALID = MAKE_RETURN_CODE(1);
static constexpr ReturnValue_t INVALID_HK_REQUEST = MAKE_RETURN_CODE(2);
/** /**
* Different types of housekeeping reporting are possible. * Different types of housekeeping reporting are possible.
* 1. PERIODIC: * 1. PERIODIC:

View File

@ -68,9 +68,9 @@ enum : uint8_t {
MUTEX_IF, // MUX MUTEX_IF, // MUX
MESSAGE_QUEUE_IF, // MQI MESSAGE_QUEUE_IF, // MQI
SEMAPHORE_IF, // SPH SEMAPHORE_IF, // SPH
LOCAL_POOL_OWNER_IF, // LPIF DATAPOOL_IF, // LPIF
POOL_VARIABLE_IF, // PVA POOL_VARIABLE_IF, // PVA
HOUSEKEEPING_MANAGER, // HKM PERIODIC_HK_IF, // HKM
DLE_ENCODER, // DLEE DLE_ENCODER, // DLEE
PUS_SERVICE_3, // PUS3 PUS_SERVICE_3, // PUS3
PUS_SERVICE_9, // PUS9 PUS_SERVICE_9, // PUS9