Update FSFW from upstream #71

Closed
muellerr wants to merge 1112 commits from development into eive/develop
32 changed files with 98 additions and 147 deletions
Showing only changes of commit 8c8d1cfa84 - Show all commits

View File

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

View File

@ -15,20 +15,16 @@ 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 = static constexpr ReturnValue_t INVALID_TLV_TYPE = returnvalue::makeCode(CFDP_CLASS_ID, 1);
returnvalue::makeCode(CFDP_CLASS_ID, 1); static constexpr ReturnValue_t INVALID_DIRECTIVE_FIELDS = returnvalue::makeCode(CFDP_CLASS_ID, 2);
static constexpr ReturnValue_t INVALID_DIRECTIVE_FIELDS = static constexpr ReturnValue_t INVALID_PDU_DATAFIELD_LEN = returnvalue::makeCode(CFDP_CLASS_ID, 3);
returnvalue::makeCode(CFDP_CLASS_ID, 2);
static constexpr ReturnValue_t INVALID_PDU_DATAFIELD_LEN =
returnvalue::makeCode(CFDP_CLASS_ID, 3);
static constexpr ReturnValue_t INVALID_ACK_DIRECTIVE_FIELDS = static constexpr ReturnValue_t INVALID_ACK_DIRECTIVE_FIELDS =
returnvalue::makeCode(CFDP_CLASS_ID, 4); 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 = static constexpr ReturnValue_t METADATA_CANT_PARSE_OPTIONS =
returnvalue::makeCode(CFDP_CLASS_ID, 5); returnvalue::makeCode(CFDP_CLASS_ID, 5);
static constexpr ReturnValue_t NAK_CANT_PARSE_OPTIONS = static constexpr ReturnValue_t NAK_CANT_PARSE_OPTIONS = returnvalue::makeCode(CFDP_CLASS_ID, 6);
returnvalue::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t FINISHED_CANT_PARSE_FS_RESPONSES = static constexpr ReturnValue_t FINISHED_CANT_PARSE_FS_RESPONSES =
returnvalue::makeCode(CFDP_CLASS_ID, 6); returnvalue::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t FILESTORE_REQUIRES_SECOND_FILE = static constexpr ReturnValue_t FILESTORE_REQUIRES_SECOND_FILE =

View File

