Merge branch 'mueller/refactor-tmtc-stack' into mueller/refactor-tmtc-stack-with-retval-refactoring

This commit is contained in:
Robin Müller 2022-08-22 14:17:24 +02:00
commit 2a4ab0af7b
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
8 changed files with 25 additions and 23 deletions

View File

@ -8,17 +8,23 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
# [unreleased]
## Changes
- Removed `HasReturnvaluesIF` class in favor of `returnvalue` namespace with `OK` and `FAILED`
constants.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/659
# [v6.0.0]
## Added
- Add new `UnsignedByteField` class
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/660
## Changes
- Removed `HasReturnvaluesIF` class in favor of `returnvalue` namespace with `OK` and `FAILED`
constants.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/659
- Overhaul of the TMTC stack, including various changes and improvements
for other modules
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/655
which also includes a migration guide
# [v5.0.0] 25.07.2022
## Changes

View File

@ -33,7 +33,7 @@ enum framework_objects : object_id_t {
TC_STORE = 0x534f0100,
TM_STORE = 0x534f0200,
TIME_STAMPER = 0x53500010,
TC_VERIFICATOR = 0x53500020,
VERIFICATION_REPORTER = 0x53500020,
FSFW_OBJECTS_END = 0x53ffffff,
NO_OBJECT = 0xFFFFFFFF

View File

@ -103,16 +103,15 @@ ReturnValue_t PusDistributor::callbackAfterSending(ReturnValue_t queueStatus) {
if (queueStatus != returnvalue::OK) {
tcStatus = queueStatus;
}
if (tcStatus != returnvalue::OK) {
verifyChannel->sendFailureReport(
VerifFailureParams(tcverif::ACCEPTANCE_FAILURE, reader, tcStatus));
if (tcStatus != RETURN_OK) {
verifyChannel->sendFailureReport({tcverif::ACCEPTANCE_FAILURE, reader, tcStatus});
// A failed packet is deleted immediately after reporting,
// otherwise it will block memory.
store->deleteData(currentMessage.getStorageId());
return returnvalue::FAILED;
} else {
verifyChannel->sendSuccessReport(VerifSuccessParams(tcverif::ACCEPTANCE_SUCCESS, reader));
return returnvalue::OK;
verifyChannel->sendSuccessReport({tcverif::ACCEPTANCE_SUCCESS, reader});
return RETURN_OK;
}
}
@ -136,7 +135,7 @@ ReturnValue_t PusDistributor::initialize() {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
if (verifyChannel == nullptr) {
verifyChannel = ObjectManager::instance()->get<VerificationReporterIF>(objects::TC_VERIFICATOR);
verifyChannel = ObjectManager::instance()->get<VerificationReporterIF>(objects::VERIFICATION_REPORTER);
if (verifyChannel == nullptr) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}

View File

@ -124,7 +124,7 @@ ReturnValue_t CommandingServiceBase::initialize() {
if (verificationReporter == nullptr) {
verificationReporter =
ObjectManager::instance()->get<VerificationReporterIF>(objects::TC_VERIFICATOR);
ObjectManager::instance()->get<VerificationReporterIF>(objects::VERIFICATION_REPORTER);
if (verificationReporter == nullptr) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}

View File

@ -126,7 +126,7 @@ ReturnValue_t PusServiceBase::initialize() {
if (psbParams.verifReporter == nullptr) {
psbParams.verifReporter =
ObjectManager::instance()->get<VerificationReporterIF>(objects::TC_VERIFICATOR);
ObjectManager::instance()->get<VerificationReporterIF>(objects::VERIFICATION_REPORTER);
if (psbParams.verifReporter == nullptr) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}

View File

@ -5,9 +5,9 @@
#include "fsfw/tmtcservices/PusVerificationReport.h"
object_id_t VerificationReporter::DEFAULT_RECEIVER = objects::PUS_SERVICE_1_VERIFICATION;
object_id_t VerificationReporter::DEFAULT_REPORTER = objects::TC_VERIFICATOR;
object_id_t VerificationReporter::DEFAULT_REPORTER = objects::VERIFICATION_REPORTER;
VerificationReporter::VerificationReporter(AcceptsVerifyMessageIF* receiver, object_id_t objectId)
VerificationReporter::VerificationReporter(object_id_t objectId, AcceptsVerifyMessageIF* receiver)
: SystemObject(objectId) {
if (receiver != nullptr) {
acknowledgeQueue = receiver->getVerificationQueue();

View File

@ -27,16 +27,13 @@ class VerificationReporter : public SystemObject, public VerificationReporterIF
friend void Factory::setStaticFrameworkObjectIds();
public:
explicit VerificationReporter(AcceptsVerifyMessageIF* receiver,
object_id_t objectId = DEFAULT_REPORTER);
explicit VerificationReporter(object_id_t objectId = DEFAULT_REPORTER,
AcceptsVerifyMessageIF* receiver = nullptr);
~VerificationReporter() override;
void setReceiver(AcceptsVerifyMessageIF& receiver);
// TODO: The API is a little bit bloated. It might be better to group all the parameters
// into a dedicated struct
ReturnValue_t sendSuccessReport(VerifSuccessParams params) override;
ReturnValue_t sendFailureReport(VerifFailureParams params) override;
static object_id_t DEFAULT_REPORTER;
@ -44,7 +41,7 @@ class VerificationReporter : public SystemObject, public VerificationReporterIF
ReturnValue_t initialize() override;
private:
MessageQueueId_t acknowledgeQueue;
MessageQueueId_t acknowledgeQueue = MessageQueueIF::NO_QUEUE;
};
#endif /* FSFW_TMTCSERVICES_VERIFICATIONREPORTER_H_ */

View File

@ -213,7 +213,7 @@ TEST_CASE("Pus Service Base", "[pus-service-base]") {
SECTION("Auto Initialize Verification Reporter") {
psbParams.verifReporter = nullptr;
psbParams.objectId = 1;
object_id_t reporterId = objects::TC_VERIFICATOR;
object_id_t reporterId = objects::VERIFICATION_REPORTER;
PusVerificationReporterMock otherReporter(reporterId);
auto psb2 = PsbMock(psbParams);
REQUIRE(psb2.initialize() == returnvalue::OK);