some more API improvements and replacements

This commit is contained in:
Robin Müller 2022-07-26 11:14:40 +02:00
parent 500a5602bd
commit f1c37203a4
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
20 changed files with 49 additions and 61 deletions

View File

@ -1,6 +1,6 @@
pipeline { pipeline {
environment { environment {
BUILDDIR = 'build-tests' BUILDDIR = 'cmake-build-tests'
} }
agent { agent {
docker { image 'fsfw-ci:d3'} docker { image 'fsfw-ci:d3'}

View File

@ -13,7 +13,7 @@ from shutil import which
from typing import List from typing import List
UNITTEST_FOLDER_NAME = "build-tests" UNITTEST_FOLDER_NAME = "cmake-build-tests"
DOCS_FOLDER_NAME = "build-docs" DOCS_FOLDER_NAME = "build-docs"

View File

@ -15,24 +15,17 @@ 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 = retval::makeCode(CFDP_CLASS_ID, 1);
retval::makeCode(CFDP_CLASS_ID, 1); static constexpr ReturnValue_t INVALID_DIRECTIVE_FIELDS = retval::makeCode(CFDP_CLASS_ID, 2);
static constexpr ReturnValue_t INVALID_DIRECTIVE_FIELDS = static constexpr ReturnValue_t INVALID_PDU_DATAFIELD_LEN = retval::makeCode(CFDP_CLASS_ID, 3);
retval::makeCode(CFDP_CLASS_ID, 2); static constexpr ReturnValue_t INVALID_ACK_DIRECTIVE_FIELDS = retval::makeCode(CFDP_CLASS_ID, 4);
static constexpr ReturnValue_t INVALID_PDU_DATAFIELD_LEN =
retval::makeCode(CFDP_CLASS_ID, 3);
static constexpr ReturnValue_t INVALID_ACK_DIRECTIVE_FIELDS =
retval::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 = retval::makeCode(CFDP_CLASS_ID, 5);
retval::makeCode(CFDP_CLASS_ID, 5); static constexpr ReturnValue_t NAK_CANT_PARSE_OPTIONS = retval::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t NAK_CANT_PARSE_OPTIONS =
retval::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t FINISHED_CANT_PARSE_FS_RESPONSES = static constexpr ReturnValue_t FINISHED_CANT_PARSE_FS_RESPONSES =
retval::makeCode(CFDP_CLASS_ID, 6); retval::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t FILESTORE_REQUIRES_SECOND_FILE = static constexpr ReturnValue_t FILESTORE_REQUIRES_SECOND_FILE = retval::makeCode(CFDP_CLASS_ID, 8);
retval::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 =

View File

@ -113,7 +113,8 @@ ReturnValue_t CService200ModeCommanding::prepareWrongModeReply(const CommandMess
ReturnValue_t CService200ModeCommanding::prepareCantReachModeReply(const CommandMessage *reply, ReturnValue_t CService200ModeCommanding::prepareCantReachModeReply(const CommandMessage *reply,
object_id_t objectId) { object_id_t objectId) {
CantReachModePacket cantReachModePacket(objectId, ModeMessage::getCantReachModeReason(reply)); CantReachModePacket cantReachModePacket(objectId, ModeMessage::getCantReachModeReason(reply));
ReturnValue_t result = tmHelper.sendTmPacket(Subservice::REPLY_CANT_REACH_MODE, cantReachModePacket); ReturnValue_t result =
tmHelper.sendTmPacket(Subservice::REPLY_CANT_REACH_MODE, cantReachModePacket);
if (result == RETURN_OK) { if (result == RETURN_OK) {
// We want to produce an error here in any case because the mode was not reached // We want to produce an error here in any case because the mode was not reached
return RETURN_FAILED; return RETURN_FAILED;

View File

@ -102,5 +102,5 @@ ReturnValue_t CService201HealthCommanding::handleReply(const CommandMessage *rep
auto health = static_cast<uint8_t>(HealthMessage::getHealth(reply)); auto health = static_cast<uint8_t>(HealthMessage::getHealth(reply));
auto oldHealth = static_cast<uint8_t>(HealthMessage::getOldHealth(reply)); auto oldHealth = static_cast<uint8_t>(HealthMessage::getOldHealth(reply));
HealthSetReply healthSetReply(health, oldHealth); HealthSetReply healthSetReply(health, oldHealth);
return sendTmPacket(Subservice::REPLY_HEALTH_SET, healthSetReply); return tmHelper.sendTmPacket(Subservice::REPLY_HEALTH_SET, healthSetReply);
} }

View File

@ -3,8 +3,8 @@
#include "fsfw/objectmanager/SystemObject.h" #include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/tmtcservices/PusServiceBase.h" #include "fsfw/tmtcservices/PusServiceBase.h"
#include "fsfw/tmtcservices/TmStoreHelper.h"
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h" #include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
#include "fsfw/tmtcservices/TmStoreHelper.h"
/** /**
* @brief Test Service * @brief Test Service

View File

@ -8,8 +8,8 @@
#include "fsfw/tmtcservices/AcceptsVerifyMessageIF.h" #include "fsfw/tmtcservices/AcceptsVerifyMessageIF.h"
#include "fsfw/tmtcservices/PusVerificationReport.h" #include "fsfw/tmtcservices/PusVerificationReport.h"
#include "fsfw/tmtcservices/TmSendHelper.h" #include "fsfw/tmtcservices/TmSendHelper.h"
#include "fsfw/tmtcservices/TmStoreHelper.h"
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h" #include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
#include "fsfw/tmtcservices/TmStoreHelper.h"
/** /**
* @brief Verify TC acceptance, start, progress and execution. * @brief Verify TC acceptance, start, progress and execution.

View File

@ -64,8 +64,7 @@ ReturnValue_t Service20ParameterManagement::checkAndAcquireTargetID(object_id_t*
ReturnValue_t Service20ParameterManagement::checkInterfaceAndAcquireMessageQueue( ReturnValue_t Service20ParameterManagement::checkInterfaceAndAcquireMessageQueue(
MessageQueueId_t* messageQueueToSet, object_id_t* objectId) { MessageQueueId_t* messageQueueToSet, object_id_t* objectId) {
// check ReceivesParameterMessagesIF property of target // check ReceivesParameterMessagesIF property of target
auto* possibleTarget = auto* possibleTarget = ObjectManager::instance()->get<ReceivesParameterMessagesIF>(*objectId);
ObjectManager::instance()->get<ReceivesParameterMessagesIF>(*objectId);
if (possibleTarget == nullptr) { if (possibleTarget == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Service20ParameterManagement::checkInterfaceAndAcquire" sif::error << "Service20ParameterManagement::checkInterfaceAndAcquire"

View File

@ -290,7 +290,8 @@ ReturnValue_t Service3Housekeeping::generateHkReply(const CommandMessage* hkMess
} }
HkPacket hkPacket(sid, resultPair.second.data(), resultPair.second.size()); HkPacket hkPacket(sid, resultPair.second.data(), resultPair.second.size());
return sendTmPacket(static_cast<uint8_t>(subserviceId), hkPacket.hkData, hkPacket.hkSize); return tmHelper.sendTmPacket(static_cast<uint8_t>(subserviceId), hkPacket.hkData,
hkPacket.hkSize);
} }
sid_t Service3Housekeeping::buildSid(object_id_t objectId, const uint8_t** tcData, sid_t Service3Housekeeping::buildSid(object_id_t objectId, const uint8_t** tcData,

View File

@ -2,8 +2,8 @@
#define FSFW_PUS_SERVICE5EVENTREPORTING_H_ #define FSFW_PUS_SERVICE5EVENTREPORTING_H_
#include "fsfw/events/EventMessage.h" #include "fsfw/events/EventMessage.h"
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
#include "fsfw/tmtcservices/PusServiceBase.h" #include "fsfw/tmtcservices/PusServiceBase.h"
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
/** /**
* @brief Report on-board events like information or errors * @brief Report on-board events like information or errors

View File

@ -138,7 +138,8 @@ ReturnValue_t Service8FunctionManagement::handleDataReply(const CommandMessage*
return result; return result;
} }
DataReply dataReply(objectId, actionId, buffer, size); DataReply dataReply(objectId, actionId, buffer, size);
result = tmHelper.sendTmPacket(static_cast<uint8_t>(Subservice::REPLY_DIRECT_COMMANDING_DATA), dataReply); result = tmHelper.sendTmPacket(static_cast<uint8_t>(Subservice::REPLY_DIRECT_COMMANDING_DATA),
dataReply);
auto deletionResult = ipcStore->deleteData(storeId); auto deletionResult = ipcStore->deleteData(storeId);
if (deletionResult != HasReturnvaluesIF::RETURN_OK) { if (deletionResult != HasReturnvaluesIF::RETURN_OK) {

View File

@ -9,10 +9,8 @@
class PusIF : public SpacePacketIF { class PusIF : public SpacePacketIF {
public: public:
static constexpr uint8_t INTERFACE_ID = CLASS_ID::PUS_IF; static constexpr uint8_t INTERFACE_ID = CLASS_ID::PUS_IF;
static constexpr ReturnValue_t INVALID_PUS_VERSION = static constexpr ReturnValue_t INVALID_PUS_VERSION = retval::makeCode(INTERFACE_ID, 0);
retval::makeCode(INTERFACE_ID, 0); static constexpr ReturnValue_t INVALID_CRC_16 = retval::makeCode(INTERFACE_ID, 1);
static constexpr ReturnValue_t INVALID_CRC_16 =
retval::makeCode(INTERFACE_ID, 1);
~PusIF() override = default; ~PusIF() override = default;
/** /**

View File

@ -134,9 +134,7 @@ ReturnValue_t PusTmCreator::setSerializableUserData(SerializeIF& serializable) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
void PusTmCreator::setService(uint8_t service) { void PusTmCreator::setService(uint8_t service) { pusParams.secHeader.service = service; }
pusParams.secHeader.service = service;
}
void PusTmCreator::setSubservice(uint8_t subservice) { void PusTmCreator::setSubservice(uint8_t subservice) {
pusParams.secHeader.subservice = subservice; pusParams.secHeader.subservice = subservice;

View File

@ -6,7 +6,6 @@
#include "TmStoreHelper.h" #include "TmStoreHelper.h"
#include "VerificationReporter.h" #include "VerificationReporter.h"
#include "fsfw/FSFW.h" #include "fsfw/FSFW.h"
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
#include "fsfw/container/FIFO.h" #include "fsfw/container/FIFO.h"
#include "fsfw/container/FixedMap.h" #include "fsfw/container/FixedMap.h"
#include "fsfw/ipc/CommandMessage.h" #include "fsfw/ipc/CommandMessage.h"
@ -15,6 +14,7 @@
#include "fsfw/serialize/SerializeIF.h" #include "fsfw/serialize/SerializeIF.h"
#include "fsfw/storagemanager/StorageManagerIF.h" #include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/tasks/ExecutableObjectIF.h" #include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
namespace Factory { namespace Factory {
void setStaticFrameworkObjectIds(); void setStaticFrameworkObjectIds();
@ -284,13 +284,12 @@ class CommandingServiceBase : public SystemObject,
*/ */
PeriodicTaskIF* executingTask = nullptr; PeriodicTaskIF* executingTask = nullptr;
[[deprecated("Use function with same name provided by tmHelper")]] [[deprecated("Use function with same name provided by tmHelper")]] ReturnValue_t sendTmPacket(
ReturnValue_t sendTmPacket(uint8_t subservice, const uint8_t* sourceData, size_t sourceDataLen); uint8_t subservice, const uint8_t* sourceData, size_t sourceDataLen);
[[deprecated("Use function with same name provided by tmHelper")]] [[deprecated("Use function with same name provided by tmHelper")]] ReturnValue_t sendTmPacket(
ReturnValue_t sendTmPacket(uint8_t subservice, object_id_t objectId, const uint8_t* data, uint8_t subservice, object_id_t objectId, const uint8_t* data, size_t dataLen);
size_t dataLen); [[deprecated("Use function with same name provided by tmHelper")]] ReturnValue_t sendTmPacket(
[[deprecated("Use function with same name provided by tmHelper")]] uint8_t subservice, SerializeIF& sourceData);
ReturnValue_t sendTmPacket(uint8_t subservice, SerializeIF& sourceData);
void checkAndExecuteFifo(CommandMapIter& iter); void checkAndExecuteFifo(CommandMapIter& iter);

View File

@ -28,7 +28,6 @@ class TmSendHelper {
ReturnValue_t sendPacket(MessageQueueId_t dest, const store_address_t& storeId); ReturnValue_t sendPacket(MessageQueueId_t dest, const store_address_t& storeId);
ReturnValue_t sendPacket(const store_address_t& storeId); ReturnValue_t sendPacket(const store_address_t& storeId);
private: private:
MessageQueueId_t defaultDest = MessageQueueIF::NO_QUEUE; MessageQueueId_t defaultDest = MessageQueueIF::NO_QUEUE;
bool ignoreFault = false; bool ignoreFault = false;

View File

@ -1,9 +1,10 @@
#include "TmStoreAndSendHelper.h" #include "TmStoreAndSendHelper.h"
#include "tmHelpers.h" #include "tmHelpers.h"
TmStoreAndSendWrapper::TmStoreAndSendWrapper( TmStoreAndSendWrapper::TmStoreAndSendWrapper(uint8_t defaultService, TmStoreHelper& storeHelper,
uint8_t defaultService, TmStoreHelper& storeHelper, TmSendHelper& sendHelper) TmSendHelper& sendHelper)
: storeHelper(storeHelper), sendHelper(sendHelper), defaultService(defaultService){} : storeHelper(storeHelper), sendHelper(sendHelper), defaultService(defaultService) {}
ReturnValue_t TmStoreAndSendWrapper::storeAndSendTmPacket() { ReturnValue_t TmStoreAndSendWrapper::storeAndSendTmPacket() {
ReturnValue_t result = storeHelper.addPacketToStore(); ReturnValue_t result = storeHelper.addPacketToStore();
@ -17,7 +18,7 @@ ReturnValue_t TmStoreAndSendWrapper::storeAndSendTmPacket() {
} }
return result; return result;
} }
if(incrementSendCounter) { if (incrementSendCounter) {
sendCounter++; sendCounter++;
} }
return result; return result;

View File

@ -5,12 +5,13 @@
#include "TmStoreHelper.h" #include "TmStoreHelper.h"
/** /**
* Wrapper class intended to help with PUS TM handling. This wrapper class also caches the current packet count * Wrapper class intended to help with PUS TM handling. This wrapper class also caches the current
* and the service ID * packet count and the service ID
*/ */
class TmStoreAndSendWrapper { class TmStoreAndSendWrapper {
public: public:
TmStoreAndSendWrapper(uint8_t defaultService, TmStoreHelper& storeHelper, TmSendHelper& sendHelper); TmStoreAndSendWrapper(uint8_t defaultService, TmStoreHelper& storeHelper,
TmSendHelper& sendHelper);
ReturnValue_t storeAndSendTmPacket(); ReturnValue_t storeAndSendTmPacket();
ReturnValue_t sendTmPacket(uint8_t subservice); ReturnValue_t sendTmPacket(uint8_t subservice);

View File

@ -18,10 +18,9 @@ TmStoreHelper::TmStoreHelper(uint16_t defaultApid, StorageManagerIF& tmStore,
} }
ReturnValue_t TmStoreHelper::preparePacket(uint8_t service, uint8_t subservice, uint16_t counter) { ReturnValue_t TmStoreHelper::preparePacket(uint8_t service, uint8_t subservice, uint16_t counter) {
PusTmParams& params = creator.getParams(); creator.setService(service);
params.secHeader.service = service; creator.setSubservice(subservice);
params.secHeader.subservice = subservice; creator.setMessageTypeCounter(counter);
params.secHeader.messageTypeCounter = counter;
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
@ -72,6 +71,6 @@ TimeStamperIF* TmStoreHelper::getTimeStamper() const { return creator.getTimesta
uint16_t TmStoreHelper::getApid() const { return creator.getApid(); } uint16_t TmStoreHelper::getApid() const { return creator.getApid(); }
ReturnValue_t TmStoreHelper::setService(uint8_t service) { creator.setService(service); } void TmStoreHelper::setService(uint8_t service) { creator.setService(service); }
ReturnValue_t TmStoreHelper::setSubservice(uint8_t subservice) { creator.setSubservice(subservice); } void TmStoreHelper::setSubservice(uint8_t subservice) { creator.setSubservice(subservice); }

View File

@ -27,8 +27,8 @@ class TmStoreHelper {
[[nodiscard]] uint16_t getApid() const; [[nodiscard]] uint16_t getApid() const;
[[nodiscard]] const store_address_t& getCurrentAddr() const; [[nodiscard]] const store_address_t& getCurrentAddr() const;
ReturnValue_t setService(uint8_t service); void setService(uint8_t service);
ReturnValue_t setSubservice(uint8_t subservice); void setSubservice(uint8_t subservice);
ReturnValue_t setSourceDataRaw(const uint8_t* data, size_t len); ReturnValue_t setSourceDataRaw(const uint8_t* data, size_t len);
ReturnValue_t setSourceDataSerializable(SerializeIF& serializable); ReturnValue_t setSourceDataSerializable(SerializeIF& serializable);

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 = retval::makeCode(CLASS_ID, 0);
retval::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,9 +41,8 @@ class CommandExecutor {
//! [EXPORT] : [COMMENT] Command execution failed //! [EXPORT] : [COMMENT] Command execution failed
static constexpr ReturnValue_t COMMAND_ERROR = retval::makeCode(CLASS_ID, 3); static constexpr ReturnValue_t COMMAND_ERROR = retval::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 = retval::makeCode(CLASS_ID, 4);
retval::makeCode(CLASS_ID, 4); static constexpr ReturnValue_t PCLOSE_CALL_ERROR = retval::makeCode(CLASS_ID, 6);
static constexpr ReturnValue_t PCLOSE_CALL_ERROR =retval::makeCode(CLASS_ID, 6);
/** /**
* Constructor. Is initialized with maximum size of internal buffer to read data from the * Constructor. Is initialized with maximum size of internal buffer to read data from the