fixing merge

This commit is contained in:
Ulrich Mohr 2022-09-14 16:31:24 +02:00
parent eae7bfc935
commit 253aa30263
7 changed files with 16 additions and 16 deletions

View File

@ -34,12 +34,12 @@ size_t Action::getSerializedSize() const {
ReturnValue_t Action::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const {
ReturnValue_t result = SerializeAdapter::serialize(&id, buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
for (auto parameter : *getParameters()) {
result = parameter->serialize(buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
}
@ -48,13 +48,13 @@ ReturnValue_t Action::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
ReturnValue_t Action::deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;/* TODO not needed as must have been read before to find this action = SerializeAdapter::deSerialize(&id, buffer, size, streamEndianness);
ReturnValue_t result = returnvalue::OK;/* TODO not needed as must have been read before to find this action = SerializeAdapter::deSerialize(&id, buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}*/
for (auto parameter : *getParameters()) {
result = parameter->deSerialize(buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
}

View File

@ -1337,7 +1337,7 @@ ReturnValue_t DeviceHandlerBase::executeAction(Action* action) {
} else if (iter->second.isExecuting) {
result = COMMAND_ALREADY_SENT;
} else {
iter->second.sendReplyTo = commandedBy;
iter->second.sendReplyTo = action->commandedBy;
result = action->handle();
}
if (result == returnvalue::OK) {

View File

@ -344,7 +344,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
*/
virtual ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,
size_t commandDataLen) {return HasReturnvaluesIF::RETURN_FAILED;}
size_t commandDataLen) {return returnvalue::FAILED;}
/* Reply handling */
/**

View File

@ -1,6 +1,6 @@
#pragma once
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/returnvalues/returnvalue.h>
#include <boost/preprocessor.hpp>

View File

@ -1,6 +1,6 @@
#pragma once
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/returnvalues/returnvalue.h>
#include <fsfw/serialize/SerializeAdapter.h>
#include <boost/preprocessor.hpp>

View File

@ -9,22 +9,22 @@
#include "mocks/MessageQueueMock.h"
TEST_CASE("Action Helper", "[ActionHelper]") {
MessageQueueMockBase testMqMock;
// TODO: Setting another number here breaks the test. Find out why
MessageQueueMock testMqMock(MessageQueueIF::NO_QUEUE);
ActionHelperOwnerMockBase testDhMock(&testMqMock);
CommandMessage actionMessage;
ActionId_t testActionId = (ActionId_t) TestActions::TEST_ACTION;
ActionId_t testActionId = (ActionId_t)TestActions::TEST_ACTION;
std::array<uint8_t, 3> testParams{1, 2, 3};
store_address_t paramAddress;
StorageManagerIF* ipcStore = tglob::getIpcStoreHandle();
REQUIRE(ipcStore != nullptr);
ipcStore->addData(&paramAddress, testParams.data(), 3);
REQUIRE(testDhMock.getActionHelper()->initialize() == retval::CATCH_OK);
REQUIRE(testDhMock.getActionHelper()->initialize() == returnvalue::OK);
SECTION("Simple tests") {
ActionMessage::setCommand(&actionMessage, testActionId, paramAddress);
CHECK(not testDhMock.executeActionCalled);
REQUIRE(testDhMock.getActionHelper()->handleActionMessage(&actionMessage) == retval::CATCH_OK);
REQUIRE(testDhMock.getActionHelper()->handleActionMessage(&actionMessage) == returnvalue::OK);
CHECK(testDhMock.executeActionCalled);
// No message is sent if everything is alright.
CHECK(not testMqMock.wasMessageSent());
@ -81,7 +81,7 @@ TEST_CASE("Action Helper", "[ActionHelper]") {
REQUIRE(ipcStore->addData(&toLongParamAddress, toLongData.data(), 5) == returnvalue::OK);
ActionMessage::setCommand(&actionMessage, testActionId, toLongParamAddress);
CHECK(not testDhMock.executeActionCalled);
REQUIRE(testDhMock.getActionHelper()->handleActionMessage(&actionMessage) == retval::CATCH_OK);
REQUIRE(testDhMock.getActionHelper()->handleActionMessage(&actionMessage) == returnvalue::OK);
REQUIRE(ipcStore->getData(toLongParamAddress).first ==
static_cast<uint32_t>(StorageManagerIF::DATA_DOES_NOT_EXIST));
CommandMessage testMessage;
@ -95,7 +95,7 @@ TEST_CASE("Action Helper", "[ActionHelper]") {
SECTION("Missing IPC Data") {
ActionMessage::setCommand(&actionMessage, testActionId, store_address_t::invalid());
CHECK(not testDhMock.executeActionCalled);
REQUIRE(testDhMock.getActionHelper()->handleActionMessage(&actionMessage) == retval::CATCH_OK);
REQUIRE(testDhMock.getActionHelper()->handleActionMessage(&actionMessage) == returnvalue::OK);
CommandMessage testMessage;
REQUIRE(testMqMock.getNextSentMessage(testMessage) == returnvalue::OK);
REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::STEP_FAILED));

View File

@ -51,7 +51,7 @@ class ActionHelperOwnerMockBase : public HasActionsIF {
buffer[0] = action->p1;
buffer[1] = action->p2;
buffer[2] = action->p3;
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
void clearBuffer() {