merge retval refactoring

This commit is contained in:
Robin Müller 2022-08-16 01:08:26 +02:00
parent 9e064fe800
commit 1037102349
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
369 changed files with 2661 additions and 2668 deletions

View File

@ -8,9 +8,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
# [unreleased] # [unreleased]
## Changes
- Removed `HasReturnvaluesIF` class in favor of `returnvalue` namespace with `OK` and `FAILED`
constants.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/659
## Added ## Added
- Add new `UnsignedByteField` class - Add new `UnsignedByteField` class
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/660
# [v5.0.0] 25.07.2022 # [v5.0.0] 25.07.2022

View File

@ -11,15 +11,15 @@ ReturnValue_t pst::pollingSequenceInitDefault(
/* Add polling sequence table here */ /* Add polling sequence table here */
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) { if (thisSequence->checkSequence() == returnvalue::OK) {
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
else { else {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!" sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!"
<< std::endl; << std::endl;
#endif #endif
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
} }

View File

@ -12,7 +12,7 @@ ReturnValue_t ActionHelper::handleActionMessage(CommandMessage* command) {
if (command->getCommand() == ActionMessage::EXECUTE_ACTION) { if (command->getCommand() == ActionMessage::EXECUTE_ACTION) {
ActionId_t currentAction = ActionMessage::getActionId(command); ActionId_t currentAction = ActionMessage::getActionId(command);
prepareExecution(command->getSender(), currentAction, ActionMessage::getStoreId(command)); prepareExecution(command->getSender(), currentAction, ActionMessage::getStoreId(command));
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} else { } else {
return CommandMessage::UNKNOWN_COMMAND; return CommandMessage::UNKNOWN_COMMAND;
} }
@ -21,7 +21,7 @@ ReturnValue_t ActionHelper::handleActionMessage(CommandMessage* command) {
ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) { ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE); ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
if (ipcStore == nullptr) { if (ipcStore == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
if (queueToUse_ != nullptr) { if (queueToUse_ != nullptr) {
setQueueToUse(queueToUse_); setQueueToUse(queueToUse_);
@ -35,10 +35,10 @@ ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
sif::printWarning("ActionHelper::initialize: No queue set\n"); sif::printWarning("ActionHelper::initialize: No queue set\n");
#endif #endif
#endif /* FSFW_VERBOSE_LEVEL >= 1 */ #endif /* FSFW_VERBOSE_LEVEL >= 1 */
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
void ActionHelper::step(uint8_t step, MessageQueueId_t reportTo, ActionId_t commandId, void ActionHelper::step(uint8_t step, MessageQueueId_t reportTo, ActionId_t commandId,
@ -62,7 +62,7 @@ void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t act
const uint8_t* dataPtr = nullptr; const uint8_t* dataPtr = nullptr;
size_t size = 0; size_t size = 0;
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size); ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
CommandMessage reply; CommandMessage reply;
ActionMessage::setStepReply(&reply, actionId, 0, result); ActionMessage::setStepReply(&reply, actionId, 0, result);
queueToUse->sendMessage(commandedBy, &reply); queueToUse->sendMessage(commandedBy, &reply);
@ -75,7 +75,7 @@ void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t act
ActionMessage::setCompletionReply(&reply, actionId, true, result); ActionMessage::setCompletionReply(&reply, actionId, true, result);
queueToUse->sendMessage(commandedBy, &reply); queueToUse->sendMessage(commandedBy, &reply);
} }
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
CommandMessage reply; CommandMessage reply;
ActionMessage::setStepReply(&reply, actionId, 0, result); ActionMessage::setStepReply(&reply, actionId, 0, result);
queueToUse->sendMessage(commandedBy, &reply); queueToUse->sendMessage(commandedBy, &reply);
@ -91,11 +91,11 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
size_t maxSize = data->getSerializedSize(); size_t maxSize = data->getSerializedSize();
if (maxSize == 0) { if (maxSize == 0) {
/* No error, there's simply nothing to report. */ /* No error, there's simply nothing to report. */
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
size_t size = 0; size_t size = 0;
ReturnValue_t result = ipcStore->getFreeElement(&storeAddress, maxSize, &dataPtr); ReturnValue_t result = ipcStore->getFreeElement(&storeAddress, maxSize, &dataPtr);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "ActionHelper::reportData: Getting free element from IPC store failed!" sif::warning << "ActionHelper::reportData: Getting free element from IPC store failed!"
<< std::endl; << std::endl;
@ -107,7 +107,7 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
return result; return result;
} }
result = data->serialize(&dataPtr, &size, maxSize, SerializeIF::Endianness::BIG); result = data->serialize(&dataPtr, &size, maxSize, SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
ipcStore->deleteData(storeAddress); ipcStore->deleteData(storeAddress);
return result; return result;
} }
@ -124,7 +124,7 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
result = queueToUse->sendMessage(reportTo, &reply); result = queueToUse->sendMessage(reportTo, &reply);
} }
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
ipcStore->deleteData(storeAddress); ipcStore->deleteData(storeAddress);
} }
return result; return result;
@ -137,7 +137,7 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
CommandMessage reply; CommandMessage reply;
store_address_t storeAddress; store_address_t storeAddress;
ReturnValue_t result = ipcStore->addData(&storeAddress, data, dataSize); ReturnValue_t result = ipcStore->addData(&storeAddress, data, dataSize);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "ActionHelper::reportData: Adding data to IPC store failed!" << std::endl; sif::warning << "ActionHelper::reportData: Adding data to IPC store failed!" << std::endl;
#else #else
@ -158,7 +158,7 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
result = queueToUse->sendMessage(reportTo, &reply); result = queueToUse->sendMessage(reportTo, &reply);
} }
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
ipcStore->deleteData(storeAddress); ipcStore->deleteData(storeAddress);
} }
return result; return result;

View File

@ -36,7 +36,7 @@ class ActionHelper {
* send to the sender of the message automatically. * send to the sender of the message automatically.
* *
* @param command Pointer to a command message received by the owner * @param command Pointer to a command message received by the owner
* @return HasReturnvaluesIF::RETURN_OK if the message is a action message, * @return returnvalue::OK if the message is a action message,
* CommandMessage::UNKNOW_COMMAND if this message ID is unkown * CommandMessage::UNKNOW_COMMAND if this message ID is unkown
*/ */
ReturnValue_t handleActionMessage(CommandMessage* command); ReturnValue_t handleActionMessage(CommandMessage* command);
@ -58,7 +58,7 @@ class ActionHelper {
* @param result Result of the execution * @param result Result of the execution
*/ */
void step(uint8_t step, MessageQueueId_t reportTo, ActionId_t commandId, void step(uint8_t step, MessageQueueId_t reportTo, ActionId_t commandId,
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK); ReturnValue_t result = returnvalue::OK);
/** /**
* Function to be called by the owner to send a action completion message * Function to be called by the owner to send a action completion message
* @param success Specify whether action was completed successfully or not. * @param success Specify whether action was completed successfully or not.
@ -67,7 +67,7 @@ class ActionHelper {
* @param result Result of the execution * @param result Result of the execution
*/ */
void finish(bool success, MessageQueueId_t reportTo, ActionId_t commandId, void finish(bool success, MessageQueueId_t reportTo, ActionId_t commandId,
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK); ReturnValue_t result = returnvalue::OK);
/** /**
* Function to be called by the owner if an action does report data. * Function to be called by the owner if an action does report data.
* Takes a SerializeIF* pointer and serializes it into the IPC store. * Takes a SerializeIF* pointer and serializes it into the IPC store.

View File

@ -25,7 +25,7 @@ store_address_t ActionMessage::getStoreId(const CommandMessage* message) {
void ActionMessage::setStepReply(CommandMessage* message, ActionId_t fid, uint8_t step, void ActionMessage::setStepReply(CommandMessage* message, ActionId_t fid, uint8_t step,
ReturnValue_t result) { ReturnValue_t result) {
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == returnvalue::OK) {
message->setCommand(STEP_SUCCESS); message->setCommand(STEP_SUCCESS);
} else { } else {
message->setCommand(STEP_FAILED); message->setCommand(STEP_FAILED);

View File

@ -33,12 +33,12 @@ class ActionMessage {
static store_address_t getStoreId(const CommandMessage* message); static store_address_t getStoreId(const CommandMessage* message);
static void setStepReply(CommandMessage* message, ActionId_t fid, uint8_t step, static void setStepReply(CommandMessage* message, ActionId_t fid, uint8_t step,
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK); ReturnValue_t result = returnvalue::OK);
static uint8_t getStep(const CommandMessage* message); static uint8_t getStep(const CommandMessage* message);
static ReturnValue_t getReturnCode(const CommandMessage* message); static ReturnValue_t getReturnCode(const CommandMessage* message);
static void setDataReply(CommandMessage* message, ActionId_t actionId, store_address_t data); static void setDataReply(CommandMessage* message, ActionId_t actionId, store_address_t data);
static void setCompletionReply(CommandMessage* message, ActionId_t fid, bool success, static void setCompletionReply(CommandMessage* message, ActionId_t fid, bool success,
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK); ReturnValue_t result = returnvalue::OK);
static void clear(CommandMessage* message); static void clear(CommandMessage* message);
}; };

View File

@ -16,12 +16,12 @@ ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId
uint8_t *storePointer; uint8_t *storePointer;
size_t maxSize = data->getSerializedSize(); size_t maxSize = data->getSerializedSize();
ReturnValue_t result = ipcStore->getFreeElement(&storeId, maxSize, &storePointer); ReturnValue_t result = ipcStore->getFreeElement(&storeId, maxSize, &storePointer);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
size_t size = 0; size_t size = 0;
result = data->serialize(&storePointer, &size, maxSize, SerializeIF::Endianness::BIG); result = data->serialize(&storePointer, &size, maxSize, SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
return sendCommand(receiver->getCommandQueue(), actionId, storeId); return sendCommand(receiver->getCommandQueue(), actionId, storeId);
@ -35,7 +35,7 @@ ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId
} }
store_address_t storeId; store_address_t storeId;
ReturnValue_t result = ipcStore->addData(&storeId, data, size); ReturnValue_t result = ipcStore->addData(&storeId, data, size);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
return sendCommand(receiver->getCommandQueue(), actionId, storeId); return sendCommand(receiver->getCommandQueue(), actionId, storeId);
@ -46,7 +46,7 @@ ReturnValue_t CommandActionHelper::sendCommand(MessageQueueId_t queueId, ActionI
CommandMessage command; CommandMessage command;
ActionMessage::setCommand(&command, actionId, storeId); ActionMessage::setCommand(&command, actionId, storeId);
ReturnValue_t result = queueToUse->sendMessage(queueId, &command); ReturnValue_t result = queueToUse->sendMessage(queueId, &command);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
ipcStore->deleteData(storeId); ipcStore->deleteData(storeId);
} }
lastTarget = queueId; lastTarget = queueId;
@ -57,44 +57,44 @@ ReturnValue_t CommandActionHelper::sendCommand(MessageQueueId_t queueId, ActionI
ReturnValue_t CommandActionHelper::initialize() { ReturnValue_t CommandActionHelper::initialize() {
ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE); ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
if (ipcStore == nullptr) { if (ipcStore == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
queueToUse = owner->getCommandQueuePtr(); queueToUse = owner->getCommandQueuePtr();
if (queueToUse == nullptr) { if (queueToUse == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t CommandActionHelper::handleReply(CommandMessage *reply) { ReturnValue_t CommandActionHelper::handleReply(CommandMessage *reply) {
if (reply->getSender() != lastTarget) { if (reply->getSender() != lastTarget) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
switch (reply->getCommand()) { switch (reply->getCommand()) {
case ActionMessage::COMPLETION_SUCCESS: case ActionMessage::COMPLETION_SUCCESS:
commandCount--; commandCount--;
owner->completionSuccessfulReceived(ActionMessage::getActionId(reply)); owner->completionSuccessfulReceived(ActionMessage::getActionId(reply));
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
case ActionMessage::COMPLETION_FAILED: case ActionMessage::COMPLETION_FAILED:
commandCount--; commandCount--;
owner->completionFailedReceived(ActionMessage::getActionId(reply), owner->completionFailedReceived(ActionMessage::getActionId(reply),
ActionMessage::getReturnCode(reply)); ActionMessage::getReturnCode(reply));
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
case ActionMessage::STEP_SUCCESS: case ActionMessage::STEP_SUCCESS:
owner->stepSuccessfulReceived(ActionMessage::getActionId(reply), owner->stepSuccessfulReceived(ActionMessage::getActionId(reply),
ActionMessage::getStep(reply)); ActionMessage::getStep(reply));
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
case ActionMessage::STEP_FAILED: case ActionMessage::STEP_FAILED:
commandCount--; commandCount--;
owner->stepFailedReceived(ActionMessage::getActionId(reply), ActionMessage::getStep(reply), owner->stepFailedReceived(ActionMessage::getActionId(reply), ActionMessage::getStep(reply),
ActionMessage::getReturnCode(reply)); ActionMessage::getReturnCode(reply));
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
case ActionMessage::DATA_REPLY: case ActionMessage::DATA_REPLY:
extractDataForOwner(ActionMessage::getActionId(reply), ActionMessage::getStoreId(reply)); extractDataForOwner(ActionMessage::getActionId(reply), ActionMessage::getStoreId(reply));
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
default: default:
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
} }
@ -104,7 +104,7 @@ void CommandActionHelper::extractDataForOwner(ActionId_t actionId, store_address
const uint8_t *data = nullptr; const uint8_t *data = nullptr;
size_t size = 0; size_t size = 0;
ReturnValue_t result = ipcStore->getData(storeId, &data, &size); ReturnValue_t result = ipcStore->getData(storeId, &data, &size);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return; return;
} }
owner->dataReceived(actionId, data, size); owner->dataReceived(actionId, data, size);

View File

@ -9,7 +9,7 @@ void SimpleActionHelper::step(ReturnValue_t result) {
// STEP_OFFESET is subtracted to compensate for adding offset in base // STEP_OFFESET is subtracted to compensate for adding offset in base
// method, which is not necessary here. // method, which is not necessary here.
ActionHelper::step(stepCount - STEP_OFFSET, lastCommander, lastAction, result); ActionHelper::step(stepCount - STEP_OFFSET, lastCommander, lastAction, result);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
resetHelper(); resetHelper();
} }
} }
@ -41,7 +41,7 @@ void SimpleActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId
const uint8_t* dataPtr = nullptr; const uint8_t* dataPtr = nullptr;
size_t size = 0; size_t size = 0;
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size); ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
ActionMessage::setStepReply(&reply, actionId, 0, result); ActionMessage::setStepReply(&reply, actionId, 0, result);
queueToUse->sendMessage(commandedBy, &reply); queueToUse->sendMessage(commandedBy, &reply);
return; return;
@ -51,12 +51,12 @@ void SimpleActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId
result = owner->executeAction(actionId, commandedBy, dataPtr, size); result = owner->executeAction(actionId, commandedBy, dataPtr, size);
ipcStore->deleteData(dataAddress); ipcStore->deleteData(dataAddress);
switch (result) { switch (result) {
case HasReturnvaluesIF::RETURN_OK: case returnvalue::OK:
isExecuting = true; isExecuting = true;
stepCount++; stepCount++;
break; break;
case HasActionsIF::EXECUTION_FINISHED: case HasActionsIF::EXECUTION_FINISHED:
ActionMessage::setCompletionReply(&reply, actionId, true, HasReturnvaluesIF::RETURN_OK); ActionMessage::setCompletionReply(&reply, actionId, true, returnvalue::OK);
queueToUse->sendMessage(commandedBy, &reply); queueToUse->sendMessage(commandedBy, &reply);
break; break;
default: default:

View File

@ -12,8 +12,8 @@ class SimpleActionHelper : public ActionHelper {
public: public:
SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue); SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue);
~SimpleActionHelper() override; ~SimpleActionHelper() override;
void step(ReturnValue_t result = HasReturnvaluesIF::RETURN_OK); void step(ReturnValue_t result = returnvalue::OK);
void finish(ReturnValue_t result = HasReturnvaluesIF::RETURN_OK); void finish(ReturnValue_t result = returnvalue::OK);
ReturnValue_t reportData(SerializeIF* data); ReturnValue_t reportData(SerializeIF* data);
protected: protected:

View File

@ -20,11 +20,11 @@ CfdpHandler::~CfdpHandler() = default;
ReturnValue_t CfdpHandler::initialize() { ReturnValue_t CfdpHandler::initialize() {
ReturnValue_t result = SystemObject::initialize(); ReturnValue_t result = SystemObject::initialize();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
this->distributor->registerHandler(this); this->distributor->registerHandler(this);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t CfdpHandler::handleRequest(store_address_t storeId) { ReturnValue_t CfdpHandler::handleRequest(store_address_t storeId) {
@ -38,18 +38,18 @@ ReturnValue_t CfdpHandler::handleRequest(store_address_t storeId) {
// TODO read out packet from store using storeId // TODO read out packet from store using storeId
return RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t CfdpHandler::performOperation(uint8_t opCode) { ReturnValue_t CfdpHandler::performOperation(uint8_t opCode) {
ReturnValue_t status = RETURN_OK; ReturnValue_t status = returnvalue::OK;
CommandMessage currentMessage; CommandMessage currentMessage;
for (status = this->requestQueue->receiveMessage(&currentMessage); status == RETURN_OK; for (status = this->requestQueue->receiveMessage(&currentMessage); status == returnvalue::OK;
status = this->requestQueue->receiveMessage(&currentMessage)) { status = this->requestQueue->receiveMessage(&currentMessage)) {
store_address_t storeId = CfdpMessage::getStoreId(&currentMessage); store_address_t storeId = CfdpMessage::getStoreId(&currentMessage);
this->handleRequest(storeId); this->handleRequest(storeId);
} }
return RETURN_OK; return returnvalue::OK;
} }
uint16_t CfdpHandler::getIdentifier() { return 0; } uint16_t CfdpHandler::getIdentifier() { return 0; }

View File

@ -12,10 +12,7 @@ namespace Factory {
void setStaticFrameworkObjectIds(); void setStaticFrameworkObjectIds();
} }
class CfdpHandler : public ExecutableObjectIF, class CfdpHandler : public ExecutableObjectIF, public AcceptsTelecommandsIF, public SystemObject {
public AcceptsTelecommandsIF,
public SystemObject,
public HasReturnvaluesIF {
friend void(Factory::setStaticFrameworkObjectIds)(); friend void(Factory::setStaticFrameworkObjectIds)();
public: public:

View File

@ -43,7 +43,7 @@ struct FileSize : public SerializeIF {
uint32_t sizeTmp = 0; uint32_t sizeTmp = 0;
ReturnValue_t result = ReturnValue_t result =
SerializeAdapter::deSerialize(&sizeTmp, buffer, size, streamEndianness); SerializeAdapter::deSerialize(&sizeTmp, buffer, size, streamEndianness);
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == returnvalue::OK) {
fileSize = sizeTmp; fileSize = sizeTmp;
} }
return result; return result;
@ -53,11 +53,11 @@ struct FileSize : public SerializeIF {
ReturnValue_t setFileSize(uint64_t fileSize, bool largeFile) { ReturnValue_t setFileSize(uint64_t fileSize, bool largeFile) {
if (not largeFile and fileSize > UINT32_MAX) { if (not largeFile and fileSize > UINT32_MAX) {
// TODO: emit warning here // TODO: emit warning here
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
this->fileSize = fileSize; this->fileSize = fileSize;
this->largeFile = largeFile; this->largeFile = largeFile;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
bool isLargeFile() const { return largeFile; } bool isLargeFile() const { return largeFile; }

View File

@ -15,21 +15,24 @@ static constexpr uint8_t VERSION_BITS = 0b00100000;
static constexpr uint8_t CFDP_CLASS_ID = CLASS_ID::CFDP; static constexpr uint8_t CFDP_CLASS_ID = CLASS_ID::CFDP;
static constexpr ReturnValue_t INVALID_TLV_TYPE = result::makeCode(CFDP_CLASS_ID, 1); static constexpr ReturnValue_t INVALID_TLV_TYPE = returnvalue::makeCode(CFDP_CLASS_ID, 1);
static constexpr ReturnValue_t INVALID_DIRECTIVE_FIELDS = result::makeCode(CFDP_CLASS_ID, 2); static constexpr ReturnValue_t INVALID_DIRECTIVE_FIELDS = returnvalue::makeCode(CFDP_CLASS_ID, 2);
static constexpr ReturnValue_t INVALID_PDU_DATAFIELD_LEN = result::makeCode(CFDP_CLASS_ID, 3); static constexpr ReturnValue_t INVALID_PDU_DATAFIELD_LEN = returnvalue::makeCode(CFDP_CLASS_ID, 3);
static constexpr ReturnValue_t INVALID_ACK_DIRECTIVE_FIELDS = result::makeCode(CFDP_CLASS_ID, 4); static constexpr ReturnValue_t INVALID_ACK_DIRECTIVE_FIELDS =
returnvalue::makeCode(CFDP_CLASS_ID, 4);
//! Can not parse options. This can also occur because there are options //! Can not parse options. This can also occur because there are options
//! available but the user did not pass a valid options array //! available but the user did not pass a valid options array
static constexpr ReturnValue_t METADATA_CANT_PARSE_OPTIONS = result::makeCode(CFDP_CLASS_ID, 5); static constexpr ReturnValue_t METADATA_CANT_PARSE_OPTIONS =
static constexpr ReturnValue_t NAK_CANT_PARSE_OPTIONS = result::makeCode(CFDP_CLASS_ID, 6); returnvalue::makeCode(CFDP_CLASS_ID, 5);
static constexpr ReturnValue_t NAK_CANT_PARSE_OPTIONS = returnvalue::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t FINISHED_CANT_PARSE_FS_RESPONSES = static constexpr ReturnValue_t FINISHED_CANT_PARSE_FS_RESPONSES =
result::makeCode(CFDP_CLASS_ID, 6); returnvalue::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t FILESTORE_REQUIRES_SECOND_FILE = result::makeCode(CFDP_CLASS_ID, 8); static constexpr ReturnValue_t FILESTORE_REQUIRES_SECOND_FILE =
returnvalue::makeCode(CFDP_CLASS_ID, 8);
//! Can not parse filestore response because user did not pass a valid instance //! Can not parse filestore response because user did not pass a valid instance
//! or remaining size is invalid //! or remaining size is invalid
static constexpr ReturnValue_t FILESTORE_RESPONSE_CANT_PARSE_FS_MESSAGE = static constexpr ReturnValue_t FILESTORE_RESPONSE_CANT_PARSE_FS_MESSAGE =
result::makeCode(CFDP_CLASS_ID, 9); returnvalue::makeCode(CFDP_CLASS_ID, 9);
//! Checksum types according to the SANA Checksum Types registry //! Checksum types according to the SANA Checksum Types registry
//! https://sanaregistry.org/r/checksum_identifiers/ //! https://sanaregistry.org/r/checksum_identifiers/

View File

@ -5,7 +5,7 @@ AckPduDeserializer::AckPduDeserializer(const uint8_t* pduBuf, size_t maxSize, Ac
ReturnValue_t AckPduDeserializer::parseData() { ReturnValue_t AckPduDeserializer::parseData() {
ReturnValue_t result = FileDirectiveDeserializer::parseData(); ReturnValue_t result = FileDirectiveDeserializer::parseData();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize(); size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
@ -15,7 +15,7 @@ ReturnValue_t AckPduDeserializer::parseData() {
if (not checkAndSetCodes(rawPtr[currentIdx], rawPtr[currentIdx + 1])) { if (not checkAndSetCodes(rawPtr[currentIdx], rawPtr[currentIdx + 1])) {
return cfdp::INVALID_ACK_DIRECTIVE_FIELDS; return cfdp::INVALID_ACK_DIRECTIVE_FIELDS;
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
bool AckPduDeserializer::checkAndSetCodes(uint8_t firstByte, uint8_t secondByte) { bool AckPduDeserializer::checkAndSetCodes(uint8_t firstByte, uint8_t secondByte) {

View File

@ -11,7 +11,7 @@ ReturnValue_t AckPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
Endianness streamEndianness) const { Endianness streamEndianness) const {
ReturnValue_t result = ReturnValue_t result =
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness); FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
cfdp::FileDirectives ackedDirective = ackInfo.getAckedDirective(); cfdp::FileDirectives ackedDirective = ackInfo.getAckedDirective();
@ -21,7 +21,7 @@ ReturnValue_t AckPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
if (ackedDirective != cfdp::FileDirectives::FINISH and if (ackedDirective != cfdp::FileDirectives::FINISH and
ackedDirective != cfdp::FileDirectives::EOF_DIRECTIVE) { ackedDirective != cfdp::FileDirectives::EOF_DIRECTIVE) {
// TODO: better returncode // TODO: better returncode
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
if (*size + 2 > maxSize) { if (*size + 2 > maxSize) {
return SerializeIF::BUFFER_TOO_SHORT; return SerializeIF::BUFFER_TOO_SHORT;
@ -32,5 +32,5 @@ ReturnValue_t AckPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
**buffer = ackedConditionCode << 4 | transactionStatus; **buffer = ackedConditionCode << 4 | transactionStatus;
*buffer += 1; *buffer += 1;
*size += 1; *size += 1;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }

View File

@ -8,7 +8,7 @@ EofPduDeserializer::EofPduDeserializer(const uint8_t* pduBuf, size_t maxSize, Eo
ReturnValue_t EofPduDeserializer::parseData() { ReturnValue_t EofPduDeserializer::parseData() {
ReturnValue_t result = FileDirectiveDeserializer::parseData(); ReturnValue_t result = FileDirectiveDeserializer::parseData();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -31,7 +31,7 @@ ReturnValue_t EofPduDeserializer::parseData() {
uint32_t checksum = 0; uint32_t checksum = 0;
auto endianness = getEndianness(); auto endianness = getEndianness();
result = SerializeAdapter::deSerialize(&checksum, &bufPtr, &deserLen, endianness); result = SerializeAdapter::deSerialize(&checksum, &bufPtr, &deserLen, endianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
info.setChecksum(checksum); info.setChecksum(checksum);
@ -44,7 +44,7 @@ ReturnValue_t EofPduDeserializer::parseData() {
result = SerializeAdapter::deSerialize(&fileSizeValue, &bufPtr, &deserLen, endianness); result = SerializeAdapter::deSerialize(&fileSizeValue, &bufPtr, &deserLen, endianness);
info.setFileSize(fileSizeValue, false); info.setFileSize(fileSizeValue, false);
} }
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (info.getConditionCode() != cfdp::ConditionCode::NO_ERROR) { if (info.getConditionCode() != cfdp::ConditionCode::NO_ERROR) {
@ -61,7 +61,7 @@ ReturnValue_t EofPduDeserializer::parseData() {
" given TLV pointer invalid"); " given TLV pointer invalid");
#endif #endif
#endif /* FSFW_VERBOSE_LEVEL >= 1 */ #endif /* FSFW_VERBOSE_LEVEL >= 1 */
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
result = tlvPtr->deSerialize(&bufPtr, &deserLen, endianness); result = tlvPtr->deSerialize(&bufPtr, &deserLen, endianness);
} }

View File

