diff --git a/ci/cppcheck.sh b/ci/cppcheck.sh index 2179a051c88e90de9c07d7f9898422c4c38beb6f..d0be486ccf6049895d93a76f070687dcb5c2e775 100755 --- a/ci/cppcheck.sh +++ b/ci/cppcheck.sh @@ -13,4 +13,4 @@ echo -e "\u001b[34;1mRunning cppcheck with default checklist...\u001b[0m" cd "$(dirname "$0")/.." cppcheck --enable=all --suppress=unusedFunction --suppress=noExplicitConstructor \ - --inline-suppr --error-exitcode=1 -I inc src test + --force --inline-suppr --error-exitcode=1 -I inc src test diff --git a/inc/Logger.hpp b/inc/Logger.hpp index 96c2101f84aeefb375400cfa0dbd54bc34f6b7e0..b5e4b7f21546360ce2d71194b6fc2c7eae4a7cd3 100644 --- a/inc/Logger.hpp +++ b/inc/Logger.hpp @@ -4,6 +4,7 @@ #include <cstdint> #include <etl/String.hpp> #include <etl/to_string.h> +#include "ECSS_Configuration.hpp" #include "ECSS_Definitions.hpp" #if defined LOGLEVEL_TRACE diff --git a/inc/ServicePool.hpp b/inc/ServicePool.hpp index f6a7ea23ecc2e1d865c9ff3f454249e0b0520f94..51c1fa201b856c3f1b0225113c1e60860f36ff1a 100644 --- a/inc/ServicePool.hpp +++ b/inc/ServicePool.hpp @@ -1,7 +1,8 @@ #ifndef ECSS_SERVICES_SERVICEPOOL_HPP #define ECSS_SERVICES_SERVICEPOOL_HPP -#include <Services/TimeBasedSchedulingService.hpp> +#include "ECSS_Configuration.hpp" +#include "Services/TimeBasedSchedulingService.hpp" #include "Services/LargePacketTransferService.hpp" #include "Services/RequestVerificationService.hpp" #include "Services/TimeManagementService.hpp" @@ -16,8 +17,6 @@ * Defines a class that contains instances of all Services. * * All Services should be stored here and should not be instantiated in a different way. - * - * @todo Find a way to disable services which are not used */ class ServicePool { /** @@ -34,16 +33,45 @@ class ServicePool { */ uint16_t packetSequenceCounter = 0; public: - RequestVerificationService requestVerification; +#ifdef SERVICE_EVENTACTION + EventActionService eventAction; +#endif + +#ifdef SERVICE_EVENTREPORT EventReportService eventReport; +#endif + +#ifdef SERVICE_FUNCTION + FunctionManagementService functionManagement; +#endif + +#ifdef SERVICE_LARGEPACKET + LargePacketTransferService largePacketTransferService; +#endif + +#ifdef SERVICE_MEMORY MemoryManagementService memoryManagement; - TimeManagementService timeManagement; - EventActionService eventAction; - TestService testService; +#endif + +#ifdef SERVICE_PARAMETER ParameterService parameterManagement; - LargePacketTransferService largePacketTransferService; - FunctionManagementService functionManagement; +#endif + +#ifdef SERVICE_REQUESTVERIFICATION + RequestVerificationService requestVerification; +#endif + +#ifdef SERVICE_TEST + TestService testService; +#endif + +#ifdef SERVICE_TIME + TimeManagementService timeManagement; +#endif + +#ifdef SERVICE_TIMESCHEDULING TimeBasedSchedulingService timeBasedScheduling; +#endif /** * The default ServicePool constructor diff --git a/inc/Services/EventReportService.hpp b/inc/Services/EventReportService.hpp index 69b80e80b504457b3e7f2ddb1cf76f16fb7ad174..376b35d4a5194cf56397c02dd1c606c6f7a96c15 100644 --- a/inc/Services/EventReportService.hpp +++ b/inc/Services/EventReportService.hpp @@ -13,8 +13,6 @@ * Note: enum IDs are these just for test purposes * */ -#define CSS_EVENTS_MAX_COUNT 16 -#define ECSS_EVENTS_BITS 16 class EventReportService : public Service { private: diff --git a/src/ErrorHandler.cpp b/src/ErrorHandler.cpp index 1cba15ca835dca1022adb68c032bb6912592dd8f..be57cb6023a3c847b47e02f71b15f0d19202b2f3 100644 --- a/src/ErrorHandler.cpp +++ b/src/ErrorHandler.cpp @@ -6,34 +6,44 @@ template <> void ErrorHandler::reportError(const Message& message, AcceptanceErrorType errorCode) { +#ifdef SERVICE_REQUESTVERIFICATION Services.requestVerification.failAcceptanceVerification(message, errorCode); +#endif logError(message, errorCode); } template <> void ErrorHandler::reportError(const Message& message, ExecutionStartErrorType errorCode) { +#ifdef SERVICE_REQUESTVERIFICATION Services.requestVerification.failStartExecutionVerification(message, errorCode); +#endif logError(message, errorCode); } void ErrorHandler::reportProgressError(const Message& message, ExecutionProgressErrorType errorCode, uint8_t stepID) { +#ifdef SERVICE_REQUESTVERIFICATION Services.requestVerification.failProgressExecutionVerification(message, errorCode, stepID); +#endif logError(message, errorCode); } template <> void ErrorHandler::reportError(const Message& message, ExecutionCompletionErrorType errorCode) { +#ifdef SERVICE_REQUESTVERIFICATION Services.requestVerification.failCompletionExecutionVerification(message, errorCode); +#endif logError(message, errorCode); } template <> void ErrorHandler::reportError(const Message& message, RoutingErrorType errorCode) { +#ifdef SERVICE_REQUESTVERIFICATION Services.requestVerification.failRoutingVerification(message, errorCode); +#endif logError(message, errorCode); } diff --git a/src/MessageParser.cpp b/src/MessageParser.cpp index a9dc0a4266d10c04d1d0e71b9a66e5921e0b5a61..b4eb3953d2e6ecba5f4115759ba0ac062fb2847e 100644 --- a/src/MessageParser.cpp +++ b/src/MessageParser.cpp @@ -8,30 +8,54 @@ void MessageParser::execute(Message& message) { switch (message.serviceType) { +#ifdef SERVICE_EVENTREPORT case 5: Services.eventReport.execute(message); // ST[05] break; +#endif + +#ifdef SERVICE_MEMORY case 6: Services.memoryManagement.execute(message); // ST[06] break; +#endif + +#ifdef SERVICE_FUNCTION case 8: Services.functionManagement.execute(message); // ST[08] break; +#endif + +#ifdef SERVICE_TIME case 9: Services.timeManagement.execute(message); // ST[09] break; +#endif + +#ifdef SERVICE_TIMESCHEDULING case 11: Services.timeBasedScheduling.execute(message); // ST[11] break; +#endif + +#ifdef SERVICE_TEST case 17: Services.testService.execute(message); // ST[17] break; +#endif + +#ifdef SERVICE_EVENTACTION case 19: Services.eventAction.execute(message); // ST[19] break; +#endif + +#ifdef SERVICE_PARAMETER case 20: Services.parameterManagement.execute(message); // ST[20] break; +#endif + default: ErrorHandler::reportInternalError(ErrorHandler::OtherMessageType); } diff --git a/src/Services/EventActionService.cpp b/src/Services/EventActionService.cpp index bd06114d32b917eab4f894c077a1331474c2dc43..f42079794019ef1d4fca34b4ed176e7d40e5c18c 100644 --- a/src/Services/EventActionService.cpp +++ b/src/Services/EventActionService.cpp @@ -1,3 +1,6 @@ +#include "ECSS_Configuration.hpp" +#ifdef SERVICE_EVENTACTION + #include "Services/EventActionService.hpp" #include "Message.hpp" #include "MessageParser.hpp" @@ -217,3 +220,5 @@ void EventActionService::execute(Message& message) { ErrorHandler::reportInternalError(ErrorHandler::OtherMessageType); } } + +#endif \ No newline at end of file diff --git a/src/Services/EventReportService.cpp b/src/Services/EventReportService.cpp index c805a5fcdfdbb5784ffe7af5e5745f75a706ec55..ce97f874a51aa795556b313e901448237c68c13b 100644 --- a/src/Services/EventReportService.cpp +++ b/src/Services/EventReportService.cpp @@ -1,3 +1,6 @@ +#include "ECSS_Configuration.hpp" +#ifdef SERVICE_EVENTREPORT + #include <Services/EventReportService.hpp> #include <Services/EventActionService.hpp> #include "Message.hpp" @@ -144,3 +147,5 @@ void EventReportService::execute(Message& message) { ErrorHandler::reportInternalError(ErrorHandler::OtherMessageType); } } + +#endif diff --git a/src/Services/FunctionManagementService.cpp b/src/Services/FunctionManagementService.cpp index cefd97023eb0bc2c2e35162c0f5f740858ff3a95..4cee2c0c7f77749b1ff34f1bd4aa87c0809d8fb5 100644 --- a/src/Services/FunctionManagementService.cpp +++ b/src/Services/FunctionManagementService.cpp @@ -1,3 +1,6 @@ +#include "ECSS_Configuration.hpp" +#ifdef SERVICE_FUNCTION + #include "Services/FunctionManagementService.hpp" void FunctionManagementService::call(Message& msg) { @@ -57,3 +60,5 @@ void FunctionManagementService::execute(Message& message) { break; } } + +#endif diff --git a/src/Services/LargePacketTransferService.cpp b/src/Services/LargePacketTransferService.cpp index 95b3cafafd1e89b51999563dd8473bd2c989275c..38a0a666b533eb7f7123389a4ad08a7c67a903c9 100644 --- a/src/Services/LargePacketTransferService.cpp +++ b/src/Services/LargePacketTransferService.cpp @@ -1,3 +1,6 @@ +#include "ECSS_Configuration.hpp" +#ifdef SERVICE_LARGEPACKET + #include <Services/LargePacketTransferService.hpp> #include "Message.hpp" #include <etl/String.hpp> @@ -88,3 +91,5 @@ void LargePacketTransferService::split(Message& message, uint16_t largeMessageTr stringPart = dataPart; lastDownlinkPartReport(largeMessageTransactionIdentifier, (parts - 1U), stringPart); } + +#endif diff --git a/src/Services/MemoryManagementService.cpp b/src/Services/MemoryManagementService.cpp index d592da573bbc7de0b99d86abcc02241b228afb84..7bee194156e2858671a33bd70febec9b18fdf843 100644 --- a/src/Services/MemoryManagementService.cpp +++ b/src/Services/MemoryManagementService.cpp @@ -1,3 +1,6 @@ +#include "ECSS_Configuration.hpp" +#ifdef SERVICE_MEMORY + #include "Services/MemoryManagementService.hpp" #include <iostream> #include <cerrno> @@ -236,3 +239,5 @@ void MemoryManagementService::execute(Message& message) { ErrorHandler::reportInternalError(ErrorHandler::OtherMessageType); } } + +#endif diff --git a/src/Services/ParameterService.cpp b/src/Services/ParameterService.cpp index 018de09f2a197bc8f87a66b518d5618e5b16ee26..aee2de5da27401a6a523f041cda172e112504281 100644 --- a/src/Services/ParameterService.cpp +++ b/src/Services/ParameterService.cpp @@ -1,3 +1,6 @@ +#include "ECSS_Configuration.hpp" +#ifdef SERVICE_PARAMETER + #include "Services/ParameterService.hpp" #define DEMOMODE @@ -131,3 +134,5 @@ void ParameterService::execute(Message& message) { ErrorHandler::reportInternalError(ErrorHandler::OtherMessageType); } } + +#endif diff --git a/src/Services/RequestVerificationService.cpp b/src/Services/RequestVerificationService.cpp index e298a18276441c4a2792afcbb313ad89034026ac..56bcdf07e3d72f9334f9f82c6cb81c98e7f546e0 100644 --- a/src/Services/RequestVerificationService.cpp +++ b/src/Services/RequestVerificationService.cpp @@ -1,3 +1,6 @@ +#include "ECSS_Configuration.hpp" +#ifdef SERVICE_REQUESTVERIFICATION + #include "Services/RequestVerificationService.hpp" void RequestVerificationService::successAcceptanceVerification(const Message& request) { @@ -147,3 +150,5 @@ void RequestVerificationService::failRoutingVerification(const Message& request, storeMessage(report); } + +#endif diff --git a/src/Services/TestService.cpp b/src/Services/TestService.cpp index 001726da6eee06412b6fff685f9114610c05aaa8..53a42b10a2ee0644be2c610ac09ba05a0e5ae110 100644 --- a/src/Services/TestService.cpp +++ b/src/Services/TestService.cpp @@ -1,3 +1,6 @@ +#include "ECSS_Configuration.hpp" +#ifdef SERVICE_TEST + #include "Services/TestService.hpp" void TestService::areYouAlive(Message& request) { @@ -30,3 +33,5 @@ void TestService::execute(Message& message) { ErrorHandler::reportInternalError(ErrorHandler::OtherMessageType); } } + +#endif diff --git a/src/Services/TimeBasedSchedulingService.cpp b/src/Services/TimeBasedSchedulingService.cpp index d381318e8adb84d14eeea958713104d5d712ef74..b88e04ec06ee58b32a282269b6d7ac610a0d3d9c 100644 --- a/src/Services/TimeBasedSchedulingService.cpp +++ b/src/Services/TimeBasedSchedulingService.cpp @@ -1,3 +1,6 @@ +#include "ECSS_Configuration.hpp" +#ifdef SERVICE_TIMESCHEDULING + #include "Services/TimeBasedSchedulingService.hpp" TimeBasedSchedulingService::TimeBasedSchedulingService() { @@ -293,3 +296,5 @@ void TimeBasedSchedulingService::execute(Message& message) { ErrorHandler::reportInternalError(ErrorHandler::OtherMessageType); } } + +#endif diff --git a/src/Services/TimeManagementService.cpp b/src/Services/TimeManagementService.cpp index 9e281450768a3978df10b857c7d763fcd21cbd78..d12061958917c080c0bda02b9aae15f839b4fec7 100644 --- a/src/Services/TimeManagementService.cpp +++ b/src/Services/TimeManagementService.cpp @@ -1,3 +1,6 @@ +#include "ECSS_Configuration.hpp" +#ifdef SERVICE_TIME + #include "Services/TimeManagementService.hpp" void TimeManagementService::cdsTimeReport(TimeAndDate& TimeInfo) { @@ -35,3 +38,5 @@ void TimeManagementService::execute(Message& message) { break; } } + +#endif