@ -37,8 +37,8 @@ class Farm1StateOpen : public Farm1StateIF {
* change to Farm1StateLockout. * change to Farm1StateLockout.
* @param frame The frame to handle. * @param frame The frame to handle.
* @param clcw Any changes to the CLCW shall be done with the help of this interface. * @param clcw Any changes to the CLCW shall be done with the help of this interface.
* @return If the Sequence Number is ok, it returns returnvalue::OK. Otherwise either #NS_POSITIVE_W, * @return If the Sequence Number is ok, it returns returnvalue::OK. Otherwise either
* #NS_NEGATIVE_W or NS_LOCKOUT is returned. * #NS_POSITIVE_W, #NS_NEGATIVE_W or NS_LOCKOUT is returned.
*/ */
ReturnValue_t handleADFrame(TcTransferFrame* frame, ClcwIF* clcw); ReturnValue_t handleADFrame(TcTransferFrame* frame, ClcwIF* clcw);
/** /**

View File

@ -102,7 +102,8 @@ 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 returnvalue::OK if the channel was successfully inserted, @c returnvalue::FAILED otherwise. * @return @c returnvalue::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);
/** /**

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,
returnvalue::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,
returnvalue::FAILED, "Could not create mutex"); "Could not create mutex");
} }
hkQueue = queueToUse; hkQueue = queueToUse;
@ -780,8 +780,7 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool i
ReturnValue_t result = ipcStore->getFreeElement(&storeId, expectedSize, &storePtr); ReturnValue_t result = ipcStore->getFreeElement(&storeId, expectedSize, &storePtr);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
printWarningOrError(sif::OutputTypes::OUT_ERROR, "generateSetStructurePacket", printWarningOrError(sif::OutputTypes::OUT_ERROR, "generateSetStructurePacket",
returnvalue::FAILED, returnvalue::FAILED, "Could not get free element from IPC store.");
"Could not get free element from IPC store.");
return result; return result;
} }
@ -794,8 +793,7 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool i
} }
if (expectedSize != size) { if (expectedSize != size) {
printWarningOrError(sif::OutputTypes::OUT_WARNING, "generateSetStructurePacket", printWarningOrError(sif::OutputTypes::OUT_WARNING, "generateSetStructurePacket",
returnvalue::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.

View File

@ -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,
returnvalue::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);
@ -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,
returnvalue::FAILED, "Command pointer not found"); "Command pointer not found");
return; return;
} }

View File

@ -9,8 +9,7 @@
#include "ConfirmsFailuresIF.h" #include "ConfirmsFailuresIF.h"
#include "FaultCounter.h" #include "FaultCounter.h"
class FailureIsolationBase : public ConfirmsFailuresIF, class FailureIsolationBase : public ConfirmsFailuresIF, public HasParametersIF {
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

@ -30,9 +30,7 @@ class HasMemoryIF {
* Sets the address of the memory, if possible. * Sets the address of the memory, if possible.
* startAddress is a proposal for an address, or the base address if multiple addresses are set. * startAddress is a proposal for an address, or the base address if multiple addresses are set.
*/ */
virtual ReturnValue_t setAddress(uint32_t* startAddress) { virtual ReturnValue_t setAddress(uint32_t* startAddress) { return returnvalue::FAILED; }
return returnvalue::FAILED;
}
static bool memAccessWasSuccessful(ReturnValue_t result) { static bool memAccessWasSuccessful(ReturnValue_t result) {
switch (result) { switch (result) {
case DO_IT_MYSELF: case DO_IT_MYSELF:

View File

@ -50,8 +50,7 @@ ReturnValue_t TcpTmTcBridge::handleTm() {
TmTcMessage message; TmTcMessage message;
ReturnValue_t status = returnvalue::OK; ReturnValue_t status = returnvalue::OK;
for (ReturnValue_t result = tmTcReceptionQueue->receiveMessage(&message); for (ReturnValue_t result = tmTcReceptionQueue->receiveMessage(&message);
result == returnvalue::OK; result == returnvalue::OK; result = tmTcReceptionQueue->receiveMessage(&message)) {
result = tmTcReceptionQueue->receiveMessage(&message)) {
status = storeDownlinkData(&message); status = storeDownlinkData(&message);
if (status != returnvalue::OK) { if (status != returnvalue::OK) {
break; break;

View File

@ -37,12 +37,9 @@ class Service11TelecommandScheduling final : public PusServiceBase {
public: public:
static constexpr uint8_t CLASS_ID = CLASS_ID::PUS_SERVICE_11; static constexpr uint8_t CLASS_ID = CLASS_ID::PUS_SERVICE_11;
static constexpr ReturnValue_t INVALID_TYPE_TIME_WINDOW = static constexpr ReturnValue_t INVALID_TYPE_TIME_WINDOW = returnvalue::makeCode(CLASS_ID, 1);
returnvalue::makeCode(CLASS_ID, 1); static constexpr ReturnValue_t TIMESHIFTING_NOT_POSSIBLE = returnvalue::makeCode(CLASS_ID, 2);
static constexpr ReturnValue_t TIMESHIFTING_NOT_POSSIBLE = static constexpr ReturnValue_t INVALID_RELATIVE_TIME = returnvalue::makeCode(CLASS_ID, 3);
returnvalue::makeCode(CLASS_ID, 2);
static constexpr ReturnValue_t INVALID_RELATIVE_TIME =
returnvalue::makeCode(CLASS_ID, 3);
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PUS_SERVICE_11; static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PUS_SERVICE_11;

View File

@ -12,8 +12,8 @@
typedef uint16_t ReturnValue_t; typedef uint16_t ReturnValue_t;
namespace returnvalue { namespace returnvalue {
static const ReturnValue_t OK = 0; static const ReturnValue_t OK = 0;
static const ReturnValue_t FAILED = 1; static const ReturnValue_t FAILED = 1;
/** /**
* It is discouraged to use the input parameters 0,0 and 0,1 as this * It is discouraged to use the input parameters 0,0 and 0,1 as this
@ -22,11 +22,10 @@ namespace returnvalue {
* @param number * @param number
* @return * @return
*/ */
static constexpr ReturnValue_t makeCode( static constexpr ReturnValue_t makeCode(uint8_t classId, uint8_t number) {
uint8_t classId, uint8_t number) {
return (static_cast<ReturnValue_t>(classId) << 8) + number; return (static_cast<ReturnValue_t>(classId) << 8) + number;
} }
} } // namespace returnvalue
#endif /* FSFW_RETURNVALUES_RETURNVALUE_H_ */ #endif /* FSFW_RETURNVALUES_RETURNVALUE_H_ */

View File

@ -55,7 +55,9 @@ ReturnValue_t Subsystem::checkSequence(Mode_t sequence) {
return checkSequence(iter, getFallbackSequence(sequence)); return checkSequence(iter, getFallbackSequence(sequence));
} }
bool Subsystem::existsModeSequence(Mode_t id) { return modeSequences.exists(id) == returnvalue::OK; } bool Subsystem::existsModeSequence(Mode_t id) {
return modeSequences.exists(id) == returnvalue::OK;
}
bool Subsystem::existsModeTable(Mode_t id) { return modeTables.exists(id) == returnvalue::OK; } bool Subsystem::existsModeTable(Mode_t id) { return modeTables.exists(id) == returnvalue::OK; }

View File

@ -43,4 +43,6 @@ void TcDistributor::print() {
#endif #endif
} }
ReturnValue_t TcDistributor::callbackAfterSending(ReturnValue_t queueStatus) { return returnvalue::OK; } ReturnValue_t TcDistributor::callbackAfterSending(ReturnValue_t queueStatus) {
return returnvalue::OK;
}

View File

@ -4,6 +4,8 @@
TcPacketCheckCFDP::TcPacketCheckCFDP(uint16_t setApid) : apid(setApid) {} TcPacketCheckCFDP::TcPacketCheckCFDP(uint16_t setApid) : apid(setApid) {}
ReturnValue_t TcPacketCheckCFDP::checkPacket(SpacePacketBase* currentPacket) { return returnvalue::OK; } ReturnValue_t TcPacketCheckCFDP::checkPacket(SpacePacketBase* currentPacket) {
return returnvalue::OK;
}
uint16_t TcPacketCheckCFDP::getApid() const { return apid; } uint16_t TcPacketCheckCFDP::getApid() const { return apid; }

View File

@ -291,8 +291,8 @@ ReturnValue_t Heater::getParameter(uint8_t domainId, uint8_t uniqueId,
void Heater::handleEventQueue() { void Heater::handleEventQueue() {
EventMessage event; EventMessage event;
for (ReturnValue_t result = eventQueue->receiveMessage(&event); for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK;
result == returnvalue::OK; result = eventQueue->receiveMessage(&event)) { result = eventQueue->receiveMessage(&event)) {
switch (event.getMessageId()) { switch (event.getMessageId()) {
case EventMessage::EVENT_MESSAGE: case EventMessage::EVENT_MESSAGE:
switch (event.getEvent()) { switch (event.getEvent()) {

View File

@ -234,7 +234,8 @@ void CommandingServiceBase::handleRequestQueue() {
address = message.getStorageId(); address = message.getStorageId();
packet.setStoreAddress(address, &packet); packet.setStoreAddress(address, &packet);
if ((packet.getSubService() == 0) or (isValidSubservice(packet.getSubService()) != returnvalue::OK)) { if ((packet.getSubService() == 0) or
(isValidSubservice(packet.getSubService()) != returnvalue::OK)) {
rejectPacket(tc_verification::START_FAILURE, &packet, INVALID_SUBSERVICE); rejectPacket(tc_verification::START_FAILURE, &packet, INVALID_SUBSERVICE);
continue; continue;
} }

View File

@ -133,8 +133,7 @@ ReturnValue_t TmTcBridge::handleTmQueue() {
size_t size = 0; size_t size = 0;
ReturnValue_t status = returnvalue::OK; ReturnValue_t status = returnvalue::OK;
for (ReturnValue_t result = tmTcReceptionQueue->receiveMessage(&message); for (ReturnValue_t result = tmTcReceptionQueue->receiveMessage(&message);
result == returnvalue::OK; result == returnvalue::OK; result = tmTcReceptionQueue->receiveMessage(&message)) {
result = tmTcReceptionQueue->receiveMessage(&message)) {
#if FSFW_VERBOSE_LEVEL >= 3 #if FSFW_VERBOSE_LEVEL >= 3
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "Sent packet counter: " << static_cast<int>(packetSentCounter) << std::endl; sif::info << "Sent packet counter: " << static_cast<int>(packetSentCounter) << std::endl;

View File

@ -3,50 +3,45 @@
#include "fsfw/serialize.h" #include "fsfw/serialize.h"
template<typename T> template <typename T>
class UnsignedByteField: public SerializeIF { class UnsignedByteField : public SerializeIF {
public: public:
static_assert(std::is_unsigned<T>::value); static_assert(std::is_unsigned<T>::value);
explicit UnsignedByteField(T value): value(value) {} explicit UnsignedByteField(T value) : value(value) {}
[[nodiscard]] ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, [[nodiscard]] ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const override { Endianness streamEndianness) const override {
return SerializeAdapter::serialize(&value, buffer, size, maxSize, streamEndianness); return SerializeAdapter::serialize(&value, buffer, size, maxSize, streamEndianness);
} }
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size, ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) override { Endianness streamEndianness) override {
return SerializeAdapter::deSerialize(&value, buffer, size, streamEndianness); return SerializeAdapter::deSerialize(&value, buffer, size, streamEndianness);
} }
[[nodiscard]] size_t getSerializedSize() const override { [[nodiscard]] size_t getSerializedSize() const override { return sizeof(T); }
return sizeof(T);
}
[[nodiscard]] T getValue() const { [[nodiscard]] T getValue() const { return value; }
return value;
} void setValue(T value_) { value = value_; }
void setValue(T value_) {
value = value_;
}
private: private:
T value; T value;
}; };
class U32ByteField: public UnsignedByteField<uint32_t> { class U32ByteField : public UnsignedByteField<uint32_t> {
public: public:
explicit U32ByteField(uint32_t value): UnsignedByteField<uint32_t>(value) {} explicit U32ByteField(uint32_t value) : UnsignedByteField<uint32_t>(value) {}
}; };
class U16ByteField: public UnsignedByteField<uint16_t> { class U16ByteField : public UnsignedByteField<uint16_t> {
public: public:
explicit U16ByteField(uint16_t value): UnsignedByteField<uint16_t>(value) {} explicit U16ByteField(uint16_t value) : UnsignedByteField<uint16_t>(value) {}
}; };
class U8ByteField: public UnsignedByteField<uint8_t> { class U8ByteField : public UnsignedByteField<uint8_t> {
public: public:
explicit U8ByteField(uint8_t value): UnsignedByteField<uint8_t>(value) {} explicit U8ByteField(uint8_t value) : UnsignedByteField<uint8_t>(value) {}
}; };
#endif // FSFW_UTIL_UNSIGNEDBYTEFIELD_H #endif // FSFW_UTIL_UNSIGNEDBYTEFIELD_H

View File

@ -31,8 +31,7 @@ class CommandExecutor {
static constexpr uint8_t CLASS_ID = CLASS_ID::LINUX_OSAL; static constexpr uint8_t CLASS_ID = CLASS_ID::LINUX_OSAL;
//! [EXPORT] : [COMMENT] Execution of the current command has finished //! [EXPORT] : [COMMENT] Execution of the current command has finished
static constexpr ReturnValue_t EXECUTION_FINISHED = static constexpr ReturnValue_t EXECUTION_FINISHED = returnvalue::makeCode(CLASS_ID, 0);
returnvalue::makeCode(CLASS_ID, 0);
//! [EXPORT] : [COMMENT] Command is pending. This will also be returned if the user tries //! [EXPORT] : [COMMENT] Command is pending. This will also be returned if the user tries
//! to load another command but a command is still pending //! to load another command but a command is still pending
@ -42,8 +41,7 @@ class CommandExecutor {
//! [EXPORT] : [COMMENT] Command execution failed //! [EXPORT] : [COMMENT] Command execution failed
static constexpr ReturnValue_t COMMAND_ERROR = returnvalue::makeCode(CLASS_ID, 3); static constexpr ReturnValue_t COMMAND_ERROR = returnvalue::makeCode(CLASS_ID, 3);
//! [EXPORT] : [COMMENT] //! [EXPORT] : [COMMENT]
static constexpr ReturnValue_t NO_COMMAND_LOADED_OR_PENDING = static constexpr ReturnValue_t NO_COMMAND_LOADED_OR_PENDING = returnvalue::makeCode(CLASS_ID, 4);
returnvalue::makeCode(CLASS_ID, 4);
static constexpr ReturnValue_t PCLOSE_CALL_ERROR = returnvalue::makeCode(CLASS_ID, 6); static constexpr ReturnValue_t PCLOSE_CALL_ERROR = returnvalue::makeCode(CLASS_ID, 6);
/** /**

View File

@ -19,18 +19,12 @@ class LinuxLibgpioIF : public GpioIF, public SystemObject {
public: public:
static const uint8_t gpioRetvalId = CLASS_ID::HAL_GPIO; static const uint8_t gpioRetvalId = CLASS_ID::HAL_GPIO;
static constexpr ReturnValue_t UNKNOWN_GPIO_ID = static constexpr ReturnValue_t UNKNOWN_GPIO_ID = returnvalue::makeCode(gpioRetvalId, 1);
returnvalue::makeCode(gpioRetvalId, 1); static constexpr ReturnValue_t DRIVE_GPIO_FAILURE = returnvalue::makeCode(gpioRetvalId, 2);
static constexpr ReturnValue_t DRIVE_GPIO_FAILURE = static constexpr ReturnValue_t GPIO_TYPE_FAILURE = returnvalue::makeCode(gpioRetvalId, 3);
returnvalue::makeCode(gpioRetvalId, 2); static constexpr ReturnValue_t GPIO_INVALID_INSTANCE = returnvalue::makeCode(gpioRetvalId, 4);
static constexpr ReturnValue_t GPIO_TYPE_FAILURE = static constexpr ReturnValue_t GPIO_DUPLICATE_DETECTED = returnvalue::makeCode(gpioRetvalId, 5);
returnvalue::makeCode(gpioRetvalId, 3); static constexpr ReturnValue_t GPIO_INIT_FAILED = returnvalue::makeCode(gpioRetvalId, 6);
static constexpr ReturnValue_t GPIO_INVALID_INSTANCE =
returnvalue::makeCode(gpioRetvalId, 4);
static constexpr ReturnValue_t GPIO_DUPLICATE_DETECTED =
returnvalue::makeCode(gpioRetvalId, 5);
static constexpr ReturnValue_t GPIO_INIT_FAILED =
returnvalue::makeCode(gpioRetvalId, 6);
LinuxLibgpioIF(object_id_t objectId); LinuxLibgpioIF(object_id_t objectId);
virtual ~LinuxLibgpioIF(); virtual ~LinuxLibgpioIF();

View File

@ -23,8 +23,7 @@ class SpiCookie;
class SpiComIF : public DeviceCommunicationIF, public SystemObject { class SpiComIF : public DeviceCommunicationIF, public SystemObject {
public: public:
static constexpr uint8_t spiRetvalId = CLASS_ID::HAL_SPI; static constexpr uint8_t spiRetvalId = CLASS_ID::HAL_SPI;
static constexpr ReturnValue_t OPENING_FILE_FAILED = static constexpr ReturnValue_t OPENING_FILE_FAILED = returnvalue::makeCode(spiRetvalId, 0);
returnvalue::makeCode(spiRetvalId, 0);
/* Full duplex (ioctl) transfer failure */ /* Full duplex (ioctl) transfer failure */
static constexpr ReturnValue_t FULL_DUPLEX_TRANSFER_FAILED = static constexpr ReturnValue_t FULL_DUPLEX_TRANSFER_FAILED =
returnvalue::makeCode(spiRetvalId, 1); returnvalue::makeCode(spiRetvalId, 1);

View File

@ -22,12 +22,9 @@ class UartComIF : public DeviceCommunicationIF, public SystemObject {
public: public:
static constexpr uint8_t uartRetvalId = CLASS_ID::HAL_UART; static constexpr uint8_t uartRetvalId = CLASS_ID::HAL_UART;
static constexpr ReturnValue_t UART_READ_FAILURE = static constexpr ReturnValue_t UART_READ_FAILURE = returnvalue::makeCode(uartRetvalId, 1);
returnvalue::makeCode(uartRetvalId, 1); static constexpr ReturnValue_t UART_READ_SIZE_MISSMATCH = returnvalue::makeCode(uartRetvalId, 2);
static constexpr ReturnValue_t UART_READ_SIZE_MISSMATCH = static constexpr ReturnValue_t UART_RX_BUFFER_TOO_SMALL = returnvalue::makeCode(uartRetvalId, 3);
returnvalue::makeCode(uartRetvalId, 2);
static constexpr ReturnValue_t UART_RX_BUFFER_TOO_SMALL =
returnvalue::makeCode(uartRetvalId, 3);
UartComIF(object_id_t objectId); UartComIF(object_id_t objectId);

View File

@ -10,8 +10,7 @@
namespace spi { namespace spi {
static constexpr uint8_t HAL_SPI_ID = CLASS_ID::HAL_SPI; static constexpr uint8_t HAL_SPI_ID = CLASS_ID::HAL_SPI;
static constexpr ReturnValue_t HAL_TIMEOUT_RETVAL = static constexpr ReturnValue_t HAL_TIMEOUT_RETVAL = returnvalue::makeCode(HAL_SPI_ID, 0);
returnvalue::makeCode(HAL_SPI_ID, 0);
static constexpr ReturnValue_t HAL_BUSY_RETVAL = returnvalue::makeCode(HAL_SPI_ID, 1); static constexpr ReturnValue_t HAL_BUSY_RETVAL = returnvalue::makeCode(HAL_SPI_ID, 1);
static constexpr ReturnValue_t HAL_ERROR_RETVAL = returnvalue::makeCode(HAL_SPI_ID, 2); static constexpr ReturnValue_t HAL_ERROR_RETVAL = returnvalue::makeCode(HAL_SPI_ID, 2);

View File

@ -57,8 +57,7 @@ TEST_CASE("Action Helper", "[ActionHelper]") {
step += 1; step += 1;
CHECK(testMqMock.wasMessageSent()); CHECK(testMqMock.wasMessageSent());
CommandMessage testMessage; CommandMessage testMessage;
REQUIRE(testMqMock.receiveMessage(&testMessage) == REQUIRE(testMqMock.receiveMessage(&testMessage) == static_cast<uint32_t>(returnvalue::OK));
static_cast<uint32_t>(returnvalue::OK));
REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::STEP_FAILED)); REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::STEP_FAILED));
REQUIRE(testMessage.getParameter() == static_cast<uint32_t>(testActionId)); REQUIRE(testMessage.getParameter() == static_cast<uint32_t>(testActionId));
uint32_t parameter2 = ((uint32_t)step << 16) | (uint32_t)status; uint32_t parameter2 = ((uint32_t)step << 16) | (uint32_t)status;
@ -72,8 +71,7 @@ TEST_CASE("Action Helper", "[ActionHelper]") {
actionHelper.finish(false, testMqMock.getId(), testActionId, status); actionHelper.finish(false, testMqMock.getId(), testActionId, status);
CHECK(testMqMock.wasMessageSent()); CHECK(testMqMock.wasMessageSent());
CommandMessage testMessage; CommandMessage testMessage;
REQUIRE(testMqMock.receiveMessage(&testMessage) == REQUIRE(testMqMock.receiveMessage(&testMessage) == static_cast<uint32_t>(returnvalue::OK));
static_cast<uint32_t>(returnvalue::OK));
REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::COMPLETION_FAILED)); REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::COMPLETION_FAILED));
REQUIRE(ActionMessage::getActionId(&testMessage) == testActionId); REQUIRE(ActionMessage::getActionId(&testMessage) == testActionId);
REQUIRE(ActionMessage::getReturnCode(&testMessage) == static_cast<uint32_t>(status)); REQUIRE(ActionMessage::getReturnCode(&testMessage) == static_cast<uint32_t>(status));
@ -89,8 +87,7 @@ TEST_CASE("Action Helper", "[ActionHelper]") {
REQUIRE(ipcStore->getData(toLongParamAddress).first == REQUIRE(ipcStore->getData(toLongParamAddress).first ==
static_cast<uint32_t>(StorageManagerIF::DATA_DOES_NOT_EXIST)); static_cast<uint32_t>(StorageManagerIF::DATA_DOES_NOT_EXIST));
CommandMessage testMessage; CommandMessage testMessage;
REQUIRE(testMqMock.receiveMessage(&testMessage) == REQUIRE(testMqMock.receiveMessage(&testMessage) == static_cast<uint32_t>(returnvalue::OK));
static_cast<uint32_t>(returnvalue::OK));
REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::STEP_FAILED)); REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::STEP_FAILED));
REQUIRE(ActionMessage::getReturnCode(&testMessage) == 0xAFFE); REQUIRE(ActionMessage::getReturnCode(&testMessage) == 0xAFFE);
REQUIRE(ActionMessage::getStep(&testMessage) == 0); REQUIRE(ActionMessage::getStep(&testMessage) == 0);
@ -102,8 +99,7 @@ TEST_CASE("Action Helper", "[ActionHelper]") {
CHECK(not testDhMock.executeActionCalled); CHECK(not testDhMock.executeActionCalled);
REQUIRE(actionHelper.handleActionMessage(&actionMessage) == returnvalue::OK); REQUIRE(actionHelper.handleActionMessage(&actionMessage) == returnvalue::OK);
CommandMessage testMessage; CommandMessage testMessage;
REQUIRE(testMqMock.receiveMessage(&testMessage) == REQUIRE(testMqMock.receiveMessage(&testMessage) == static_cast<uint32_t>(returnvalue::OK));
static_cast<uint32_t>(returnvalue::OK));
REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::STEP_FAILED)); REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::STEP_FAILED));
REQUIRE(ActionMessage::getReturnCode(&testMessage) == REQUIRE(ActionMessage::getReturnCode(&testMessage) ==
static_cast<uint32_t>(StorageManagerIF::ILLEGAL_STORAGE_ID)); static_cast<uint32_t>(StorageManagerIF::ILLEGAL_STORAGE_ID));

View File

@ -80,8 +80,7 @@ TEST_CASE("CFDP TLV LV", "[CfdpTlvLv]") {
serPtr = rawBuf.data(); serPtr = rawBuf.data();
deserSize = 0; deserSize = 0;
REQUIRE(zeroLenField.serialize(&serPtr, &deserSize, rawBuf.size(), REQUIRE(zeroLenField.serialize(&serPtr, &deserSize, rawBuf.size(),
SerializeIF::Endianness::NETWORK) == SerializeIF::Endianness::NETWORK) == returnvalue::OK);
returnvalue::OK);
REQUIRE(rawBuf[0] == TlvTypes::FAULT_HANDLER); REQUIRE(rawBuf[0] == TlvTypes::FAULT_HANDLER);
REQUIRE(rawBuf[1] == 0); REQUIRE(rawBuf[1] == 0);
} }
@ -110,8 +109,7 @@ TEST_CASE("CFDP TLV LV", "[CfdpTlvLv]") {
SerializeIF::Endianness::NETWORK); SerializeIF::Endianness::NETWORK);
REQUIRE(entityId == 0x0ff0); REQUIRE(entityId == 0x0ff0);
REQUIRE(tlv.deSerialize(nullptr, nullptr, SerializeIF::Endianness::NETWORK) != REQUIRE(tlv.deSerialize(nullptr, nullptr, SerializeIF::Endianness::NETWORK) != returnvalue::OK);
returnvalue::OK);
deserPtr = rawBuf.data(); deserPtr = rawBuf.data();
deserSize = 0; deserSize = 0;
REQUIRE(tlv.deSerialize(&deserPtr, &deserSize, SerializeIF::Endianness::NETWORK) == REQUIRE(tlv.deSerialize(&deserPtr, &deserSize, SerializeIF::Endianness::NETWORK) ==
@ -126,8 +124,7 @@ TEST_CASE("CFDP TLV LV", "[CfdpTlvLv]") {
serPtr = rawBuf.data(); serPtr = rawBuf.data();
deserSize = 0; deserSize = 0;
REQUIRE(zeroLenField.serialize(&serPtr, &deserSize, rawBuf.size(), REQUIRE(zeroLenField.serialize(&serPtr, &deserSize, rawBuf.size(),
SerializeIF::Endianness::NETWORK) == SerializeIF::Endianness::NETWORK) == returnvalue::OK);
returnvalue::OK);
deserPtr = rawBuf.data(); deserPtr = rawBuf.data();
result = zeroLenField.deSerialize(&deserPtr, &deserSize, SerializeIF::Endianness::NETWORK); result = zeroLenField.deSerialize(&deserPtr, &deserSize, SerializeIF::Endianness::NETWORK);
REQUIRE(result == returnvalue::OK); REQUIRE(result == returnvalue::OK);

View File

@ -74,8 +74,7 @@ TEST_CASE("Array List", "[ArrayListTest]") {
SECTION("Const Iterator") { SECTION("Const Iterator") {
ArrayList<TestClass>::Iterator it = complexList.begin(); ArrayList<TestClass>::Iterator it = complexList.begin();
for (auto i = 0; i < 10; i++) { for (auto i = 0; i < 10; i++) {
REQUIRE(complexList.insert(TestClass(i, i + 1)) == REQUIRE(complexList.insert(TestClass(i, i + 1)) == static_cast<int>(returnvalue::OK));
static_cast<int>(returnvalue::OK));
} }
it++; it++;
const TestClass* secondTest = it.value; const TestClass* secondTest = it.value;

View File

@ -19,8 +19,7 @@ TEST_CASE("FixedMap Tests", "[TestFixedMap]") {
SECTION("Fill and erase") { SECTION("Fill and erase") {
for (uint16_t i = 0; i < 30; i++) { for (uint16_t i = 0; i < 30; i++) {
REQUIRE(map.insert(std::make_pair(i, i + 1)) == REQUIRE(map.insert(std::make_pair(i, i + 1)) == static_cast<int>(returnvalue::OK));
static_cast<int>(returnvalue::OK));
REQUIRE(map.exists(i) == static_cast<int>(returnvalue::OK)); REQUIRE(map.exists(i) == static_cast<int>(returnvalue::OK));
REQUIRE(map.find(i)->second == i + 1); REQUIRE(map.find(i)->second == i + 1);
REQUIRE(not map.empty()); REQUIRE(not map.empty());
@ -97,9 +96,9 @@ TEST_CASE("FixedMap Tests", "[TestFixedMap]") {
static_cast<int>(SerializeIF::BUFFER_TOO_SHORT)); static_cast<int>(SerializeIF::BUFFER_TOO_SHORT));
loc_ptr = buffer; loc_ptr = buffer;
size = 0; size = 0;
REQUIRE(map.serialize( REQUIRE(map.serialize(&loc_ptr, &size,
&loc_ptr, &size, sizeof(uint32_t) + 2 * (sizeof(uint32_t) + sizeof(uint16_t)), sizeof(uint32_t) + 2 * (sizeof(uint32_t) + sizeof(uint16_t)),
SerializeIF::Endianness::BIG) == static_cast<int>(returnvalue::OK)); SerializeIF::Endianness::BIG) == static_cast<int>(returnvalue::OK));
REQUIRE(size == 16); REQUIRE(size == 16);
uint32_t internal_size = 0; uint32_t internal_size = 0;

View File

@ -14,8 +14,7 @@ TEST_CASE("FixedOrderedMultimap Tests", "[TestFixedOrderedMultimap]") {
SECTION("Test insert, find, exists") { SECTION("Test insert, find, exists") {
for (uint16_t i = 0; i < 30; i++) { for (uint16_t i = 0; i < 30; i++) {
REQUIRE(map.insert(std::make_pair(i, i + 1)) == REQUIRE(map.insert(std::make_pair(i, i + 1)) == static_cast<int>(returnvalue::OK));
static_cast<int>(returnvalue::OK));
REQUIRE(map.exists(i) == static_cast<int>(returnvalue::OK)); REQUIRE(map.exists(i) == static_cast<int>(returnvalue::OK));
REQUIRE(map.find(i)->second == i + 1); REQUIRE(map.find(i)->second == i + 1);
} }
@ -188,23 +187,19 @@ TEST_CASE("FixedOrderedMultimap Non Trivial Type", "[TestFixedOrderedMultimapNon
SECTION("Test different insert variants") { SECTION("Test different insert variants") {
FixedOrderedMultimap<uint32_t, TestClass>::Iterator it = map.end(); FixedOrderedMultimap<uint32_t, TestClass>::Iterator it = map.end();
REQUIRE(map.insert(36, TestClass(37, 36), &it) == REQUIRE(map.insert(36, TestClass(37, 36), &it) == static_cast<int>(returnvalue::OK));
static_cast<int>(returnvalue::OK));
REQUIRE(it->first == 36); REQUIRE(it->first == 36);
bool compare = it->second == TestClass(37, 36); bool compare = it->second == TestClass(37, 36);
REQUIRE(compare); REQUIRE(compare);
REQUIRE(map.size() == 1); REQUIRE(map.size() == 1);
REQUIRE(map.insert(37, TestClass(38, 37), nullptr) == REQUIRE(map.insert(37, TestClass(38, 37), nullptr) == static_cast<int>(returnvalue::OK));
static_cast<int>(returnvalue::OK));
compare = map.find(37)->second == TestClass(38, 37); compare = map.find(37)->second == TestClass(38, 37);
REQUIRE(compare); REQUIRE(compare);
REQUIRE(map.size() == 2); REQUIRE(map.size() == 2);
REQUIRE(map.insert(37, TestClass(24, 37), nullptr) == REQUIRE(map.insert(37, TestClass(24, 37), nullptr) == static_cast<int>(returnvalue::OK));
static_cast<int>(returnvalue::OK));
compare = map.find(37)->second == TestClass(38, 37); compare = map.find(37)->second == TestClass(38, 37);
REQUIRE(compare); REQUIRE(compare);
REQUIRE(map.insert(0, TestClass(1, 0), nullptr) == REQUIRE(map.insert(0, TestClass(1, 0), nullptr) == static_cast<int>(returnvalue::OK));
static_cast<int>(returnvalue::OK));
compare = map.find(0)->second == TestClass(1, 0); compare = map.find(0)->second == TestClass(1, 0);
REQUIRE(compare); REQUIRE(compare);
REQUIRE(map.size() == 4); REQUIRE(map.size() == 4);

View File

@ -113,8 +113,7 @@ TEST_CASE("Command Executor", "[cmd-exec]") {
REQUIRE(result == returnvalue::OK); REQUIRE(result == returnvalue::OK);
result = cmdExecutor.execute(); result = cmdExecutor.execute();
REQUIRE(result == returnvalue::OK); REQUIRE(result == returnvalue::OK);
while (result != CommandExecutor::EXECUTION_FINISHED and while (result != CommandExecutor::EXECUTION_FINISHED and result != returnvalue::FAILED) {
result != returnvalue::FAILED) {
limitIdx++; limitIdx++;
result = cmdExecutor.check(bytesHaveBeenRead); result = cmdExecutor.check(bytesHaveBeenRead);
REQUIRE(result != CommandExecutor::COMMAND_ERROR); REQUIRE(result != CommandExecutor::COMMAND_ERROR);

View File

@ -1,8 +1,8 @@
#ifndef FSFW_TESTS_SIMPLESERIALIZABLE_H #ifndef FSFW_TESTS_SIMPLESERIALIZABLE_H
#define FSFW_TESTS_SIMPLESERIALIZABLE_H #define FSFW_TESTS_SIMPLESERIALIZABLE_H
#include "fsfw/serialize.h"
#include "fsfw/osal/Endiness.h" #include "fsfw/osal/Endiness.h"
#include "fsfw/serialize.h"
class SimpleSerializable : public SerializeIF { class SimpleSerializable : public SerializeIF {
public: public:

View File

@ -26,8 +26,7 @@ TEST_CASE("Serialize IF Serialize", "[serialize-if-ser]") {
SECTION("Little Endian Simple") { SECTION("Little Endian Simple") {
size_t serLen = 0xff; size_t serLen = 0xff;
REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), serLen, buf.size(), REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), serLen, buf.size(),
SerializeIF::Endianness::LITTLE) == SerializeIF::Endianness::LITTLE) == returnvalue::OK);
returnvalue::OK);
CHECK(buf[0] == 1); CHECK(buf[0] == 1);
CHECK(buf[1] == 3); CHECK(buf[1] == 3);
CHECK(buf[2] == 2); CHECK(buf[2] == 2);
@ -59,8 +58,7 @@ TEST_CASE("Serialize IF Serialize", "[serialize-if-ser]") {
size_t serLen = 0xff; size_t serLen = 0xff;
SECTION("Explicit") { SECTION("Explicit") {
REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), serLen, buf.size(), REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), serLen, buf.size(),
SerializeIF::Endianness::BIG) == SerializeIF::Endianness::BIG) == returnvalue::OK);
returnvalue::OK);
} }
SECTION("Network 0") { SECTION("Network 0") {
REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), serLen, buf.size(), REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), serLen, buf.size(),
@ -85,8 +83,7 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") {
size_t len = buf.size(); size_t len = buf.size();
SECTION("Little Endian Normal") { SECTION("Little Endian Normal") {
REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::LITTLE) == REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::LITTLE) == returnvalue::OK);
returnvalue::OK);
CHECK(simpleSer.getU8() == 5); CHECK(simpleSer.getU8() == 5);
CHECK(simpleSer.getU16() == 0x0100); CHECK(simpleSer.getU16() == 0x0100);
CHECK(ptr == buf.data() + 3); CHECK(ptr == buf.data() + 3);
@ -95,9 +92,8 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") {
SECTION("Little Endian Simple") { SECTION("Little Endian Simple") {
size_t deserLen = 0xff; size_t deserLen = 0xff;
REQUIRE( REQUIRE(simpleSer.SerializeIF::deSerialize(ptr, deserLen, len,
simpleSer.SerializeIF::deSerialize(ptr, deserLen, len, SerializeIF::Endianness::LITTLE) == SerializeIF::Endianness::LITTLE) == returnvalue::OK);
returnvalue::OK);
CHECK(simpleSer.getU8() == 5); CHECK(simpleSer.getU8() == 5);
CHECK(simpleSer.getU16() == 0x0100); CHECK(simpleSer.getU16() == 0x0100);
CHECK(deserLen == 3); CHECK(deserLen == 3);
@ -105,8 +101,7 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") {
SECTION("Big Endian Normal") { SECTION("Big Endian Normal") {
SECTION("Explicit") { SECTION("Explicit") {
REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::BIG) == REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::BIG) == returnvalue::OK);
returnvalue::OK);
} }
SECTION("Network 0") { SECTION("Network 0") {
REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::NETWORK) == REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::NETWORK) ==
@ -125,8 +120,7 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") {
size_t deserLen = 0xff; size_t deserLen = 0xff;
SECTION("Explicit") { SECTION("Explicit") {
REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), deserLen, buf.size(), REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), deserLen, buf.size(),
SerializeIF::Endianness::BIG) == SerializeIF::Endianness::BIG) == returnvalue::OK);
returnvalue::OK);
} }
SECTION("Network 0") { SECTION("Network 0") {
REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), deserLen, buf.size(), REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), deserLen, buf.size(),

View File

@ -1,10 +1,9 @@
#include <array>
#include <catch2/catch_test_macros.hpp> #include <catch2/catch_test_macros.hpp>
#include "fsfw/util/UnsignedByteField.h" #include "fsfw/util/UnsignedByteField.h"
#include <array>
TEST_CASE("Unsigned Byte Field", "[unsigned-byte-field]") { TEST_CASE("Unsigned Byte Field", "[unsigned-byte-field]") {
auto testByteField = UnsignedByteField<uint32_t>(10); auto testByteField = UnsignedByteField<uint32_t>(10);
auto u32ByteField = U32ByteField(10); auto u32ByteField = U32ByteField(10);