@ -16,7 +16,7 @@ ReturnValue_t EofPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
Endianness streamEndianness) const { Endianness streamEndianness) const {
ReturnValue_t result = ReturnValue_t result =
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness); FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (*size + 1 > maxSize) { if (*size + 1 > maxSize) {
@ -27,7 +27,7 @@ ReturnValue_t EofPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
*size += 1; *size += 1;
uint32_t checksum = info.getChecksum(); uint32_t checksum = info.getChecksum();
result = SerializeAdapter::serialize(&checksum, buffer, size, maxSize, streamEndianness); result = SerializeAdapter::serialize(&checksum, buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (info.getFileSize().isLargeFile()) { if (info.getFileSize().isLargeFile()) {

View File

@ -6,7 +6,7 @@ FileDataDeserializer::FileDataDeserializer(const uint8_t* pduBuf, size_t maxSize
ReturnValue_t FileDataDeserializer::parseData() { ReturnValue_t FileDataDeserializer::parseData() {
ReturnValue_t result = HeaderDeserializer::parseData(); ReturnValue_t result = HeaderDeserializer::parseData();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
size_t currentIdx = HeaderDeserializer::getHeaderSize(); size_t currentIdx = HeaderDeserializer::getHeaderSize();
@ -32,13 +32,13 @@ ReturnValue_t FileDataDeserializer::parseData() {
} }
} }
result = info.getOffset().deSerialize(&buf, &remSize, this->getEndianness()); result = info.getOffset().deSerialize(&buf, &remSize, this->getEndianness());
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (remSize > 0) { if (remSize > 0) {
info.setFileData(buf, remSize); info.setFileData(buf, remSize);
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
SerializeIF::Endianness FileDataDeserializer::getEndianness() const { return endianness; } SerializeIF::Endianness FileDataDeserializer::getEndianness() const { return endianness; }

View File

@ -50,11 +50,11 @@ ReturnValue_t FileDataInfo::addSegmentMetadataInfo(cfdp::RecordContinuationState
this->segmentMetadataFlag = cfdp::SegmentMetadataFlag::PRESENT; this->segmentMetadataFlag = cfdp::SegmentMetadataFlag::PRESENT;
this->recContState = recContState; this->recContState = recContState;
if (segmentMetadataLen > 63) { if (segmentMetadataLen > 63) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
this->segmentMetadata = segmentMetadata; this->segmentMetadata = segmentMetadata;
this->segmentMetadataLen = segmentMetadataLen; this->segmentMetadataLen = segmentMetadataLen;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
const uint8_t *FileDataInfo::getFileData(size_t *fileSize) const { const uint8_t *FileDataInfo::getFileData(size_t *fileSize) const {

View File

@ -17,7 +17,7 @@ void FileDataSerializer::update() {
ReturnValue_t FileDataSerializer::serialize(uint8_t** buffer, size_t* size, size_t maxSize, ReturnValue_t FileDataSerializer::serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const { Endianness streamEndianness) const {
ReturnValue_t result = HeaderSerializer::serialize(buffer, size, maxSize, streamEndianness); ReturnValue_t result = HeaderSerializer::serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (*size + this->getSerializedSize() > maxSize) { if (*size + this->getSerializedSize() > maxSize) {
@ -36,7 +36,7 @@ ReturnValue_t FileDataSerializer::serialize(uint8_t** buffer, size_t* size, size
} }
cfdp::FileSize& offset = info.getOffset(); cfdp::FileSize& offset = info.getOffset();
result = offset.serialize(this->getLargeFileFlag(), buffer, size, maxSize, streamEndianness); result = offset.serialize(this->getLargeFileFlag(), buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
size_t fileSize = 0; size_t fileSize = 0;
@ -47,7 +47,7 @@ ReturnValue_t FileDataSerializer::serialize(uint8_t** buffer, size_t* size, size
std::memcpy(*buffer, readOnlyPtr, fileSize); std::memcpy(*buffer, readOnlyPtr, fileSize);
*buffer += fileSize; *buffer += fileSize;
*size += fileSize; *size += fileSize;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
size_t FileDataSerializer::getSerializedSize() const { size_t FileDataSerializer::getSerializedSize() const {

View File

@ -7,7 +7,7 @@ cfdp::FileDirectives FileDirectiveDeserializer::getFileDirective() const { retur
ReturnValue_t FileDirectiveDeserializer::parseData() { ReturnValue_t FileDirectiveDeserializer::parseData() {
ReturnValue_t result = HeaderDeserializer::parseData(); ReturnValue_t result = HeaderDeserializer::parseData();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (this->getPduDataFieldLen() < 1) { if (this->getPduDataFieldLen() < 1) {
@ -21,7 +21,7 @@ ReturnValue_t FileDirectiveDeserializer::parseData() {
return cfdp::INVALID_DIRECTIVE_FIELDS; return cfdp::INVALID_DIRECTIVE_FIELDS;
} }
setFileDirective(static_cast<cfdp::FileDirectives>(rawPtr[currentIdx])); setFileDirective(static_cast<cfdp::FileDirectives>(rawPtr[currentIdx]));
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
size_t FileDirectiveDeserializer::getHeaderSize() const { size_t FileDirectiveDeserializer::getHeaderSize() const {

View File

@ -13,13 +13,13 @@ size_t FileDirectiveSerializer::getSerializedSize() const {
ReturnValue_t FileDirectiveSerializer::serialize(uint8_t **buffer, size_t *size, size_t maxSize, ReturnValue_t FileDirectiveSerializer::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const { Endianness streamEndianness) const {
if (buffer == nullptr or size == nullptr) { if (buffer == nullptr or size == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
if (FileDirectiveSerializer::getWholePduSize() > maxSize) { if (FileDirectiveSerializer::getWholePduSize() > maxSize) {
return BUFFER_TOO_SHORT; return BUFFER_TOO_SHORT;
} }
ReturnValue_t result = HeaderSerializer::serialize(buffer, size, maxSize, streamEndianness); ReturnValue_t result = HeaderSerializer::serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -29,7 +29,7 @@ ReturnValue_t FileDirectiveSerializer::serialize(uint8_t **buffer, size_t *size,
**buffer = directiveCode; **buffer = directiveCode;
*buffer += 1; *buffer += 1;
*size += 1; *size += 1;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
void FileDirectiveSerializer::setDirectiveDataFieldLen(size_t len) { void FileDirectiveSerializer::setDirectiveDataFieldLen(size_t len) {

View File

@ -46,14 +46,14 @@ ReturnValue_t FinishedInfo::setFilestoreResponsesArray(FilestoreResponseTlv** fs
if (maxFsResponsesLen != nullptr) { if (maxFsResponsesLen != nullptr) {
this->fsResponsesMaxLen = *maxFsResponsesLen; this->fsResponsesMaxLen = *maxFsResponsesLen;
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t FinishedInfo::getFilestoreResonses(FilestoreResponseTlv*** fsResponses, ReturnValue_t FinishedInfo::getFilestoreResonses(FilestoreResponseTlv*** fsResponses,
size_t* fsResponsesLen, size_t* fsResponsesLen,
size_t* fsResponsesMaxLen) { size_t* fsResponsesMaxLen) {
if (fsResponses == nullptr) { if (fsResponses == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
*fsResponses = this->fsResponses; *fsResponses = this->fsResponses;
if (fsResponsesLen != nullptr) { if (fsResponsesLen != nullptr) {
@ -62,7 +62,7 @@ ReturnValue_t FinishedInfo::getFilestoreResonses(FilestoreResponseTlv*** fsRespo
if (fsResponsesMaxLen != nullptr) { if (fsResponsesMaxLen != nullptr) {
*fsResponsesMaxLen = this->fsResponsesMaxLen; *fsResponsesMaxLen = this->fsResponsesMaxLen;
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
void FinishedInfo::setFaultLocation(EntityIdTlv* faultLocation) { void FinishedInfo::setFaultLocation(EntityIdTlv* faultLocation) {
@ -71,10 +71,10 @@ void FinishedInfo::setFaultLocation(EntityIdTlv* faultLocation) {
ReturnValue_t FinishedInfo::getFaultLocation(EntityIdTlv** faultLocation) { ReturnValue_t FinishedInfo::getFaultLocation(EntityIdTlv** faultLocation) {
if (this->faultLocation == nullptr) { if (this->faultLocation == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
*faultLocation = this->faultLocation; *faultLocation = this->faultLocation;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
cfdp::ConditionCode FinishedInfo::getConditionCode() const { return conditionCode; } cfdp::ConditionCode FinishedInfo::getConditionCode() const { return conditionCode; }

View File

@ -6,7 +6,7 @@ FinishPduDeserializer::FinishPduDeserializer(const uint8_t* pduBuf, size_t maxSi
ReturnValue_t FinishPduDeserializer::parseData() { ReturnValue_t FinishPduDeserializer::parseData() {
ReturnValue_t result = FileDirectiveDeserializer::parseData(); ReturnValue_t result = FileDirectiveDeserializer::parseData();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize(); size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
@ -33,7 +33,7 @@ FinishedInfo& FinishPduDeserializer::getInfo() { return finishedInfo; }
ReturnValue_t FinishPduDeserializer::parseTlvs(size_t remLen, size_t currentIdx, const uint8_t* buf, ReturnValue_t FinishPduDeserializer::parseTlvs(size_t remLen, size_t currentIdx, const uint8_t* buf,
cfdp::ConditionCode conditionCode) { cfdp::ConditionCode conditionCode) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = returnvalue::OK;
size_t fsResponsesIdx = 0; size_t fsResponsesIdx = 0;
auto endianness = getEndianness(); auto endianness = getEndianness();
FilestoreResponseTlv** fsResponseArray = nullptr; FilestoreResponseTlv** fsResponseArray = nullptr;
@ -60,7 +60,7 @@ ReturnValue_t FinishPduDeserializer::parseTlvs(size_t remLen, size_t currentIdx,
return cfdp::FINISHED_CANT_PARSE_FS_RESPONSES; return cfdp::FINISHED_CANT_PARSE_FS_RESPONSES;
} }
result = fsResponseArray[fsResponsesIdx]->deSerialize(&buf, &remLen, endianness); result = fsResponseArray[fsResponsesIdx]->deSerialize(&buf, &remLen, endianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
fsResponsesIdx += 1; fsResponsesIdx += 1;
@ -72,11 +72,11 @@ ReturnValue_t FinishPduDeserializer::parseTlvs(size_t remLen, size_t currentIdx,
return cfdp::INVALID_TLV_TYPE; return cfdp::INVALID_TLV_TYPE;
} }
result = finishedInfo.getFaultLocation(&faultLocation); result = finishedInfo.getFaultLocation(&faultLocation);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = faultLocation->deSerialize(&buf, &remLen, endianness); result = faultLocation->deSerialize(&buf, &remLen, endianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
} else { } else {

View File

@ -17,7 +17,7 @@ ReturnValue_t FinishPduSerializer::serialize(uint8_t **buffer, size_t *size, siz
Endianness streamEndianness) const { Endianness streamEndianness) const {
ReturnValue_t result = ReturnValue_t result =
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness); FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (*size + 1 >= maxSize) { if (*size + 1 >= maxSize) {
@ -34,13 +34,13 @@ ReturnValue_t FinishPduSerializer::serialize(uint8_t **buffer, size_t *size, siz
finishInfo.getFilestoreResonses(&fsResponsesArray, &fsResponsesArrayLen, nullptr); finishInfo.getFilestoreResonses(&fsResponsesArray, &fsResponsesArrayLen, nullptr);
for (size_t idx = 0; idx < fsResponsesArrayLen; idx++) { for (size_t idx = 0; idx < fsResponsesArrayLen; idx++) {
result = fsResponsesArray[idx]->serialize(buffer, size, maxSize, streamEndianness); result = fsResponsesArray[idx]->serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
} }
} }
EntityIdTlv *entityId = nullptr; EntityIdTlv *entityId = nullptr;
if (finishInfo.getFaultLocation(&entityId) == HasReturnvaluesIF::RETURN_OK) { if (finishInfo.getFaultLocation(&entityId) == returnvalue::OK) {
result = entityId->serialize(buffer, size, maxSize, streamEndianness); result = entityId->serialize(buffer, size, maxSize, streamEndianness);
} }
return result; return result;

View File

@ -18,7 +18,7 @@ ReturnValue_t HeaderDeserializer::setData(uint8_t *dataPtr, size_t maxSize, void
if (dataPtr == nullptr) { if (dataPtr == nullptr) {
// Allowed for now // Allowed for now
this->fixedHeader = nullptr; this->fixedHeader = nullptr;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
this->fixedHeader = reinterpret_cast<PduHeaderFixedStruct *>(const_cast<uint8_t *>(dataPtr)); this->fixedHeader = reinterpret_cast<PduHeaderFixedStruct *>(const_cast<uint8_t *>(dataPtr));
sourceIdRaw = static_cast<uint8_t *>(&fixedHeader->variableFieldsStart); sourceIdRaw = static_cast<uint8_t *>(&fixedHeader->variableFieldsStart);
@ -27,7 +27,7 @@ ReturnValue_t HeaderDeserializer::setData(uint8_t *dataPtr, size_t maxSize, void
seqNumRaw = static_cast<uint8_t *>(sourceIdRaw) + static_cast<uint8_t>(widthEntityIds); seqNumRaw = static_cast<uint8_t *>(sourceIdRaw) + static_cast<uint8_t>(widthEntityIds);
destIdRaw = static_cast<uint8_t *>(seqNumRaw) + static_cast<uint8_t>(widthSeqNum); destIdRaw = static_cast<uint8_t *>(seqNumRaw) + static_cast<uint8_t>(widthSeqNum);
this->maxSize = maxSize; this->maxSize = maxSize;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
size_t HeaderDeserializer::getHeaderSize() const { size_t HeaderDeserializer::getHeaderSize() const {

View File

@ -37,7 +37,7 @@ class HeaderDeserializer : public RedirectableDataPointerIF, public PduHeaderIF
* This needs to be called before accessing the PDU fields to avoid segmentation faults. * This needs to be called before accessing the PDU fields to avoid segmentation faults.
* @return * @return
* - RETURN_OK on parse success * - RETURN_OK on parse success
* - RETURN_FAILED Invalid raw data * - returnvalue::FAILED Invalid raw data
* - SerializeIF::BUFFER_TOO_SHORT if buffer is shorter than expected * - SerializeIF::BUFFER_TOO_SHORT if buffer is shorter than expected
*/ */
virtual ReturnValue_t parseData(); virtual ReturnValue_t parseData();
@ -61,7 +61,7 @@ class HeaderDeserializer : public RedirectableDataPointerIF, public PduHeaderIF
void getDestId(cfdp::EntityId& destId) const override; void getDestId(cfdp::EntityId& destId) const override;
void getTransactionSeqNum(cfdp::TransactionSeqNum& seqNum) const override; void getTransactionSeqNum(cfdp::TransactionSeqNum& seqNum) const override;
ReturnValue_t deserResult = HasReturnvaluesIF::RETURN_OK; ReturnValue_t deserResult = returnvalue::OK;
/** /**
* Can also be used to reset the pointer to a nullptr, but the getter functions will not * Can also be used to reset the pointer to a nullptr, but the getter functions will not

View File

@ -15,7 +15,7 @@ HeaderSerializer::HeaderSerializer(PduConfig &pduConf, cfdp::PduType pduType,
ReturnValue_t HeaderSerializer::serialize(uint8_t **buffer, size_t *size, size_t maxSize, ReturnValue_t HeaderSerializer::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const { Endianness streamEndianness) const {
if (buffer == nullptr or size == nullptr) { if (buffer == nullptr or size == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
if (maxSize < this->getSerializedSize()) { if (maxSize < this->getSerializedSize()) {
return BUFFER_TOO_SHORT; return BUFFER_TOO_SHORT;
@ -32,19 +32,19 @@ ReturnValue_t HeaderSerializer::serialize(uint8_t **buffer, size_t *size, size_t
*buffer += 1; *buffer += 1;
*size += 4; *size += 4;
ReturnValue_t result = pduConf.sourceId.serialize(buffer, size, maxSize, streamEndianness); ReturnValue_t result = pduConf.sourceId.serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = pduConf.seqNum.serialize(buffer, size, maxSize, streamEndianness); result = pduConf.seqNum.serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = pduConf.destId.serialize(buffer, size, maxSize, streamEndianness); result = pduConf.destId.serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
size_t HeaderSerializer::getSerializedSize() const { size_t HeaderSerializer::getSerializedSize() const {
@ -55,7 +55,7 @@ size_t HeaderSerializer::getSerializedSize() const {
ReturnValue_t HeaderSerializer::deSerialize(const uint8_t **buffer, size_t *size, ReturnValue_t HeaderSerializer::deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) { Endianness streamEndianness) {
// We could implement this, but I prefer dedicated classes // We could implement this, but I prefer dedicated classes
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
size_t HeaderSerializer::getWholePduSize() const { size_t HeaderSerializer::getWholePduSize() const {

View File

@ -6,7 +6,7 @@ KeepAlivePduDeserializer::KeepAlivePduDeserializer(const uint8_t* pduBuf, size_t
ReturnValue_t KeepAlivePduDeserializer::parseData() { ReturnValue_t KeepAlivePduDeserializer::parseData() {
ReturnValue_t result = FileDirectiveDeserializer::parseData(); ReturnValue_t result = FileDirectiveDeserializer::parseData();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize(); size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();

View File

@ -19,7 +19,7 @@ ReturnValue_t KeepAlivePduSerializer::serialize(uint8_t **buffer, size_t *size,
Endianness streamEndianness) const { Endianness streamEndianness) const {
ReturnValue_t result = ReturnValue_t result =
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness); FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
return progress.serialize(this->getLargeFileFlag(), buffer, size, maxSize, streamEndianness); return progress.serialize(this->getLargeFileFlag(), buffer, size, maxSize, streamEndianness);

View File

@ -39,7 +39,7 @@ cfdp::FileSize& MetadataInfo::getFileSize() { return fileSize; }
ReturnValue_t MetadataInfo::getOptions(cfdp::Tlv*** optionsArray, size_t* optionsLen, ReturnValue_t MetadataInfo::getOptions(cfdp::Tlv*** optionsArray, size_t* optionsLen,
size_t* maxOptsLen) { size_t* maxOptsLen) {
if (optionsArray == nullptr or this->optionsArray == nullptr) { if (optionsArray == nullptr or this->optionsArray == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
*optionsArray = this->optionsArray; *optionsArray = this->optionsArray;
if (optionsLen != nullptr) { if (optionsLen != nullptr) {
@ -48,7 +48,7 @@ ReturnValue_t MetadataInfo::getOptions(cfdp::Tlv*** optionsArray, size_t* option
if (maxOptsLen != nullptr) { if (maxOptsLen != nullptr) {
*maxOptsLen = this->maxOptionsLen; *maxOptsLen = this->maxOptionsLen;
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
bool MetadataInfo::hasOptions() const { bool MetadataInfo::hasOptions() const {

View File

@ -6,7 +6,7 @@ MetadataPduDeserializer::MetadataPduDeserializer(const uint8_t* pduBuf, size_t m
ReturnValue_t MetadataPduDeserializer::parseData() { ReturnValue_t MetadataPduDeserializer::parseData() {
ReturnValue_t result = FileDirectiveDeserializer::parseData(); ReturnValue_t result = FileDirectiveDeserializer::parseData();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize(); size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
@ -21,15 +21,15 @@ ReturnValue_t MetadataPduDeserializer::parseData() {
buf += 1; buf += 1;
auto endianness = getEndianness(); auto endianness = getEndianness();
result = info.getFileSize().deSerialize(&buf, &remSize, endianness); result = info.getFileSize().deSerialize(&buf, &remSize, endianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = info.getSourceFileName().deSerialize(&buf, &remSize, endianness); result = info.getSourceFileName().deSerialize(&buf, &remSize, endianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = info.getDestFileName().deSerialize(&buf, &remSize, endianness); result = info.getDestFileName().deSerialize(&buf, &remSize, endianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -47,7 +47,7 @@ ReturnValue_t MetadataPduDeserializer::parseData() {
return cfdp::METADATA_CANT_PARSE_OPTIONS; return cfdp::METADATA_CANT_PARSE_OPTIONS;
} }
result = optionsArray[optsIdx]->deSerialize(&buf, &remSize, endianness); result = optionsArray[optsIdx]->deSerialize(&buf, &remSize, endianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
optsIdx++; optsIdx++;

View File

@ -17,7 +17,7 @@ ReturnValue_t MetadataPduSerializer::serialize(uint8_t **buffer, size_t *size, s
Endianness streamEndianness) const { Endianness streamEndianness) const {
ReturnValue_t result = ReturnValue_t result =
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness); FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (*size + 1 >= maxSize) { if (*size + 1 >= maxSize) {
@ -27,15 +27,15 @@ ReturnValue_t MetadataPduSerializer::serialize(uint8_t **buffer, size_t *size, s
*buffer += 1; *buffer += 1;
*size += 1; *size += 1;
result = info.getFileSize().serialize(buffer, size, maxSize, streamEndianness); result = info.getFileSize().serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = info.getSourceFileName().serialize(buffer, size, maxSize, streamEndianness); result = info.getSourceFileName().serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = info.getDestFileName().serialize(buffer, size, maxSize, streamEndianness); result = info.getDestFileName().serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -45,7 +45,7 @@ ReturnValue_t MetadataPduSerializer::serialize(uint8_t **buffer, size_t *size, s
info.getOptions(&optsArray, &optsLen, nullptr); info.getOptions(&optsArray, &optsLen, nullptr);
for (size_t idx = 0; idx < optsLen; idx++) { for (size_t idx = 0; idx < optsLen; idx++) {
result = optsArray[idx]->serialize(buffer, size, maxSize, streamEndianness); result = optsArray[idx]->serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
} }

View File

@ -5,7 +5,7 @@ NakPduDeserializer::NakPduDeserializer(const uint8_t* pduBuf, size_t maxSize, Na
ReturnValue_t NakPduDeserializer::parseData() { ReturnValue_t NakPduDeserializer::parseData() {
ReturnValue_t result = FileDirectiveDeserializer::parseData(); ReturnValue_t result = FileDirectiveDeserializer::parseData();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize(); size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
@ -16,11 +16,11 @@ ReturnValue_t NakPduDeserializer::parseData() {
} }
result = result =
nakInfo.getStartOfScope().deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK); nakInfo.getStartOfScope().deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = nakInfo.getEndOfScope().deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK); result = nakInfo.getEndOfScope().deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
nakInfo.setSegmentRequestLen(0); nakInfo.setSegmentRequestLen(0);
@ -39,12 +39,12 @@ ReturnValue_t NakPduDeserializer::parseData() {
} }
result = result =
segReqs[idx].first.deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK); segReqs[idx].first.deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = result =
segReqs[idx].second.deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK); segReqs[idx].second.deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
idx++; idx++;

View File

@ -17,15 +17,15 @@ ReturnValue_t NakPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
Endianness streamEndianness) const { Endianness streamEndianness) const {
ReturnValue_t result = ReturnValue_t result =
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness); FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = nakInfo.getStartOfScope().serialize(buffer, size, maxSize, streamEndianness); result = nakInfo.getStartOfScope().serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = nakInfo.getEndOfScope().serialize(buffer, size, maxSize, streamEndianness); result = nakInfo.getEndOfScope().serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (nakInfo.hasSegmentRequests()) { if (nakInfo.hasSegmentRequests()) {
@ -34,11 +34,11 @@ ReturnValue_t NakPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
nakInfo.getSegmentRequests(&segmentRequests, &segmentRequestLen, nullptr); nakInfo.getSegmentRequests(&segmentRequests, &segmentRequestLen, nullptr);
for (size_t idx = 0; idx < segmentRequestLen; idx++) { for (size_t idx = 0; idx < segmentRequestLen; idx++) {
result = segmentRequests[idx].first.serialize(buffer, size, maxSize, streamEndianness); result = segmentRequests[idx].first.serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = segmentRequests[idx].second.serialize(buffer, size, maxSize, streamEndianness); result = segmentRequests[idx].second.serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
} }

View File

@ -9,7 +9,7 @@ cfdp::PromptResponseRequired PromptPduDeserializer::getPromptResponseRequired()
ReturnValue_t PromptPduDeserializer::parseData() { ReturnValue_t PromptPduDeserializer::parseData() {
ReturnValue_t result = FileDirectiveDeserializer::parseData(); ReturnValue_t result = FileDirectiveDeserializer::parseData();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize(); size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
@ -17,5 +17,5 @@ ReturnValue_t PromptPduDeserializer::parseData() {
return SerializeIF::STREAM_TOO_SHORT; return SerializeIF::STREAM_TOO_SHORT;
} }
responseRequired = static_cast<cfdp::PromptResponseRequired>((rawPtr[currentIdx] >> 7) & 0x01); responseRequired = static_cast<cfdp::PromptResponseRequired>((rawPtr[currentIdx] >> 7) & 0x01);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }

View File

@ -13,7 +13,7 @@ ReturnValue_t PromptPduSerializer::serialize(uint8_t **buffer, size_t *size, siz
Endianness streamEndianness) const { Endianness streamEndianness) const {
ReturnValue_t result = ReturnValue_t result =
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness); FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (*size + 1 > maxSize) { if (*size + 1 > maxSize) {

View File

@ -6,7 +6,7 @@
cfdp::VarLenField::VarLenField(cfdp::WidthInBytes width, size_t value) : VarLenField() { cfdp::VarLenField::VarLenField(cfdp::WidthInBytes width, size_t value) : VarLenField() {
ReturnValue_t result = this->setValue(width, value); ReturnValue_t result = this->setValue(width, value);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
#if FSFW_DISABLE_PRINTOUT == 0 #if FSFW_DISABLE_PRINTOUT == 0
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "cfdp::VarLenField: Setting value failed" << std::endl; sif::warning << "cfdp::VarLenField: Setting value failed" << std::endl;
@ -25,21 +25,21 @@ ReturnValue_t cfdp::VarLenField::setValue(cfdp::WidthInBytes widthInBytes, size_
switch (widthInBytes) { switch (widthInBytes) {
case (cfdp::WidthInBytes::ONE_BYTE): { case (cfdp::WidthInBytes::ONE_BYTE): {
if (value > UINT8_MAX) { if (value > UINT8_MAX) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
this->value.oneByte = value; this->value.oneByte = value;
break; break;
} }
case (cfdp::WidthInBytes::TWO_BYTES): { case (cfdp::WidthInBytes::TWO_BYTES): {
if (value > UINT16_MAX) { if (value > UINT16_MAX) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
this->value.twoBytes = value; this->value.twoBytes = value;
break; break;
} }
case (cfdp::WidthInBytes::FOUR_BYTES): { case (cfdp::WidthInBytes::FOUR_BYTES): {
if (value > UINT32_MAX) { if (value > UINT32_MAX) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
this->value.fourBytes = value; this->value.fourBytes = value;
break; break;
@ -49,7 +49,7 @@ ReturnValue_t cfdp::VarLenField::setValue(cfdp::WidthInBytes widthInBytes, size_
} }
} }
this->width = widthInBytes; this->width = widthInBytes;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
size_t cfdp::VarLenField::getValue() const { size_t cfdp::VarLenField::getValue() const {
@ -77,7 +77,7 @@ ReturnValue_t cfdp::VarLenField::serialize(uint8_t **buffer, size_t *size, size_
**buffer = value.oneByte; **buffer = value.oneByte;
*size += 1; *size += 1;
*buffer += 1; *buffer += 1;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
case (cfdp::WidthInBytes::TWO_BYTES): { case (cfdp::WidthInBytes::TWO_BYTES): {
return SerializeAdapter::serialize(&value.twoBytes, buffer, size, maxSize, streamEndianness); return SerializeAdapter::serialize(&value.twoBytes, buffer, size, maxSize, streamEndianness);
@ -86,7 +86,7 @@ ReturnValue_t cfdp::VarLenField::serialize(uint8_t **buffer, size_t *size, size_
return SerializeAdapter::serialize(&value.fourBytes, buffer, size, maxSize, streamEndianness); return SerializeAdapter::serialize(&value.fourBytes, buffer, size, maxSize, streamEndianness);
} }
default: { default: {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
} }
} }
@ -105,7 +105,7 @@ ReturnValue_t cfdp::VarLenField::deSerialize(const uint8_t **buffer, size_t *siz
case (cfdp::WidthInBytes::ONE_BYTE): { case (cfdp::WidthInBytes::ONE_BYTE): {
value.oneByte = **buffer; value.oneByte = **buffer;
*size += 1; *size += 1;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
case (cfdp::WidthInBytes::TWO_BYTES): { case (cfdp::WidthInBytes::TWO_BYTES): {
return SerializeAdapter::deSerialize(&value.twoBytes, buffer, size, streamEndianness); return SerializeAdapter::deSerialize(&value.twoBytes, buffer, size, streamEndianness);
@ -114,7 +114,7 @@ ReturnValue_t cfdp::VarLenField::deSerialize(const uint8_t **buffer, size_t *siz
return SerializeAdapter::deSerialize(&value.fourBytes, buffer, size, streamEndianness); return SerializeAdapter::deSerialize(&value.fourBytes, buffer, size, streamEndianness);
} }
default: { default: {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
} }
} }

View File

@ -22,7 +22,7 @@ ReturnValue_t FaultHandlerOverrideTlv::serialize(uint8_t **buffer, size_t *size,
**buffer = this->conditionCode << 4 | this->handlerCode; **buffer = this->conditionCode << 4 | this->handlerCode;
*buffer += 1; *buffer += 1;
*size += 1; *size += 1;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
size_t FaultHandlerOverrideTlv::getSerializedSize() const { return getLengthField() + 2; } size_t FaultHandlerOverrideTlv::getSerializedSize() const { return getLengthField() + 2; }
@ -40,7 +40,7 @@ ReturnValue_t FaultHandlerOverrideTlv::deSerialize(const uint8_t **buffer, size_
*size -= 1; *size -= 1;
size_t detectedSize = **buffer; size_t detectedSize = **buffer;
if (detectedSize != getLengthField()) { if (detectedSize != getLengthField()) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
*buffer += 1; *buffer += 1;
*size += 1; *size += 1;
@ -48,7 +48,7 @@ ReturnValue_t FaultHandlerOverrideTlv::deSerialize(const uint8_t **buffer, size_
this->handlerCode = static_cast<cfdp::FaultHandlerCode>(**buffer & 0x0f); this->handlerCode = static_cast<cfdp::FaultHandlerCode>(**buffer & 0x0f);
*buffer += 1; *buffer += 1;
*size += 1; *size += 1;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
cfdp::TlvTypes FaultHandlerOverrideTlv::getType() const { return cfdp::TlvTypes::FAULT_HANDLER; } cfdp::TlvTypes FaultHandlerOverrideTlv::getType() const { return cfdp::TlvTypes::FAULT_HANDLER; }

View File

@ -16,11 +16,11 @@ void FilestoreRequestTlv::setSecondFileName(cfdp::Lv *secondFileName) {
ReturnValue_t FilestoreRequestTlv::serialize(uint8_t **buffer, size_t *size, size_t maxSize, ReturnValue_t FilestoreRequestTlv::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const { Endianness streamEndianness) const {
ReturnValue_t result = commonSerialize(buffer, size, maxSize, streamEndianness); ReturnValue_t result = commonSerialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = firstFileName.serialize(buffer, size, maxSize, streamEndianness); result = firstFileName.serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (requiresSecondFileName()) { if (requiresSecondFileName()) {
@ -30,13 +30,13 @@ ReturnValue_t FilestoreRequestTlv::serialize(uint8_t **buffer, size_t *size, siz
} }
secondFileName->serialize(buffer, size, maxSize, streamEndianness); secondFileName->serialize(buffer, size, maxSize, streamEndianness);
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t FilestoreRequestTlv::deSerialize(const uint8_t **buffer, size_t *size, ReturnValue_t FilestoreRequestTlv::deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) { Endianness streamEndianness) {
ReturnValue_t result = commonDeserialize(buffer, size, streamEndianness); ReturnValue_t result = commonDeserialize(buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
return deSerializeFromValue(buffer, size, streamEndianness); return deSerializeFromValue(buffer, size, streamEndianness);
@ -63,13 +63,13 @@ ReturnValue_t FilestoreRequestTlv::deSerializeFromValue(const uint8_t **buffer,
*buffer += 1; *buffer += 1;
*size -= 1; *size -= 1;
ReturnValue_t result = firstFileName.deSerialize(buffer, size, streamEndianness); ReturnValue_t result = firstFileName.deSerialize(buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (requiresSecondFileName()) { if (requiresSecondFileName()) {
if (secondFileName == nullptr) { if (secondFileName == nullptr) {
secondFileNameMissing(); secondFileNameMissing();
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
result = secondFileName->deSerialize(buffer, size, streamEndianness); result = secondFileName->deSerialize(buffer, size, streamEndianness);
} }

View File

@ -32,11 +32,11 @@ ReturnValue_t FilestoreResponseTlv::serialize(uint8_t **buffer, size_t *size, si
Endianness streamEndianness) const { Endianness streamEndianness) const {
ReturnValue_t result = ReturnValue_t result =
commonSerialize(buffer, size, maxSize, streamEndianness, true, this->statusCode); commonSerialize(buffer, size, maxSize, streamEndianness, true, this->statusCode);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = firstFileName.serialize(buffer, size, maxSize, streamEndianness); result = firstFileName.serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (requiresSecondFileName()) { if (requiresSecondFileName()) {
@ -61,7 +61,7 @@ ReturnValue_t FilestoreResponseTlv::serialize(uint8_t **buffer, size_t *size, si
ReturnValue_t FilestoreResponseTlv::deSerialize(const uint8_t **buffer, size_t *size, ReturnValue_t FilestoreResponseTlv::deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) { Endianness streamEndianness) {
ReturnValue_t result = commonDeserialize(buffer, size, streamEndianness); ReturnValue_t result = commonDeserialize(buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
return deSerializeFromValue(buffer, size, streamEndianness); return deSerializeFromValue(buffer, size, streamEndianness);
@ -75,7 +75,7 @@ ReturnValue_t FilestoreResponseTlv::deSerializeFromValue(const uint8_t **buffer,
*buffer += 1; *buffer += 1;
*size -= 1; *size -= 1;
ReturnValue_t result = firstFileName.deSerialize(buffer, size, streamEndianness); ReturnValue_t result = firstFileName.deSerialize(buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (requiresSecondFileName()) { if (requiresSecondFileName()) {
@ -83,7 +83,7 @@ ReturnValue_t FilestoreResponseTlv::deSerializeFromValue(const uint8_t **buffer,
return cfdp::FILESTORE_REQUIRES_SECOND_FILE; return cfdp::FILESTORE_REQUIRES_SECOND_FILE;
} }
result = secondFileName->deSerialize(buffer, size, streamEndianness); result = secondFileName->deSerialize(buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
} }
@ -98,7 +98,7 @@ ReturnValue_t FilestoreResponseTlv::deSerializeFromValue(const uint8_t **buffer,
*size -= 1; *size -= 1;
*buffer += 1; *buffer += 1;
// Ignore empty filestore message // Ignore empty filestore message
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
return filestoreMsg->deSerialize(buffer, size, streamEndianness); return filestoreMsg->deSerialize(buffer, size, streamEndianness);
} }

View File

@ -73,7 +73,7 @@ class FilestoreTlvBase : public TlvIF {
Endianness streamEndianness, bool isResponse = false, Endianness streamEndianness, bool isResponse = false,
uint8_t responseStatusCode = 0) const { uint8_t responseStatusCode = 0) const {
if (buffer == nullptr or size == nullptr) { if (buffer == nullptr or size == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
if (maxSize < 3) { if (maxSize < 3) {
return SerializeIF::BUFFER_TOO_SHORT; return SerializeIF::BUFFER_TOO_SHORT;
@ -90,13 +90,13 @@ class FilestoreTlvBase : public TlvIF {
} }
*buffer += 1; *buffer += 1;
*size += 1; *size += 1;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t commonDeserialize(const uint8_t** buffer, size_t* size, ReturnValue_t commonDeserialize(const uint8_t** buffer, size_t* size,
SerializeIF::Endianness streamEndianness) { SerializeIF::Endianness streamEndianness) {
if (buffer == nullptr or size == nullptr) { if (buffer == nullptr or size == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
if (*size < 3) { if (*size < 3) {
return SerializeIF::STREAM_TOO_SHORT; return SerializeIF::STREAM_TOO_SHORT;
@ -114,7 +114,7 @@ class FilestoreTlvBase : public TlvIF {
if (remainingLength == 0) { if (remainingLength == 0) {
return SerializeIF::STREAM_TOO_SHORT; return SerializeIF::STREAM_TOO_SHORT;
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
bool requiresSecondFileName() const { bool requiresSecondFileName() const {
@ -152,7 +152,7 @@ class FilestoreTlvBase : public TlvIF {
size_t serSize = 0; size_t serSize = 0;
uint8_t* valueStart = buffer + 2; uint8_t* valueStart = buffer + 2;
ReturnValue_t result = this->serialize(&buffer, &serSize, maxSize, streamEndianness); ReturnValue_t result = this->serialize(&buffer, &serSize, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
tlv.setValue(valueStart, serSize - 2); tlv.setValue(valueStart, serSize - 2);

View File

@ -31,13 +31,13 @@ ReturnValue_t cfdp::Lv::serialize(uint8_t** buffer, size_t* size, size_t maxSize
return BUFFER_TOO_SHORT; return BUFFER_TOO_SHORT;
} }
if (buffer == nullptr or size == nullptr) { if (buffer == nullptr or size == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
if (zeroLen) { if (zeroLen) {
**buffer = 0; **buffer = 0;
*size += 1; *size += 1;
*buffer += 1; *buffer += 1;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
return value.serialize(buffer, size, maxSize, streamEndianness); return value.serialize(buffer, size, maxSize, streamEndianness);
} }
@ -54,7 +54,7 @@ size_t cfdp::Lv::getSerializedSize() const {
ReturnValue_t cfdp::Lv::deSerialize(const uint8_t** buffer, size_t* size, ReturnValue_t cfdp::Lv::deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) { Endianness streamEndianness) {
if (buffer == nullptr or size == nullptr) { if (buffer == nullptr or size == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
if (*size < 1) { if (*size < 1) {
return SerializeIF::STREAM_TOO_SHORT; return SerializeIF::STREAM_TOO_SHORT;
@ -64,7 +64,7 @@ ReturnValue_t cfdp::Lv::deSerialize(const uint8_t** buffer, size_t* size,
zeroLen = true; zeroLen = true;
*buffer += 1; *buffer += 1;
*size -= 1; *size -= 1;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} else if (*size < lengthField + 1) { } else if (*size < lengthField + 1) {
return SerializeIF::STREAM_TOO_SHORT; return SerializeIF::STREAM_TOO_SHORT;
} }
@ -73,7 +73,7 @@ ReturnValue_t cfdp::Lv::deSerialize(const uint8_t** buffer, size_t* size,
value.setBuffer(const_cast<uint8_t*>(*buffer + 1), lengthField); value.setBuffer(const_cast<uint8_t*>(*buffer + 1), lengthField);
*buffer += 1 + lengthField; *buffer += 1 + lengthField;
*size -= 1 + lengthField; *size -= 1 + lengthField;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
const uint8_t* cfdp::Lv::getValue(size_t* size) const { const uint8_t* cfdp::Lv::getValue(size_t* size) const {

View File

@ -12,7 +12,7 @@ cfdp::Tlv::Tlv() : value(static_cast<uint8_t *>(nullptr), 0, true) {}
ReturnValue_t cfdp::Tlv::serialize(uint8_t **buffer, size_t *size, size_t maxSize, ReturnValue_t cfdp::Tlv::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const { Endianness streamEndianness) const {
if (buffer == nullptr or size == nullptr) { if (buffer == nullptr or size == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
if (*size + 2 > maxSize) { if (*size + 2 > maxSize) {
return BUFFER_TOO_SHORT; return BUFFER_TOO_SHORT;
@ -28,10 +28,10 @@ ReturnValue_t cfdp::Tlv::serialize(uint8_t **buffer, size_t *size, size_t maxSiz
**buffer = 0; **buffer = 0;
*size += 1; *size += 1;
*buffer += 1; *buffer += 1;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
if (value.getConstBuffer() == nullptr) { if (value.getConstBuffer() == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
return value.serialize(buffer, size, maxSize, streamEndianness); return value.serialize(buffer, size, maxSize, streamEndianness);
} }
@ -48,7 +48,7 @@ size_t cfdp::Tlv::getSerializedSize() const {
ReturnValue_t cfdp::Tlv::deSerialize(const uint8_t **buffer, size_t *size, ReturnValue_t cfdp::Tlv::deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) { Endianness streamEndianness) {
if (buffer == nullptr or size == nullptr) { if (buffer == nullptr or size == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
if (*size < 2) { if (*size < 2) {
return STREAM_TOO_SHORT; return STREAM_TOO_SHORT;
@ -68,7 +68,7 @@ ReturnValue_t cfdp::Tlv::deSerialize(const uint8_t **buffer, size_t *size,
zeroLen = true; zeroLen = true;
*buffer += 1; *buffer += 1;
*size -= 1; *size -= 1;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
if (lengthField + 1 > *size) { if (lengthField + 1 > *size) {
return SerializeIF::STREAM_TOO_SHORT; return SerializeIF::STREAM_TOO_SHORT;
@ -78,7 +78,7 @@ ReturnValue_t cfdp::Tlv::deSerialize(const uint8_t **buffer, size_t *size,
value.setBuffer(const_cast<uint8_t *>(*buffer + 1), lengthField); value.setBuffer(const_cast<uint8_t *>(*buffer + 1), lengthField);
*buffer += 1 + lengthField; *buffer += 1 + lengthField;
*size -= 1 + lengthField; *size -= 1 + lengthField;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
const uint8_t *cfdp::Tlv::getValue() const { return value.getConstBuffer(); } const uint8_t *cfdp::Tlv::getValue() const { return value.getConstBuffer(); }

View File

@ -191,7 +191,7 @@ class ArrayList {
} }
entries[size] = entry; entries[size] = entry;
++size; ++size;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
/** /**

View File

@ -17,7 +17,7 @@ inline ReturnValue_t FIFOBase<T>::insert(T value) {
values[writeIndex] = value; values[writeIndex] = value;
writeIndex = next(writeIndex); writeIndex = next(writeIndex);
++currentSize; ++currentSize;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
}; };
@ -27,12 +27,12 @@ inline ReturnValue_t FIFOBase<T>::retrieve(T* value) {
return EMPTY; return EMPTY;
} else { } else {
if (value == nullptr) { if (value == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
*value = values[readIndex]; *value = values[readIndex];
readIndex = next(readIndex); readIndex = next(readIndex);
--currentSize; --currentSize;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
}; };
@ -42,10 +42,10 @@ inline ReturnValue_t FIFOBase<T>::peek(T* value) {
return EMPTY; return EMPTY;
} else { } else {
if (value == nullptr) { if (value == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
*value = values[readIndex]; *value = values[readIndex];
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
}; };

View File

@ -75,7 +75,7 @@ class FixedMap : public SerializeIF {
uint32_t size() const { return _size; } uint32_t size() const { return _size; }
ReturnValue_t insert(key_t key, T value, Iterator* storedValue = nullptr) { ReturnValue_t insert(key_t key, T value, Iterator* storedValue = nullptr) {
if (exists(key) == HasReturnvaluesIF::RETURN_OK) { if (exists(key) == returnvalue::OK) {
return KEY_ALREADY_EXISTS; return KEY_ALREADY_EXISTS;
} }
if (_size == theMap.maxSize()) { if (_size == theMap.maxSize()) {
@ -87,7 +87,7 @@ class FixedMap : public SerializeIF {
*storedValue = Iterator(&theMap[_size]); *storedValue = Iterator(&theMap[_size]);
} }
++_size; ++_size;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t insert(std::pair<key_t, T> pair) { return insert(pair.first, pair.second); } ReturnValue_t insert(std::pair<key_t, T> pair) { return insert(pair.first, pair.second); }
@ -95,7 +95,7 @@ class FixedMap : public SerializeIF {
ReturnValue_t exists(key_t key) const { ReturnValue_t exists(key_t key) const {
ReturnValue_t result = KEY_DOES_NOT_EXIST; ReturnValue_t result = KEY_DOES_NOT_EXIST;
if (findIndex(key) < _size) { if (findIndex(key) < _size) {
result = HasReturnvaluesIF::RETURN_OK; result = returnvalue::OK;
} }
return result; return result;
} }
@ -108,7 +108,7 @@ class FixedMap : public SerializeIF {
theMap[i] = theMap[_size - 1]; theMap[i] = theMap[_size - 1];
--_size; --_size;
--((*iter).value); --((*iter).value);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t erase(key_t key) { ReturnValue_t erase(key_t key) {
@ -118,14 +118,14 @@ class FixedMap : public SerializeIF {
} }
theMap[i] = theMap[_size - 1]; theMap[i] = theMap[_size - 1];
--_size; --_size;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
T* findValue(key_t key) const { return &theMap[findIndex(key)].second; } T* findValue(key_t key) const { return &theMap[findIndex(key)].second; }
Iterator find(key_t key) const { Iterator find(key_t key) const {
ReturnValue_t result = exists(key); ReturnValue_t result = exists(key);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return end(); return end();
} }
return Iterator(&theMap[findIndex(key)]); return Iterator(&theMap[findIndex(key)]);
@ -133,11 +133,11 @@ class FixedMap : public SerializeIF {
ReturnValue_t find(key_t key, T** value) const { ReturnValue_t find(key_t key, T** value) const {
ReturnValue_t result = exists(key); ReturnValue_t result = exists(key);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
*value = &theMap[findIndex(key)].second; *value = &theMap[findIndex(key)].second;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
bool empty() { bool empty() {
@ -165,7 +165,7 @@ class FixedMap : public SerializeIF {
ReturnValue_t result = ReturnValue_t result =
SerializeAdapter::serialize(&this->_size, buffer, size, maxSize, streamEndianness); SerializeAdapter::serialize(&this->_size, buffer, size, maxSize, streamEndianness);
uint32_t i = 0; uint32_t i = 0;
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->_size)) { while ((result == returnvalue::OK) && (i < this->_size)) {
result = result =
SerializeAdapter::serialize(&theMap[i].first, buffer, size, maxSize, streamEndianness); SerializeAdapter::serialize(&theMap[i].first, buffer, size, maxSize, streamEndianness);
result = result =
@ -195,7 +195,7 @@ class FixedMap : public SerializeIF {
return SerializeIF::TOO_MANY_ELEMENTS; return SerializeIF::TOO_MANY_ELEMENTS;
} }
uint32_t i = 0; uint32_t i = 0;
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->_size)) { while ((result == returnvalue::OK) && (i < this->_size)) {
result = SerializeAdapter::deSerialize(&theMap[i].first, buffer, size, streamEndianness); result = SerializeAdapter::deSerialize(&theMap[i].first, buffer, size, streamEndianness);
result = SerializeAdapter::deSerialize(&theMap[i].second, buffer, size, streamEndianness); result = SerializeAdapter::deSerialize(&theMap[i].second, buffer, size, streamEndianness);
++i; ++i;

View File

@ -148,7 +148,7 @@ class FixedOrderedMultimap {
*/ */
Iterator find(key_t key) const { Iterator find(key_t key) const {
ReturnValue_t result = exists(key); ReturnValue_t result = exists(key);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return end(); return end();
} }
return Iterator(&theMap[findFirstIndex(key)]); return Iterator(&theMap[findFirstIndex(key)]);

View File

@ -16,7 +16,7 @@ inline ReturnValue_t FixedOrderedMultimap<key_t, T, KEY_COMPARE>::insert(key_t k
if (storedValue != nullptr) { if (storedValue != nullptr) {
*storedValue = Iterator(&theMap[position]); *storedValue = Iterator(&theMap[position]);
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
template <typename key_t, typename T, typename KEY_COMPARE> template <typename key_t, typename T, typename KEY_COMPARE>
inline ReturnValue_t FixedOrderedMultimap<key_t, T, KEY_COMPARE>::insert(std::pair<key_t, T> pair) { inline ReturnValue_t FixedOrderedMultimap<key_t, T, KEY_COMPARE>::insert(std::pair<key_t, T> pair) {
@ -27,7 +27,7 @@ template <typename key_t, typename T, typename KEY_COMPARE>
inline ReturnValue_t FixedOrderedMultimap<key_t, T, KEY_COMPARE>::exists(key_t key) const { inline ReturnValue_t FixedOrderedMultimap<key_t, T, KEY_COMPARE>::exists(key_t key) const {
ReturnValue_t result = KEY_DOES_NOT_EXIST; ReturnValue_t result = KEY_DOES_NOT_EXIST;
if (findFirstIndex(key) < _size) { if (findFirstIndex(key) < _size) {
result = HasReturnvaluesIF::RETURN_OK; result = returnvalue::OK;
} }
return result; return result;
} }
@ -44,7 +44,7 @@ inline ReturnValue_t FixedOrderedMultimap<key_t, T, KEY_COMPARE>::erase(Iterator
} else { } else {
*iter = begin(); *iter = begin();
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
template <typename key_t, typename T, typename KEY_COMPARE> template <typename key_t, typename T, typename KEY_COMPARE>
@ -57,17 +57,17 @@ inline ReturnValue_t FixedOrderedMultimap<key_t, T, KEY_COMPARE>::erase(key_t ke
removeFromPosition(i); removeFromPosition(i);
i = findFirstIndex(key, i); i = findFirstIndex(key, i);
} while (i < _size); } while (i < _size);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
template <typename key_t, typename T, typename KEY_COMPARE> template <typename key_t, typename T, typename KEY_COMPARE>
inline ReturnValue_t FixedOrderedMultimap<key_t, T, KEY_COMPARE>::find(key_t key, T **value) const { inline ReturnValue_t FixedOrderedMultimap<key_t, T, KEY_COMPARE>::find(key_t key, T **value) const {
ReturnValue_t result = exists(key); ReturnValue_t result = exists(key);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
*value = &theMap[findFirstIndex(key)].second; *value = &theMap[findFirstIndex(key)].second;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
template <typename key_t, typename T, typename KEY_COMPARE> template <typename key_t, typename T, typename KEY_COMPARE>

View File

@ -52,15 +52,15 @@ class Index : public SerializeIF {
Endianness streamEndianness) const { Endianness streamEndianness) const {
ReturnValue_t result = ReturnValue_t result =
SerializeAdapter::serialize(&blockStartAddress, buffer, size, maxSize, streamEndianness); SerializeAdapter::serialize(&blockStartAddress, buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = indexType.serialize(buffer, size, maxSize, streamEndianness); result = indexType.serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = SerializeAdapter::serialize(&this->size, buffer, size, maxSize, streamEndianness); result = SerializeAdapter::serialize(&this->size, buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = result =
@ -71,19 +71,19 @@ class Index : public SerializeIF {
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, Endianness streamEndianness) { ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, Endianness streamEndianness) {
ReturnValue_t result = ReturnValue_t result =
SerializeAdapter::deSerialize(&blockStartAddress, buffer, size, streamEndianness); SerializeAdapter::deSerialize(&blockStartAddress, buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = indexType.deSerialize(buffer, size, streamEndianness); result = indexType.deSerialize(buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = SerializeAdapter::deSerialize(&this->size, buffer, size, streamEndianness); result = SerializeAdapter::deSerialize(&this->size, buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = SerializeAdapter::deSerialize(&this->storedPackets, buffer, size, streamEndianness); result = SerializeAdapter::deSerialize(&this->storedPackets, buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
return result; return result;
@ -449,13 +449,13 @@ class IndexedRingMemoryArray : public SerializeIF, public ArrayList<Index<T>, ui
// Check Next Block // Check Next Block
if (!isNextBlockWritable()) { if (!isNextBlockWritable()) {
// The Index is full and does not overwrite old // The Index is full and does not overwrite old
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
// Next block can be written, update Metadata // Next block can be written, update Metadata
currentWriteBlock = getNextWrite(); currentWriteBlock = getNextWrite();
currentWriteBlock->setSize(0); currentWriteBlock->setSize(0);
currentWriteBlock->setStoredPackets(0); currentWriteBlock->setStoredPackets(0);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
/** /**
@ -475,21 +475,21 @@ class IndexedRingMemoryArray : public SerializeIF, public ArrayList<Index<T>, ui
additionalInfo->serialize(buffer, size, maxSize, streamEndianness); additionalInfo->serialize(buffer, size, maxSize, streamEndianness);
} }
ReturnValue_t result = currentWriteBlock->serialize(buffer, size, maxSize, streamEndianness); ReturnValue_t result = currentWriteBlock->serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = SerializeAdapter::serialize(&this->size, buffer, size, maxSize, streamEndianness); result = SerializeAdapter::serialize(&this->size, buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
uint32_t i = 0; uint32_t i = 0;
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->size)) { while ((result == returnvalue::OK) && (i < this->size)) {
result = result =
SerializeAdapter::serialize(&this->entries[i], buffer, size, maxSize, streamEndianness); SerializeAdapter::serialize(&this->entries[i], buffer, size, maxSize, streamEndianness);
++i; ++i;
} }
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
uint16_t crc = Calculate_CRC(crcBuffer, (*size - oldSize)); uint16_t crc = Calculate_CRC(crcBuffer, (*size - oldSize));
@ -523,44 +523,44 @@ class IndexedRingMemoryArray : public SerializeIF, public ArrayList<Index<T>, ui
*/ */
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, Endianness streamEndianness) { ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, Endianness streamEndianness) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = returnvalue::OK;
if (additionalInfo != NULL) { if (additionalInfo != NULL) {
result = additionalInfo->deSerialize(buffer, size, streamEndianness); result = additionalInfo->deSerialize(buffer, size, streamEndianness);
} }
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
Index<T> tempIndex; Index<T> tempIndex;
result = tempIndex.deSerialize(buffer, size, streamEndianness); result = tempIndex.deSerialize(buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
uint32_t tempSize = 0; uint32_t tempSize = 0;
result = SerializeAdapter::deSerialize(&tempSize, buffer, size, streamEndianness); result = SerializeAdapter::deSerialize(&tempSize, buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (this->size != tempSize) { if (this->size != tempSize) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
uint32_t i = 0; uint32_t i = 0;
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->size)) { while ((result == returnvalue::OK) && (i < this->size)) {
result = SerializeAdapter::deSerialize(&this->entries[i], buffer, size, streamEndianness); result = SerializeAdapter::deSerialize(&this->entries[i], buffer, size, streamEndianness);
++i; ++i;
} }
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
typename IndexedRingMemoryArray<T>::Iterator cmp(&tempIndex); typename IndexedRingMemoryArray<T>::Iterator cmp(&tempIndex);
for (typename IndexedRingMemoryArray<T>::Iterator it = this->begin(); it != this->end(); ++it) { for (typename IndexedRingMemoryArray<T>::Iterator it = this->begin(); it != this->end(); ++it) {
if (*(cmp.value) == *(it.value)) { if (*(cmp.value) == *(it.value)) {
currentWriteBlock = it; currentWriteBlock = it;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
} }
// Reached if current write block iterator is not found // Reached if current write block iterator is not found
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
uint32_t getIndexAddress() const { return indexAddress; } uint32_t getIndexAddress() const { return indexAddress; }

View File

@ -40,7 +40,7 @@ class PlacementFactory {
store_address_t tempId; store_address_t tempId;
uint8_t* pData = nullptr; uint8_t* pData = nullptr;
ReturnValue_t result = dataBackend->getFreeElement(&tempId, sizeof(T), &pData); ReturnValue_t result = dataBackend->getFreeElement(&tempId, sizeof(T), &pData);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return nullptr; return nullptr;
} }
T* temp = new (pData) T(std::forward<Args>(args)...); T* temp = new (pData) T(std::forward<Args>(args)...);
@ -56,7 +56,7 @@ class PlacementFactory {
template <typename T> template <typename T>
ReturnValue_t destroy(T* thisElement) { ReturnValue_t destroy(T* thisElement) {
if (thisElement == nullptr) { if (thisElement == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
// Need to call destructor first, in case something was allocated by the object (shouldn't do // Need to call destructor first, in case something was allocated by the object (shouldn't do
// that, however). // that, however).

View File

@ -58,18 +58,18 @@ class RingBufferBase {
ReturnValue_t readData(uint32_t amount, uint8_t n = 0) { ReturnValue_t readData(uint32_t amount, uint8_t n = 0) {
if (getAvailableReadData(n) >= amount) { if (getAvailableReadData(n) >= amount) {
incrementRead(amount, n); incrementRead(amount, n);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} else { } else {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
} }
ReturnValue_t writeData(uint32_t amount) { ReturnValue_t writeData(uint32_t amount) {
if (availableWriteSpace() >= amount or overwriteOld) { if (availableWriteSpace() >= amount or overwriteOld) {
incrementWrite(amount); incrementWrite(amount);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} else { } else {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
} }

View File

@ -32,14 +32,14 @@ ReturnValue_t SimpleRingBuffer::getFreeElement(uint8_t** writePointer, size_t am
size_t amountTillWrap = writeTillWrap(); size_t amountTillWrap = writeTillWrap();
if (amountTillWrap < amount) { if (amountTillWrap < amount) {
if ((amount - amountTillWrap + excessBytes) > maxExcessBytes) { if ((amount - amountTillWrap + excessBytes) > maxExcessBytes) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
excessBytes = amount - amountTillWrap; excessBytes = amount - amountTillWrap;
} }
*writePointer = &buffer[write]; *writePointer = &buffer[write];
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} else { } else {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
} }
@ -52,7 +52,7 @@ void SimpleRingBuffer::confirmBytesWritten(size_t amount) {
ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data, size_t amount) { ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data, size_t amount) {
if (data == nullptr) { if (data == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
if (amount > getMaxSize()) { if (amount > getMaxSize()) {
#if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_VERBOSE_LEVEL >= 1
@ -62,7 +62,7 @@ ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data, size_t amount) {
sif::printError("SimpleRingBuffer::writeData: Amount of data too large\n"); sif::printError("SimpleRingBuffer::writeData: Amount of data too large\n");
#endif #endif
#endif #endif
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
if (availableWriteSpace() >= amount or overwriteOld) { if (availableWriteSpace() >= amount or overwriteOld) {
size_t amountTillWrap = writeTillWrap(); size_t amountTillWrap = writeTillWrap();
@ -74,9 +74,9 @@ ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data, size_t amount) {
memcpy(buffer, data + amountTillWrap, amount - amountTillWrap); memcpy(buffer, data + amountTillWrap, amount - amountTillWrap);
} }
incrementWrite(amount); incrementWrite(amount);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} else { } else {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
} }
@ -89,7 +89,7 @@ ReturnValue_t SimpleRingBuffer::readData(uint8_t* data, size_t amount, bool incr
// more data available than amount specified. // more data available than amount specified.
amount = availableData; amount = availableData;
} else { } else {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
} }
if (trueAmount != nullptr) { if (trueAmount != nullptr) {
@ -105,7 +105,7 @@ ReturnValue_t SimpleRingBuffer::readData(uint8_t* data, size_t amount, bool incr
if (incrementReadPtr) { if (incrementReadPtr) {
deleteData(amount, readRemaining); deleteData(amount, readRemaining);
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
size_t SimpleRingBuffer::getExcessBytes() const { return excessBytes; } size_t SimpleRingBuffer::getExcessBytes() const { return excessBytes; }
@ -124,12 +124,12 @@ ReturnValue_t SimpleRingBuffer::deleteData(size_t amount, bool deleteRemaining,
if (deleteRemaining) { if (deleteRemaining) {
amount = availableData; amount = availableData;
} else { } else {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
} }
if (trueAmount != nullptr) { if (trueAmount != nullptr) {
*trueAmount = amount; *trueAmount = amount;
} }
incrementRead(amount, READ_PTR); incrementRead(amount, READ_PTR);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }

View File

@ -48,7 +48,7 @@ class SimpleRingBuffer : public RingBufferBase<> {
* @param data * @param data
* @param amount * @param amount
* @return -@c RETURN_OK if write operation was successful * @return -@c RETURN_OK if write operation was successful
* -@c RETURN_FAILED if * -@c returnvalue::FAILED if
*/ */
ReturnValue_t writeData(const uint8_t* data, size_t amount); ReturnValue_t writeData(const uint8_t* data, size_t amount);
@ -96,7 +96,7 @@ class SimpleRingBuffer : public RingBufferBase<> {
* to the passed value. * to the passed value.
* @return * @return
* - @c RETURN_OK if data was read successfully * - @c RETURN_OK if data was read successfully
* - @c RETURN_FAILED if not enough data was available and readRemaining * - @c returnvalue::FAILED if not enough data was available and readRemaining
* was set to false. * was set to false.
*/ */
ReturnValue_t readData(uint8_t* data, size_t amount, bool incrementReadPtr = false, ReturnValue_t readData(uint8_t* data, size_t amount, bool incrementReadPtr = false,

View File

@ -20,7 +20,7 @@ ControllerBase::~ControllerBase() { QueueFactory::instance()->deleteMessageQueue
ReturnValue_t ControllerBase::initialize() { ReturnValue_t ControllerBase::initialize() {
ReturnValue_t result = SystemObject::initialize(); ReturnValue_t result = SystemObject::initialize();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -28,7 +28,7 @@ ReturnValue_t ControllerBase::initialize() {
if (parentId != objects::NO_OBJECT) { if (parentId != objects::NO_OBJECT) {
auto* parent = ObjectManager::instance()->get<SubsystemBase>(parentId); auto* parent = ObjectManager::instance()->get<SubsystemBase>(parentId);
if (parent == nullptr) { if (parent == nullptr) {
return RETURN_FAILED; return returnvalue::FAILED;
} }
parentQueue = parent->getCommandQueue(); parentQueue = parent->getCommandQueue();
@ -36,16 +36,16 @@ ReturnValue_t ControllerBase::initialize() {
} }
result = healthHelper.initialize(parentQueue); result = healthHelper.initialize(parentQueue);
if (result != RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = modeHelper.initialize(parentQueue); result = modeHelper.initialize(parentQueue);
if (result != RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
return RETURN_OK; return returnvalue::OK;
} }
MessageQueueId_t ControllerBase::getCommandQueue() const { return commandQueue->getId(); } MessageQueueId_t ControllerBase::getCommandQueue() const { return commandQueue->getId(); }
@ -53,19 +53,19 @@ MessageQueueId_t ControllerBase::getCommandQueue() const { return commandQueue->
void ControllerBase::handleQueue() { void ControllerBase::handleQueue() {
CommandMessage command; CommandMessage command;
ReturnValue_t result; ReturnValue_t result;
for (result = commandQueue->receiveMessage(&command); result == RETURN_OK; for (result = commandQueue->receiveMessage(&command); result == returnvalue::OK;
result = commandQueue->receiveMessage(&command)) { result = commandQueue->receiveMessage(&command)) {
result = modeHelper.handleModeCommand(&command); result = modeHelper.handleModeCommand(&command);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
continue; continue;
} }
result = healthHelper.handleHealthCommand(&command); result = healthHelper.handleHealthCommand(&command);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
continue; continue;
} }
result = handleCommandMessage(&command); result = handleCommandMessage(&command);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
continue; continue;
} }
command.setToUnknownCommand(); command.setToUnknownCommand();
@ -96,7 +96,7 @@ void ControllerBase::announceMode(bool recursive) { triggerEvent(MODE_INFO, mode
ReturnValue_t ControllerBase::performOperation(uint8_t opCode) { ReturnValue_t ControllerBase::performOperation(uint8_t opCode) {
handleQueue(); handleQueue();
performControlOperation(); performControlOperation();
return RETURN_OK; return returnvalue::OK;
} }
void ControllerBase::modeChanged(Mode_t mode_, Submode_t submode_) {} void ControllerBase::modeChanged(Mode_t mode_, Submode_t submode_) {}
@ -106,7 +106,7 @@ ReturnValue_t ControllerBase::setHealth(HealthState health) {
case HEALTHY: case HEALTHY:
case EXTERNAL_CONTROL: case EXTERNAL_CONTROL:
healthHelper.setHealth(health); healthHelper.setHealth(health);
return RETURN_OK; return returnvalue::OK;
default: default:
return INVALID_HEALTH_STATE; return INVALID_HEALTH_STATE;
} }
@ -117,4 +117,4 @@ void ControllerBase::setTaskIF(PeriodicTaskIF* task_) { executingTask = task_; }
void ControllerBase::changeHK(Mode_t mode_, Submode_t submode_, bool enable) {} void ControllerBase::changeHK(Mode_t mode_, Submode_t submode_, bool enable) {}
ReturnValue_t ControllerBase::initializeAfterTaskCreation() { return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t ControllerBase::initializeAfterTaskCreation() { return returnvalue::OK; }

View File

@ -18,8 +18,7 @@
class ControllerBase : public HasModesIF, class ControllerBase : public HasModesIF,
public HasHealthIF, public HasHealthIF,
public ExecutableObjectIF, public ExecutableObjectIF,
public SystemObject, public SystemObject {
public HasReturnvaluesIF {
public: public:
static const Mode_t MODE_NORMAL = 2; static const Mode_t MODE_NORMAL = 2;

View File

@ -12,7 +12,7 @@ ReturnValue_t ExtendedControllerBase::executeAction(ActionId_t actionId,
MessageQueueId_t commandedBy, MessageQueueId_t commandedBy,
const uint8_t *data, size_t size) { const uint8_t *data, size_t size) {
/* Needs to be overriden and implemented by child class. */ /* Needs to be overriden and implemented by child class. */
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
object_id_t ExtendedControllerBase::getObjectId() const { return SystemObject::getObjectId(); } object_id_t ExtendedControllerBase::getObjectId() const { return SystemObject::getObjectId(); }
@ -23,7 +23,7 @@ uint32_t ExtendedControllerBase::getPeriodicOperationFrequency() const {
ReturnValue_t ExtendedControllerBase::handleCommandMessage(CommandMessage *message) { ReturnValue_t ExtendedControllerBase::handleCommandMessage(CommandMessage *message) {
ReturnValue_t result = actionHelper.handleActionMessage(message); ReturnValue_t result = actionHelper.handleActionMessage(message);
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == returnvalue::OK) {
return result; return result;
} }
return poolManager.handleHousekeepingMessage(message); return poolManager.handleHousekeepingMessage(message);
@ -32,30 +32,30 @@ ReturnValue_t ExtendedControllerBase::handleCommandMessage(CommandMessage *messa
void ExtendedControllerBase::handleQueue() { void ExtendedControllerBase::handleQueue() {
CommandMessage command; CommandMessage command;
ReturnValue_t result; ReturnValue_t result;
for (result = commandQueue->receiveMessage(&command); result == RETURN_OK; for (result = commandQueue->receiveMessage(&command); result == returnvalue::OK;
result = commandQueue->receiveMessage(&command)) { result = commandQueue->receiveMessage(&command)) {
result = actionHelper.handleActionMessage(&command); result = actionHelper.handleActionMessage(&command);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
continue; continue;
} }
result = modeHelper.handleModeCommand(&command); result = modeHelper.handleModeCommand(&command);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
continue; continue;
} }
result = healthHelper.handleHealthCommand(&command); result = healthHelper.handleHealthCommand(&command);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
continue; continue;
} }
result = poolManager.handleHousekeepingMessage(&command); result = poolManager.handleHousekeepingMessage(&command);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
continue; continue;
} }
result = handleCommandMessage(&command); result = handleCommandMessage(&command);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
continue; continue;
} }
command.setToUnknownCommand(); command.setToUnknownCommand();
@ -65,11 +65,11 @@ void ExtendedControllerBase::handleQueue() {
ReturnValue_t ExtendedControllerBase::initialize() { ReturnValue_t ExtendedControllerBase::initialize() {
ReturnValue_t result = ControllerBase::initialize(); ReturnValue_t result = ControllerBase::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = actionHelper.initialize(commandQueue); result = actionHelper.initialize(commandQueue);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -86,7 +86,7 @@ ReturnValue_t ExtendedControllerBase::performOperation(uint8_t opCode) {
/* We do this after performing control operation because variables will be set changed /* We do this after performing control operation because variables will be set changed
in this function. */ in this function. */
poolManager.performHkOperation(); poolManager.performHkOperation();
return RETURN_OK; return returnvalue::OK;
} }
MessageQueueId_t ExtendedControllerBase::getCommandQueue() const { return commandQueue->getId(); } MessageQueueId_t ExtendedControllerBase::getCommandQueue() const { return commandQueue->getId(); }

View File

@ -152,7 +152,7 @@ ReturnValue_t Sgp4Propagator::initialize(const uint8_t* line1, const uint8_t* li
return MAKE_RETURN_CODE(result); return MAKE_RETURN_CODE(result);
} else { } else {
initialized = true; initialized = true;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
} }
@ -195,6 +195,6 @@ ReturnValue_t Sgp4Propagator::propagate(double* position, double* velocity, time
if (result != 0) { if (result != 0) {
return MAKE_RETURN_CODE(result || 0xB0); return MAKE_RETURN_CODE(result || 0xB0);
} else { } else {
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
} }

View File

@ -28,7 +28,7 @@ ReturnValue_t DataLinkLayer::frameDelimitingAndFillRemoval() {
TcTransferFrame frame_candidate(frameBuffer); TcTransferFrame frame_candidate(frameBuffer);
this->currentFrame = frame_candidate; // should work with shallow copy. this->currentFrame = frame_candidate; // should work with shallow copy.
return RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t DataLinkLayer::frameValidationCheck() { ReturnValue_t DataLinkLayer::frameValidationCheck() {
@ -59,14 +59,14 @@ ReturnValue_t DataLinkLayer::frameValidationCheck() {
if (USE_CRC) { if (USE_CRC) {
return this->frameCheckCRC(); return this->frameCheckCRC();
} }
return RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t DataLinkLayer::frameCheckCRC() { ReturnValue_t DataLinkLayer::frameCheckCRC() {
uint16_t checkValue = uint16_t checkValue =
CRC::crc16ccitt(this->currentFrame.getFullFrame(), this->currentFrame.getFullSize()); CRC::crc16ccitt(this->currentFrame.getFullFrame(), this->currentFrame.getFullSize());
if (checkValue == 0) { if (checkValue == 0) {
return RETURN_OK; return returnvalue::OK;
} else { } else {
return CRC_FAILED; return CRC_FAILED;
} }
@ -74,7 +74,7 @@ ReturnValue_t DataLinkLayer::frameCheckCRC() {
ReturnValue_t DataLinkLayer::allFramesReception() { ReturnValue_t DataLinkLayer::allFramesReception() {
ReturnValue_t status = this->frameDelimitingAndFillRemoval(); ReturnValue_t status = this->frameDelimitingAndFillRemoval();
if (status != RETURN_OK) { if (status != returnvalue::OK) {
return status; return status;
} }
return this->frameValidationCheck(); return this->frameValidationCheck();
@ -90,7 +90,7 @@ ReturnValue_t DataLinkLayer::virtualChannelDemultiplexing() {
virtualChannelIterator iter = virtualChannels.find(vcId); virtualChannelIterator iter = virtualChannels.find(vcId);
if (iter == virtualChannels.end()) { if (iter == virtualChannels.end()) {
// Do not report because passive board will get this error all the time. // Do not report because passive board will get this error all the time.
return RETURN_OK; return returnvalue::OK;
} else { } else {
return (iter->second)->frameAcceptanceAndReportingMechanism(&currentFrame, clcw); return (iter->second)->frameAcceptanceAndReportingMechanism(&currentFrame, clcw);
} }
@ -99,7 +99,7 @@ ReturnValue_t DataLinkLayer::virtualChannelDemultiplexing() {
ReturnValue_t DataLinkLayer::processFrame(uint16_t length) { ReturnValue_t DataLinkLayer::processFrame(uint16_t length) {
receivedDataLength = length; receivedDataLength = length;
ReturnValue_t status = allFramesReception(); ReturnValue_t status = allFramesReception();
if (status != RETURN_OK) { if (status != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "DataLinkLayer::processFrame: frame reception failed. " sif::error << "DataLinkLayer::processFrame: frame reception failed. "
"Error code: " "Error code: "
@ -117,14 +117,14 @@ ReturnValue_t DataLinkLayer::addVirtualChannel(uint8_t virtualChannelId,
std::pair<virtualChannelIterator, bool> returnValue = virtualChannels.insert( std::pair<virtualChannelIterator, bool> returnValue = virtualChannels.insert(
std::pair<uint8_t, VirtualChannelReceptionIF*>(virtualChannelId, object)); std::pair<uint8_t, VirtualChannelReceptionIF*>(virtualChannelId, object));
if (returnValue.second == true) { if (returnValue.second == true) {
return RETURN_OK; return returnvalue::OK;
} else { } else {
return RETURN_FAILED; return returnvalue::FAILED;
} }
} }
ReturnValue_t DataLinkLayer::initialize() { ReturnValue_t DataLinkLayer::initialize() {
ReturnValue_t returnValue = RETURN_FAILED; ReturnValue_t returnValue = returnvalue::FAILED;
// Set Virtual Channel ID to first virtual channel instance in this DataLinkLayer instance to // Set Virtual Channel ID to first virtual channel instance in this DataLinkLayer instance to
// avoid faulty information (e.g. 0) in the VCID. // avoid faulty information (e.g. 0) in the VCID.
if (virtualChannels.begin() != virtualChannels.end()) { if (virtualChannels.begin() != virtualChannels.end()) {
@ -133,13 +133,13 @@ ReturnValue_t DataLinkLayer::initialize() {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "DataLinkLayer::initialize: No VC assigned to this DLL instance! " << std::endl; sif::error << "DataLinkLayer::initialize: No VC assigned to this DLL instance! " << std::endl;
#endif #endif
return RETURN_FAILED; return returnvalue::FAILED;
} }
for (virtualChannelIterator iterator = virtualChannels.begin(); iterator != virtualChannels.end(); for (virtualChannelIterator iterator = virtualChannels.begin(); iterator != virtualChannels.end();
iterator++) { iterator++) {
returnValue = iterator->second->initialize(); returnValue = iterator->second->initialize();
if (returnValue != RETURN_OK) break; if (returnValue != returnvalue::OK) break;
} }
return returnValue; return returnValue;
} }

View File

@ -61,7 +61,7 @@ class DataLinkLayer : public CCSDSReturnValuesIF {
* handle Frames directed to this VC. * handle Frames directed to this VC.
* @param virtualChannelId Id of the VC. Shall be smaller than 64. * @param virtualChannelId Id of the VC. Shall be smaller than 64.
* @param object Reference to the object that handles the Frame. * @param object Reference to the object that handles the Frame.
* @return @c RETURN_OK on success, @c RETURN_FAILED otherwise. * @return @c RETURN_OK on success, @c returnvalue::FAILED otherwise.
*/ */
ReturnValue_t addVirtualChannel(uint8_t virtualChannelId, VirtualChannelReceptionIF* object); ReturnValue_t addVirtualChannel(uint8_t virtualChannelId, VirtualChannelReceptionIF* object);
/** /**

View File

@ -11,7 +11,7 @@ ReturnValue_t Farm1StateOpen::handleADFrame(TcTransferFrame* frame, ClcwIF* clcw
if (diff == 0) { if (diff == 0) {
myVC->vR++; myVC->vR++;
clcw->setRetransmitFlag(false); clcw->setRetransmitFlag(false);
return RETURN_OK; return returnvalue::OK;
} else if (diff < myVC->positiveWindow && diff > 0) { } else if (diff < myVC->positiveWindow && diff > 0) {
clcw->setRetransmitFlag(true); clcw->setRetransmitFlag(true);
return NS_POSITIVE_W; return NS_POSITIVE_W;

View File

@ -31,7 +31,7 @@ ReturnValue_t MapPacketExtraction::extractPackets(TcTransferFrame* frame) {
if (packetLength <= MAX_PACKET_SIZE) { if (packetLength <= MAX_PACKET_SIZE) {
memcpy(packetBuffer, frame->getDataField(), packetLength); memcpy(packetBuffer, frame->getDataField(), packetLength);
bufferPosition = &packetBuffer[packetLength]; bufferPosition = &packetBuffer[packetLength];
status = RETURN_OK; status = returnvalue::OK;
} else { } else {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "MapPacketExtraction::extractPackets. Packet too large! Size: " sif::error << "MapPacketExtraction::extractPackets. Packet too large! Size: "
@ -52,7 +52,7 @@ ReturnValue_t MapPacketExtraction::extractPackets(TcTransferFrame* frame) {
status = sendCompletePacket(packetBuffer, packetLength); status = sendCompletePacket(packetBuffer, packetLength);
clearBuffers(); clearBuffers();
} }
status = RETURN_OK; status = returnvalue::OK;
} else { } else {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "MapPacketExtraction::extractPackets. Packet too large! Size: " sif::error << "MapPacketExtraction::extractPackets. Packet too large! Size: "
@ -95,7 +95,7 @@ ReturnValue_t MapPacketExtraction::unpackBlockingPackets(TcTransferFrame* frame)
status = sendCompletePacket(packet.getWholeData(), packet.getFullSize()); status = sendCompletePacket(packet.getWholeData(), packet.getFullSize());
totalLength -= packet.getFullSize(); totalLength -= packet.getFullSize();
position += packet.getFullSize(); position += packet.getFullSize();
status = RETURN_OK; status = returnvalue::OK;
} else { } else {
status = DATA_CORRUPTED; status = DATA_CORRUPTED;
totalLength = 0; totalLength = 0;
@ -110,7 +110,7 @@ ReturnValue_t MapPacketExtraction::unpackBlockingPackets(TcTransferFrame* frame)
ReturnValue_t MapPacketExtraction::sendCompletePacket(uint8_t* data, uint32_t size) { ReturnValue_t MapPacketExtraction::sendCompletePacket(uint8_t* data, uint32_t size) {
store_address_t store_id; store_address_t store_id;
ReturnValue_t status = this->packetStore->addData(&store_id, data, size); ReturnValue_t status = this->packetStore->addData(&store_id, data, size);
if (status == RETURN_OK) { if (status == returnvalue::OK) {
TmTcMessage message(store_id); TmTcMessage message(store_id);
status = MessageQueueSenderIF::sendMessage(tcQueueId, &message); status = MessageQueueSenderIF::sendMessage(tcQueueId, &message);
} }
@ -130,9 +130,9 @@ ReturnValue_t MapPacketExtraction::initialize() {
ObjectManager::instance()->get<AcceptsTelecommandsIF>(packetDestination); ObjectManager::instance()->get<AcceptsTelecommandsIF>(packetDestination);
if ((packetStore != NULL) && (distributor != NULL)) { if ((packetStore != NULL) && (distributor != NULL)) {
tcQueueId = distributor->getRequestQueue(); tcQueueId = distributor->getRequestQueue();
return RETURN_OK; return returnvalue::OK;
} else { } else {
return RETURN_FAILED; return returnvalue::FAILED;
} }
} }

View File

@ -63,7 +63,7 @@ class MapPacketExtraction : public MapPacketExtractionIF {
ReturnValue_t extractPackets(TcTransferFrame* frame); ReturnValue_t extractPackets(TcTransferFrame* frame);
/** /**
* The #packetStore and the default destination of #tcQueue are initialized here. * The #packetStore and the default destination of #tcQueue are initialized here.
* @return @c RETURN_OK on success, @c RETURN_FAILED otherwise. * @return @c RETURN_OK on success, @c returnvalue::FAILED otherwise.
*/ */
ReturnValue_t initialize(); ReturnValue_t initialize();
/** /**

View File

@ -57,18 +57,18 @@ ReturnValue_t VirtualChannelReception::doFARM(TcTransferFrame* frame, ClcwIF* cl
ReturnValue_t VirtualChannelReception::frameAcceptanceAndReportingMechanism(TcTransferFrame* frame, ReturnValue_t VirtualChannelReception::frameAcceptanceAndReportingMechanism(TcTransferFrame* frame,
ClcwIF* clcw) { ClcwIF* clcw) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = returnvalue::OK;
result = doFARM(frame, &internalClcw); result = doFARM(frame, &internalClcw);
internalClcw.setReceiverFrameSequenceNumber(vR); internalClcw.setReceiverFrameSequenceNumber(vR);
internalClcw.setFarmBCount(farmBCounter); internalClcw.setFarmBCount(farmBCounter);
clcw->setWhole(internalClcw.getAsWhole()); clcw->setWhole(internalClcw.getAsWhole());
switch (result) { switch (result) {
case RETURN_OK: case returnvalue::OK:
return mapDemultiplexing(frame); return mapDemultiplexing(frame);
case BC_IS_SET_VR_COMMAND: case BC_IS_SET_VR_COMMAND:
case BC_IS_UNLOCK_COMMAND: case BC_IS_UNLOCK_COMMAND:
// Need to catch these codes to avoid error reporting later. // Need to catch these codes to avoid error reporting later.
return RETURN_OK; return returnvalue::OK;
default: default:
break; break;
} }
@ -79,15 +79,15 @@ ReturnValue_t VirtualChannelReception::addMapChannel(uint8_t mapId, MapPacketExt
std::pair<mapChannelIterator, bool> returnValue = std::pair<mapChannelIterator, bool> returnValue =
mapChannels.insert(std::pair<uint8_t, MapPacketExtractionIF*>(mapId, object)); mapChannels.insert(std::pair<uint8_t, MapPacketExtractionIF*>(mapId, object));
if (returnValue.second == true) { if (returnValue.second == true) {
return RETURN_OK; return returnvalue::OK;
} else { } else {
return RETURN_FAILED; return returnvalue::FAILED;
} }
} }
ReturnValue_t VirtualChannelReception::handleBDFrame(TcTransferFrame* frame, ClcwIF* clcw) { ReturnValue_t VirtualChannelReception::handleBDFrame(TcTransferFrame* frame, ClcwIF* clcw) {
farmBCounter++; farmBCounter++;
return RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t VirtualChannelReception::handleBCFrame(TcTransferFrame* frame, ClcwIF* clcw) { ReturnValue_t VirtualChannelReception::handleBCFrame(TcTransferFrame* frame, ClcwIF* clcw) {
@ -107,18 +107,18 @@ ReturnValue_t VirtualChannelReception::handleBCFrame(TcTransferFrame* frame, Clc
uint8_t VirtualChannelReception::getChannelId() const { return channelId; } uint8_t VirtualChannelReception::getChannelId() const { return channelId; }
ReturnValue_t VirtualChannelReception::initialize() { ReturnValue_t VirtualChannelReception::initialize() {
ReturnValue_t returnValue = RETURN_FAILED; ReturnValue_t returnValue = returnvalue::FAILED;
if ((slidingWindowWidth > 254) || (slidingWindowWidth % 2 != 0)) { if ((slidingWindowWidth > 254) || (slidingWindowWidth % 2 != 0)) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "VirtualChannelReception::initialize: Illegal sliding window width: " sif::error << "VirtualChannelReception::initialize: Illegal sliding window width: "
<< (int)slidingWindowWidth << std::endl; << (int)slidingWindowWidth << std::endl;
#endif #endif
return RETURN_FAILED; return returnvalue::FAILED;
} }
for (mapChannelIterator iterator = mapChannels.begin(); iterator != mapChannels.end(); for (mapChannelIterator iterator = mapChannels.begin(); iterator != mapChannels.end();
iterator++) { iterator++) {
returnValue = iterator->second->initialize(); returnValue = iterator->second->initialize();
if (returnValue != RETURN_OK) break; if (returnValue != returnvalue::OK) break;
} }
return returnValue; return returnValue;
} }

View File

@ -102,13 +102,14 @@ class VirtualChannelReception : public VirtualChannelReceptionIF, public CCSDSRe
* Helper method to simplify adding a mapChannel during construction. * Helper method to simplify adding a mapChannel during construction.
* @param mapId The mapId of the object to add. * @param mapId The mapId of the object to add.
* @param object Pointer to the MapPacketExtraction object itself. * @param object Pointer to the MapPacketExtraction object itself.
* @return @c RETURN_OK if the channel was successfully inserted, @c RETURN_FAILED otherwise. * @return @c RETURN_OK if the channel was successfully inserted, @c returnvalue::FAILED
* otherwise.
*/ */
ReturnValue_t addMapChannel(uint8_t mapId, MapPacketExtractionIF* object); ReturnValue_t addMapChannel(uint8_t mapId, MapPacketExtractionIF* object);
/** /**
* The initialization routine checks the set #slidingWindowWidth and initializes all MAP * The initialization routine checks the set #slidingWindowWidth and initializes all MAP
* channels. * channels.
* @return @c RETURN_OK on successful initialization, @c RETURN_FAILED otherwise. * @return @c RETURN_OK on successful initialization, @c returnvalue::FAILED otherwise.
*/ */
ReturnValue_t initialize(); ReturnValue_t initialize();
/** /**

View File

@ -14,7 +14,7 @@ PoolDataSetBase::~PoolDataSetBase() {}
ReturnValue_t PoolDataSetBase::registerVariable(PoolVariableIF* variable) { ReturnValue_t PoolDataSetBase::registerVariable(PoolVariableIF* variable) {
if (registeredVariables == nullptr) { if (registeredVariables == nullptr) {
/* Underlying container invalid */ /* Underlying container invalid */
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
if (state != States::STATE_SET_UNINITIALISED) { if (state != States::STATE_SET_UNINITIALISED) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
@ -42,17 +42,17 @@ ReturnValue_t PoolDataSetBase::registerVariable(PoolVariableIF* variable) {
} }
registeredVariables[fillCount] = variable; registeredVariables[fillCount] = variable;
fillCount++; fillCount++;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t PoolDataSetBase::read(MutexIF::TimeoutType timeoutType, uint32_t lockTimeout) { ReturnValue_t PoolDataSetBase::read(MutexIF::TimeoutType timeoutType, uint32_t lockTimeout) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = returnvalue::OK;
ReturnValue_t error = result; ReturnValue_t error = result;
if (state == States::STATE_SET_UNINITIALISED) { if (state == States::STATE_SET_UNINITIALISED) {
lockDataPool(timeoutType, lockTimeout); lockDataPool(timeoutType, lockTimeout);
for (uint16_t count = 0; count < fillCount; count++) { for (uint16_t count = 0; count < fillCount; count++) {
result = readVariable(count); result = readVariable(count);
if (result != RETURN_OK) { if (result != returnvalue::OK) {
error = result; error = result;
} }
} }
@ -71,7 +71,7 @@ ReturnValue_t PoolDataSetBase::read(MutexIF::TimeoutType timeoutType, uint32_t l
result = SET_WAS_ALREADY_READ; result = SET_WAS_ALREADY_READ;
} }
if (error != HasReturnvaluesIF::RETURN_OK) { if (error != returnvalue::OK) {
result = error; result = error;
} }
return result; return result;
@ -80,10 +80,10 @@ ReturnValue_t PoolDataSetBase::read(MutexIF::TimeoutType timeoutType, uint32_t l
uint16_t PoolDataSetBase::getFillCount() const { return fillCount; } uint16_t PoolDataSetBase::getFillCount() const { return fillCount; }
ReturnValue_t PoolDataSetBase::readVariable(uint16_t count) { ReturnValue_t PoolDataSetBase::readVariable(uint16_t count) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = returnvalue::OK;
if (registeredVariables[count] == nullptr) { if (registeredVariables[count] == nullptr) {
/* Configuration error. */ /* Configuration error. */
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
/* These checks are often performed by the respective variable implementation too, but I guess /* These checks are often performed by the respective variable implementation too, but I guess
@ -98,7 +98,7 @@ ReturnValue_t PoolDataSetBase::readVariable(uint16_t count) {
result = ReadCommitIFAttorney::readWithoutLock(registeredVariables[count]); result = ReadCommitIFAttorney::readWithoutLock(registeredVariables[count]);
} }
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
result = INVALID_PARAMETER_DEFINITION; result = INVALID_PARAMETER_DEFINITION;
} }
} }
@ -108,7 +108,7 @@ ReturnValue_t PoolDataSetBase::readVariable(uint16_t count) {
ReturnValue_t PoolDataSetBase::commit(MutexIF::TimeoutType timeoutType, uint32_t lockTimeout) { ReturnValue_t PoolDataSetBase::commit(MutexIF::TimeoutType timeoutType, uint32_t lockTimeout) {
if (state == States::STATE_SET_WAS_READ) { if (state == States::STATE_SET_WAS_READ) {
handleAlreadyReadDatasetCommit(timeoutType, lockTimeout); handleAlreadyReadDatasetCommit(timeoutType, lockTimeout);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} else { } else {
return handleUnreadDatasetCommit(timeoutType, lockTimeout); return handleUnreadDatasetCommit(timeoutType, lockTimeout);
} }
@ -134,7 +134,7 @@ void PoolDataSetBase::handleAlreadyReadDatasetCommit(MutexIF::TimeoutType timeou
ReturnValue_t PoolDataSetBase::handleUnreadDatasetCommit(MutexIF::TimeoutType timeoutType, ReturnValue_t PoolDataSetBase::handleUnreadDatasetCommit(MutexIF::TimeoutType timeoutType,
uint32_t lockTimeout) { uint32_t lockTimeout) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = returnvalue::OK;
lockDataPool(timeoutType, lockTimeout); lockDataPool(timeoutType, lockTimeout);
for (uint16_t count = 0; count < fillCount; count++) { for (uint16_t count = 0; count < fillCount; count++) {
if ((registeredVariables[count]->getReadWriteMode() == PoolVariableIF::VAR_WRITE) and if ((registeredVariables[count]->getReadWriteMode() == PoolVariableIF::VAR_WRITE) and
@ -165,17 +165,17 @@ ReturnValue_t PoolDataSetBase::handleUnreadDatasetCommit(MutexIF::TimeoutType ti
ReturnValue_t PoolDataSetBase::lockDataPool(MutexIF::TimeoutType timeoutType, ReturnValue_t PoolDataSetBase::lockDataPool(MutexIF::TimeoutType timeoutType,
uint32_t lockTimeout) { uint32_t lockTimeout) {
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t PoolDataSetBase::unlockDataPool() { return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t PoolDataSetBase::unlockDataPool() { return returnvalue::OK; }
ReturnValue_t PoolDataSetBase::serialize(uint8_t** buffer, size_t* size, const size_t maxSize, ReturnValue_t PoolDataSetBase::serialize(uint8_t** buffer, size_t* size, const size_t maxSize,
SerializeIF::Endianness streamEndianness) const { SerializeIF::Endianness streamEndianness) const {
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED; ReturnValue_t result = returnvalue::FAILED;
for (uint16_t count = 0; count < fillCount; count++) { for (uint16_t count = 0; count < fillCount; count++) {
result = registeredVariables[count]->serialize(buffer, size, maxSize, streamEndianness); result = registeredVariables[count]->serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
} }
@ -184,10 +184,10 @@ ReturnValue_t PoolDataSetBase::serialize(uint8_t** buffer, size_t* size, const s
ReturnValue_t PoolDataSetBase::deSerialize(const uint8_t** buffer, size_t* size, ReturnValue_t PoolDataSetBase::deSerialize(const uint8_t** buffer, size_t* size,
SerializeIF::Endianness streamEndianness) { SerializeIF::Endianness streamEndianness) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED; ReturnValue_t result = returnvalue::FAILED;
for (uint16_t count = 0; count < fillCount; count++) { for (uint16_t count = 0; count < fillCount; count++) {
result = registeredVariables[count]->deSerialize(buffer, size, streamEndianness); result = registeredVariables[count]->deSerialize(buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
} }

View File

@ -29,20 +29,20 @@
* @author Bastian Baetz * @author Bastian Baetz
* @ingroup data_pool * @ingroup data_pool
*/ */
class PoolDataSetBase : public PoolDataSetIF, public SerializeIF, public HasReturnvaluesIF { class PoolDataSetBase : public PoolDataSetIF, public SerializeIF {
public: public:
/** /**
* @brief Creates an empty dataset. Use registerVariable or * @brief Creates an empty dataset. Use registerVariable or
* supply a pointer to this dataset to PoolVariable * supply a pointer to this dataset to PoolVariable
* initializations to register pool variables. * initializations to register pool variables.
*/ */
PoolDataSetBase(PoolVariableIF** registeredVariablesArray, const size_t maxFillCount); PoolDataSetBase(PoolVariableIF** registeredVariablesArray, size_t maxFillCount);
/* Forbidden for now */ /* Forbidden for now */
PoolDataSetBase(const PoolDataSetBase& otherSet) = delete; PoolDataSetBase(const PoolDataSetBase& otherSet) = delete;
const PoolDataSetBase& operator=(const PoolDataSetBase& otherSet) = delete; const PoolDataSetBase& operator=(const PoolDataSetBase& otherSet) = delete;
virtual ~PoolDataSetBase(); ~PoolDataSetBase() override;
/** /**
* @brief The read call initializes reading out all registered variables. * @brief The read call initializes reading out all registered variables.

View File

@ -17,7 +17,7 @@ class PoolReadGuard {
: readObject(readObject), mutexTimeout(mutexTimeout) { : readObject(readObject), mutexTimeout(mutexTimeout) {
if (readObject != nullptr) { if (readObject != nullptr) {
readResult = readObject->read(timeoutType, mutexTimeout); readResult = readObject->read(timeoutType, mutexTimeout);
if (readResult != HasReturnvaluesIF::RETURN_OK) { if (readResult != returnvalue::OK) {
#if FSFW_VERBOSE_LEVEL == 1 #if FSFW_VERBOSE_LEVEL == 1
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "PoolReadHelper: Read failed!" << std::endl; sif::error << "PoolReadHelper: Read failed!" << std::endl;
@ -47,7 +47,7 @@ class PoolReadGuard {
private: private:
ReadCommitIF* readObject = nullptr; ReadCommitIF* readObject = nullptr;
ReturnValue_t readResult = HasReturnvaluesIF::RETURN_OK; ReturnValue_t readResult = returnvalue::OK;
bool noCommit = false; bool noCommit = false;
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
uint32_t mutexTimeout = 20; uint32_t mutexTimeout = 20;

View File

@ -12,14 +12,14 @@ class ReadCommitIFAttorney {
private: private:
static ReturnValue_t readWithoutLock(ReadCommitIF* readCommitIF) { static ReturnValue_t readWithoutLock(ReadCommitIF* readCommitIF) {
if (readCommitIF == nullptr) { if (readCommitIF == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
return readCommitIF->readWithoutLock(); return readCommitIF->readWithoutLock();
} }
static ReturnValue_t commitWithoutLock(ReadCommitIF* readCommitIF) { static ReturnValue_t commitWithoutLock(ReadCommitIF* readCommitIF) {
if (readCommitIF == nullptr) { if (readCommitIF == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
return readCommitIF->commitWithoutLock(); return readCommitIF->commitWithoutLock();
} }

View File

@ -110,10 +110,10 @@ class HasLocalDataPoolIF {
* These function can be implemented by pool owner, if they are required * These function can be implemented by pool owner, if they are required
* and used by the housekeeping message interface. * and used by the housekeeping message interface.
* */ * */
virtual ReturnValue_t addDataSet(sid_t sid) { return HasReturnvaluesIF::RETURN_FAILED; }; virtual ReturnValue_t addDataSet(sid_t sid) { return returnvalue::FAILED; };
virtual ReturnValue_t removeDataSet(sid_t sid) { return HasReturnvaluesIF::RETURN_FAILED; }; virtual ReturnValue_t removeDataSet(sid_t sid) { return returnvalue::FAILED; };
virtual ReturnValue_t changeCollectionInterval(sid_t sid, float newIntervalSeconds) { virtual ReturnValue_t changeCollectionInterval(sid_t sid, float newIntervalSeconds) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
}; };
/** /**

View File

@ -21,15 +21,15 @@ LocalDataPoolManager::LocalDataPoolManager(HasLocalDataPoolIF* owner, MessageQue
bool appendValidityBuffer) bool appendValidityBuffer)
: appendValidityBuffer(appendValidityBuffer) { : appendValidityBuffer(appendValidityBuffer) {
if (owner == nullptr) { if (owner == nullptr) {
printWarningOrError(sif::OutputTypes::OUT_WARNING, "LocalDataPoolManager", printWarningOrError(sif::OutputTypes::OUT_WARNING, "LocalDataPoolManager", returnvalue::FAILED,
HasReturnvaluesIF::RETURN_FAILED, "Invalid supplied owner"); "Invalid supplied owner");
return; return;
} }
this->owner = owner; this->owner = owner;
mutex = MutexFactory::instance()->createMutex(); mutex = MutexFactory::instance()->createMutex();
if (mutex == nullptr) { if (mutex == nullptr) {
printWarningOrError(sif::OutputTypes::OUT_ERROR, "LocalDataPoolManager", printWarningOrError(sif::OutputTypes::OUT_ERROR, "LocalDataPoolManager", returnvalue::FAILED,
HasReturnvaluesIF::RETURN_FAILED, "Could not create mutex"); "Could not create mutex");
} }
hkQueue = queueToUse; hkQueue = queueToUse;
@ -51,9 +51,9 @@ ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) {
ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE); ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
if (ipcStore == nullptr) { if (ipcStore == nullptr) {
/* Error, all destinations invalid */ /* Error, all destinations invalid */
printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize", HasReturnvaluesIF::RETURN_FAILED, printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize", returnvalue::FAILED,
"Could not set IPC store."); "Could not set IPC store.");
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
if (defaultHkDestination != objects::NO_OBJECT) { if (defaultHkDestination != objects::NO_OBJECT) {
@ -67,7 +67,7 @@ ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) {
} }
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t LocalDataPoolManager::initializeAfterTaskCreation(uint8_t nonDiagInvlFactor) { ReturnValue_t LocalDataPoolManager::initializeAfterTaskCreation(uint8_t nonDiagInvlFactor) {
@ -78,19 +78,19 @@ ReturnValue_t LocalDataPoolManager::initializeAfterTaskCreation(uint8_t nonDiagI
ReturnValue_t LocalDataPoolManager::initializeHousekeepingPoolEntriesOnce() { ReturnValue_t LocalDataPoolManager::initializeHousekeepingPoolEntriesOnce() {
if (not mapInitialized) { if (not mapInitialized) {
ReturnValue_t result = owner->initializeLocalDataPool(localPoolMap, *this); ReturnValue_t result = owner->initializeLocalDataPool(localPoolMap, *this);
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == returnvalue::OK) {
mapInitialized = true; mapInitialized = true;
} }
return result; return result;
} }
printWarningOrError(sif::OutputTypes::OUT_WARNING, "initializeHousekeepingPoolEntriesOnce", printWarningOrError(sif::OutputTypes::OUT_WARNING, "initializeHousekeepingPoolEntriesOnce",
HasReturnvaluesIF::RETURN_FAILED, "The map should only be initialized once"); returnvalue::FAILED, "The map should only be initialized once");
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t LocalDataPoolManager::performHkOperation() { ReturnValue_t LocalDataPoolManager::performHkOperation() {
ReturnValue_t status = HasReturnvaluesIF::RETURN_OK; ReturnValue_t status = returnvalue::OK;
for (auto& receiver : hkReceivers) { for (auto& receiver : hkReceivers) {
switch (receiver.reportingType) { switch (receiver.reportingType) {
case (ReportingType::PERIODIC): { case (ReportingType::PERIODIC): {
@ -115,7 +115,7 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() {
} }
default: default:
// This should never happen. // This should never happen.
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
} }
resetHkUpdateResetHelper(); resetHkUpdateResetHelper();
@ -125,7 +125,7 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() {
ReturnValue_t LocalDataPoolManager::handleHkUpdate(HkReceiver& receiver, ReturnValue_t& status) { ReturnValue_t LocalDataPoolManager::handleHkUpdate(HkReceiver& receiver, ReturnValue_t& status) {
if (receiver.dataType == DataType::LOCAL_POOL_VARIABLE) { if (receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
/* Update packets shall only be generated from datasets. */ /* Update packets shall only be generated from datasets. */
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
LocalPoolDataSetBase* dataSet = LocalPoolDataSetBase* dataSet =
HasLocalDpIFManagerAttorney::getDataSetHandle(owner, receiver.dataId.sid); HasLocalDpIFManagerAttorney::getDataSetHandle(owner, receiver.dataId.sid);
@ -135,12 +135,12 @@ ReturnValue_t LocalDataPoolManager::handleHkUpdate(HkReceiver& receiver, ReturnV
if (dataSet->hasChanged()) { if (dataSet->hasChanged()) {
/* Prepare and send update notification */ /* Prepare and send update notification */
ReturnValue_t result = generateHousekeepingPacket(receiver.dataId.sid, dataSet, true); ReturnValue_t result = generateHousekeepingPacket(receiver.dataId.sid, dataSet, true);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
status = result; status = result;
} }
} }
handleChangeResetLogic(receiver.dataType, receiver.dataId, dataSet); handleChangeResetLogic(receiver.dataType, receiver.dataId, dataSet);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t LocalDataPoolManager::handleNotificationUpdate(HkReceiver& receiver, ReturnValue_t LocalDataPoolManager::handleNotificationUpdate(HkReceiver& receiver,
@ -160,7 +160,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationUpdate(HkReceiver& receive
HousekeepingMessage::setUpdateNotificationVariableCommand( HousekeepingMessage::setUpdateNotificationVariableCommand(
&notification, gp_id_t(owner->getObjectId(), receiver.dataId.localPoolId)); &notification, gp_id_t(owner->getObjectId(), receiver.dataId.localPoolId));
ReturnValue_t result = hkQueue->sendMessage(receiver.destinationQueue, &notification); ReturnValue_t result = hkQueue->sendMessage(receiver.destinationQueue, &notification);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
status = result; status = result;
} }
toReset = poolObj; toReset = poolObj;
@ -179,7 +179,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationUpdate(HkReceiver& receive
CommandMessage notification; CommandMessage notification;
HousekeepingMessage::setUpdateNotificationSetCommand(&notification, receiver.dataId.sid); HousekeepingMessage::setUpdateNotificationSetCommand(&notification, receiver.dataId.sid);
ReturnValue_t result = hkQueue->sendMessage(receiver.destinationQueue, &notification); ReturnValue_t result = hkQueue->sendMessage(receiver.destinationQueue, &notification);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
status = result; status = result;
} }
toReset = dataSet; toReset = dataSet;
@ -188,7 +188,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationUpdate(HkReceiver& receive
if (toReset != nullptr) { if (toReset != nullptr) {
handleChangeResetLogic(receiver.dataType, receiver.dataId, toReset); handleChangeResetLogic(receiver.dataType, receiver.dataId, toReset);
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& receiver, ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& receiver,
@ -205,7 +205,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
} }
if (not poolObj->hasChanged()) { if (not poolObj->hasChanged()) {
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
/* Prepare and send update snapshot */ /* Prepare and send update snapshot */
@ -219,7 +219,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
store_address_t storeId; store_address_t storeId;
ReturnValue_t result = addUpdateToStore(updatePacket, storeId); ReturnValue_t result = addUpdateToStore(updatePacket, storeId);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -227,7 +227,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
HousekeepingMessage::setUpdateSnapshotVariableCommand( HousekeepingMessage::setUpdateSnapshotVariableCommand(
&notification, gp_id_t(owner->getObjectId(), receiver.dataId.localPoolId), storeId); &notification, gp_id_t(owner->getObjectId(), receiver.dataId.localPoolId), storeId);
result = hkQueue->sendMessage(receiver.destinationQueue, &notification); result = hkQueue->sendMessage(receiver.destinationQueue, &notification);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
status = result; status = result;
} }
toReset = poolObj; toReset = poolObj;
@ -241,7 +241,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
} }
if (not dataSet->hasChanged()) { if (not dataSet->hasChanged()) {
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
/* Prepare and send update snapshot */ /* Prepare and send update snapshot */
@ -255,14 +255,14 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
store_address_t storeId; store_address_t storeId;
ReturnValue_t result = addUpdateToStore(updatePacket, storeId); ReturnValue_t result = addUpdateToStore(updatePacket, storeId);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
CommandMessage notification; CommandMessage notification;
HousekeepingMessage::setUpdateSnapshotSetCommand(&notification, receiver.dataId.sid, storeId); HousekeepingMessage::setUpdateSnapshotSetCommand(&notification, receiver.dataId.sid, storeId);
result = hkQueue->sendMessage(receiver.destinationQueue, &notification); result = hkQueue->sendMessage(receiver.destinationQueue, &notification);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
status = result; status = result;
} }
toReset = dataSet; toReset = dataSet;
@ -270,7 +270,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
if (toReset != nullptr) { if (toReset != nullptr) {
handleChangeResetLogic(receiver.dataType, receiver.dataId, toReset); handleChangeResetLogic(receiver.dataType, receiver.dataId, toReset);
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t LocalDataPoolManager::addUpdateToStore(HousekeepingSnapshot& updatePacket, ReturnValue_t LocalDataPoolManager::addUpdateToStore(HousekeepingSnapshot& updatePacket,
@ -279,7 +279,7 @@ ReturnValue_t LocalDataPoolManager::addUpdateToStore(HousekeepingSnapshot& updat
uint8_t* storePtr = nullptr; uint8_t* storePtr = nullptr;
ReturnValue_t result = ReturnValue_t result =
ipcStore->getFreeElement(&storeId, updatePacket.getSerializedSize(), &storePtr); ipcStore->getFreeElement(&storeId, updatePacket.getSerializedSize(), &storePtr);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
size_t serializedSize = 0; size_t serializedSize = 0;
@ -356,7 +356,7 @@ ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(subdp::ParamsBase
} }
hkReceivers.push_back(hkReceiver); hkReceivers.push_back(hkReceiver);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t LocalDataPoolManager::subscribeForRegularUpdatePacket( ReturnValue_t LocalDataPoolManager::subscribeForRegularUpdatePacket(
@ -388,7 +388,7 @@ ReturnValue_t LocalDataPoolManager::subscribeForUpdatePacket(subdp::ParamsBase&
hkReceivers.push_back(hkReceiver); hkReceivers.push_back(hkReceiver);
handleHkUpdateResetListInsertion(hkReceiver.dataType, hkReceiver.dataId); handleHkUpdateResetListInsertion(hkReceiver.dataType, hkReceiver.dataId);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t LocalDataPoolManager::subscribeForSetUpdateMessage(const uint32_t setId, ReturnValue_t LocalDataPoolManager::subscribeForSetUpdateMessage(const uint32_t setId,
@ -409,7 +409,7 @@ ReturnValue_t LocalDataPoolManager::subscribeForSetUpdateMessage(const uint32_t
hkReceivers.push_back(hkReceiver); hkReceivers.push_back(hkReceiver);
handleHkUpdateResetListInsertion(hkReceiver.dataType, hkReceiver.dataId); handleHkUpdateResetListInsertion(hkReceiver.dataType, hkReceiver.dataId);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t LocalDataPoolManager::subscribeForVariableUpdateMessage( ReturnValue_t LocalDataPoolManager::subscribeForVariableUpdateMessage(
@ -429,7 +429,7 @@ ReturnValue_t LocalDataPoolManager::subscribeForVariableUpdateMessage(
hkReceivers.push_back(hkReceiver); hkReceivers.push_back(hkReceiver);
handleHkUpdateResetListInsertion(hkReceiver.dataType, hkReceiver.dataId); handleHkUpdateResetListInsertion(hkReceiver.dataType, hkReceiver.dataId);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
void LocalDataPoolManager::handleHkUpdateResetListInsertion(DataType dataType, DataId dataId) { void LocalDataPoolManager::handleHkUpdateResetListInsertion(DataType dataType, DataId dataId) {
@ -463,7 +463,7 @@ void LocalDataPoolManager::handleHkUpdateResetListInsertion(DataType dataType, D
ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* message) { ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* message) {
Command_t command = message->getCommand(); Command_t command = message->getCommand();
sid_t sid = HousekeepingMessage::getSid(message); sid_t sid = HousekeepingMessage::getSid(message);
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = returnvalue::OK;
switch (command) { switch (command) {
// Houskeeping interface handling. // Houskeeping interface handling.
case (HousekeepingMessage::ENABLE_PERIODIC_DIAGNOSTICS_GENERATION): { case (HousekeepingMessage::ENABLE_PERIODIC_DIAGNOSTICS_GENERATION): {
@ -488,7 +488,7 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* me
case (HousekeepingMessage::REPORT_DIAGNOSTICS_REPORT_STRUCTURES): { case (HousekeepingMessage::REPORT_DIAGNOSTICS_REPORT_STRUCTURES): {
result = generateSetStructurePacket(sid, true); result = generateSetStructurePacket(sid, true);
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == returnvalue::OK) {
return result; return result;
} }
break; break;
@ -496,7 +496,7 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* me
case (HousekeepingMessage::REPORT_HK_REPORT_STRUCTURES): { case (HousekeepingMessage::REPORT_HK_REPORT_STRUCTURES): {
result = generateSetStructurePacket(sid, false); result = generateSetStructurePacket(sid, false);
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == returnvalue::OK) {
return result; return result;
} }
break; break;
@ -536,12 +536,12 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* me
/* Notification handling */ /* Notification handling */
case (HousekeepingMessage::UPDATE_NOTIFICATION_SET): { case (HousekeepingMessage::UPDATE_NOTIFICATION_SET): {
owner->handleChangedDataset(sid); owner->handleChangedDataset(sid);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
case (HousekeepingMessage::UPDATE_NOTIFICATION_VARIABLE): { case (HousekeepingMessage::UPDATE_NOTIFICATION_VARIABLE): {
gp_id_t globPoolId = HousekeepingMessage::getUpdateNotificationVariableCommand(message); gp_id_t globPoolId = HousekeepingMessage::getUpdateNotificationVariableCommand(message);
owner->handleChangedPoolVariable(globPoolId); owner->handleChangedPoolVariable(globPoolId);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
case (HousekeepingMessage::UPDATE_SNAPSHOT_SET): { case (HousekeepingMessage::UPDATE_SNAPSHOT_SET): {
store_address_t storeId; store_address_t storeId;
@ -551,7 +551,7 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* me
if (clearMessage) { if (clearMessage) {
message->clear(); message->clear();
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
case (HousekeepingMessage::UPDATE_SNAPSHOT_VARIABLE): { case (HousekeepingMessage::UPDATE_SNAPSHOT_VARIABLE): {
store_address_t storeId; store_address_t storeId;
@ -561,7 +561,7 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* me
if (clearMessage) { if (clearMessage) {
message->clear(); message->clear();
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
default: default:
@ -569,7 +569,7 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* me
} }
CommandMessage reply; CommandMessage reply;
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
HousekeepingMessage::setHkRequestFailureReply(&reply, sid, result); HousekeepingMessage::setHkRequestFailureReply(&reply, sid, result);
} else { } else {
HousekeepingMessage::setHkRequestSuccessReply(&reply, sid); HousekeepingMessage::setHkRequestSuccessReply(&reply, sid);
@ -586,7 +586,7 @@ ReturnValue_t LocalDataPoolManager::printPoolEntry(lp_id_t localPoolId) {
return localpool::POOL_ENTRY_NOT_FOUND; return localpool::POOL_ENTRY_NOT_FOUND;
} }
poolIter->second->print(); poolIter->second->print();
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
MutexIF* LocalDataPoolManager::getMutexHandle() { return mutex; } MutexIF* LocalDataPoolManager::getMutexHandle() { return mutex; }
@ -609,7 +609,7 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
size_t serializedSize = 0; size_t serializedSize = 0;
ReturnValue_t result = ReturnValue_t result =
serializeHkPacketIntoStore(hkPacket, storeId, forDownlink, &serializedSize); serializeHkPacketIntoStore(hkPacket, storeId, forDownlink, &serializedSize);
if (result != HasReturnvaluesIF::RETURN_OK or serializedSize == 0) { if (result != returnvalue::OK or serializedSize == 0) {
return result; return result;
} }
@ -647,7 +647,7 @@ ReturnValue_t LocalDataPoolManager::serializeHkPacketIntoStore(HousekeepingPacke
uint8_t* dataPtr = nullptr; uint8_t* dataPtr = nullptr;
const size_t maxSize = hkPacket.getSerializedSize(); const size_t maxSize = hkPacket.getSerializedSize();
ReturnValue_t result = ipcStore->getFreeElement(&storeId, maxSize, &dataPtr); ReturnValue_t result = ipcStore->getFreeElement(&storeId, maxSize, &dataPtr);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -687,7 +687,7 @@ void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) {
} }
ReturnValue_t result = generateHousekeepingPacket(sid, dataSet, true); ReturnValue_t result = generateHousekeepingPacket(sid, dataSet, true);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
/* Configuration error */ /* Configuration error */
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "LocalDataPoolManager::performPeriodicHkOperation: HK generation failed." sif::warning << "LocalDataPoolManager::performPeriodicHkOperation: HK generation failed."
@ -718,7 +718,7 @@ ReturnValue_t LocalDataPoolManager::togglePeriodicGeneration(sid_t sid, bool ena
} }
LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, enable); LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, enable);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t LocalDataPoolManager::changeCollectionInterval(sid_t sid, float newCollectionInterval, ReturnValue_t LocalDataPoolManager::changeCollectionInterval(sid_t sid, float newCollectionInterval,
@ -744,7 +744,7 @@ ReturnValue_t LocalDataPoolManager::changeCollectionInterval(sid_t sid, float ne
} }
periodicHelper->changeCollectionInterval(newCollectionInterval); periodicHelper->changeCollectionInterval(newCollectionInterval);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool isDiagnostics) { ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool isDiagnostics) {
@ -772,24 +772,22 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool i
uint8_t* storePtr = nullptr; uint8_t* storePtr = nullptr;
store_address_t storeId; store_address_t storeId;
ReturnValue_t result = ipcStore->getFreeElement(&storeId, expectedSize, &storePtr); ReturnValue_t result = ipcStore->getFreeElement(&storeId, expectedSize, &storePtr);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
printWarningOrError(sif::OutputTypes::OUT_ERROR, "generateSetStructurePacket", printWarningOrError(sif::OutputTypes::OUT_ERROR, "generateSetStructurePacket",
HasReturnvaluesIF::RETURN_FAILED, returnvalue::FAILED, "Could not get free element from IPC store.");
"Could not get free element from IPC store.");
return result; return result;
} }
// Serialize set packet into store. // Serialize set packet into store.
size_t size = 0; size_t size = 0;
result = setPacket.serialize(&storePtr, &size, expectedSize, SerializeIF::Endianness::BIG); result = setPacket.serialize(&storePtr, &size, expectedSize, SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
ipcStore->deleteData(storeId); ipcStore->deleteData(storeId);
return result; return result;
} }
if (expectedSize != size) { if (expectedSize != size) {
printWarningOrError(sif::OutputTypes::OUT_WARNING, "generateSetStructurePacket", printWarningOrError(sif::OutputTypes::OUT_WARNING, "generateSetStructurePacket",
HasReturnvaluesIF::RETURN_FAILED, returnvalue::FAILED, "Expected size is not equal to serialized size");
"Expected size is not equal to serialized size");
} }
// Send structure reporting reply. // Send structure reporting reply.
@ -801,7 +799,7 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool i
} }
result = hkQueue->reply(&reply); result = hkQueue->reply(&reply);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
ipcStore->deleteData(storeId); ipcStore->deleteData(storeId);
} }
return result; return result;
@ -827,7 +825,7 @@ void LocalDataPoolManager::printWarningOrError(sif::OutputTypes outputType,
errorPrint = "Dataset not found"; errorPrint = "Dataset not found";
} else if (error == POOLOBJECT_NOT_FOUND) { } else if (error == POOLOBJECT_NOT_FOUND) {
errorPrint = "Pool Object not found"; errorPrint = "Pool Object not found";
} else if (error == HasReturnvaluesIF::RETURN_FAILED) { } else if (error == returnvalue::FAILED) {
if (outputType == sif::OutputTypes::OUT_WARNING) { if (outputType == sif::OutputTypes::OUT_WARNING) {
errorPrint = "Generic Warning"; errorPrint = "Generic Warning";
} else { } else {

View File

@ -361,7 +361,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
ReturnValue_t addUpdateToStore(HousekeepingSnapshot& updatePacket, store_address_t& storeId); ReturnValue_t addUpdateToStore(HousekeepingSnapshot& updatePacket, store_address_t& storeId);
void printWarningOrError(sif::OutputTypes outputType, const char* functionName, void printWarningOrError(sif::OutputTypes outputType, const char* functionName,
ReturnValue_t errorCode = HasReturnvaluesIF::RETURN_FAILED, ReturnValue_t errorCode = returnvalue::FAILED,
const char* errorPrint = nullptr); const char* errorPrint = nullptr);
}; };
@ -369,7 +369,7 @@ template <class T>
inline ReturnValue_t LocalDataPoolManager::fetchPoolEntry(lp_id_t localPoolId, inline ReturnValue_t LocalDataPoolManager::fetchPoolEntry(lp_id_t localPoolId,
PoolEntry<T>** poolEntry) { PoolEntry<T>** poolEntry) {
if (poolEntry == nullptr) { if (poolEntry == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
auto poolIter = localPoolMap.find(localPoolId); auto poolIter = localPoolMap.find(localPoolId);
@ -385,7 +385,7 @@ inline ReturnValue_t LocalDataPoolManager::fetchPoolEntry(lp_id_t localPoolId,
localpool::POOL_ENTRY_TYPE_CONFLICT); localpool::POOL_ENTRY_TYPE_CONFLICT);
return localpool::POOL_ENTRY_TYPE_CONFLICT; return localpool::POOL_ENTRY_TYPE_CONFLICT;
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
#endif /* FSFW_DATAPOOLLOCAL_LOCALDATAPOOLMANAGER_H_ */ #endif /* FSFW_DATAPOOLLOCAL_LOCALDATAPOOLMANAGER_H_ */

View File

@ -85,13 +85,13 @@ ReturnValue_t LocalPoolDataSetBase::lockDataPool(MutexIF::TimeoutType timeoutTyp
if (mutexIfSingleDataCreator != nullptr) { if (mutexIfSingleDataCreator != nullptr) {
return mutexIfSingleDataCreator->lockMutex(timeoutType, timeoutMs); return mutexIfSingleDataCreator->lockMutex(timeoutType, timeoutMs);
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t LocalPoolDataSetBase::serializeWithValidityBuffer( ReturnValue_t LocalPoolDataSetBase::serializeWithValidityBuffer(
uint8_t **buffer, size_t *size, size_t maxSize, uint8_t **buffer, size_t *size, size_t maxSize,
SerializeIF::Endianness streamEndianness) const { SerializeIF::Endianness streamEndianness) const {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = returnvalue::OK;
const uint8_t validityMaskSize = std::ceil(static_cast<float>(fillCount) / 8.0); const uint8_t validityMaskSize = std::ceil(static_cast<float>(fillCount) / 8.0);
uint8_t *validityPtr = nullptr; uint8_t *validityPtr = nullptr;
#if defined(_MSC_VER) || defined(__clang__) #if defined(_MSC_VER) || defined(__clang__)
@ -119,7 +119,7 @@ ReturnValue_t LocalPoolDataSetBase::serializeWithValidityBuffer(
} }
result = registeredVariables[count]->serialize(buffer, size, maxSize, streamEndianness); result = registeredVariables[count]->serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
} }
@ -135,10 +135,10 @@ ReturnValue_t LocalPoolDataSetBase::serializeWithValidityBuffer(
ReturnValue_t LocalPoolDataSetBase::deSerializeWithValidityBuffer( ReturnValue_t LocalPoolDataSetBase::deSerializeWithValidityBuffer(
const uint8_t **buffer, size_t *size, SerializeIF::Endianness streamEndianness) { const uint8_t **buffer, size_t *size, SerializeIF::Endianness streamEndianness) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED; ReturnValue_t result = returnvalue::FAILED;
for (uint16_t count = 0; count < fillCount; count++) { for (uint16_t count = 0; count < fillCount; count++) {
result = registeredVariables[count]->deSerialize(buffer, size, streamEndianness); result = registeredVariables[count]->deSerialize(buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
} }
@ -169,7 +169,7 @@ ReturnValue_t LocalPoolDataSetBase::unlockDataPool() {
if (mutexIfSingleDataCreator != nullptr) { if (mutexIfSingleDataCreator != nullptr) {
return mutexIfSingleDataCreator->unlockMutex(); return mutexIfSingleDataCreator->unlockMutex();
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t LocalPoolDataSetBase::serializeLocalPoolIds(uint8_t **buffer, size_t *size, ReturnValue_t LocalPoolDataSetBase::serializeLocalPoolIds(uint8_t **buffer, size_t *size,
@ -185,7 +185,7 @@ ReturnValue_t LocalPoolDataSetBase::serializeLocalPoolIds(uint8_t **buffer, size
lp_id_t currentPoolId = registeredVariables[count]->getDataPoolId(); lp_id_t currentPoolId = registeredVariables[count]->getDataPoolId();
auto result = auto result =
SerializeAdapter::serialize(&currentPoolId, buffer, size, maxSize, streamEndianness); SerializeAdapter::serialize(&currentPoolId, buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "LocalPoolDataSetBase::serializeLocalPoolIds: " sif::warning << "LocalPoolDataSetBase::serializeLocalPoolIds: "
<< "Serialization error!" << std::endl; << "Serialization error!" << std::endl;
@ -197,7 +197,7 @@ ReturnValue_t LocalPoolDataSetBase::serializeLocalPoolIds(uint8_t **buffer, size
return result; return result;
} }
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
uint8_t LocalPoolDataSetBase::getLocalPoolIdsSerializedSize(bool serializeFillCount) const { uint8_t LocalPoolDataSetBase::getLocalPoolIdsSerializedSize(bool serializeFillCount) const {

View File

@ -15,7 +15,7 @@ class HasLocalDataPoolIF;
* @brief This class serves as a non-template base for pool objects like pool variables * @brief This class serves as a non-template base for pool objects like pool variables
* or pool vectors. * or pool vectors.
*/ */
class LocalPoolObjectBase : public PoolVariableIF, public HasReturnvaluesIF, public MarkChangedIF { class LocalPoolObjectBase : public PoolVariableIF, public MarkChangedIF {
public: public:
LocalPoolObjectBase(lp_id_t poolId, HasLocalDataPoolIF* hkOwner, DataSetIF* dataSet, LocalPoolObjectBase(lp_id_t poolId, HasLocalDataPoolIF* hkOwner, DataSetIF* dataSet,
pool_rwm_t setReadWriteMode); pool_rwm_t setReadWriteMode);

View File

@ -29,7 +29,7 @@ inline ReturnValue_t LocalPoolVariable<T>::read(MutexIF::TimeoutType timeoutType
} }
MutexIF* mutex = LocalDpManagerAttorney::getMutexHandle(*hkManager); MutexIF* mutex = LocalDpManagerAttorney::getMutexHandle(*hkManager);
ReturnValue_t result = mutex->lockMutex(timeoutType, timeoutMs); ReturnValue_t result = mutex->lockMutex(timeoutType, timeoutMs);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = readWithoutLock(); result = readWithoutLock();
@ -49,7 +49,7 @@ inline ReturnValue_t LocalPoolVariable<T>::readWithoutLock() {
PoolEntry<T>* poolEntry = nullptr; PoolEntry<T>* poolEntry = nullptr;
ReturnValue_t result = ReturnValue_t result =
LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId, &poolEntry); LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId, &poolEntry);
if (result != RETURN_OK) { if (result != returnvalue::OK) {
object_id_t ownerObjectId = hkManager->getCreatorObjectId(); object_id_t ownerObjectId = hkManager->getCreatorObjectId();
reportReadCommitError("LocalPoolVariable", result, false, ownerObjectId, localPoolId); reportReadCommitError("LocalPoolVariable", result, false, ownerObjectId, localPoolId);
return result; return result;
@ -57,7 +57,7 @@ inline ReturnValue_t LocalPoolVariable<T>::readWithoutLock() {
this->value = *(poolEntry->getDataPtr()); this->value = *(poolEntry->getDataPtr());
this->valid = poolEntry->getValid(); this->valid = poolEntry->getValid();
return RETURN_OK; return returnvalue::OK;
} }
template <typename T> template <typename T>
@ -75,7 +75,7 @@ inline ReturnValue_t LocalPoolVariable<T>::commit(MutexIF::TimeoutType timeoutTy
} }
MutexIF* mutex = LocalDpManagerAttorney::getMutexHandle(*hkManager); MutexIF* mutex = LocalDpManagerAttorney::getMutexHandle(*hkManager);
ReturnValue_t result = mutex->lockMutex(timeoutType, timeoutMs); ReturnValue_t result = mutex->lockMutex(timeoutType, timeoutMs);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = commitWithoutLock(); result = commitWithoutLock();
@ -95,7 +95,7 @@ inline ReturnValue_t LocalPoolVariable<T>::commitWithoutLock() {
PoolEntry<T>* poolEntry = nullptr; PoolEntry<T>* poolEntry = nullptr;
ReturnValue_t result = ReturnValue_t result =
LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId, &poolEntry); LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId, &poolEntry);
if (result != RETURN_OK) { if (result != returnvalue::OK) {
object_id_t ownerObjectId = hkManager->getCreatorObjectId(); object_id_t ownerObjectId = hkManager->getCreatorObjectId();
reportReadCommitError("LocalPoolVariable", result, false, ownerObjectId, localPoolId); reportReadCommitError("LocalPoolVariable", result, false, ownerObjectId, localPoolId);
return result; return result;
@ -103,7 +103,7 @@ inline ReturnValue_t LocalPoolVariable<T>::commitWithoutLock() {
*(poolEntry->getDataPtr()) = this->value; *(poolEntry->getDataPtr()) = this->value;
poolEntry->setValid(this->valid); poolEntry->setValid(this->valid);
return RETURN_OK; return returnvalue::OK;
} }
template <typename T> template <typename T>

View File

@ -43,14 +43,14 @@ inline ReturnValue_t LocalPoolVector<T, vectorSize>::readWithoutLock() {
LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId, &poolEntry); LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId, &poolEntry);
memset(this->value, 0, vectorSize * sizeof(T)); memset(this->value, 0, vectorSize * sizeof(T));
if (result != RETURN_OK) { if (result != returnvalue::OK) {
object_id_t targetObjectId = hkManager->getCreatorObjectId(); object_id_t targetObjectId = hkManager->getCreatorObjectId();
reportReadCommitError("LocalPoolVector", result, true, targetObjectId, localPoolId); reportReadCommitError("LocalPoolVector", result, true, targetObjectId, localPoolId);
return result; return result;
} }
std::memcpy(this->value, poolEntry->getDataPtr(), poolEntry->getByteSize()); std::memcpy(this->value, poolEntry->getDataPtr(), poolEntry->getByteSize());
this->valid = poolEntry->getValid(); this->valid = poolEntry->getValid();
return RETURN_OK; return returnvalue::OK;
} }
template <typename T, uint16_t vectorSize> template <typename T, uint16_t vectorSize>
@ -79,14 +79,14 @@ inline ReturnValue_t LocalPoolVector<T, vectorSize>::commitWithoutLock() {
PoolEntry<T>* poolEntry = nullptr; PoolEntry<T>* poolEntry = nullptr;
ReturnValue_t result = ReturnValue_t result =
LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId, &poolEntry); LocalDpManagerAttorney::fetchPoolEntry(*hkManager, localPoolId, &poolEntry);
if (result != RETURN_OK) { if (result != returnvalue::OK) {
object_id_t targetObjectId = hkManager->getCreatorObjectId(); object_id_t targetObjectId = hkManager->getCreatorObjectId();
reportReadCommitError("LocalPoolVector", result, false, targetObjectId, localPoolId); reportReadCommitError("LocalPoolVector", result, false, targetObjectId, localPoolId);
return result; return result;
} }
std::memcpy(poolEntry->getDataPtr(), this->value, poolEntry->getByteSize()); std::memcpy(poolEntry->getDataPtr(), this->value, poolEntry->getByteSize());
poolEntry->setValid(this->valid); poolEntry->setValid(this->valid);
return RETURN_OK; return returnvalue::OK;
} }
template <typename T, uint16_t vectorSize> template <typename T, uint16_t vectorSize>
@ -131,10 +131,10 @@ template <typename T, uint16_t vectorSize>
inline ReturnValue_t LocalPoolVector<T, vectorSize>::serialize( inline ReturnValue_t LocalPoolVector<T, vectorSize>::serialize(
uint8_t** buffer, size_t* size, size_t maxSize, uint8_t** buffer, size_t* size, size_t maxSize,
SerializeIF::Endianness streamEndianness) const { SerializeIF::Endianness streamEndianness) const {
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED; ReturnValue_t result = returnvalue::FAILED;
for (uint16_t i = 0; i < vectorSize; i++) { for (uint16_t i = 0; i < vectorSize; i++) {
result = SerializeAdapter::serialize(&(value[i]), buffer, size, maxSize, streamEndianness); result = SerializeAdapter::serialize(&(value[i]), buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
break; break;
} }
} }
@ -149,10 +149,10 @@ inline size_t LocalPoolVector<T, vectorSize>::getSerializedSize() const {
template <typename T, uint16_t vectorSize> template <typename T, uint16_t vectorSize>
inline ReturnValue_t LocalPoolVector<T, vectorSize>::deSerialize( inline ReturnValue_t LocalPoolVector<T, vectorSize>::deSerialize(
const uint8_t** buffer, size_t* size, SerializeIF::Endianness streamEndianness) { const uint8_t** buffer, size_t* size, SerializeIF::Endianness streamEndianness) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED; ReturnValue_t result = returnvalue::FAILED;
for (uint16_t i = 0; i < vectorSize; i++) { for (uint16_t i = 0; i < vectorSize; i++) {
result = SerializeAdapter::deSerialize(&(value[i]), buffer, size, streamEndianness); result = SerializeAdapter::deSerialize(&(value[i]), buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
break; break;
} }
} }

View File

@ -20,7 +20,7 @@ ReturnValue_t SharedLocalDataSet::lockDataset(MutexIF::TimeoutType timeoutType,
if (datasetLock != nullptr) { if (datasetLock != nullptr) {
return datasetLock->lockMutex(timeoutType, mutexTimeout); return datasetLock->lockMutex(timeoutType, mutexTimeout);
} }
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
SharedLocalDataSet::~SharedLocalDataSet() { MutexFactory::instance()->deleteMutex(datasetLock); } SharedLocalDataSet::~SharedLocalDataSet() { MutexFactory::instance()->deleteMutex(datasetLock); }
@ -29,5 +29,5 @@ ReturnValue_t SharedLocalDataSet::unlockDataset() {
if (datasetLock != nullptr) { if (datasetLock != nullptr) {
return datasetLock->unlockMutex(); return datasetLock->unlockMutex();
} }
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }

View File

@ -50,7 +50,7 @@ bool AssemblyBase::isInTransition() {
bool AssemblyBase::handleChildrenChanged() { bool AssemblyBase::handleChildrenChanged() {
if (childrenChangedMode) { if (childrenChangedMode) {
ReturnValue_t result = checkChildrenState(); ReturnValue_t result = checkChildrenState();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
handleChildrenLostMode(result); handleChildrenLostMode(result);
} }
return true; return true;
@ -116,7 +116,7 @@ void AssemblyBase::handleChildrenTransition() {
break; break;
} }
ReturnValue_t result = checkChildrenState(); ReturnValue_t result = checkChildrenState();
if (result == RETURN_OK) { if (result == returnvalue::OK) {
handleModeReached(); handleModeReached();
} else { } else {
handleModeTransitionFailed(result); handleModeTransitionFailed(result);
@ -149,7 +149,7 @@ void AssemblyBase::handleModeTransitionFailed(ReturnValue_t result) {
void AssemblyBase::sendHealthCommand(MessageQueueId_t sendTo, HealthState health) { void AssemblyBase::sendHealthCommand(MessageQueueId_t sendTo, HealthState health) {
CommandMessage command; CommandMessage command;
HealthMessage::setHealthMessage(&command, HealthMessage::HEALTH_SET, health); HealthMessage::setHealthMessage(&command, HealthMessage::HEALTH_SET, health);
if (commandQueue->sendMessage(sendTo, &command) == RETURN_OK) { if (commandQueue->sendMessage(sendTo, &command) == returnvalue::OK) {
commandsOutstanding++; commandsOutstanding++;
} }
} }
@ -164,25 +164,25 @@ ReturnValue_t AssemblyBase::checkChildrenState() {
ReturnValue_t AssemblyBase::checkChildrenStateOff() { ReturnValue_t AssemblyBase::checkChildrenStateOff() {
for (const auto& childIter : childrenMap) { for (const auto& childIter : childrenMap) {
if (checkChildOff(childIter.first) != RETURN_OK) { if (checkChildOff(childIter.first) != returnvalue::OK) {
return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE; return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE;
} }
} }
return RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t AssemblyBase::checkChildOff(uint32_t objectId) { ReturnValue_t AssemblyBase::checkChildOff(uint32_t objectId) {
ChildInfo childInfo = childrenMap.find(objectId)->second; ChildInfo childInfo = childrenMap.find(objectId)->second;
if (healthHelper.healthTable->isCommandable(objectId)) { if (healthHelper.healthTable->isCommandable(objectId)) {
if (childInfo.submode != SUBMODE_NONE) { if (childInfo.submode != SUBMODE_NONE) {
return RETURN_FAILED; return returnvalue::FAILED;
} else { } else {
if ((childInfo.mode != MODE_OFF) && (childInfo.mode != DeviceHandlerIF::MODE_ERROR_ON)) { if ((childInfo.mode != MODE_OFF) && (childInfo.mode != DeviceHandlerIF::MODE_ERROR_ON)) {
return RETURN_FAILED; return returnvalue::FAILED;
} }
} }
} }
return RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t AssemblyBase::checkModeCommand(Mode_t mode, Submode_t submode, ReturnValue_t AssemblyBase::checkModeCommand(Mode_t mode, Submode_t submode,
@ -192,7 +192,7 @@ ReturnValue_t AssemblyBase::checkModeCommand(Mode_t mode, Submode_t submode,
if (submode != SUBMODE_NONE) { if (submode != SUBMODE_NONE) {
return INVALID_SUBMODE; return INVALID_SUBMODE;
} }
return RETURN_OK; return returnvalue::OK;
} }
if ((mode != MODE_ON) && (mode != DeviceHandlerIF::MODE_NORMAL)) { if ((mode != MODE_ON) && (mode != DeviceHandlerIF::MODE_NORMAL)) {
@ -212,7 +212,7 @@ ReturnValue_t AssemblyBase::handleHealthReply(CommandMessage* message) {
if (health != EXTERNAL_CONTROL) { if (health != EXTERNAL_CONTROL) {
updateChildChangedHealth(message->getSender(), true); updateChildChangedHealth(message->getSender(), true);
} }
return RETURN_OK; return returnvalue::OK;
} }
if (message->getCommand() == HealthMessage::REPLY_HEALTH_SET || if (message->getCommand() == HealthMessage::REPLY_HEALTH_SET ||
(message->getCommand() == CommandMessage::REPLY_REJECTED && (message->getCommand() == CommandMessage::REPLY_REJECTED &&
@ -220,9 +220,9 @@ ReturnValue_t AssemblyBase::handleHealthReply(CommandMessage* message) {
if (isInTransition()) { if (isInTransition()) {
commandsOutstanding--; commandsOutstanding--;
} }
return RETURN_OK; return returnvalue::OK;
} }
return RETURN_FAILED; return returnvalue::FAILED;
} }
bool AssemblyBase::checkAndHandleRecovery() { bool AssemblyBase::checkAndHandleRecovery() {

View File

@ -79,7 +79,7 @@ class AssemblyBase : public SubsystemBase {
* @param submode The targeted submmode * @param submode The targeted submmode
* @return Any information why this combination is invalid from HasModesIF * @return Any information why this combination is invalid from HasModesIF
* like HasModesIF::INVALID_SUBMODE. * like HasModesIF::INVALID_SUBMODE.
* On success return HasReturnvaluesIF::RETURN_OK * On success return returnvalue::OK
*/ */
virtual ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) = 0; virtual ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) = 0;

View File

@ -19,7 +19,7 @@ ChildHandlerBase::~ChildHandlerBase() {}
ReturnValue_t ChildHandlerBase::initialize() { ReturnValue_t ChildHandlerBase::initialize() {
ReturnValue_t result = DeviceHandlerBase::initialize(); ReturnValue_t result = DeviceHandlerBase::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -28,7 +28,7 @@ ReturnValue_t ChildHandlerBase::initialize() {
if (parentId != objects::NO_OBJECT) { if (parentId != objects::NO_OBJECT) {
SubsystemBase* parent = ObjectManager::instance()->get<SubsystemBase>(parentId); SubsystemBase* parent = ObjectManager::instance()->get<SubsystemBase>(parentId);
if (parent == NULL) { if (parent == NULL) {
return RETURN_FAILED; return returnvalue::FAILED;
} }
parentQueue = parent->getCommandQueue(); parentQueue = parent->getCommandQueue();
@ -39,5 +39,5 @@ ReturnValue_t ChildHandlerBase::initialize() {
modeHelper.setParentQueue(parentQueue); modeHelper.setParentQueue(parentQueue);
return RETURN_OK; return returnvalue::OK;
} }

View File

@ -34,7 +34,7 @@
* @ingroup interfaces * @ingroup interfaces
* @ingroup comm * @ingroup comm
*/ */
class DeviceCommunicationIF : public HasReturnvaluesIF { class DeviceCommunicationIF {
public: public:
static const uint8_t INTERFACE_ID = CLASS_ID::DEVICE_COMMUNICATION_IF; static const uint8_t INTERFACE_ID = CLASS_ID::DEVICE_COMMUNICATION_IF;

View File

@ -32,7 +32,7 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, object_id_t device
parameterHelper(this), parameterHelper(this),
actionHelper(this, nullptr), actionHelper(this, nullptr),
poolManager(this, nullptr), poolManager(this, nullptr),
childTransitionFailure(RETURN_OK), childTransitionFailure(returnvalue::OK),
fdirInstance(fdirInstance), fdirInstance(fdirInstance),
defaultFDIRUsed(fdirInstance == nullptr), defaultFDIRUsed(fdirInstance == nullptr),
switchOffWasReported(false), switchOffWasReported(false),
@ -45,8 +45,8 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, object_id_t device
cookieInfo.state = COOKIE_UNUSED; cookieInfo.state = COOKIE_UNUSED;
cookieInfo.pendingCommand = deviceCommandMap.end(); cookieInfo.pendingCommand = deviceCommandMap.end();
if (comCookie == nullptr) { if (comCookie == nullptr) {
printWarningOrError(sif::OutputTypes::OUT_ERROR, "DeviceHandlerBase", printWarningOrError(sif::OutputTypes::OUT_ERROR, "DeviceHandlerBase", returnvalue::FAILED,
HasReturnvaluesIF::RETURN_FAILED, "Invalid cookie"); "Invalid cookie");
} }
if (this->fdirInstance == nullptr) { if (this->fdirInstance == nullptr) {
this->fdirInstance = new DeviceHandlerFailureIsolation(setObjectId, defaultFdirParentId); this->fdirInstance = new DeviceHandlerFailureIsolation(setObjectId, defaultFdirParentId);
@ -79,7 +79,7 @@ ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
this->lastStep = this->pstStep; this->lastStep = this->pstStep;
if (getComAction() == CommunicationAction::NOTHING) { if (getComAction() == CommunicationAction::NOTHING) {
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
if (getComAction() == CommunicationAction::PERFORM_OPERATION) { if (getComAction() == CommunicationAction::PERFORM_OPERATION) {
@ -90,11 +90,11 @@ ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
decrementDeviceReplyMap(); decrementDeviceReplyMap();
fdirInstance->checkForFailures(); fdirInstance->checkForFailures();
performOperationHook(); performOperationHook();
return RETURN_OK; return returnvalue::OK;
} }
if (mode == MODE_OFF) { if (mode == MODE_OFF) {
return RETURN_OK; return returnvalue::OK;
} }
switch (getComAction()) { switch (getComAction()) {
@ -120,12 +120,12 @@ ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
default: default:
break; break;
} }
return RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t DeviceHandlerBase::initialize() { ReturnValue_t DeviceHandlerBase::initialize() {
ReturnValue_t result = SystemObject::initialize(); ReturnValue_t result = SystemObject::initialize();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -138,7 +138,7 @@ ReturnValue_t DeviceHandlerBase::initialize() {
} }
result = communicationInterface->initializeInterface(comCookie); result = communicationInterface->initializeInterface(comCookie);
if (result != RETURN_OK) { if (result != returnvalue::OK) {
printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize", printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize",
ObjectManagerIF::CHILD_INIT_FAILED, "ComIF initialization failed"); ObjectManagerIF::CHILD_INIT_FAILED, "ComIF initialization failed");
return result; return result;
@ -192,30 +192,30 @@ ReturnValue_t DeviceHandlerBase::initialize() {
} }
result = healthHelper.initialize(); result = healthHelper.initialize();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = modeHelper.initialize(); result = modeHelper.initialize();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = actionHelper.initialize(commandQueue); result = actionHelper.initialize(commandQueue);
if (result != RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = fdirInstance->initialize(); result = fdirInstance->initialize();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = parameterHelper.initialize(); result = parameterHelper.initialize();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = poolManager.initialize(commandQueue); result = poolManager.initialize(commandQueue);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -224,14 +224,14 @@ ReturnValue_t DeviceHandlerBase::initialize() {
if (thermalSet != nullptr) { if (thermalSet != nullptr) {
// Set temperature target state to NON_OP. // Set temperature target state to NON_OP.
result = thermalSet->read(); result = thermalSet->read();
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == returnvalue::OK) {
thermalSet->heaterRequest.value = ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL; thermalSet->heaterRequest.value = ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL;
thermalSet->heaterRequest.setValid(true); thermalSet->heaterRequest.setValid(true);
thermalSet->commit(); thermalSet->commit();
} }
} }
return RETURN_OK; return returnvalue::OK;
} }
void DeviceHandlerBase::decrementDeviceReplyMap() { void DeviceHandlerBase::decrementDeviceReplyMap() {
@ -265,42 +265,42 @@ void DeviceHandlerBase::readCommandQueue() {
CommandMessage command; CommandMessage command;
ReturnValue_t result = commandQueue->receiveMessage(&command); ReturnValue_t result = commandQueue->receiveMessage(&command);
if (result != RETURN_OK) { if (result != returnvalue::OK) {
return; return;
} }
result = healthHelper.handleHealthCommand(&command); result = healthHelper.handleHealthCommand(&command);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
return; return;
} }
result = modeHelper.handleModeCommand(&command); result = modeHelper.handleModeCommand(&command);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
return; return;
} }
result = actionHelper.handleActionMessage(&command); result = actionHelper.handleActionMessage(&command);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
return; return;
} }
result = parameterHelper.handleParameterMessage(&command); result = parameterHelper.handleParameterMessage(&command);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
return; return;
} }
result = poolManager.handleHousekeepingMessage(&command); result = poolManager.handleHousekeepingMessage(&command);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
return; return;
} }
result = handleDeviceHandlerMessage(&command); result = handleDeviceHandlerMessage(&command);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
return; return;
} }
result = letChildHandleMessage(&command); result = letChildHandleMessage(&command);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
return; return;
} }
@ -328,7 +328,7 @@ void DeviceHandlerBase::doStateMachine() {
sprintf(printout, "Transition timeout (%lu) occured !", sprintf(printout, "Transition timeout (%lu) occured !",
static_cast<unsigned long>(childTransitionDelay)); static_cast<unsigned long>(childTransitionDelay));
/* Common configuration error for development, so print it */ /* Common configuration error for development, so print it */
printWarningOrError(sif::OutputTypes::OUT_WARNING, "doStateMachine", RETURN_FAILED, printWarningOrError(sif::OutputTypes::OUT_WARNING, "doStateMachine", returnvalue::FAILED,
printout); printout);
#endif #endif
triggerEvent(MODE_TRANSITION_FAILED, childTransitionFailure, 0); triggerEvent(MODE_TRANSITION_FAILED, childTransitionFailure, 0);
@ -407,7 +407,7 @@ ReturnValue_t DeviceHandlerBase::isModeCombinationValid(Mode_t mode, Submode_t s
case MODE_NORMAL: case MODE_NORMAL:
case MODE_RAW: case MODE_RAW:
if (submode == SUBMODE_NONE) { if (submode == SUBMODE_NONE) {
return RETURN_OK; return returnvalue::OK;
} else { } else {
return INVALID_SUBMODE; return INVALID_SUBMODE;
} }
@ -444,9 +444,9 @@ ReturnValue_t DeviceHandlerBase::insertInReplyMap(DeviceCommandId_t replyId,
info.countdown = countdown; info.countdown = countdown;
auto resultPair = deviceReplyMap.emplace(replyId, info); auto resultPair = deviceReplyMap.emplace(replyId, info);
if (resultPair.second) { if (resultPair.second) {
return RETURN_OK; return returnvalue::OK;
} else { } else {
return RETURN_FAILED; return returnvalue::FAILED;
} }
} }
@ -461,9 +461,9 @@ ReturnValue_t DeviceHandlerBase::insertInCommandMap(DeviceCommandId_t deviceComm
info.alternativeReplyId = alternativeReplyId; info.alternativeReplyId = alternativeReplyId;
auto resultPair = deviceCommandMap.emplace(deviceCommand, info); auto resultPair = deviceCommandMap.emplace(deviceCommand, info);
if (resultPair.second) { if (resultPair.second) {
return RETURN_OK; return returnvalue::OK;
} else { } else {
return RETURN_FAILED; return returnvalue::FAILED;
} }
} }
@ -499,7 +499,7 @@ ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(DeviceCommandId_t deviceRep
} }
info->delayCycles = delayCycles; info->delayCycles = delayCycles;
info->periodic = periodic; info->periodic = periodic;
return RETURN_OK; return returnvalue::OK;
} }
} }
@ -529,17 +529,17 @@ ReturnValue_t DeviceHandlerBase::updatePeriodicReply(bool enable, DeviceCommandI
} }
} }
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t DeviceHandlerBase::setReplyDataset(DeviceCommandId_t replyId, ReturnValue_t DeviceHandlerBase::setReplyDataset(DeviceCommandId_t replyId,
LocalPoolDataSetBase* dataSet) { LocalPoolDataSetBase* dataSet) {
auto replyIter = deviceReplyMap.find(replyId); auto replyIter = deviceReplyMap.find(replyId);
if (replyIter == deviceReplyMap.end()) { if (replyIter == deviceReplyMap.end()) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
replyIter->second.dataSet = dataSet; replyIter->second.dataSet = dataSet;
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
void DeviceHandlerBase::callChildStatemachine() { void DeviceHandlerBase::callChildStatemachine() {
@ -578,7 +578,7 @@ void DeviceHandlerBase::setMode(Mode_t newMode, uint8_t newSubmode) {
if (mode == MODE_OFF and thermalSet != nullptr) { if (mode == MODE_OFF and thermalSet != nullptr) {
ReturnValue_t result = thermalSet->read(); ReturnValue_t result = thermalSet->read();
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == returnvalue::OK) {
if (thermalSet->heaterRequest.value != ThermalComponentIF::STATE_REQUEST_IGNORE) { if (thermalSet->heaterRequest.value != ThermalComponentIF::STATE_REQUEST_IGNORE) {
thermalSet->heaterRequest.value = ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL; thermalSet->heaterRequest.value = ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL;
} }
@ -593,7 +593,7 @@ void DeviceHandlerBase::setMode(Mode_t newMode) { setMode(newMode, submode); }
void DeviceHandlerBase::replyReturnvalueToCommand(ReturnValue_t status, uint32_t parameter) { void DeviceHandlerBase::replyReturnvalueToCommand(ReturnValue_t status, uint32_t parameter) {
// This is actually the reply protocol for raw and misc DH commands. // This is actually the reply protocol for raw and misc DH commands.
if (status == RETURN_OK) { if (status == returnvalue::OK) {
CommandMessage reply(CommandMessage::REPLY_COMMAND_OK, 0, parameter); CommandMessage reply(CommandMessage::REPLY_COMMAND_OK, 0, parameter);
commandQueue->reply(&reply); commandQueue->reply(&reply);
} else { } else {
@ -606,7 +606,7 @@ void DeviceHandlerBase::replyToCommand(ReturnValue_t status, uint32_t parameter)
// Check if we reply to a raw command. // Check if we reply to a raw command.
if (cookieInfo.pendingCommand->first == RAW_COMMAND_ID) { if (cookieInfo.pendingCommand->first == RAW_COMMAND_ID) {
if (status == NO_REPLY_EXPECTED) { if (status == NO_REPLY_EXPECTED) {
status = RETURN_OK; status = returnvalue::OK;
} }
replyReturnvalueToCommand(status, parameter); replyReturnvalueToCommand(status, parameter);
// Always delete data from a raw command. // Always delete data from a raw command.
@ -617,7 +617,7 @@ void DeviceHandlerBase::replyToCommand(ReturnValue_t status, uint32_t parameter)
if (cookieInfo.pendingCommand->second.sendReplyTo != NO_COMMANDER) { if (cookieInfo.pendingCommand->second.sendReplyTo != NO_COMMANDER) {
MessageQueueId_t queueId = cookieInfo.pendingCommand->second.sendReplyTo; MessageQueueId_t queueId = cookieInfo.pendingCommand->second.sendReplyTo;
if (status == NO_REPLY_EXPECTED) { if (status == NO_REPLY_EXPECTED) {
actionHelper.finish(true, queueId, cookieInfo.pendingCommand->first, RETURN_OK); actionHelper.finish(true, queueId, cookieInfo.pendingCommand->first, returnvalue::OK);
} else { } else {
actionHelper.step(1, queueId, cookieInfo.pendingCommand->first, status); actionHelper.step(1, queueId, cookieInfo.pendingCommand->first, status);
} }
@ -634,8 +634,8 @@ void DeviceHandlerBase::replyToReply(const DeviceCommandId_t command, DeviceRepl
} }
DeviceCommandInfo* info = &replyInfo.command->second; DeviceCommandInfo* info = &replyInfo.command->second;
if (info == nullptr) { if (info == nullptr) {
printWarningOrError(sif::OutputTypes::OUT_ERROR, "replyToReply", printWarningOrError(sif::OutputTypes::OUT_ERROR, "replyToReply", returnvalue::FAILED,
HasReturnvaluesIF::RETURN_FAILED, "Command pointer not found"); "Command pointer not found");
return; return;
} }
@ -649,7 +649,7 @@ void DeviceHandlerBase::replyToReply(const DeviceCommandId_t command, DeviceRepl
// Don't send any replies in that case. // Don't send any replies in that case.
if (info->sendReplyTo != NO_COMMANDER) { if (info->sendReplyTo != NO_COMMANDER) {
bool success = false; bool success = false;
if (status == HasReturnvaluesIF::RETURN_OK) { if (status == returnvalue::OK) {
success = true; success = true;
} }
actionHelper.finish(success, info->sendReplyTo, command, status); actionHelper.finish(success, info->sendReplyTo, command, status);
@ -662,7 +662,7 @@ void DeviceHandlerBase::doSendWrite() {
if (cookieInfo.state == COOKIE_WRITE_READY) { if (cookieInfo.state == COOKIE_WRITE_READY) {
ReturnValue_t result = communicationInterface->sendMessage(comCookie, rawPacket, rawPacketLen); ReturnValue_t result = communicationInterface->sendMessage(comCookie, rawPacket, rawPacketLen);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
cookieInfo.state = COOKIE_WRITE_SENT; cookieInfo.state = COOKIE_WRITE_SENT;
} else { } else {
// always generate a failure event, so that FDIR knows what's up // always generate a failure event, so that FDIR knows what's up
@ -680,7 +680,7 @@ void DeviceHandlerBase::doGetWrite() {
} }
cookieInfo.state = COOKIE_UNUSED; cookieInfo.state = COOKIE_UNUSED;
ReturnValue_t result = communicationInterface->getSendSuccess(comCookie); ReturnValue_t result = communicationInterface->getSendSuccess(comCookie);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
if (wiretappingMode == RAW) { if (wiretappingMode == RAW) {
replyRawData(rawPacket, rawPacketLen, requestedRawTraffic, true); replyRawData(rawPacket, rawPacketLen, requestedRawTraffic, true);
} }
@ -694,7 +694,7 @@ void DeviceHandlerBase::doGetWrite() {
// always generate a failure event, so that FDIR knows what's up // always generate a failure event, so that FDIR knows what's up
triggerEvent(DEVICE_SENDING_COMMAND_FAILED, result, cookieInfo.pendingCommand->first); triggerEvent(DEVICE_SENDING_COMMAND_FAILED, result, cookieInfo.pendingCommand->first);
} }
if (result != RETURN_OK) { if (result != returnvalue::OK) {
cookieInfo.pendingCommand->second.isExecuting = false; cookieInfo.pendingCommand->second.isExecuting = false;
} }
replyToCommand(result); replyToCommand(result);
@ -704,7 +704,7 @@ void DeviceHandlerBase::doSendRead() {
ReturnValue_t result; ReturnValue_t result;
result = doSendReadHook(); result = doSendReadHook();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
return; return;
} }
@ -715,7 +715,7 @@ void DeviceHandlerBase::doSendRead() {
result = communicationInterface->requestReceiveMessage(comCookie, replyLen); result = communicationInterface->requestReceiveMessage(comCookie, replyLen);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
cookieInfo.state = COOKIE_READ_SENT; cookieInfo.state = COOKIE_READ_SENT;
} else { } else {
triggerEvent(DEVICE_REQUESTING_REPLY_FAILED, result); triggerEvent(DEVICE_REQUESTING_REPLY_FAILED, result);
@ -741,7 +741,7 @@ void DeviceHandlerBase::doGetRead() {
ReturnValue_t result = ReturnValue_t result =
communicationInterface->readReceivedMessage(comCookie, &receivedData, &receivedDataLen); communicationInterface->readReceivedMessage(comCookie, &receivedData, &receivedDataLen);
if (result != RETURN_OK) { if (result != returnvalue::OK) {
triggerEvent(DEVICE_REQUESTING_REPLY_FAILED, result); triggerEvent(DEVICE_REQUESTING_REPLY_FAILED, result);
// I think we can allow to ignore one missedReply. // I think we can allow to ignore one missedReply.
ignoreMissedRepliesCount++; ignoreMissedRepliesCount++;
@ -764,7 +764,7 @@ void DeviceHandlerBase::doGetRead() {
} }
void DeviceHandlerBase::parseReply(const uint8_t* receivedData, size_t receivedDataLen) { void DeviceHandlerBase::parseReply(const uint8_t* receivedData, size_t receivedDataLen) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED; ReturnValue_t result = returnvalue::FAILED;
DeviceCommandId_t foundId = DeviceHandlerIF::NO_COMMAND_ID; DeviceCommandId_t foundId = DeviceHandlerIF::NO_COMMAND_ID;
size_t foundLen = 0; size_t foundLen = 0;
/* The loop may not execute more often than the number of received bytes /* The loop may not execute more often than the number of received bytes
@ -773,7 +773,7 @@ void DeviceHandlerBase::parseReply(const uint8_t* receivedData, size_t receivedD
for (uint32_t count = 0; count < receivedDataLen; count++) { for (uint32_t count = 0; count < receivedDataLen; count++) {
result = scanForReply(receivedData, remainingLength, &foundId, &foundLen); result = scanForReply(receivedData, remainingLength, &foundId, &foundLen);
switch (result) { switch (result) {
case RETURN_OK: case returnvalue::OK:
handleReply(receivedData, foundId, foundLen); handleReply(receivedData, foundId, foundLen);
if (foundLen == 0) { if (foundLen == 0) {
printWarningOrError(sif::OutputTypes::OUT_WARNING, "parseReply", printWarningOrError(sif::OutputTypes::OUT_WARNING, "parseReply",
@ -783,7 +783,7 @@ void DeviceHandlerBase::parseReply(const uint8_t* receivedData, size_t receivedD
break; break;
case APERIODIC_REPLY: { case APERIODIC_REPLY: {
result = interpretDeviceReply(foundId, receivedData); result = interpretDeviceReply(foundId, receivedData);
if (result != RETURN_OK) { if (result != returnvalue::OK) {
replyRawReplyIfnotWiretapped(receivedData, foundLen); replyRawReplyIfnotWiretapped(receivedData, foundLen);
triggerEvent(DEVICE_INTERPRETING_REPLY_FAILED, result, foundId); triggerEvent(DEVICE_INTERPRETING_REPLY_FAILED, result, foundId);
} }
@ -846,7 +846,7 @@ void DeviceHandlerBase::handleReply(const uint8_t* receivedData, DeviceCommandId
resetDelayCyclesControlledReply(info); resetDelayCyclesControlledReply(info);
} }
if (result != RETURN_OK) { if (result != returnvalue::OK) {
// Report failed interpretation to FDIR. // Report failed interpretation to FDIR.
replyRawReplyIfnotWiretapped(receivedData, foundLen); replyRawReplyIfnotWiretapped(receivedData, foundLen);
triggerEvent(DEVICE_INTERPRETING_REPLY_FAILED, result, foundId); triggerEvent(DEVICE_INTERPRETING_REPLY_FAILED, result, foundId);
@ -887,12 +887,12 @@ ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress,
if (IPCStore == nullptr) { if (IPCStore == nullptr) {
*data = nullptr; *data = nullptr;
*len = 0; *len = 0;
return RETURN_FAILED; return returnvalue::FAILED;
} }
ReturnValue_t result = IPCStore->modifyData(storageAddress, data, &lenTmp); ReturnValue_t result = IPCStore->modifyData(storageAddress, data, &lenTmp);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
*len = lenTmp; *len = lenTmp;
return RETURN_OK; return returnvalue::OK;
} else { } else {
triggerEvent(StorageManagerIF::GET_DATA_FAILED, result, storageAddress.raw); triggerEvent(StorageManagerIF::GET_DATA_FAILED, result, storageAddress.raw);
*data = nullptr; *data = nullptr;
@ -909,7 +909,7 @@ void DeviceHandlerBase::replyRawData(const uint8_t* data, size_t len, MessageQue
store_address_t address; store_address_t address;
ReturnValue_t result = IPCStore->addData(&address, data, len); ReturnValue_t result = IPCStore->addData(&address, data, len);
if (result != RETURN_OK) { if (result != returnvalue::OK) {
triggerEvent(StorageManagerIF::STORE_DATA_FAILED, result); triggerEvent(StorageManagerIF::STORE_DATA_FAILED, result);
return; return;
} }
@ -921,7 +921,7 @@ void DeviceHandlerBase::replyRawData(const uint8_t* data, size_t len, MessageQue
result = commandQueue->sendMessage(sendTo, &command); result = commandQueue->sendMessage(sendTo, &command);
if (result != RETURN_OK) { if (result != returnvalue::OK) {
IPCStore->deleteData(address); IPCStore->deleteData(address);
// Silently discard data, this indicates heavy TM traffic which // Silently discard data, this indicates heavy TM traffic which
// should not be increased by additional events. // should not be increased by additional events.
@ -957,7 +957,7 @@ MessageQueueId_t DeviceHandlerBase::getCommandQueue() const { return commandQueu
void DeviceHandlerBase::buildRawDeviceCommand(CommandMessage* commandMessage) { void DeviceHandlerBase::buildRawDeviceCommand(CommandMessage* commandMessage) {
storedRawData = DeviceHandlerMessage::getStoreAddress(commandMessage); storedRawData = DeviceHandlerMessage::getStoreAddress(commandMessage);
ReturnValue_t result = getStorageData(storedRawData, &rawPacket, &rawPacketLen); ReturnValue_t result = getStorageData(storedRawData, &rawPacket, &rawPacketLen);
if (result != RETURN_OK) { if (result != returnvalue::OK) {
replyReturnvalueToCommand(result, RAW_COMMAND_ID); replyReturnvalueToCommand(result, RAW_COMMAND_ID);
storedRawData.raw = StorageManagerIF::INVALID_ADDRESS; storedRawData.raw = StorageManagerIF::INVALID_ADDRESS;
} else { } else {
@ -974,7 +974,7 @@ void DeviceHandlerBase::commandSwitch(ReturnValue_t onOff) {
const uint8_t* switches; const uint8_t* switches;
uint8_t numberOfSwitches = 0; uint8_t numberOfSwitches = 0;
ReturnValue_t result = getSwitches(&switches, &numberOfSwitches); ReturnValue_t result = getSwitches(&switches, &numberOfSwitches);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
while (numberOfSwitches > 0) { while (numberOfSwitches > 0) {
powerSwitcher->sendSwitchCommand(switches[numberOfSwitches - 1], onOff); powerSwitcher->sendSwitchCommand(switches[numberOfSwitches - 1], onOff);
numberOfSwitches--; numberOfSwitches--;
@ -982,7 +982,7 @@ void DeviceHandlerBase::commandSwitch(ReturnValue_t onOff) {
} }
} }
ReturnValue_t DeviceHandlerBase::doSendReadHook() { return RETURN_OK; } ReturnValue_t DeviceHandlerBase::doSendReadHook() { return returnvalue::OK; }
ReturnValue_t DeviceHandlerBase::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) { ReturnValue_t DeviceHandlerBase::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
return DeviceHandlerBase::NO_SWITCH; return DeviceHandlerBase::NO_SWITCH;
@ -1011,7 +1011,7 @@ ReturnValue_t DeviceHandlerBase::enableReplyInReplyMap(DeviceCommandMap::iterato
info->countdown->resetTimer(); info->countdown->resetTimer();
} }
info->active = true; info->active = true;
return RETURN_OK; return returnvalue::OK;
} else { } else {
return NO_REPLY_EXPECTED; return NO_REPLY_EXPECTED;
} }
@ -1029,7 +1029,7 @@ ReturnValue_t DeviceHandlerBase::getStateOfSwitches(void) {
const uint8_t* switches; const uint8_t* switches;
ReturnValue_t result = getSwitches(&switches, &numberOfSwitches); ReturnValue_t result = getSwitches(&switches, &numberOfSwitches);
if ((result == RETURN_OK) && (numberOfSwitches != 0)) { if ((result == returnvalue::OK) && (numberOfSwitches != 0)) {
while (numberOfSwitches > 0) { while (numberOfSwitches > 0) {
if (powerSwitcher->getSwitchState(switches[numberOfSwitches - 1]) == if (powerSwitcher->getSwitchState(switches[numberOfSwitches - 1]) ==
PowerSwitchIF::SWITCH_OFF) { PowerSwitchIF::SWITCH_OFF) {
@ -1074,7 +1074,7 @@ ReturnValue_t DeviceHandlerBase::checkModeCommand(Mode_t commandedMode, Submode_
if ((commandedMode == MODE_ON) && (mode == MODE_OFF) and (thermalSet != nullptr)) { if ((commandedMode == MODE_ON) && (mode == MODE_OFF) and (thermalSet != nullptr)) {
ReturnValue_t result = thermalSet->read(); ReturnValue_t result = thermalSet->read();
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == returnvalue::OK) {
if ((thermalSet->heaterRequest.value != ThermalComponentIF::STATE_REQUEST_IGNORE) and if ((thermalSet->heaterRequest.value != ThermalComponentIF::STATE_REQUEST_IGNORE) and
(not ThermalComponentIF::isOperational(thermalSet->thermalState.value))) { (not ThermalComponentIF::isOperational(thermalSet->thermalState.value))) {
triggerEvent(ThermalComponentIF::TEMP_NOT_IN_OP_RANGE, thermalSet->thermalState.value); triggerEvent(ThermalComponentIF::TEMP_NOT_IN_OP_RANGE, thermalSet->thermalState.value);
@ -1134,7 +1134,7 @@ void DeviceHandlerBase::handleTransitionToOnMode(Mode_t commandedMode, Submode_t
triggerEvent(CHANGING_MODE, commandedMode, commandedSubmode); triggerEvent(CHANGING_MODE, commandedMode, commandedSubmode);
if (thermalSet != nullptr) { if (thermalSet != nullptr) {
ReturnValue_t result = thermalSet->read(); ReturnValue_t result = thermalSet->read();
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == returnvalue::OK) {
if (thermalSet->heaterRequest != ThermalComponentIF::STATE_REQUEST_IGNORE) { if (thermalSet->heaterRequest != ThermalComponentIF::STATE_REQUEST_IGNORE) {
thermalSet->heaterRequest = ThermalComponentIF::STATE_REQUEST_OPERATIONAL; thermalSet->heaterRequest = ThermalComponentIF::STATE_REQUEST_OPERATIONAL;
thermalSet->commit(); thermalSet->commit();
@ -1169,7 +1169,7 @@ HasHealthIF::HealthState DeviceHandlerBase::getHealth() { return healthHelper.ge
ReturnValue_t DeviceHandlerBase::setHealth(HealthState health) { ReturnValue_t DeviceHandlerBase::setHealth(HealthState health) {
healthHelper.setHealth(health); healthHelper.setHealth(health);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
void DeviceHandlerBase::checkSwitchState() { void DeviceHandlerBase::checkSwitchState() {
@ -1191,7 +1191,7 @@ ReturnValue_t DeviceHandlerBase::acceptExternalDeviceCommands() {
if ((mode != MODE_ON) && (mode != MODE_NORMAL)) { if ((mode != MODE_ON) && (mode != MODE_NORMAL)) {
return WRONG_MODE_FOR_COMMAND; return WRONG_MODE_FOR_COMMAND;
} }
return RETURN_OK; return returnvalue::OK;
} }
void DeviceHandlerBase::replyRawReplyIfnotWiretapped(const uint8_t* data, size_t len) { void DeviceHandlerBase::replyRawReplyIfnotWiretapped(const uint8_t* data, size_t len) {
@ -1220,10 +1220,10 @@ ReturnValue_t DeviceHandlerBase::handleDeviceHandlerMessage(CommandMessage* mess
default: default:
replyReturnvalueToCommand(INVALID_COMMAND_PARAMETER); replyReturnvalueToCommand(INVALID_COMMAND_PARAMETER);
wiretappingMode = OFF; wiretappingMode = OFF;
return RETURN_OK; return returnvalue::OK;
} }
replyReturnvalueToCommand(RETURN_OK); replyReturnvalueToCommand(returnvalue::OK);
return RETURN_OK; return returnvalue::OK;
case DeviceHandlerMessage::CMD_RAW: case DeviceHandlerMessage::CMD_RAW:
if ((mode != MODE_RAW)) { if ((mode != MODE_RAW)) {
DeviceHandlerMessage::clear(message); DeviceHandlerMessage::clear(message);
@ -1231,9 +1231,9 @@ ReturnValue_t DeviceHandlerBase::handleDeviceHandlerMessage(CommandMessage* mess
} else { } else {
buildRawDeviceCommand(message); buildRawDeviceCommand(message);
} }
return RETURN_OK; return returnvalue::OK;
default: default:
return RETURN_FAILED; return returnvalue::FAILED;
} }
} }
@ -1254,7 +1254,7 @@ bool DeviceHandlerBase::isAwaitingReply() {
} }
ReturnValue_t DeviceHandlerBase::letChildHandleMessage(CommandMessage* message) { ReturnValue_t DeviceHandlerBase::letChildHandleMessage(CommandMessage* message) {
return RETURN_FAILED; return returnvalue::FAILED;
} }
void DeviceHandlerBase::handleDeviceTM(SerializeIF* dataSet, DeviceCommandId_t replyId, void DeviceHandlerBase::handleDeviceTM(SerializeIF* dataSet, DeviceCommandId_t replyId,
@ -1316,7 +1316,7 @@ void DeviceHandlerBase::handleDeviceTM(SerializeIF* dataSet, DeviceCommandId_t r
ReturnValue_t DeviceHandlerBase::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, ReturnValue_t DeviceHandlerBase::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) { const uint8_t* data, size_t size) {
ReturnValue_t result = acceptExternalDeviceCommands(); ReturnValue_t result = acceptExternalDeviceCommands();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
DeviceCommandMap::iterator iter = deviceCommandMap.find(actionId); DeviceCommandMap::iterator iter = deviceCommandMap.find(actionId);
@ -1327,7 +1327,7 @@ ReturnValue_t DeviceHandlerBase::executeAction(ActionId_t actionId, MessageQueue
} else { } else {
result = buildCommandFromCommand(actionId, data, size); result = buildCommandFromCommand(actionId, data, size);
} }
if (result == RETURN_OK) { if (result == returnvalue::OK) {
iter->second.sendReplyTo = commandedBy; iter->second.sendReplyTo = commandedBy;
iter->second.isExecuting = true; iter->second.isExecuting = true;
cookieInfo.pendingCommand = iter; cookieInfo.pendingCommand = iter;
@ -1345,7 +1345,7 @@ void DeviceHandlerBase::buildInternalCommand(void) {
if (result == BUSY) { if (result == BUSY) {
/* So we can track misconfigurations */ /* So we can track misconfigurations */
printWarningOrError(sif::OutputTypes::OUT_WARNING, "buildInternalCommand", printWarningOrError(sif::OutputTypes::OUT_WARNING, "buildInternalCommand",
HasReturnvaluesIF::RETURN_FAILED, "Busy."); returnvalue::FAILED, "Busy.");
/* No need to report this */ /* No need to report this */
result = NOTHING_TO_SEND; result = NOTHING_TO_SEND;
} }
@ -1361,7 +1361,7 @@ void DeviceHandlerBase::buildInternalCommand(void) {
if (result == NOTHING_TO_SEND) { if (result == NOTHING_TO_SEND) {
return; return;
} }
if (result == RETURN_OK) { if (result == returnvalue::OK) {
DeviceCommandMap::iterator iter = deviceCommandMap.find(deviceCommandId); DeviceCommandMap::iterator iter = deviceCommandMap.find(deviceCommandId);
if (iter == deviceCommandMap.end()) { if (iter == deviceCommandMap.end()) {
#if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_VERBOSE_LEVEL >= 1
@ -1378,7 +1378,7 @@ void DeviceHandlerBase::buildInternalCommand(void) {
sprintf(output, "Command 0x%08x is executing", static_cast<unsigned int>(deviceCommandId)); sprintf(output, "Command 0x%08x is executing", static_cast<unsigned int>(deviceCommandId));
// so we can track misconfigurations // so we can track misconfigurations
printWarningOrError(sif::OutputTypes::OUT_WARNING, "buildInternalCommand", printWarningOrError(sif::OutputTypes::OUT_WARNING, "buildInternalCommand",
HasReturnvaluesIF::RETURN_FAILED, output); returnvalue::FAILED, output);
#endif #endif
// this is an internal command, no need to report a failure here, // this is an internal command, no need to report a failure here,
// missed reply will track if a reply is too late, otherwise, it's ok // missed reply will track if a reply is too late, otherwise, it's ok
@ -1390,7 +1390,7 @@ void DeviceHandlerBase::buildInternalCommand(void) {
cookieInfo.state = COOKIE_WRITE_READY; cookieInfo.state = COOKIE_WRITE_READY;
} }
} }
if (result != RETURN_OK) { if (result != returnvalue::OK) {
triggerEvent(DEVICE_BUILDING_COMMAND_FAILED, result, deviceCommandId); triggerEvent(DEVICE_BUILDING_COMMAND_FAILED, result, deviceCommandId);
} }
} }
@ -1466,7 +1466,7 @@ ReturnValue_t DeviceHandlerBase::initializeLocalDataPool(localpool::DataPool& lo
localDataPoolMap.emplace(thermalSet->heaterRequestPoolId, localDataPoolMap.emplace(thermalSet->heaterRequestPoolId,
new PoolEntry<DeviceHandlerIF::dh_heater_request_t>); new PoolEntry<DeviceHandlerIF::dh_heater_request_t>);
} }
return RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t DeviceHandlerBase::initializeAfterTaskCreation() { ReturnValue_t DeviceHandlerBase::initializeAfterTaskCreation() {
@ -1480,7 +1480,7 @@ ReturnValue_t DeviceHandlerBase::initializeAfterTaskCreation() {
if (setStartupImmediately) { if (setStartupImmediately) {
startTransition(MODE_ON, SUBMODE_NONE); startTransition(MODE_ON, SUBMODE_NONE);
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
LocalPoolDataSetBase* DeviceHandlerBase::getDataSetHandle(sid_t sid) { LocalPoolDataSetBase* DeviceHandlerBase::getDataSetHandle(sid_t sid) {
@ -1518,7 +1518,7 @@ void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType, const ch
if (errorPrint == nullptr) { if (errorPrint == nullptr) {
if (errorCode == ObjectManagerIF::CHILD_INIT_FAILED) { if (errorCode == ObjectManagerIF::CHILD_INIT_FAILED) {
errorPrint = "Initialization error"; errorPrint = "Initialization error";
} else if (errorCode == HasReturnvaluesIF::RETURN_FAILED) { } else if (errorCode == returnvalue::FAILED) {
if (errorType == sif::OutputTypes::OUT_WARNING) { if (errorType == sif::OutputTypes::OUT_WARNING) {
errorPrint = "Generic Warning"; errorPrint = "Generic Warning";
} else { } else {

View File

@ -78,7 +78,6 @@ class StorageManagerIF;
* @ingroup devices * @ingroup devices
*/ */
class DeviceHandlerBase : public DeviceHandlerIF, class DeviceHandlerBase : public DeviceHandlerIF,
public HasReturnvaluesIF,
public ExecutableObjectIF, public ExecutableObjectIF,
public SystemObject, public SystemObject,
public HasModesIF, public HasModesIF,
@ -359,7 +358,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* buffer is scanned at previous position + foundLen. * buffer is scanned at previous position + foundLen.
* @return * @return
* - @c RETURN_OK a valid packet was found at @c start, @c foundLen is valid * - @c RETURN_OK a valid packet was found at @c start, @c foundLen is valid
* - @c RETURN_FAILED no reply could be found starting at @c start, * - @c returnvalue::FAILED no reply could be found starting at @c start,
* implies @c foundLen is not valid, base class will call scanForReply() * implies @c foundLen is not valid, base class will call scanForReply()
* again with ++start * again with ++start
* - @c DeviceHandlerIF::INVALID_DATA a packet was found but it is invalid, * - @c DeviceHandlerIF::INVALID_DATA a packet was found but it is invalid,
@ -391,7 +390,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* - @c RETURN_OK when the reply was interpreted. * - @c RETURN_OK when the reply was interpreted.
* - @c IGNORE_REPLY_DATA Ignore the reply and don't reset reply cycle * - @c IGNORE_REPLY_DATA Ignore the reply and don't reset reply cycle
* counter. * counter.
* - @c RETURN_FAILED when the reply could not be interpreted, * - @c returnvalue::FAILED when the reply could not be interpreted,
* e.g. logical errors or range violations occurred * e.g. logical errors or range violations occurred
*/ */
virtual ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) = 0; virtual ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) = 0;
@ -452,7 +451,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* to provide a pointer to a Countdown object which will signal the timeout * to provide a pointer to a Countdown object which will signal the timeout
* when expired * when expired
* @return - @c RETURN_OK when the command was successfully inserted, * @return - @c RETURN_OK when the command was successfully inserted,
* - @c RETURN_FAILED else. * - @c returnvalue::FAILED else.
*/ */
ReturnValue_t insertInCommandAndReplyMap(DeviceCommandId_t deviceCommand, uint16_t maxDelayCycles, ReturnValue_t insertInCommandAndReplyMap(DeviceCommandId_t deviceCommand, uint16_t maxDelayCycles,
LocalPoolDataSetBase *replyDataSet = nullptr, LocalPoolDataSetBase *replyDataSet = nullptr,
@ -473,7 +472,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* to provide a pointer to a Countdown object which will signal the timeout * to provide a pointer to a Countdown object which will signal the timeout
* when expired * when expired
* @return - @c RETURN_OK when the command was successfully inserted, * @return - @c RETURN_OK when the command was successfully inserted,
* - @c RETURN_FAILED else. * - @c returnvalue::FAILED else.
*/ */
ReturnValue_t insertInReplyMap(DeviceCommandId_t deviceCommand, uint16_t maxDelayCycles, ReturnValue_t insertInReplyMap(DeviceCommandId_t deviceCommand, uint16_t maxDelayCycles,
LocalPoolDataSetBase *dataSet = nullptr, size_t replyLen = 0, LocalPoolDataSetBase *dataSet = nullptr, size_t replyLen = 0,
@ -483,7 +482,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* @brief A simple command to add a command to the commandList. * @brief A simple command to add a command to the commandList.
* @param deviceCommand The command to add * @param deviceCommand The command to add
* @return - @c RETURN_OK when the command was successfully inserted, * @return - @c RETURN_OK when the command was successfully inserted,
* - @c RETURN_FAILED else. * - @c returnvalue::FAILED else.
*/ */
ReturnValue_t insertInCommandMap(DeviceCommandId_t deviceCommand, ReturnValue_t insertInCommandMap(DeviceCommandId_t deviceCommand,
bool useAlternativeReply = false, bool useAlternativeReply = false,
@ -520,7 +519,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* by the device repeatedly without request) or not. Default is aperiodic (0). * by the device repeatedly without request) or not. Default is aperiodic (0).
* Warning: The setting always overrides the value that was entered in the map. * Warning: The setting always overrides the value that was entered in the map.
* @return - @c RETURN_OK when the command was successfully inserted, * @return - @c RETURN_OK when the command was successfully inserted,
* - @c RETURN_FAILED else. * - @c returnvalue::FAILED else.
*/ */
ReturnValue_t updateReplyMapEntry(DeviceCommandId_t deviceReply, uint16_t delayCycles, ReturnValue_t updateReplyMapEntry(DeviceCommandId_t deviceReply, uint16_t delayCycles,
uint16_t maxDelayCycles, bool periodic = false); uint16_t maxDelayCycles, bool periodic = false);
@ -604,7 +603,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* @param submode * @param submode
* @return * @return
* - @c RETURN_OK if valid * - @c RETURN_OK if valid
* - @c RETURN_FAILED if invalid * - @c returnvalue::FAILED if invalid
*/ */
virtual ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode); virtual ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode);
/** /**
@ -624,7 +623,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* @param[out] numberOfSwitches length of returned array * @param[out] numberOfSwitches length of returned array
* @return * @return
* - @c RETURN_OK if the parameters were set * - @c RETURN_OK if the parameters were set
* - @c RETURN_FAILED if no switches exist * - @c returnvalue::FAILED if no switches exist
*/ */
virtual ReturnValue_t getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches); virtual ReturnValue_t getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches);
@ -1033,7 +1032,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* by #switches are on * by #switches are on
* - @c PowerSwitchIF::SWITCH_OFF one of the switches specified by * - @c PowerSwitchIF::SWITCH_OFF one of the switches specified by
* #switches are off * #switches are off
* - @c PowerSwitchIF::RETURN_FAILED if an error occured * - @c PowerSwitchIF::returnvalue::FAILED if an error occured
*/ */
ReturnValue_t getStateOfSwitches(); ReturnValue_t getStateOfSwitches();
@ -1275,7 +1274,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* @param[out] len * @param[out] len
* @return * @return
* - @c RETURN_OK @c data is valid * - @c RETURN_OK @c data is valid
* - @c RETURN_FAILED IPCStore is nullptr * - @c returnvalue::FAILED IPCStore is nullptr
* - the return value from the IPCStore if it was not @c RETURN_OK * - the return value from the IPCStore if it was not @c RETURN_OK
*/ */
ReturnValue_t getStorageData(store_address_t storageAddress, uint8_t **data, size_t *len); ReturnValue_t getStorageData(store_address_t storageAddress, uint8_t **data, size_t *len);
@ -1306,7 +1305,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* @param errorPrint * @param errorPrint
*/ */
void printWarningOrError(sif::OutputTypes errorType, const char *functionName, void printWarningOrError(sif::OutputTypes errorType, const char *functionName,
ReturnValue_t errorCode = HasReturnvaluesIF::RETURN_FAILED, ReturnValue_t errorCode = returnvalue::FAILED,
const char *errorPrint = nullptr); const char *errorPrint = nullptr);
}; };

View File

@ -23,9 +23,9 @@ DeviceHandlerFailureIsolation::~DeviceHandlerFailureIsolation() {}
ReturnValue_t DeviceHandlerFailureIsolation::eventReceived(EventMessage* event) { ReturnValue_t DeviceHandlerFailureIsolation::eventReceived(EventMessage* event) {
if (isFdirInActionOrAreWeFaulty(event)) { if (isFdirInActionOrAreWeFaulty(event)) {
return RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t result = RETURN_FAILED; ReturnValue_t result = returnvalue::FAILED;
switch (event->getEvent()) { switch (event->getEvent()) {
case HasModesIF::MODE_TRANSITION_FAILED: case HasModesIF::MODE_TRANSITION_FAILED:
case HasModesIF::OBJECT_IN_INVALID_MODE: case HasModesIF::OBJECT_IN_INVALID_MODE:
@ -48,7 +48,7 @@ ReturnValue_t DeviceHandlerFailureIsolation::eventReceived(EventMessage* event)
// The two above should never be confirmed. // The two above should never be confirmed.
case DeviceHandlerIF::DEVICE_MISSED_REPLY: case DeviceHandlerIF::DEVICE_MISSED_REPLY:
result = sendConfirmationRequest(event); result = sendConfirmationRequest(event);
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == returnvalue::OK) {
break; break;
} }
// else // else
@ -72,7 +72,7 @@ ReturnValue_t DeviceHandlerFailureIsolation::eventReceived(EventMessage* event)
case PowerSwitchIF::SWITCH_WENT_OFF: case PowerSwitchIF::SWITCH_WENT_OFF:
if (powerConfirmation != MessageQueueIF::NO_QUEUE) { if (powerConfirmation != MessageQueueIF::NO_QUEUE) {
result = sendConfirmationRequest(event, powerConfirmation); result = sendConfirmationRequest(event, powerConfirmation);
if (result == RETURN_OK) { if (result == returnvalue::OK) {
setFdirState(DEVICE_MIGHT_BE_OFF); setFdirState(DEVICE_MIGHT_BE_OFF);
} }
} }
@ -106,9 +106,9 @@ ReturnValue_t DeviceHandlerFailureIsolation::eventReceived(EventMessage* event)
// break; // break;
default: default:
// We don't know the event, someone else should handle it. // We don't know the event, someone else should handle it.
return RETURN_FAILED; return returnvalue::FAILED;
} }
return RETURN_OK; return returnvalue::OK;
} }
void DeviceHandlerFailureIsolation::eventConfirmed(EventMessage* event) { void DeviceHandlerFailureIsolation::eventConfirmed(EventMessage* event) {
@ -162,7 +162,7 @@ void DeviceHandlerFailureIsolation::clearFaultCounters() {
ReturnValue_t DeviceHandlerFailureIsolation::initialize() { ReturnValue_t DeviceHandlerFailureIsolation::initialize() {
ReturnValue_t result = FailureIsolationBase::initialize(); ReturnValue_t result = FailureIsolationBase::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "DeviceHandlerFailureIsolation::initialize: Could not" sif::error << "DeviceHandlerFailureIsolation::initialize: Could not"
" initialize FailureIsolationBase." " initialize FailureIsolationBase."
@ -176,7 +176,7 @@ ReturnValue_t DeviceHandlerFailureIsolation::initialize() {
powerConfirmation = power->getEventReceptionQueue(); powerConfirmation = power->getEventReceptionQueue();
} }
return RETURN_OK; return returnvalue::OK;
} }
void DeviceHandlerFailureIsolation::setFdirState(FDIRState state) { void DeviceHandlerFailureIsolation::setFdirState(FDIRState state) {

View File

@ -12,11 +12,11 @@ ReturnValue_t DeviceTmReportingWrapper::serialize(uint8_t** buffer, size_t* size
Endianness streamEndianness) const { Endianness streamEndianness) const {
ReturnValue_t result = ReturnValue_t result =
SerializeAdapter::serialize(&objectId, buffer, size, maxSize, streamEndianness); SerializeAdapter::serialize(&objectId, buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = SerializeAdapter::serialize(&actionId, buffer, size, maxSize, streamEndianness); result = SerializeAdapter::serialize(&actionId, buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
return data->serialize(buffer, size, maxSize, streamEndianness); return data->serialize(buffer, size, maxSize, streamEndianness);
@ -29,11 +29,11 @@ size_t DeviceTmReportingWrapper::getSerializedSize() const {
ReturnValue_t DeviceTmReportingWrapper::deSerialize(const uint8_t** buffer, size_t* size, ReturnValue_t DeviceTmReportingWrapper::deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) { Endianness streamEndianness) {
ReturnValue_t result = SerializeAdapter::deSerialize(&objectId, buffer, size, streamEndianness); ReturnValue_t result = SerializeAdapter::deSerialize(&objectId, buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = SerializeAdapter::deSerialize(&actionId, buffer, size, streamEndianness); result = SerializeAdapter::deSerialize(&actionId, buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
return data->deSerialize(buffer, size, streamEndianness); return data->deSerialize(buffer, size, streamEndianness);

View File

@ -16,7 +16,7 @@ HealthDevice::~HealthDevice() { QueueFactory::instance()->deleteMessageQueue(com
ReturnValue_t HealthDevice::performOperation(uint8_t opCode) { ReturnValue_t HealthDevice::performOperation(uint8_t opCode) {
CommandMessage command; CommandMessage command;
ReturnValue_t result = commandQueue->receiveMessage(&command); ReturnValue_t result = commandQueue->receiveMessage(&command);
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == returnvalue::OK) {
result = healthHelper.handleHealthCommand(&command); result = healthHelper.handleHealthCommand(&command);
} }
return result; return result;
@ -24,7 +24,7 @@ ReturnValue_t HealthDevice::performOperation(uint8_t opCode) {
ReturnValue_t HealthDevice::initialize() { ReturnValue_t HealthDevice::initialize() {
ReturnValue_t result = SystemObject::initialize(); ReturnValue_t result = SystemObject::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (parentQueue != 0) { if (parentQueue != 0) {
@ -50,7 +50,7 @@ bool HealthDevice::hasHealthChanged() {
ReturnValue_t HealthDevice::setHealth(HealthState health) { ReturnValue_t HealthDevice::setHealth(HealthState health) {
healthHelper.setHealth(health); healthHelper.setHealth(health);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
HasHealthIF::HealthState HealthDevice::getHealth() { return healthHelper.getHealth(); } HasHealthIF::HealthState HealthDevice::getHealth() { return healthHelper.getHealth(); }

View File

@ -30,18 +30,18 @@ EventManager::~EventManager() {
MessageQueueId_t EventManager::getEventReportQueue() { return eventReportQueue->getId(); } MessageQueueId_t EventManager::getEventReportQueue() { return eventReportQueue->getId(); }
ReturnValue_t EventManager::performOperation(uint8_t opCode) { ReturnValue_t EventManager::performOperation(uint8_t opCode) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = returnvalue::OK;
while (result == HasReturnvaluesIF::RETURN_OK) { while (result == returnvalue::OK) {
EventMessage message; EventMessage message;
result = eventReportQueue->receiveMessage(&message); result = eventReportQueue->receiveMessage(&message);
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == returnvalue::OK) {
#if FSFW_OBJ_EVENT_TRANSLATION == 1 #if FSFW_OBJ_EVENT_TRANSLATION == 1
printEvent(&message); printEvent(&message);
#endif #endif
notifyListeners(&message); notifyListeners(&message);
} }
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
void EventManager::notifyListeners(EventMessage* message) { void EventManager::notifyListeners(EventMessage* message) {
@ -59,9 +59,9 @@ ReturnValue_t EventManager::registerListener(MessageQueueId_t listener,
auto result = listenerList.insert(std::pair<MessageQueueId_t, EventMatchTree>( auto result = listenerList.insert(std::pair<MessageQueueId_t, EventMatchTree>(
listener, EventMatchTree(&factoryBackend, forwardAllButSelected))); listener, EventMatchTree(&factoryBackend, forwardAllButSelected)));
if (!result.second) { if (!result.second) {
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t EventManager::subscribeToEvent(MessageQueueId_t listener, EventId_t event) { ReturnValue_t EventManager::subscribeToEvent(MessageQueueId_t listener, EventId_t event) {

View File

@ -31,12 +31,12 @@ ReturnValue_t EventMatchTree::addMatch(EventId_t idFrom, EventId_t idTo, bool id
iterator lastTest; iterator lastTest;
ReturnValue_t result = findOrInsertRangeMatcher<EventId_t, EventIdRangeMatcher>( ReturnValue_t result = findOrInsertRangeMatcher<EventId_t, EventIdRangeMatcher>(
begin(), idFrom, idTo, idInverted, &lastTest); begin(), idFrom, idTo, idInverted, &lastTest);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (reporterFrom == 0) { if (reporterFrom == 0) {
// No need to add another AND branch // No need to add another AND branch
return RETURN_OK; return returnvalue::OK;
} }
if (reporterTo == 0) { if (reporterTo == 0) {
reporterTo = reporterFrom; reporterTo = reporterFrom;
@ -95,7 +95,7 @@ inline ReturnValue_t EventMatchTree::findOrInsertRangeMatcher(iterator start, VA
if ((matcher->rangeMatcher.lowerBound == idFrom) && if ((matcher->rangeMatcher.lowerBound == idFrom) &&
(matcher->rangeMatcher.upperBound == idTo) && (matcher->rangeMatcher.upperBound == idTo) &&
(matcher->rangeMatcher.inverted == inverted)) { (matcher->rangeMatcher.inverted == inverted)) {
return RETURN_OK; return returnvalue::OK;
} else { } else {
iter = iter.right(); iter = iter.right();
} }
@ -115,9 +115,9 @@ inline ReturnValue_t EventMatchTree::findOrInsertRangeMatcher(iterator start, VA
*lastTest = insert(attachToBranch, *lastTest, newNode); *lastTest = insert(attachToBranch, *lastTest, newNode);
if (*lastTest == end()) { if (*lastTest == end()) {
// This actaully never fails, so creating a dedicated returncode seems an overshoot. // This actaully never fails, so creating a dedicated returncode seems an overshoot.
return RETURN_FAILED; return returnvalue::FAILED;
} }
return RETURN_OK; return returnvalue::OK;
} }
template <typename VALUE_T, typename INSERTION_T> template <typename VALUE_T, typename INSERTION_T>

View File

@ -7,7 +7,7 @@
#include "../../returnvalues/HasReturnvaluesIF.h" #include "../../returnvalues/HasReturnvaluesIF.h"
class StorageManagerIF; class StorageManagerIF;
class EventMatchTree : public MatchTree<EventMessage*>, public HasReturnvaluesIF { class EventMatchTree : public MatchTree<EventMessage*> {
public: public:
EventMatchTree(StorageManagerIF* storageBackend, bool invertedMatch); EventMatchTree(StorageManagerIF* storageBackend, bool invertedMatch);
virtual ~EventMatchTree(); virtual ~EventMatchTree();

View File

@ -35,15 +35,15 @@ ReturnValue_t FailureIsolationBase::initialize() {
" been initialized!" " been initialized!"
<< std::endl; << std::endl;
#endif #endif
return RETURN_FAILED; return returnvalue::FAILED;
} }
ReturnValue_t result = manager->registerListener(eventQueue->getId()); ReturnValue_t result = manager->registerListener(eventQueue->getId());
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (ownerId != objects::NO_OBJECT) { if (ownerId != objects::NO_OBJECT) {
result = manager->subscribeToAllEventsFrom(eventQueue->getId(), ownerId); result = manager->subscribeToAllEventsFrom(eventQueue->getId(), ownerId);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
owner = ObjectManager::instance()->get<HasHealthIF>(ownerId); owner = ObjectManager::instance()->get<HasHealthIF>(ownerId);
@ -68,16 +68,16 @@ ReturnValue_t FailureIsolationBase::initialize() {
sif::error << "Make sure it implements ConfirmsFailuresIF." << std::endl; sif::error << "Make sure it implements ConfirmsFailuresIF." << std::endl;
#endif #endif
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
return RETURN_FAILED; return returnvalue::FAILED;
} }
eventQueue->setDefaultDestination(parentIF->getEventReceptionQueue()); eventQueue->setDefaultDestination(parentIF->getEventReceptionQueue());
} }
return RETURN_OK; return returnvalue::OK;
} }
void FailureIsolationBase::checkForFailures() { void FailureIsolationBase::checkForFailures() {
EventMessage event; EventMessage event;
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == RETURN_OK; for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK;
result = eventQueue->receiveMessage(&event)) { result = eventQueue->receiveMessage(&event)) {
if (event.getSender() == eventQueue->getId()) { if (event.getSender() == eventQueue->getId()) {
// We already got this event, because we sent it. // We already got this event, because we sent it.
@ -124,7 +124,7 @@ ReturnValue_t FailureIsolationBase::sendConfirmationRequest(EventMessage* event,
} else if (faultTreeParent != objects::NO_OBJECT) { } else if (faultTreeParent != objects::NO_OBJECT) {
return eventQueue->sendToDefault(event); return eventQueue->sendToDefault(event);
} }
return RETURN_FAILED; return returnvalue::FAILED;
} }
void FailureIsolationBase::eventConfirmed(EventMessage* event) {} void FailureIsolationBase::eventConfirmed(EventMessage* event) {}

View File

@ -9,9 +9,7 @@
#include "ConfirmsFailuresIF.h" #include "ConfirmsFailuresIF.h"
#include "FaultCounter.h" #include "FaultCounter.h"
class FailureIsolationBase : public HasReturnvaluesIF, class FailureIsolationBase : public ConfirmsFailuresIF, public HasParametersIF {
public ConfirmsFailuresIF,
public HasParametersIF {
public: public:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::FDIR_1; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::FDIR_1;
static const Event FDIR_CHANGED_STATE = static const Event FDIR_CHANGED_STATE =

View File

@ -73,7 +73,7 @@ ReturnValue_t FaultCounter::getParameter(uint8_t domainId, uint8_t uniqueId,
default: default:
return INVALID_IDENTIFIER_ID; return INVALID_IDENTIFIER_ID;
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
void FaultCounter::setParameterDomain(uint8_t domain) { parameterDomain = domain; } void FaultCounter::setParameterDomain(uint8_t domain) { parameterDomain = domain; }

View File

@ -44,7 +44,7 @@ ReturnValue_t AsciiConverter::scanAsciiHexByte(const uint8_t** dataPtr, uint8_t*
*value = *value >> 4; *value = *value >> 4;
} }
return RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t AsciiConverter::scanAsciiDecimalNumber_(uint8_t const** dataPtr, uint8_t len, ReturnValue_t AsciiConverter::scanAsciiDecimalNumber_(uint8_t const** dataPtr, uint8_t len,
@ -99,7 +99,7 @@ ReturnValue_t AsciiConverter::scanAsciiDecimalNumber_(uint8_t const** dataPtr, u
*dataPtr = ptr; *dataPtr = ptr;
return RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t AsciiConverter::printFloat(uint8_t* buffer, uint32_t bufferLength, float value, ReturnValue_t AsciiConverter::printFloat(uint8_t* buffer, uint32_t bufferLength, float value,
@ -124,7 +124,7 @@ ReturnValue_t AsciiConverter::printFloat(uint8_t* buffer, uint32_t bufferLength,
ReturnValue_t result = ReturnValue_t result =
printInteger(buffer + streamposition, bufferLength - streamposition - decimalPlaces - 1, printInteger(buffer + streamposition, bufferLength - streamposition - decimalPlaces - 1,
value, &integerSize); value, &integerSize);
if (result != RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
streamposition += integerSize; streamposition += integerSize;
@ -161,7 +161,7 @@ ReturnValue_t AsciiConverter::printInteger(uint8_t* buffer, uint32_t bufferLengt
} }
if (!leadingZeros && (value == 0)) { if (!leadingZeros && (value == 0)) {
buffer[(*printedSize)++] = '0'; buffer[(*printedSize)++] = '0';
return RETURN_OK; return returnvalue::OK;
} }
while (maximumNumber >= 1) { while (maximumNumber >= 1) {
uint8_t number = value / maximumNumber; uint8_t number = value / maximumNumber;
@ -174,7 +174,7 @@ ReturnValue_t AsciiConverter::printInteger(uint8_t* buffer, uint32_t bufferLengt
maximumNumber /= 10; maximumNumber /= 10;
} }
} }
return RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t AsciiConverter::printSignedInteger(uint8_t* buffer, uint32_t bufferLength, ReturnValue_t AsciiConverter::printSignedInteger(uint8_t* buffer, uint32_t bufferLength,

View File

@ -3,7 +3,7 @@
#include "../returnvalues/HasReturnvaluesIF.h" #include "../returnvalues/HasReturnvaluesIF.h"
class AsciiConverter : public HasReturnvaluesIF { class AsciiConverter {
public: public:
static const uint8_t INTERFACE_ID = CLASS_ID::ASCII_CONVERTER; static const uint8_t INTERFACE_ID = CLASS_ID::ASCII_CONVERTER;
static const ReturnValue_t TOO_LONG_FOR_TARGET_TYPE = MAKE_RETURN_CODE(1); static const ReturnValue_t TOO_LONG_FOR_TARGET_TYPE = MAKE_RETURN_CODE(1);

View File

@ -73,7 +73,7 @@ ReturnValue_t DleEncoder::encodeStreamEscaped(const uint8_t *sourceStream, size_
++encodedIndex; ++encodedIndex;
} }
*encodedLen = encodedIndex; *encodedLen = encodedIndex;
return RETURN_OK; return returnvalue::OK;
} else { } else {
return STREAM_TOO_SHORT; return STREAM_TOO_SHORT;
} }
@ -119,7 +119,7 @@ ReturnValue_t DleEncoder::encodeStreamNonEscaped(const uint8_t *sourceStream, si
destStream[encodedIndex++] = ETX_CHAR; destStream[encodedIndex++] = ETX_CHAR;
} }
*encodedLen = encodedIndex; *encodedLen = encodedIndex;
return RETURN_OK; return returnvalue::OK;
} else { } else {
return STREAM_TOO_SHORT; return STREAM_TOO_SHORT;
} }
@ -191,7 +191,7 @@ ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_
case (ETX_CHAR): { case (ETX_CHAR): {
*readLen = ++encodedIndex; *readLen = ++encodedIndex;
*decodedLen = decodedIndex; *decodedLen = decodedIndex;
return RETURN_OK; return returnvalue::OK;
} }
default: { default: {
destStream[decodedIndex] = sourceStream[encodedIndex]; destStream[decodedIndex] = sourceStream[encodedIndex];
@ -255,7 +255,7 @@ ReturnValue_t DleEncoder::decodeStreamNonEscaped(const uint8_t *sourceStream,
// End of stream reached // End of stream reached
*readLen = encodedIndex + 2; *readLen = encodedIndex + 2;
*decodedLen = decodedIndex; *decodedLen = decodedIndex;
return RETURN_OK; return returnvalue::OK;
} else { } else {
*readLen = encodedIndex; *readLen = encodedIndex;
return DECODING_ERROR; return DECODING_ERROR;

View File

@ -30,7 +30,7 @@
* are escaped with DLE. If the receiver detects a DLE char, it needs to read the next char * are escaped with DLE. If the receiver detects a DLE char, it needs to read the next char
* to determine whether a start (STX) or end (ETX) of a frame has been detected. * to determine whether a start (STX) or end (ETX) of a frame has been detected.
*/ */
class DleEncoder : public HasReturnvaluesIF { class DleEncoder {
public: public:
/** /**
* Create an encoder instance with the given configuration. * Create an encoder instance with the given configuration.

View File

@ -52,12 +52,12 @@ ReturnValue_t Type::serialize(uint8_t** buffer, size_t* size, size_t maxSize,
uint8_t ptc; uint8_t ptc;
uint8_t pfc; uint8_t pfc;
ReturnValue_t result = getPtcPfc(&ptc, &pfc); ReturnValue_t result = getPtcPfc(&ptc, &pfc);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = SerializeAdapter::serialize(&ptc, buffer, size, maxSize, streamEndianness); result = SerializeAdapter::serialize(&ptc, buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -75,18 +75,18 @@ ReturnValue_t Type::deSerialize(const uint8_t** buffer, size_t* size, Endianness
uint8_t ptc; uint8_t ptc;
uint8_t pfc; uint8_t pfc;
ReturnValue_t result = SerializeAdapter::deSerialize(&ptc, buffer, size, streamEndianness); ReturnValue_t result = SerializeAdapter::deSerialize(&ptc, buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = SerializeAdapter::deSerialize(&pfc, buffer, size, streamEndianness); result = SerializeAdapter::deSerialize(&pfc, buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
actualType = getActualType(ptc, pfc); actualType = getActualType(ptc, pfc);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
ReturnValue_t Type::getPtcPfc(uint8_t* ptc, uint8_t* pfc) const { ReturnValue_t Type::getPtcPfc(uint8_t* ptc, uint8_t* pfc) const {
@ -124,9 +124,9 @@ ReturnValue_t Type::getPtcPfc(uint8_t* ptc, uint8_t* pfc) const {
*pfc = 2; *pfc = 2;
break; break;
default: default:
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
Type::ActualType_t Type::getActualType(uint8_t ptc, uint8_t pfc) { Type::ActualType_t Type::getActualType(uint8_t ptc, uint8_t pfc) {

View File

@ -40,34 +40,34 @@ class MatchTree : public SerializeableMatcherIF<T>, public BinaryTree<Serializea
uint8_t count = this->countRight(iter); uint8_t count = this->countRight(iter);
ReturnValue_t result = ReturnValue_t result =
SerializeAdapter::serialize(&count, buffer, size, maxSize, streamEndianness); SerializeAdapter::serialize(&count, buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (iter == this->end()) { if (iter == this->end()) {
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
result = iter->serialize(buffer, size, maxSize, streamEndianness); result = iter->serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (maxDepth > 0) { if (maxDepth > 0) {
MatchTree<T> temp(iter.left(), maxDepth - 1); MatchTree<T> temp(iter.left(), maxDepth - 1);
result = temp.serialize(buffer, size, maxSize, streamEndianness); result = temp.serialize(buffer, size, maxSize, streamEndianness);
} }
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
iter = iter.right(); iter = iter.right();
while (iter != this->end()) { while (iter != this->end()) {
result = iter->serialize(buffer, size, maxSize, streamEndianness); result = iter->serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (maxDepth > 0) { if (maxDepth > 0) {
MatchTree<T> temp(iter.left(), maxDepth - 1); MatchTree<T> temp(iter.left(), maxDepth - 1);
result = temp.serialize(buffer, size, maxSize, streamEndianness); result = temp.serialize(buffer, size, maxSize, streamEndianness);
} }
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
iter = iter.right(); iter = iter.right();
@ -106,7 +106,7 @@ class MatchTree : public SerializeableMatcherIF<T>, public BinaryTree<Serializea
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
SerializeIF::Endianness streamEndianness) override { SerializeIF::Endianness streamEndianness) override {
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
protected: protected:
@ -124,17 +124,17 @@ class MatchTree : public SerializeableMatcherIF<T>, public BinaryTree<Serializea
// SHOULDDO: What to do if insertion/deletion fails. Throw event? // SHOULDDO: What to do if insertion/deletion fails. Throw event?
ReturnValue_t removeElementAndAllChildren(iterator position) { ReturnValue_t removeElementAndAllChildren(iterator position) {
auto children = this->erase(position); auto children = this->erase(position);
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = returnvalue::OK;
if (children.first != this->end()) { if (children.first != this->end()) {
result = removeElementAndAllChildren(children.first); result = removeElementAndAllChildren(children.first);
} }
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (children.second != this->end()) { if (children.second != this->end()) {
result = removeElementAndAllChildren(children.second); result = removeElementAndAllChildren(children.second);
} }
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
// Delete element itself. // Delete element itself.
@ -143,13 +143,13 @@ class MatchTree : public SerializeableMatcherIF<T>, public BinaryTree<Serializea
ReturnValue_t removeElementAndReconnectChildren(iterator position) { ReturnValue_t removeElementAndReconnectChildren(iterator position) {
if (position == this->end()) { if (position == this->end()) {
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
// Delete everything from the AND branch. // Delete everything from the AND branch.
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = returnvalue::OK;
if (position.left() != this->end()) { if (position.left() != this->end()) {
result = removeElementAndAllChildren(position.left()); result = removeElementAndAllChildren(position.left());
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
} }
@ -176,7 +176,7 @@ class MatchTree : public SerializeableMatcherIF<T>, public BinaryTree<Serializea
return cleanUpElement(position); return cleanUpElement(position);
} }
virtual ReturnValue_t cleanUpElement(iterator position) { return HasReturnvaluesIF::RETURN_OK; } virtual ReturnValue_t cleanUpElement(iterator position) { return returnvalue::OK; }
bool matchSubtree(iterator iter, T number) { bool matchSubtree(iterator iter, T number) {
if (iter == nullptr) { if (iter == nullptr) {

View File

@ -27,11 +27,11 @@ class RangeMatcher : public SerializeableMatcherIF<T> {
SerializeIF::Endianness streamEndianness) const override { SerializeIF::Endianness streamEndianness) const override {
ReturnValue_t result = ReturnValue_t result =
SerializeAdapter::serialize(&lowerBound, buffer, size, maxSize, streamEndianness); SerializeAdapter::serialize(&lowerBound, buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = SerializeAdapter::serialize(&upperBound, buffer, size, maxSize, streamEndianness); result = SerializeAdapter::serialize(&upperBound, buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
return SerializeAdapter::serialize(&inverted, buffer, size, maxSize, streamEndianness); return SerializeAdapter::serialize(&inverted, buffer, size, maxSize, streamEndianness);
@ -45,11 +45,11 @@ class RangeMatcher : public SerializeableMatcherIF<T> {
SerializeIF::Endianness streamEndianness) override { SerializeIF::Endianness streamEndianness) override {
ReturnValue_t result = ReturnValue_t result =
SerializeAdapter::deSerialize(&lowerBound, buffer, size, streamEndianness); SerializeAdapter::deSerialize(&lowerBound, buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = SerializeAdapter::deSerialize(&upperBound, buffer, size, streamEndianness); result = SerializeAdapter::deSerialize(&upperBound, buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
return SerializeAdapter::deSerialize(&inverted, buffer, size, streamEndianness); return SerializeAdapter::deSerialize(&inverted, buffer, size, streamEndianness);

View File

@ -11,13 +11,13 @@ ReturnValue_t HealthHelper::handleHealthCommand(CommandMessage* message) {
switch (message->getCommand()) { switch (message->getCommand()) {
case HealthMessage::HEALTH_SET: case HealthMessage::HEALTH_SET:
handleSetHealthCommand(message); handleSetHealthCommand(message);
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
case HealthMessage::HEALTH_ANNOUNCE: { case HealthMessage::HEALTH_ANNOUNCE: {
eventSender->forwardEvent(HasHealthIF::HEALTH_INFO, getHealth(), getHealth()); eventSender->forwardEvent(HasHealthIF::HEALTH_INFO, getHealth(), getHealth());
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
default: default:
return HasReturnvaluesIF::RETURN_FAILED; return returnvalue::FAILED;
} }
} }
@ -53,10 +53,10 @@ ReturnValue_t HealthHelper::initialize() {
} }
ReturnValue_t result = healthTable->registerObject(objectId, HasHealthIF::HEALTHY); ReturnValue_t result = healthTable->registerObject(objectId, HasHealthIF::HEALTHY);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
return HasReturnvaluesIF::RETURN_OK; return returnvalue::OK;
} }
void HealthHelper::setHealth(HasHealthIF::HealthState health) { void HealthHelper::setHealth(HasHealthIF::HealthState health) {
@ -76,7 +76,7 @@ void HealthHelper::informParent(HasHealthIF::HealthState health,
CommandMessage information; CommandMessage information;
HealthMessage::setHealthMessage(&information, HealthMessage::HEALTH_INFO, health, oldHealth); HealthMessage::setHealthMessage(&information, HealthMessage::HEALTH_INFO, health, oldHealth);
if (MessageQueueSenderIF::sendMessage(parentQueue, &information, owner->getCommandQueue()) != if (MessageQueueSenderIF::sendMessage(parentQueue, &information, owner->getCommandQueue()) !=
HasReturnvaluesIF::RETURN_OK) { returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "HealthHelper::informParent: sending health reply failed." << std::endl; sif::debug << "HealthHelper::informParent: sending health reply failed." << std::endl;
#endif #endif
@ -89,13 +89,13 @@ void HealthHelper::handleSetHealthCommand(CommandMessage* command) {
return; return;
} }
CommandMessage reply; CommandMessage reply;
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == returnvalue::OK) {
HealthMessage::setHealthMessage(&reply, HealthMessage::REPLY_HEALTH_SET); HealthMessage::setHealthMessage(&reply, HealthMessage::REPLY_HEALTH_SET);
} else { } else {
reply.setReplyRejected(result, command->getCommand()); reply.setReplyRejected(result, command->getCommand());
} }
if (MessageQueueSenderIF::sendMessage(command->getSender(), &reply, owner->getCommandQueue()) != if (MessageQueueSenderIF::sendMessage(command->getSender(), &reply, owner->getCommandQueue()) !=
HasReturnvaluesIF::RETURN_OK) { returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "HealthHelper::handleHealthCommand: sending health " sif::debug << "HealthHelper::handleHealthCommand: sending health "
"reply failed." "reply failed."

Some files were not shown because too many files have changed in this diff Show More