Merge remote-tracking branch 'upstream/development' into mueller/local-pool-update-remove-ignore-fault-arg

This commit is contained in:
Robin Müller 2022-10-28 10:06:04 +02:00
commit f715b65d6e
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
31 changed files with 103 additions and 70 deletions

View File

@ -61,6 +61,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
interface itself so it can be re-used more easily. Also add new
abstract function `bool hasDataAtId(store_address_t storeId) const`.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/685
- Improvements for `AcceptsTelemetryIF` and `AcceptsTelecommandsIF`:
- Make functions `const` where it makes sense
- Add `const char* getName const` abstract function
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/684
# [v5.0.0] 25.07.2022

View File

@ -51,6 +51,6 @@ ReturnValue_t CfdpHandler::performOperation(uint8_t opCode) {
return returnvalue::OK;
}
uint16_t CfdpHandler::getIdentifier() { return 0; }
uint32_t CfdpHandler::getIdentifier() const { return 0; }
MessageQueueId_t CfdpHandler::getRequestQueue() { return this->requestQueue->getId(); }
MessageQueueId_t CfdpHandler::getRequestQueue() const { return this->requestQueue->getId(); }

View File

@ -25,8 +25,8 @@ class CfdpHandler : public ExecutableObjectIF, public AcceptsTelecommandsIF, pub
virtual ReturnValue_t handleRequest(store_address_t storeId);
virtual ReturnValue_t initialize() override;
virtual uint16_t getIdentifier() override;
MessageQueueId_t getRequestQueue() override;
uint32_t getIdentifier() const override;
MessageQueueId_t getRequestQueue() const override;
ReturnValue_t performOperation(uint8_t opCode) override;
protected:

View File

