some more API improvements and replacements
All checks were successful
fsfw/fsfw/pipeline/pr-development This commit looks good

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 {
environment {
BUILDDIR = 'build-tests'
BUILDDIR = 'cmake-build-tests'
}
agent {
docker { image 'fsfw-ci:d3'}

View File

@ -13,7 +13,7 @@ from shutil import which
from typing import List
UNITTEST_FOLDER_NAME = "build-tests"
UNITTEST_FOLDER_NAME = "cmake-build-tests"
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 ReturnValue_t INVALID_TLV_TYPE =
retval::makeCode(CFDP_CLASS_ID, 1);
static constexpr ReturnValue_t INVALID_DIRECTIVE_FIELDS =
retval::makeCode(CFDP_CLASS_ID, 2);
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);
static constexpr ReturnValue_t INVALID_TLV_TYPE = retval::makeCode(CFDP_CLASS_ID, 1);
static constexpr ReturnValue_t INVALID_DIRECTIVE_FIELDS = retval::makeCode(CFDP_CLASS_ID, 2);
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
//! available but the user did not pass a valid options array
static constexpr ReturnValue_t METADATA_CANT_PARSE_OPTIONS =
retval::makeCode(CFDP_CLASS_ID, 5);
static constexpr ReturnValue_t NAK_CANT_PARSE_OPTIONS =
retval::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t METADATA_CANT_PARSE_OPTIONS = retval::makeCode(CFDP_CLASS_ID, 5);
static constexpr ReturnValue_t NAK_CANT_PARSE_OPTIONS = retval::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t FINISHED_CANT_PARSE_FS_RESPONSES =
retval::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t FILESTORE_REQUIRES_SECOND_FILE =
retval::makeCode(CFDP_CLASS_ID, 8);
static constexpr ReturnValue_t FILESTORE_REQUIRES_SECOND_FILE = retval::makeCode(CFDP_CLASS_ID, 8);
//! Can not parse filestore response because user did not pass a valid instance
//! or remaining size is invalid
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,
object_id_t objectId) {
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) {
// We want to produce an error here in any case because the mode was not reached
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 oldHealth = static_cast<uint8_t>(HealthMessage::getOldHealth(reply));
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/tmtcservices/PusServiceBase.h"
#include "fsfw/tmtcservices/TmStoreHelper.h"
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
#include "fsfw/tmtcservices/TmStoreHelper.h"
/**
* @brief Test Service

View File

@ -8,8 +8,8 @@
#include "fsfw/tmtcservices/AcceptsVerifyMessageIF.h"
#include "fsfw/tmtcservices/PusVerificationReport.h"
#include "fsfw/tmtcservices/TmSendHelper.h"
#include "fsfw/tmtcservices/TmStoreHelper.h"
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
#include "fsfw/tmtcservices/TmStoreHelper.h"
/**
* @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(
MessageQueueId_t* messageQueueToSet, object_id_t* objectId) {
// check ReceivesParameterMessagesIF property of target
auto* possibleTarget =
ObjectManager::instance()->get<ReceivesParameterMessagesIF>(*objectId);
auto* possibleTarget = ObjectManager::instance()->get<ReceivesParameterMessagesIF>(*objectId);
if (possibleTarget == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
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());
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,

View File

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

View File

@ -138,7 +138,8 @@ ReturnValue_t Service8FunctionManagement::handleDataReply(const CommandMessage*
return result;
}
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);
if (deletionResult != HasReturnvaluesIF::RETURN_OK) {

View File

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

View File

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

View File

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

View File

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

View File

@ -5,12 +5,13 @@
#include "TmStoreHelper.h"
/**
* Wrapper class intended to help with PUS TM handling. This wrapper class also caches the current packet count
* and the service ID
* Wrapper class intended to help with PUS TM handling. This wrapper class also caches the current
* packet count and the service ID
*/
class TmStoreAndSendWrapper {
public:
TmStoreAndSendWrapper(uint8_t defaultService, TmStoreHelper& storeHelper, TmSendHelper& sendHelper);
TmStoreAndSendWrapper(uint8_t defaultService, TmStoreHelper& storeHelper,
TmSendHelper& sendHelper);
ReturnValue_t storeAndSendTmPacket();
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) {
PusTmParams& params = creator.getParams();
params.secHeader.service = service;
params.secHeader.subservice = subservice;
params.secHeader.messageTypeCounter = counter;
creator.setService(service);
creator.setSubservice(subservice);
creator.setMessageTypeCounter(counter);
return HasReturnvaluesIF::RETURN_OK;
}
@ -72,6 +71,6 @@ TimeStamperIF* TmStoreHelper::getTimeStamper() const { return creator.getTimesta
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]] const store_address_t& getCurrentAddr() const;
ReturnValue_t setService(uint8_t service);
ReturnValue_t setSubservice(uint8_t subservice);
void setService(uint8_t service);
void setSubservice(uint8_t subservice);
ReturnValue_t setSourceDataRaw(const uint8_t* data, size_t len);
ReturnValue_t setSourceDataSerializable(SerializeIF& serializable);

View File

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