@ -18,7 +18,7 @@
TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId,
object_id_t tcStoreId)
: TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
: TmTcBridge("TCP TMTC Bridge", objectId, tcDestination, tmStoreId, tcStoreId) {
mutex = MutexFactory::instance()->createMutex();
// Connection is always up, TM is requested by connecting to server and receiving packets
registerCommConnect();

View File

@ -22,7 +22,7 @@ const std::string UdpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_POR
UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
const std::string &udpServerPort_, object_id_t tmStoreId,
object_id_t tcStoreId)
: TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
: TmTcBridge("UDP TMTC Bridge", objectId, tcDestination, tmStoreId, tcStoreId) {
if (udpServerPort_.empty()) {
udpServerPort = DEFAULT_SERVER_PORT;
} else {

View File

@ -10,8 +10,8 @@
CService200ModeCommanding::CService200ModeCommanding(object_id_t objectId, uint16_t apid,
uint8_t serviceId, uint8_t numParallelCommands,
uint16_t commandTimeoutSeconds)
: CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) {
}
: CommandingServiceBase(objectId, apid, "PUS 200 Mode MGMT", serviceId, numParallelCommands,
commandTimeoutSeconds) {}
CService200ModeCommanding::~CService200ModeCommanding() {}

View File

@ -10,8 +10,8 @@ CService201HealthCommanding::CService201HealthCommanding(object_id_t objectId, u
uint8_t serviceId,
uint8_t numParallelCommands,
uint16_t commandTimeoutSeconds)
: CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) {
}
: CommandingServiceBase(objectId, apid, "PUS 201 Health MGMT", serviceId, numParallelCommands,
commandTimeoutSeconds) {}
ReturnValue_t CService201HealthCommanding::isValidSubservice(uint8_t subservice) {
switch (subservice) {

View File

@ -16,7 +16,9 @@ inline Service11TelecommandScheduling<MAX_NUM_TCS>::Service11TelecommandScheduli
: PusServiceBase(params),
RELEASE_TIME_MARGIN_SECONDS(releaseTimeMarginSeconds),
debugMode(debugMode),
tcRecipient(tcRecipient) {}
tcRecipient(tcRecipient) {
params.name = "PUS 11 TC Scheduling";
}
template <size_t MAX_NUM_TCS>
inline Service11TelecommandScheduling<MAX_NUM_TCS>::~Service11TelecommandScheduling() = default;

View File

@ -8,7 +8,9 @@
Service17Test::Service17Test(PsbParams params)
: PusServiceBase(params),
storeHelper(params.apid),
tmHelper(params.serviceId, storeHelper, sendHelper) {}
tmHelper(params.serviceId, storeHelper, sendHelper) {
params.name = "PUS 17 Test";
}
Service17Test::~Service17Test() = default;

View File

@ -11,8 +11,8 @@ Service20ParameterManagement::Service20ParameterManagement(object_id_t objectId,
uint8_t serviceId,
uint8_t numberOfParallelCommands,
uint16_t commandTimeoutSeconds)
: CommandingServiceBase(objectId, apid, serviceId, numberOfParallelCommands,
commandTimeoutSeconds) {}
: CommandingServiceBase(objectId, apid, "PUS 20 Parameter MGMT", serviceId,
numberOfParallelCommands, commandTimeoutSeconds) {}
Service20ParameterManagement::~Service20ParameterManagement() = default;

View File

@ -14,8 +14,8 @@
Service2DeviceAccess::Service2DeviceAccess(object_id_t objectId, uint16_t apid, uint8_t serviceId,
uint8_t numberOfParallelCommands,
uint16_t commandTimeoutSeconds)
: CommandingServiceBase(objectId, apid, serviceId, numberOfParallelCommands,
commandTimeoutSeconds) {}
: CommandingServiceBase(objectId, apid, "PUS 2 Raw Commanding", serviceId,
numberOfParallelCommands, commandTimeoutSeconds) {}
Service2DeviceAccess::~Service2DeviceAccess() {}

View File

@ -5,7 +5,7 @@
#include "fsfw/pus/servicepackets/Service3Packets.h"
Service3Housekeeping::Service3Housekeeping(object_id_t objectId, uint16_t apid, uint8_t serviceId)
: CommandingServiceBase(objectId, apid, serviceId, NUM_OF_PARALLEL_COMMANDS,
: CommandingServiceBase(objectId, apid, "PUS 3 HK", serviceId, NUM_OF_PARALLEL_COMMANDS,
COMMAND_TIMEOUT_SECONDS) {}
Service3Housekeeping::~Service3Housekeeping() {}

View File

@ -13,6 +13,7 @@ Service5EventReporting::Service5EventReporting(PsbParams params, size_t maxNumbe
storeHelper(params.apid),
tmHelper(params.serviceId, storeHelper, sendHelper),
maxNumberReportsPerCycle(maxNumberReportsPerCycle) {
psbParams.name = "PUS 5 Event Reporting";
eventQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth);
}

View File

@ -12,8 +12,8 @@ Service8FunctionManagement::Service8FunctionManagement(object_id_t objectId, uin
uint8_t serviceId,
uint8_t numParallelCommands,
uint16_t commandTimeoutSeconds)
: CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) {
}
: CommandingServiceBase(objectId, apid, "PUS 8 Functional Commanding", serviceId,
numParallelCommands, commandTimeoutSeconds) {}
Service8FunctionManagement::~Service8FunctionManagement() {}

View File

@ -5,7 +5,9 @@
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/timemanager/CCSDSTime.h"
Service9TimeManagement::Service9TimeManagement(PsbParams params) : PusServiceBase(params) {}
Service9TimeManagement::Service9TimeManagement(PsbParams params) : PusServiceBase(params) {
params.name = "PUS 9 Time MGMT";
}
Service9TimeManagement::~Service9TimeManagement() = default;

View File

@ -59,7 +59,7 @@ TcDistributor::TcMqMapIter CCSDSDistributor::selectDestination() {
}
}
MessageQueueId_t CCSDSDistributor::getRequestQueue() { return tcQueue->getId(); }
MessageQueueId_t CCSDSDistributor::getRequestQueue() const { return tcQueue->getId(); }
ReturnValue_t CCSDSDistributor::registerApplication(AcceptsTelecommandsIF* application) {
ReturnValue_t returnValue = returnvalue::OK;
@ -80,7 +80,7 @@ ReturnValue_t CCSDSDistributor::registerApplication(uint16_t apid, MessageQueueI
return returnValue;
}
uint16_t CCSDSDistributor::getIdentifier() { return 0; }
uint32_t CCSDSDistributor::getIdentifier() const { return 0; }
ReturnValue_t CCSDSDistributor::initialize() {
if (packetChecker == nullptr) {

View File

@ -35,10 +35,10 @@ class CCSDSDistributor : public TcDistributor,
*/
~CCSDSDistributor() override;
MessageQueueId_t getRequestQueue() override;
MessageQueueId_t getRequestQueue() const override;
ReturnValue_t registerApplication(uint16_t apid, MessageQueueId_t id) override;
ReturnValue_t registerApplication(AcceptsTelecommandsIF* application) override;
uint16_t getIdentifier() override;
uint32_t getIdentifier() const override;
ReturnValue_t initialize() override;
protected:

View File

@ -33,9 +33,9 @@ class CFDPDistributor : public TcDistributor,
*/
~CFDPDistributor() override;
ReturnValue_t registerHandler(AcceptsTelecommandsIF* handler) override;
MessageQueueId_t getRequestQueue() override;
MessageQueueId_t getRequestQueue() const override;
ReturnValue_t initialize() override;
uint16_t getIdentifier() override;
uint32_t getIdentifier() const override;
protected:
uint16_t apid;

View File

@ -1,9 +1,4 @@
target_sources(
${LIB_FSFW_NAME}
PRIVATE CCSDSDistributor.cpp
PusDistributor.cpp
TcDistributor.cpp
PusPacketChecker.cpp
TcPacketCheckCFDP.cpp
CFDPDistributor.cpp
CcsdsPacketChecker.cpp)
PRIVATE CCSDSDistributor.cpp PusDistributor.cpp TcDistributor.cpp
TcPacketCheckCFDP.cpp CcsdsPacketChecker.cpp)

View File

@ -97,7 +97,7 @@ ReturnValue_t PusDistributor::registerService(AcceptsTelecommandsIF* service) {
return returnvalue::OK;
}
MessageQueueId_t PusDistributor::getRequestQueue() { return tcQueue->getId(); }
MessageQueueId_t PusDistributor::getRequestQueue() const { return tcQueue->getId(); }
ReturnValue_t PusDistributor::callbackAfterSending(ReturnValue_t queueStatus) {
if (queueStatus != returnvalue::OK) {
@ -115,7 +115,7 @@ ReturnValue_t PusDistributor::callbackAfterSending(ReturnValue_t queueStatus) {
}
}
uint16_t PusDistributor::getIdentifier() { return checker.getApid(); }
uint32_t PusDistributor::getIdentifier() const { return checker.getApid(); }
ReturnValue_t PusDistributor::initialize() {
if (store == nullptr) {

View File

@ -34,9 +34,9 @@ class PusDistributor : public TcDistributor, public PUSDistributorIF, public Acc
*/
~PusDistributor() override;
ReturnValue_t registerService(AcceptsTelecommandsIF* service) override;
MessageQueueId_t getRequestQueue() override;
MessageQueueId_t getRequestQueue() const override;
ReturnValue_t initialize() override;
uint16_t getIdentifier() override;
uint32_t getIdentifier() const override;
protected:
StorageManagerIF* store;

View File

@ -21,20 +21,22 @@ class AcceptsTelecommandsIF {
* @brief The virtual destructor as it is mandatory for C++ interfaces.
*/
virtual ~AcceptsTelecommandsIF() = default;
[[nodiscard]] virtual const char* getName() const = 0;
/**
* @brief Getter for the service id.
* @details Any receiving service (at least any PUS service) shall have a
* service ID. If the receiver can handle Telecommands, but for
* some reason has no service id, it shall return 0.
* @return The service ID or 0.
* @brief Getter for a generic identifier ID.
* @details Any receiving service (at least any PUS service) shall have an identifier. For
* example, this could be the APID for a receiver expecting generic PUS packets, or a PUS
* service for a component expecting specific PUS service packets.
* @return The identifier.
*/
virtual uint16_t getIdentifier() = 0;
[[nodiscard]] virtual uint32_t getIdentifier() const = 0;
/**
* @brief This method returns the message queue id of the telecommand
* receiving message queue.
* @return The telecommand reception message queue id.
*/
virtual MessageQueueId_t getRequestQueue() = 0;
[[nodiscard]] virtual MessageQueueId_t getRequestQueue() const = 0;
};
#endif /* FRAMEWORK_TMTCSERVICES_ACCEPTSTELECOMMANDSIF_H_ */

View File

@ -14,6 +14,8 @@ class AcceptsTelemetryIF {
* @brief The virtual destructor as it is mandatory for C++ interfaces.
*/
virtual ~AcceptsTelemetryIF() = default;
[[nodiscard]] virtual const char* getName() const = 0;
/**
* @brief This method returns the message queue id of the telemetry
* receiving message queue.

View File

@ -14,7 +14,8 @@ object_id_t CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT;
object_id_t CommandingServiceBase::defaultPacketDestination = objects::NO_OBJECT;
CommandingServiceBase::CommandingServiceBase(object_id_t setObjectId, uint16_t apid,
uint8_t service, uint8_t numberOfParallelCommands,
const char* name, uint8_t service,
uint8_t numberOfParallelCommands,
uint16_t commandTimeoutSeconds, size_t queueDepth,
VerificationReporterIF* verificationReporter)
: SystemObject(setObjectId),
@ -24,7 +25,8 @@ CommandingServiceBase::CommandingServiceBase(object_id_t setObjectId, uint16_t a
tmStoreHelper(apid),
tmHelper(service, tmStoreHelper, tmSendHelper),
verificationReporter(verificationReporter),
commandMap(numberOfParallelCommands) {
commandMap(numberOfParallelCommands),
name(name) {
commandQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
requestQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
}
@ -50,9 +52,9 @@ ReturnValue_t CommandingServiceBase::performOperation(uint8_t opCode) {
return returnvalue::OK;
}
uint16_t CommandingServiceBase::getIdentifier() { return service; }
uint32_t CommandingServiceBase::getIdentifier() const { return service; }
MessageQueueId_t CommandingServiceBase::getRequestQueue() { return requestQueue->getId(); }
MessageQueueId_t CommandingServiceBase::getRequestQueue() const { return requestQueue->getId(); }
ReturnValue_t CommandingServiceBase::initialize() {
ReturnValue_t result = SystemObject::initialize();
@ -489,3 +491,5 @@ void CommandingServiceBase::prepareVerificationSuccessWithFullInfo(
successParams.tcPsc = tcInfo.tcSequenceControl;
successParams.ackFlags = tcInfo.ackFlags;
}
const char* CommandingServiceBase::getName() const { return name; }

View File

@ -75,7 +75,7 @@ class CommandingServiceBase : public SystemObject,
* @param setPacketDestination
* @param queueDepth
*/
CommandingServiceBase(object_id_t setObjectId, uint16_t apid, uint8_t service,
CommandingServiceBase(object_id_t setObjectId, uint16_t apid, const char* name, uint8_t service,
uint8_t numberOfParallelCommands, uint16_t commandTimeoutSeconds,
size_t queueDepth = 20, VerificationReporterIF* reporter = nullptr);
~CommandingServiceBase() override;
@ -105,7 +105,7 @@ class CommandingServiceBase : public SystemObject,
*/
ReturnValue_t performOperation(uint8_t opCode) override;
uint16_t getIdentifier() override;
uint32_t getIdentifier() const override;
/**
* Returns the requestQueue MessageQueueId_t
@ -114,7 +114,7 @@ class CommandingServiceBase : public SystemObject,
*
* @return requestQueue messageQueueId_t
*/
MessageQueueId_t getRequestQueue() override;
MessageQueueId_t getRequestQueue() const override;
/**
* Returns the commandQueue MessageQueueId_t
@ -133,6 +133,7 @@ class CommandingServiceBase : public SystemObject,
* @param task Pointer to the taskIF of this task
*/
void setTaskIF(PeriodicTaskIF* task) override;
const char* getName() const override;
protected:
/**
@ -283,6 +284,8 @@ class CommandingServiceBase : public SystemObject,
uint32_t failureParameter1 = 0;
uint32_t failureParameter2 = 0;
const char* name = "";
static object_id_t defaultPacketSource;
object_id_t packetSource = objects::NO_OBJECT;
static object_id_t defaultPacketDestination;

View File

@ -82,9 +82,9 @@ void PusServiceBase::handleRequestQueue() {
}
}
uint16_t PusServiceBase::getIdentifier() { return psbParams.serviceId; }
uint32_t PusServiceBase::getIdentifier() const { return psbParams.serviceId; }
MessageQueueId_t PusServiceBase::getRequestQueue() {
MessageQueueId_t PusServiceBase::getRequestQueue() const {
if (psbParams.reqQueue == nullptr) {
return MessageQueueIF::NO_QUEUE;
}
@ -202,3 +202,5 @@ void PusServiceBase::setTmReceiver(AcceptsTelemetryIF& tmReceiver_) {
}
void PusServiceBase::setRequestQueue(MessageQueueIF& reqQueue) { psbParams.reqQueue = &reqQueue; }
const char* PusServiceBase::getName() const { return psbParams.name; }

View File

@ -22,9 +22,13 @@ class StorageManagerIF;
struct PsbParams {
PsbParams() = default;
PsbParams(uint16_t apid, AcceptsTelemetryIF* tmReceiver) : apid(apid), tmReceiver(tmReceiver) {}
PsbParams(const char* name, uint16_t apid, AcceptsTelemetryIF* tmReceiver)
: name(name), apid(apid), tmReceiver(tmReceiver) {}
PsbParams(object_id_t objectId, uint16_t apid, uint8_t serviceId)
: objectId(objectId), apid(apid), serviceId(serviceId) {}
PsbParams(const char* name, object_id_t objectId, uint16_t apid, uint8_t serviceId)
: name(name), objectId(objectId), apid(apid), serviceId(serviceId) {}
const char* name = "";
object_id_t objectId = objects::NO_OBJECT;
uint16_t apid = 0;
uint8_t serviceId = 0;
@ -187,11 +191,12 @@ class PusServiceBase : public ExecutableObjectIF,
* @c returnvalue::FAILED else.
*/
ReturnValue_t performOperation(uint8_t opCode) override;
uint16_t getIdentifier() override;
MessageQueueId_t getRequestQueue() override;
uint32_t getIdentifier() const override;
MessageQueueId_t getRequestQueue() const override;
ReturnValue_t initialize() override;
void setTaskIF(PeriodicTaskIF* taskHandle) override;
[[nodiscard]] const char* getName() const override;
protected:
/**
@ -200,6 +205,7 @@ class PusServiceBase : public ExecutableObjectIF,
* Will be set by setTaskIF(), which is called on task creation.
*/
PeriodicTaskIF* taskHandle = nullptr;
/**
* One of two error parameters for additional error information.
*/

View File

@ -7,9 +7,10 @@
#define TMTCBRIDGE_WIRETAPPING 0
TmTcBridge::TmTcBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId,
object_id_t tcStoreId)
TmTcBridge::TmTcBridge(const char* name, object_id_t objectId, object_id_t tcDestination,
object_id_t tmStoreId, object_id_t tcStoreId)
: SystemObject(objectId),
name(name),
tmStoreId(tmStoreId),
tcStoreId(tcStoreId),
tcDestination(tcDestination)
@ -67,8 +68,7 @@ ReturnValue_t TmTcBridge::initialize() {
#endif
return ObjectManagerIF::CHILD_INIT_FAILED;
}
AcceptsTelecommandsIF* tcDistributor =
ObjectManager::instance()->get<AcceptsTelecommandsIF>(tcDestination);
auto* tcDistributor = ObjectManager::instance()->get<AcceptsTelecommandsIF>(tcDestination);
if (tcDistributor == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "TmTcBridge::initialize: TC Distributor invalid" << std::endl;
@ -246,14 +246,16 @@ MessageQueueId_t TmTcBridge::getReportReceptionQueue(uint8_t virtualChannel) {
void TmTcBridge::printData(uint8_t* data, size_t dataLen) { arrayprinter::print(data, dataLen); }
uint16_t TmTcBridge::getIdentifier() {
uint32_t TmTcBridge::getIdentifier() const {
// This is no PUS service, so we just return 0
return 0;
}
MessageQueueId_t TmTcBridge::getRequestQueue() {
MessageQueueId_t TmTcBridge::getRequestQueue() const {
// Default implementation: Relay TC messages to TC distributor directly.
return tmTcReceptionQueue->getDefaultDestination();
}
void TmTcBridge::setFifoToOverwriteOldData(bool overwriteOld) { this->overwriteOld = overwriteOld; }
const char* TmTcBridge::getName() const { return name; }

View File

@ -22,9 +22,9 @@ class TmTcBridge : public AcceptsTelemetryIF,
static constexpr uint8_t DEFAULT_STORED_DATA_SENT_PER_CYCLE = 5;
static constexpr uint8_t DEFAULT_DOWNLINK_PACKETS_STORED = 10;
TmTcBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId,
object_id_t tcStoreId);
virtual ~TmTcBridge();
TmTcBridge(const char* name, object_id_t objectId, object_id_t tcDestination,
object_id_t tmStoreId, object_id_t tcStoreId);
~TmTcBridge() override;
/**
* Set number of packets sent per performOperation().Please note that this
@ -57,21 +57,24 @@ class TmTcBridge : public AcceptsTelemetryIF,
* Initializes necessary FSFW components for the TMTC Bridge
* @return
*/
virtual ReturnValue_t initialize() override;
ReturnValue_t initialize() override;
/**
* @brief Handles TMTC reception
*/
virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override;
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
/** AcceptsTelemetryIF override */
virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override;
MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override;
/** AcceptsTelecommandsIF override */
virtual uint16_t getIdentifier() override;
virtual MessageQueueId_t getRequestQueue() override;
uint32_t getIdentifier() const override;
MessageQueueId_t getRequestQueue() const override;
const char* getName() const override;
protected:
const char* name = "";
//! Cached for initialize function.
object_id_t tmStoreId = objects::NO_OBJECT;
object_id_t tcStoreId = objects::NO_OBJECT;

View File

@ -9,3 +9,5 @@ AcceptsTmMock::AcceptsTmMock(MessageQueueId_t queueToReturn)
MessageQueueId_t AcceptsTmMock::getReportReceptionQueue(uint8_t virtualChannel) {
return returnedQueue;
}
const char* AcceptsTmMock::getName() const { return "TM Acceptor Mock"; }

View File

@ -10,6 +10,7 @@ class AcceptsTmMock : public SystemObject, public AcceptsTelemetryIF {
explicit AcceptsTmMock(MessageQueueId_t queueToReturn);
MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) override;
const char* getName() const override;
MessageQueueId_t returnedQueue;
};