From 6b3fca18abc668a8edb730374ed5a8673cf2033f Mon Sep 17 00:00:00 2001 From: athatheo <athatheoc@gmail.com> Date: Fri, 15 Jul 2022 20:26:23 +0000 Subject: [PATCH] Added Application ID --- inc/ECSS_Definitions.hpp | 6 ++ inc/Message.hpp | 3 +- inc/Service.hpp | 5 +- inc/ServicePool.hpp | 2 +- inc/Services/DummyService.hpp | 6 +- inc/Services/EventActionService.hpp | 11 +-- inc/Services/EventReportService.hpp | 5 +- inc/Services/FunctionManagementService.hpp | 4 +- inc/Services/HousekeepingService.hpp | 15 +-- inc/Services/LargePacketTransferService.hpp | 17 ++-- inc/Services/OnBoardMonitoringService.hpp | 5 + inc/Services/ParameterService.hpp | 3 +- .../RealTimeForwardingControlService.hpp | 6 +- inc/Services/RequestVerificationService.hpp | 11 +-- inc/Services/StorageAndRetrievalService.hpp | 4 +- inc/Services/TestService.hpp | 3 +- inc/Services/TimeBasedSchedulingService.hpp | 4 +- src/Message.cpp | 10 +- src/Services/HousekeepingService.cpp | 52 +++++----- src/Services/LargePacketTransferService.cpp | 34 +++---- src/Services/MemoryManagementService.cpp | 97 +++++++------------ src/Services/ParameterService.cpp | 20 +--- src/Services/ParameterStatisticsService.cpp | 8 +- src/Services/StorageAndRetrievalService.cpp | 6 +- src/Services/TestService.cpp | 1 + src/Services/TimeBasedSchedulingService.cpp | 4 +- test/Services/ParameterService.cpp | 2 +- test/Services/RequestVerificationService.cpp | 18 ++-- test/Services/TestService.cpp | 4 +- 29 files changed, 173 insertions(+), 193 deletions(-) diff --git a/inc/ECSS_Definitions.hpp b/inc/ECSS_Definitions.hpp index 24c490d7..27ba18b7 100644 --- a/inc/ECSS_Definitions.hpp +++ b/inc/ECSS_Definitions.hpp @@ -232,5 +232,11 @@ inline struct { */ inline const uint8_t ECSSMaxMonitoringDefinitions = 4; +/** + * 6.18.2.2 The applicationId that is assigned on the specific device that runs these Services. + * In the ECSS-E-ST-70-41C the application ID is also referred as application process. + */ +inline const uint16_t ApplicationId = 1; + /** @} */ #endif // ECSS_SERVICES_ECSS_DEFINITIONS_H diff --git a/inc/Message.hpp b/inc/Message.hpp index 39f3ced9..360867b9 100644 --- a/inc/Message.hpp +++ b/inc/Message.hpp @@ -89,7 +89,7 @@ public: */ uint16_t applicationId; - // 7.4.3.1b + //> 7.4.3.1b uint16_t messageTypeCounter = 0; // 7.4.1, as defined in CCSDS 133.0-B-1 @@ -233,6 +233,7 @@ public: public: Message(uint8_t serviceType, uint8_t messageType, PacketType packetType, uint16_t applicationId); + Message(uint8_t serviceType, uint8_t messageType, Message::PacketType packetType); /** * Adds a single-byte boolean value to the end of the message diff --git a/inc/Service.hpp b/inc/Service.hpp index 53bf0bae..b7ffbab7 100644 --- a/inc/Service.hpp +++ b/inc/Service.hpp @@ -4,8 +4,6 @@ #include <cstdint> #include "Message.hpp" -class ServicePool; - /** * @defgroup Services Services * ECSS Services implementations, as defined in ECSS-E-ST-70-41C. These services receive TC Messages, and output TM @@ -35,10 +33,9 @@ protected: * @param messageType The ID of the message type, as specified in the standard. For example, * the TC[17,3] message has `messageType = 3`. * @todo See if the Message must be returned by reference - * @todo Set the application ID to the current application */ Message createTM(uint8_t messageType) { - return Message(serviceType, messageType, Message::TM, 0); + return Message(serviceType, messageType, Message::TM); } /** diff --git a/inc/ServicePool.hpp b/inc/ServicePool.hpp index b93a7dba..080a3971 100644 --- a/inc/ServicePool.hpp +++ b/inc/ServicePool.hpp @@ -31,7 +31,6 @@ class ServicePool { * the number of the service, while the least significant 8 bits are the number of the Message. The value is the * counter of each MessageType. */ - etl::map<uint16_t, uint16_t, ECSSTotalMessageTypes> messageTypeCounter; /** @@ -100,6 +99,7 @@ public: TimeBasedSchedulingService timeBasedScheduling; #endif + /** * The default ServicePool constructor */ diff --git a/inc/Services/DummyService.hpp b/inc/Services/DummyService.hpp index 605825d7..039828ff 100644 --- a/inc/Services/DummyService.hpp +++ b/inc/Services/DummyService.hpp @@ -20,12 +20,16 @@ public: LogString = 128, }; + DummyService() { + serviceType = ServiceType; + } + /** * Send data as a part of a custom ECSS Message * Creates a TM[128, 128] */ void logAsECSSMessage(const etl::string<LOGGER_MAX_MESSAGE_SIZE>& data) { - Message log(ServiceType, MessageType::LogString, Message::TM, 1); + Message log = createTM(MessageType::LogString); log.appendString(data); storeMessage(log); } diff --git a/inc/Services/EventActionService.hpp b/inc/Services/EventActionService.hpp index 6ed438d8..b9c33870 100644 --- a/inc/Services/EventActionService.hpp +++ b/inc/Services/EventActionService.hpp @@ -2,8 +2,8 @@ #define ECSS_SERVICES_EVENTACTIONSERVICE_HPP #include "Service.hpp" -#include "etl/String.hpp" #include "Services/EventReportService.hpp" +#include "etl/String.hpp" #include "etl/multimap.h" /** @@ -39,7 +39,6 @@ private: void executeAction(uint16_t eventID); public: - inline static const uint8_t ServiceType = 19; enum MessageType : uint8_t { @@ -56,8 +55,8 @@ public: struct EventActionDefinition { // TODO: APID = 0 is the Ground Station APID. This should be changed - uint16_t applicationId = 0; - uint16_t eventDefinitionID = 65535; // The ID of the event that might take place + uint16_t applicationId = ApplicationId; + uint16_t eventDefinitionID = 65535; // The ID of the event that might take place uint16_t eventActionDefinitionID = 0; // The ID of the event-action String<64> request = ""; bool enabled = false; @@ -66,10 +65,10 @@ public: friend EventReportService; etl::multimap<uint16_t, EventActionDefinition, ECSSEventActionStructMapSize> - eventActionDefinitionMap; + eventActionDefinitionMap; EventActionService() { - serviceType = 19; + serviceType = ServiceType; eventActionFunctionStatus = true; } diff --git a/inc/Services/EventReportService.hpp b/inc/Services/EventReportService.hpp index 839dff8b..f58dbeae 100644 --- a/inc/Services/EventReportService.hpp +++ b/inc/Services/EventReportService.hpp @@ -1,8 +1,8 @@ #ifndef ECSS_SERVICES_EVENTREPORTSERVICE_HPP #define ECSS_SERVICES_EVENTREPORTSERVICE_HPP -#include "Service.hpp" #include <etl/bitset.h> +#include "Service.hpp" /** * Implementation of ST[05] event reporting service @@ -20,7 +20,6 @@ private: etl::bitset<numberOfEvents> stateOfEvents; public: - inline static const uint8_t ServiceType = 5; enum MessageType : uint8_t { @@ -52,7 +51,7 @@ public: EventReportService() { stateOfEvents.set(); - serviceType = 5; + serviceType = ServiceType; lowSeverityReportCount = 0; mediumSeverityReportCount = 0; highSeverityReportCount = 0; diff --git a/inc/Services/FunctionManagementService.hpp b/inc/Services/FunctionManagementService.hpp index 4dd09225..422f98dd 100644 --- a/inc/Services/FunctionManagementService.hpp +++ b/inc/Services/FunctionManagementService.hpp @@ -45,7 +45,9 @@ public: * Constructs the function pointer index with all the necessary functions at initialization time * These functions need to be in scope. Un-default when needed. */ - FunctionManagementService() = default; + FunctionManagementService() { + serviceType = ServiceType; + } /** * Calls the function described in the TC[8,1] message *msg*, passing the arguments contained diff --git a/inc/Services/HousekeepingService.hpp b/inc/Services/HousekeepingService.hpp index 2336f094..08f47524 100644 --- a/inc/Services/HousekeepingService.hpp +++ b/inc/Services/HousekeepingService.hpp @@ -1,11 +1,11 @@ #ifndef ECSS_SERVICES_HOUSEKEEPINGSERVICE_HPP #define ECSS_SERVICES_HOUSEKEEPINGSERVICE_HPP -#include "etl/map.h" #include "ECSS_Definitions.hpp" -#include "Service.hpp" #include "ErrorHandler.hpp" #include "Helpers/HousekeepingStructure.hpp" +#include "Service.hpp" +#include "etl/map.h" /** * Implementation of the ST[03] Housekeeping Reporting Service. The job of the Housekeeping Service is to store @@ -31,11 +31,11 @@ private: static bool existsInVector(const etl::vector<uint16_t, ECSSMaxSimplyCommutatedParameters>& ids, uint16_t parameterId); - /** + /** * Initializes Housekeeping Structures with the Parameters found in the obc-software. * The function definition is also found in the obc-software repo. */ - void initializeHousekeepingStructures(); + void initializeHousekeepingStructures(); public: inline static const uint8_t ServiceType = 3; @@ -60,9 +60,10 @@ public: HousekeepingPeriodicPropertiesReport = 35, }; - HousekeepingService() { - initializeHousekeepingStructures(); - }; + HousekeepingService() { + serviceType = ServiceType; + initializeHousekeepingStructures(); + }; /** * Implementation of TC[3,1]. Request to create a housekeeping parameters report structure. diff --git a/inc/Services/LargePacketTransferService.hpp b/inc/Services/LargePacketTransferService.hpp index a3ef0a27..3f14695f 100644 --- a/inc/Services/LargePacketTransferService.hpp +++ b/inc/Services/LargePacketTransferService.hpp @@ -1,8 +1,8 @@ #ifndef ECSS_SERVICES_LARGEPACKETTRANSFERSERVICE_HPP #define ECSS_SERVICES_LARGEPACKETTRANSFERSERVICE_HPP -#include "Service.hpp" #include <etl/String.hpp> +#include "Service.hpp" /** * Implementation of the ST[13] large packet transfer service @@ -16,7 +16,6 @@ class LargePacketTransferService : public Service { public: - inline static const uint8_t ServiceType = 13; @@ -30,11 +29,11 @@ public: * Default constructor since only functions will be used. */ LargePacketTransferService() { - serviceType = 13; + serviceType = ServiceType; } /** - * Function that handles the first part of the download report + * TM[13,1] Function that handles the first part of the download report * @param largeMessageTransactionIdentifier The identifier of the large packet * @param partSequenceNumber The identifier of the part of the large packet * @param string The data contained in this part of the large packet @@ -43,7 +42,7 @@ public: const String<ECSSMaxFixedOctetStringSize>& string); /** - * Function that handles the n-2 parts of tbe n-part download report + * TM[13,2] Function that handles the n-2 parts of tbe n-part download report * @param largeMessageTransactionIdentifier The identifier of the large packet * @param partSequenceNumber The identifier of the part of the large packet * @param string The data contained in this part of the large packet @@ -52,7 +51,7 @@ public: const String<ECSSMaxFixedOctetStringSize>& string); /** - * Function that handles the last part of the download report + * TM[13,3] Function that handles the last part of the download report * @param largeMessageTransactionIdentifier The identifier of the large packet * @param partSequenceNumber The identifier of the part of the large packet * @param string The data contained in this part of the large packet @@ -64,20 +63,20 @@ public: // a composeECSS function ready, I just return the given string. // @TODO: Modify these functions properly /** - * Function that handles the first part of the uplink request + * TC[13,9] Function that handles the first part of the uplink request * @param string This will change when these function will be modified */ String<ECSSMaxFixedOctetStringSize> firstUplinkPart(const String<ECSSMaxFixedOctetStringSize>& string); /** - * Function that handles the n-2 parts of tbe n-part uplink request + * TC[13,10] Function that handles the n-2 parts of the n-part uplink request * @param string This will change when these function will be modified */ String<ECSSMaxFixedOctetStringSize> intermediateUplinkPart(const String<ECSSMaxFixedOctetStringSize>& string); /** - * Function that handles the last part of the uplink request + * TC[13,11] Function that handles the last part of the uplink request * @param string This will change when these function will be modified */ String<ECSSMaxFixedOctetStringSize> lastUplinkPart(const String<ECSSMaxFixedOctetStringSize>& string); diff --git a/inc/Services/OnBoardMonitoringService.hpp b/inc/Services/OnBoardMonitoringService.hpp index 1ef954f2..6af64f36 100644 --- a/inc/Services/OnBoardMonitoringService.hpp +++ b/inc/Services/OnBoardMonitoringService.hpp @@ -40,6 +40,11 @@ public: ReportStatusOfParameterMonitoringDefinition = 13, ParameterMonitoringDefinitionStatusReport = 14 }; + + OnBoardMonitoringService() { + serviceType = ServiceType; + } + /** * The maximum time between two transition reports. * Measured in "on-board parameter minimum sampling interval" units (see 5.4.3.2c in ECSS-E-ST-70-41C). diff --git a/inc/Services/ParameterService.hpp b/inc/Services/ParameterService.hpp index 437bd395..9ee75040 100644 --- a/inc/Services/ParameterService.hpp +++ b/inc/Services/ParameterService.hpp @@ -3,9 +3,9 @@ #include <optional> #include "ECSS_Definitions.hpp" -#include "Service.hpp" #include "ErrorHandler.hpp" #include "Helpers/Parameter.hpp" +#include "Service.hpp" #include "etl/map.h" /** @@ -57,6 +57,7 @@ public: * by calling \fn initializeParametersArray */ ParameterService() { + serviceType = ServiceType; initializeParameterMap(); } diff --git a/inc/Services/RealTimeForwardingControlService.hpp b/inc/Services/RealTimeForwardingControlService.hpp index 5e42edbe..a34997a9 100644 --- a/inc/Services/RealTimeForwardingControlService.hpp +++ b/inc/Services/RealTimeForwardingControlService.hpp @@ -17,7 +17,7 @@ * * @author Konstantinos Petridis <petridkon@gmail.com> */ -class RealTimeForwardingControlService { +class RealTimeForwardingControlService : Service { public: inline static const uint8_t ServiceType = 14; @@ -25,7 +25,9 @@ public: AddReportTypesToAppProcessConfiguration = 1, }; - RealTimeForwardingControlService() = default; + RealTimeForwardingControlService() { + serviceType = ServiceType; + } /** * Contains the Application IDs, controlled by the Service. diff --git a/inc/Services/RequestVerificationService.hpp b/inc/Services/RequestVerificationService.hpp index c6ccd872..08c00834 100644 --- a/inc/Services/RequestVerificationService.hpp +++ b/inc/Services/RequestVerificationService.hpp @@ -1,10 +1,10 @@ #ifndef ECSS_SERVICES_REQUESTVERIFICATIONSERVICE_HPP #define ECSS_SERVICES_REQUESTVERIFICATIONSERVICE_HPP -#include "Service.hpp" -#include "Message.hpp" -#include "ErrorHandler.hpp" #include "ECSS_Definitions.hpp" +#include "ErrorHandler.hpp" +#include "Message.hpp" +#include "Service.hpp" /** * Implementation of the ST[01] request verification service @@ -20,7 +20,6 @@ */ class RequestVerificationService : public Service { public: - inline static const uint8_t ServiceType = 1; enum MessageType : uint8_t { @@ -36,7 +35,7 @@ public: }; RequestVerificationService() { - serviceType = 1; + serviceType = ServiceType; } /** @@ -133,7 +132,7 @@ public: * telecommand packet that failed the routing * @param errorCode The cause of creating this type of report */ - void failRoutingVerification(const Message &request, ErrorHandler::RoutingErrorType errorCode); + void failRoutingVerification(const Message& request, ErrorHandler::RoutingErrorType errorCode); }; #endif // ECSS_SERVICES_REQUESTVERIFICATIONSERVICE_HPP diff --git a/inc/Services/StorageAndRetrievalService.hpp b/inc/Services/StorageAndRetrievalService.hpp index 95142327..0387c8ff 100644 --- a/inc/Services/StorageAndRetrievalService.hpp +++ b/inc/Services/StorageAndRetrievalService.hpp @@ -206,7 +206,9 @@ public: ChangeVirtualChannel = 28 }; - StorageAndRetrievalService() = default; + StorageAndRetrievalService() { + serviceType = ServiceType; + } /** * Adds new packet store into packet stores. diff --git a/inc/Services/TestService.hpp b/inc/Services/TestService.hpp index af37e9ff..63e3fbc2 100644 --- a/inc/Services/TestService.hpp +++ b/inc/Services/TestService.hpp @@ -20,7 +20,7 @@ public: }; TestService() { - serviceType = 17; + serviceType = ServiceType; } /** @@ -41,7 +41,6 @@ public: /** * TM[17,4] on-board connection test report to show that the MCU is connected to the on-board - * @param applicationProcessId */ void onBoardConnectionReport(uint16_t applicationProcessId); diff --git a/inc/Services/TimeBasedSchedulingService.hpp b/inc/Services/TimeBasedSchedulingService.hpp index efdc72bf..d8b9c467 100644 --- a/inc/Services/TimeBasedSchedulingService.hpp +++ b/inc/Services/TimeBasedSchedulingService.hpp @@ -46,11 +46,11 @@ class TimeBasedSchedulingService : public Service { private: /** * @brief Indicator of the schedule execution - * + * True indicates "enabled" and False "disabled" state * @details The schedule execution indicator will be updated by the process that is running * the time scheduling service. */ - bool executionFunctionStatus = false; // True indicates "enabled" and False "disabled" state + bool executionFunctionStatus = false; /** * @brief Request identifier of the received packet diff --git a/src/Message.cpp b/src/Message.cpp index 4733fb91..c5846604 100644 --- a/src/Message.cpp +++ b/src/Message.cpp @@ -1,13 +1,17 @@ #include "Message.hpp" #include <ErrorHandler.hpp> #include <MessageParser.hpp> -#include <ServicePool.hpp> #include <cstring> +#include "ServicePool.hpp" #include "macros.hpp" -Message::Message(uint8_t serviceType, uint8_t messageType, Message::PacketType packetType, uint16_t applicationId) + +Message::Message(uint8_t serviceType, uint8_t messageType, PacketType packetType, uint16_t applicationId) : serviceType(serviceType), messageType(messageType), packetType(packetType), applicationId(applicationId) {} +Message::Message(uint8_t serviceType, uint8_t messageType, PacketType packetType) + : serviceType(serviceType), messageType(messageType), packetType(packetType), applicationId(ApplicationId) {} + void Message::appendBits(uint8_t numBits, uint16_t data) { // TODO: Add assertion that data does not contain 1s outside of numBits bits ASSERT_INTERNAL(numBits <= 16, ErrorHandler::TooManyBitsAppend); @@ -174,7 +178,7 @@ void Message::appendString(const etl::istring& string) { void Message::appendFixedString(const etl::istring& string) { ASSERT_INTERNAL((dataSize + string.max_size()) < ECSSMaxMessageSize, ErrorHandler::MessageTooLarge); std::copy(string.data(), string.data() + string.size(), data + dataSize); - (void)memset(data + dataSize + string.size(), 0, string.max_size() - string.size()); + (void) memset(data + dataSize + string.size(), 0, string.max_size() - string.size()); dataSize += string.max_size(); } diff --git a/src/Services/HousekeepingService.cpp b/src/Services/HousekeepingService.cpp index 35beaa2a..ac616781 100644 --- a/src/Services/HousekeepingService.cpp +++ b/src/Services/HousekeepingService.cpp @@ -98,14 +98,14 @@ void HousekeepingService::housekeepingStructureReport(uint8_t structIdToReport) ErrorHandler::reportInternalError(ErrorHandler::InternalErrorType::NonExistentHousekeeping); return; } - Message structReport(ServiceType, MessageType::HousekeepingStructuresReport, Message::TM, 1); + Message structReport = createTM(MessageType::HousekeepingStructuresReport); structReport.appendUint8(structIdToReport); structReport.appendBoolean(housekeepingStructure->second.periodicGenerationActionStatus); structReport.appendUint32(housekeepingStructure->second.collectionInterval); structReport.appendUint16(housekeepingStructure->second.simplyCommutatedParameterIds.size()); - for (auto parameterId : housekeepingStructure->second.simplyCommutatedParameterIds) { + for (auto parameterId: housekeepingStructure->second.simplyCommutatedParameterIds) { structReport.appendUint16(parameterId); } storeMessage(structReport); @@ -116,10 +116,10 @@ void HousekeepingService::housekeepingParametersReport(uint8_t structureId) { ErrorHandler::reportInternalError(ErrorHandler::InternalErrorType::NonExistentHousekeeping); return; } - Message housekeepingReport(ServiceType, MessageType::HousekeepingParametersReport, Message::TM, 1); + Message housekeepingReport = createTM(MessageType::HousekeepingParametersReport); housekeepingReport.appendUint8(structureId); - for (auto id : housekeepingStructures.at(structureId).simplyCommutatedParameterIds) { + for (auto id: housekeepingStructures.at(structureId).simplyCommutatedParameterIds) { if (auto parameter = Services.parameterManagement.getParameter(id)) { parameter->get().appendValueToMessage(housekeepingReport); } @@ -201,7 +201,7 @@ void HousekeepingService::reportHousekeepingPeriodicProperties(Message& request) numOfValidIds++; } } - Message periodicPropertiesReport(ServiceType, MessageType::HousekeepingPeriodicPropertiesReport, Message::TM, 1); + Message periodicPropertiesReport = createTM(MessageType::HousekeepingPeriodicPropertiesReport); periodicPropertiesReport.appendUint8(numOfValidIds); request.resetRead(); request.readUint8(); @@ -262,25 +262,25 @@ bool HousekeepingService::existsInVector(const etl::vector<uint16_t, ECSSMaxSimp uint32_t HousekeepingService::reportPendingStructures(uint32_t currentTime, uint32_t previousTime, uint32_t expectedDelay) { - uint32_t nextCollection = std::numeric_limits<uint32_t>::max(); - - for (auto &housekeepingStructure: housekeepingStructures) { - if (housekeepingStructure.second.collectionInterval == 0) { - housekeepingParametersReport(housekeepingStructure.second.structureId); - nextCollection = 0; - continue; - } - if (currentTime != 0 and (currentTime % housekeepingStructure.second.collectionInterval == 0 or - (previousTime + expectedDelay) % housekeepingStructure.second.collectionInterval == - 0)) { - housekeepingParametersReport(housekeepingStructure.second.structureId); - } - uint32_t structureTimeToCollection = housekeepingStructure.second.collectionInterval - - currentTime % housekeepingStructure.second.collectionInterval; - if (nextCollection > structureTimeToCollection) { - nextCollection = structureTimeToCollection; - } - } - - return nextCollection; + uint32_t nextCollection = std::numeric_limits<uint32_t>::max(); + + for (auto& housekeepingStructure: housekeepingStructures) { + if (housekeepingStructure.second.collectionInterval == 0) { + housekeepingParametersReport(housekeepingStructure.second.structureId); + nextCollection = 0; + continue; + } + if (currentTime != 0 and (currentTime % housekeepingStructure.second.collectionInterval == 0 or + (previousTime + expectedDelay) % housekeepingStructure.second.collectionInterval == + 0)) { + housekeepingParametersReport(housekeepingStructure.second.structureId); + } + uint32_t structureTimeToCollection = housekeepingStructure.second.collectionInterval - + currentTime % housekeepingStructure.second.collectionInterval; + if (nextCollection > structureTimeToCollection) { + nextCollection = structureTimeToCollection; + } + } + + return nextCollection; } diff --git a/src/Services/LargePacketTransferService.cpp b/src/Services/LargePacketTransferService.cpp index 03bebbcd..b96c03ae 100644 --- a/src/Services/LargePacketTransferService.cpp +++ b/src/Services/LargePacketTransferService.cpp @@ -2,58 +2,52 @@ #ifdef SERVICE_LARGEPACKET #include <Services/LargePacketTransferService.hpp> -#include "Message.hpp" #include <etl/String.hpp> +#include "Message.hpp" void LargePacketTransferService::firstDownlinkPartReport(uint16_t largeMessageTransactionIdentifier, uint16_t partSequenceNumber, const String<ECSSMaxFixedOctetStringSize>& string) { - // TM[13,1] - Message report = createTM(LargePacketTransferService::MessageType::FirstDownlinkPartReport); report.appendUint16(largeMessageTransactionIdentifier); // large message transaction identifier - report.appendUint16(partSequenceNumber); // part sequence number - report.appendOctetString(string); // fixed octet-string + report.appendUint16(partSequenceNumber); // part sequence number + report.appendOctetString(string); // fixed octet-string storeMessage(report); } void LargePacketTransferService::intermediateDownlinkPartReport( uint16_t largeMessageTransactionIdentifier, uint16_t partSequenceNumber, const String<ECSSMaxFixedOctetStringSize>& string) { - // TM[13,2] + Message report = createTM(LargePacketTransferService::MessageType::InternalDownlinkPartReport); report.appendUint16(largeMessageTransactionIdentifier); // large message transaction identifier - report.appendUint16(partSequenceNumber); // part sequence number - report.appendOctetString(string); // fixed octet-string + report.appendUint16(partSequenceNumber); // part sequence number + report.appendOctetString(string); // fixed octet-string storeMessage(report); } void LargePacketTransferService::lastDownlinkPartReport(uint16_t largeMessageTransactionIdentifier, uint16_t partSequenceNumber, const String<ECSSMaxFixedOctetStringSize>& string) { - // TM[13,3] Message report = createTM(LargePacketTransferService::MessageType::LastDownlinkPartReport); report.appendUint16(largeMessageTransactionIdentifier); // large message transaction identifier - report.appendUint16(partSequenceNumber); // part sequence number - report.appendOctetString(string); // fixed octet-string + report.appendUint16(partSequenceNumber); // part sequence number + report.appendOctetString(string); // fixed octet-string storeMessage(report); } String<ECSSMaxFixedOctetStringSize> LargePacketTransferService::firstUplinkPart(const String<ECSSMaxFixedOctetStringSize>& string) { - // TC[13,9] return string; } String<ECSSMaxFixedOctetStringSize> LargePacketTransferService::intermediateUplinkPart(const String<ECSSMaxFixedOctetStringSize>& string) { - // TC[13,10] return string; } String<ECSSMaxFixedOctetStringSize> LargePacketTransferService::lastUplinkPart(const String<ECSSMaxFixedOctetStringSize>& string) { - // TC[13, 11] return string; } @@ -61,19 +55,19 @@ void LargePacketTransferService::split(Message& message, uint16_t largeMessageTr //TODO: Should this be uint32? uint16_t size = message.dataSize; uint16_t positionCounter = 0; - uint16_t parts = (size/ECSSMaxFixedOctetStringSize) + 1; + uint16_t parts = (size / ECSSMaxFixedOctetStringSize) + 1; String<ECSSMaxFixedOctetStringSize> stringPart(""); uint8_t dataPart[ECSSMaxFixedOctetStringSize]; - for (uint16_t i = 0; i < ECSSMaxFixedOctetStringSize; i++){ + for (uint16_t i = 0; i < ECSSMaxFixedOctetStringSize; i++) { dataPart[i] = message.data[positionCounter]; positionCounter++; } stringPart = dataPart; firstDownlinkPartReport(largeMessageTransactionIdentifier, 0, stringPart); - for (uint16_t part = 1; part < (parts - 1U); part++){ - for (uint16_t i = 0; i < ECSSMaxFixedOctetStringSize; i++){ + for (uint16_t part = 1; part < (parts - 1U); part++) { + for (uint16_t i = 0; i < ECSSMaxFixedOctetStringSize; i++) { dataPart[i] = message.data[positionCounter]; positionCounter++; } @@ -81,8 +75,8 @@ void LargePacketTransferService::split(Message& message, uint16_t largeMessageTr intermediateDownlinkPartReport(largeMessageTransactionIdentifier, part, stringPart); } - for (uint16_t i = 0; i < ECSSMaxFixedOctetStringSize; i++){ - if (message.dataSize == positionCounter){ + for (uint16_t i = 0; i < ECSSMaxFixedOctetStringSize; i++) { + if (message.dataSize == positionCounter) { dataPart[i] = 0; // To prevent from filling the rest of the String with garbage info } dataPart[i] = message.data[positionCounter]; diff --git a/src/Services/MemoryManagementService.cpp b/src/Services/MemoryManagementService.cpp index db821cbf..c754aebf 100644 --- a/src/Services/MemoryManagementService.cpp +++ b/src/Services/MemoryManagementService.cpp @@ -1,11 +1,10 @@ #include "ECSS_Configuration.hpp" #ifdef SERVICE_MEMORY -#include "Services/MemoryManagementService.hpp" #include <cerrno> #include <etl/String.hpp> +#include "Services/MemoryManagementService.hpp" -// Define the constructors for the classes MemoryManagementService::MemoryManagementService() : rawDataMemorySubservice(*this) { serviceType = MemoryManagementService::ServiceType; } @@ -13,7 +12,6 @@ MemoryManagementService::MemoryManagementService() : rawDataMemorySubservice(*th MemoryManagementService::RawDataMemoryManagement::RawDataMemoryManagement(MemoryManagementService& parent) : mainService(parent) {} -// Function declarations for the raw data memory management subservice void MemoryManagementService::RawDataMemoryManagement::loadRawData(Message& request) { /** * Bear in mind that there is currently no error checking for invalid parameters. @@ -23,27 +21,21 @@ void MemoryManagementService::RawDataMemoryManagement::loadRawData(Message& requ * @todo Add error checking and reporting for the parameters * @todo Add failure reporting */ - // Check if we have the correct packet request.assertTC(MemoryManagementService::ServiceType, MemoryManagementService::MessageType::LoadRawMemoryDataAreas); - - // Read the memory ID from the request auto memoryID = MemoryManagementService::MemoryID(request.readEnum8()); - // Check for a valid memory ID first if (mainService.memoryIdValidator(MemoryManagementService::MemoryID(memoryID))) { - // Variable declaration - uint8_t readData[ECSSMaxStringSize]; // Preallocate the array - uint16_t iterationCount = request.readUint16(); // Get the iteration count + uint8_t readData[ECSSMaxStringSize]; + uint16_t iterationCount = request.readUint16(); if (memoryID == MemoryManagementService::MemoryID::FLASH) { - // todo: Define FLASH specific access code when we transfer to embedded + // TODO: Define FLASH specific access code when we transfer to embedded } else { for (std::size_t j = 0; j < iterationCount; j++) { - uint64_t startAddress = request.readUint64(); // Start address of the memory - uint16_t dataLength = request.readOctetString(readData); // Data length to load - uint16_t checksum = request.readBits(16); // Get the CRC checksum from the message + uint64_t startAddress = request.readUint64(); + uint16_t dataLength = request.readOctetString(readData); + uint16_t checksum = request.readBits(16); - // Continue only if the checksum passes if (mainService.dataValidator(readData, checksum, dataLength)) { if (mainService.addressValidator(memoryID, startAddress) && mainService.addressValidator(memoryID, startAddress + dataLength)) { @@ -51,7 +43,6 @@ void MemoryManagementService::RawDataMemoryManagement::loadRawData(Message& requ *(reinterpret_cast<uint8_t*>(startAddress) + i) = readData[i]; } - // Read the loaded data for checksum validation and perform a check for (std::size_t i = 0; i < dataLength; i++) { readData[i] = *(reinterpret_cast<uint8_t*>(startAddress) + i); } @@ -63,109 +54,91 @@ void MemoryManagementService::RawDataMemoryManagement::loadRawData(Message& requ } } else { ErrorHandler::reportError(request, ErrorHandler::ChecksumFailed); - continue; // Continue to the next command + continue; } } } } else { - // todo: Send a failed start of execution + // TODO: Send a failed start of execution } } void MemoryManagementService::RawDataMemoryManagement::dumpRawData(Message& request) { - // Check if we have the correct packet request.assertTC(MemoryManagementService::ServiceType, MemoryManagementService::MessageType::DumpRawMemoryData); - // Create the report message object of telemetry message subtype 6 Message report = mainService.createTM(MemoryManagementService::MessageType::DumpRawMemoryDataReport); - uint8_t memoryID = request.readEnum8(); // Read the memory ID from the request + uint8_t memoryID = request.readEnum8(); - // Check for a valid memory ID first if (mainService.memoryIdValidator(MemoryManagementService::MemoryID(memoryID))) { - // Variable declaration - uint8_t readData[ECSSMaxStringSize]; // Preallocate the array - uint16_t iterationCount = request.readUint16(); // Get the iteration count + uint8_t readData[ECSSMaxStringSize]; + uint16_t iterationCount = request.readUint16(); - // Append the data to report message - report.appendEnum8(memoryID); // Memory ID - report.appendUint16(iterationCount); // Iteration count + report.appendEnum8(memoryID); + report.appendUint16(iterationCount); - // Iterate N times, as specified in the command message for (std::size_t j = 0; j < iterationCount; j++) { - uint64_t startAddress = request.readUint64(); // Data length to read - uint16_t readLength = request.readUint16(); // Start address for the memory read + uint64_t startAddress = request.readUint64(); + uint16_t readLength = request.readUint16(); - // Read memory data, an octet at a time, checking for a valid address first if (mainService.addressValidator(MemoryManagementService::MemoryID(memoryID), startAddress) && mainService.addressValidator(MemoryManagementService::MemoryID(memoryID), startAddress + readLength)) { for (std::size_t i = 0; i < readLength; i++) { readData[i] = *(reinterpret_cast<uint8_t*>(startAddress) + i); } - // This part is repeated N-times (N = iteration count) - report.appendUint64(startAddress); // Start address - report.appendOctetString(String<1024>(readData, readLength)); // Save the - // read data + report.appendUint64(startAddress); + report.appendOctetString(String<1024>(readData, readLength)); report.appendBits(16, CRCHelper::calculateCRC(readData, readLength)); } else { ErrorHandler::reportError(request, ErrorHandler::AddressOutOfRange); } } - mainService.storeMessage(report); // Save the report message - request.resetRead(); // Reset the reading count + mainService.storeMessage(report); + request.resetRead(); } else { - // todo: Send a failed start of execution + // TODO: Send a failed start of execution } } void MemoryManagementService::RawDataMemoryManagement::checkRawData(Message& request) { - // Check if we have the correct packet request.assertTC(MemoryManagementService::ServiceType, MemoryManagementService::MessageType::CheckRawMemoryData); - // Create the report message object of telemetry message subtype 10 Message report = mainService.createTM(MemoryManagementService::MessageType::CheckRawMemoryDataReport); - uint8_t memoryID = request.readEnum8(); // Read the memory ID from the request + uint8_t memoryID = request.readEnum8(); if (mainService.memoryIdValidator(MemoryManagementService::MemoryID(memoryID))) { - // Variable declaration - uint8_t readData[ECSSMaxStringSize]; // Preallocate the array - uint16_t iterationCount = request.readUint16(); // Get the iteration count + uint8_t readData[ECSSMaxStringSize]; + uint16_t iterationCount = request.readUint16(); - // Append the data to report message - report.appendEnum8(memoryID); // Memory ID - report.appendUint16(iterationCount); // Iteration count + report.appendEnum8(memoryID); + report.appendUint16(iterationCount); - // Iterate N times, as specified in the command message for (std::size_t j = 0; j < iterationCount; j++) { - uint64_t startAddress = request.readUint64(); // Data length to read - uint16_t readLength = request.readUint16(); // Start address for the memory read + uint64_t startAddress = request.readUint64(); + uint16_t readLength = request.readUint16(); - // Check whether the first and the last addresses are within the limits if (mainService.addressValidator(MemoryManagementService::MemoryID(memoryID), startAddress) && mainService.addressValidator(MemoryManagementService::MemoryID(memoryID), startAddress + readLength)) { - // Read memory data and save them for checksum calculation for (std::size_t i = 0; i < readLength; i++) { readData[i] = *(reinterpret_cast<uint8_t*>(startAddress) + i); } - // This part is repeated N-times (N = iteration count) - report.appendUint64(startAddress); // Start address - report.appendUint16(readLength); // Save the read data - report.appendBits(16, CRCHelper::calculateCRC(readData, readLength)); // Append CRC + report.appendUint64(startAddress); + report.appendUint16(readLength); + report.appendBits(16, CRCHelper::calculateCRC(readData, readLength)); } else { ErrorHandler::reportError(request, ErrorHandler::AddressOutOfRange); } } - mainService.storeMessage(report); // Save the report message - request.resetRead(); // Reset the reading count + mainService.storeMessage(report); + request.resetRead(); } else { - // todo: Send a failed start of execution report + // TODO: Send a failed start of execution report } } -// Private function declaration section bool MemoryManagementService::addressValidator(MemoryManagementService::MemoryID memId, uint64_t address) { bool validIndicator = false; @@ -202,7 +175,7 @@ bool MemoryManagementService::addressValidator(MemoryManagementService::MemoryID break; default: - validIndicator = true; // todo: Implemented so addresses from PC can be read. Remove. + validIndicator = true; // TODO: Implemented so addresses from PC can be read. Remove. break; } diff --git a/src/Services/ParameterService.cpp b/src/Services/ParameterService.cpp index 417debf6..140eca27 100644 --- a/src/Services/ParameterService.cpp +++ b/src/Services/ParameterService.cpp @@ -1,21 +1,14 @@ #include "ECSS_Configuration.hpp" #ifdef SERVICE_PARAMETER -#include "Services/ParameterService.hpp" #include "Helpers/Parameter.hpp" +#include "Services/ParameterService.hpp" void ParameterService::reportParameters(Message& paramIds) { - // TM[20,2] - Message parameterReport(ParameterService::ServiceType, ParameterService::MessageType::ParameterValuesReport, - Message::TM, 1); - ErrorHandler::assertRequest(paramIds.packetType == Message::TC, paramIds, - ErrorHandler::AcceptanceErrorType::UnacceptableMessage); - ErrorHandler::assertRequest(paramIds.messageType == ParameterService::MessageType::ReportParameterValues, paramIds, - ErrorHandler::AcceptanceErrorType::UnacceptableMessage); - ErrorHandler::assertRequest(paramIds.serviceType == ParameterService::ServiceType, paramIds, - ErrorHandler::AcceptanceErrorType::UnacceptableMessage); + paramIds.assertTC(ServiceType, ReportParameterValues); + Message parameterReport = createTM(ParameterValuesReport); uint16_t numOfIds = paramIds.readUint16(); uint16_t numberOfValidIds = 0; @@ -42,12 +35,7 @@ void ParameterService::reportParameters(Message& paramIds) { } void ParameterService::setParameters(Message& newParamValues) { - ErrorHandler::assertRequest(newParamValues.packetType == Message::TC, newParamValues, - ErrorHandler::AcceptanceErrorType::UnacceptableMessage); - ErrorHandler::assertRequest(newParamValues.messageType == ParameterService::MessageType::SetParameterValues, - newParamValues, ErrorHandler::AcceptanceErrorType::UnacceptableMessage); - ErrorHandler::assertRequest(newParamValues.serviceType == ParameterService::ServiceType, newParamValues, - ErrorHandler::AcceptanceErrorType::UnacceptableMessage); + newParamValues.assertTC(ServiceType, MessageType::SetParameterValues); uint16_t numOfIds = newParamValues.readUint16(); diff --git a/src/Services/ParameterStatisticsService.cpp b/src/Services/ParameterStatisticsService.cpp index c490c91a..45982157 100644 --- a/src/Services/ParameterStatisticsService.cpp +++ b/src/Services/ParameterStatisticsService.cpp @@ -3,7 +3,9 @@ #include "ServicePool.hpp" #include "Services/ParameterStatisticsService.hpp" -ParameterStatisticsService::ParameterStatisticsService() : evaluationStartTime(TimeGetter::getCurrentTimeCustomCUC()) {} +ParameterStatisticsService::ParameterStatisticsService() : evaluationStartTime(TimeGetter::getCurrentTimeCustomCUC()) { + serviceType = ServiceType; +} void ParameterStatisticsService::reportParameterStatistics(Message& request) { request.assertTC(ServiceType, MessageType::ReportParameterStatistics); @@ -20,7 +22,7 @@ void ParameterStatisticsService::reportParameterStatistics(Message& request) { } void ParameterStatisticsService::parameterStatisticsReport() { - Message report(ServiceType, MessageType::ParameterStatisticsReport, Message::TM, 1); + Message report = createTM(ParameterStatisticsReport); report.append(evaluationStartTime); auto evaluationStopTime = TimeGetter::getCurrentTimeCustomCUC(); report.append(evaluationStopTime); @@ -156,7 +158,7 @@ void ParameterStatisticsService::reportStatisticsDefinitions(Message& request) { } void ParameterStatisticsService::statisticsDefinitionsReport() { - Message definitionsReport(ServiceType, MessageType::ParameterStatisticsDefinitionsReport, Message::TM, 1); + Message definitionsReport = createTM(ParameterStatisticsDefinitionsReport); uint16_t currentReportingInterval = 0; if (periodicStatisticsReportingStatus) { diff --git a/src/Services/StorageAndRetrievalService.cpp b/src/Services/StorageAndRetrievalService.cpp index 23f06f48..0f83c10d 100644 --- a/src/Services/StorageAndRetrievalService.cpp +++ b/src/Services/StorageAndRetrievalService.cpp @@ -334,7 +334,7 @@ void StorageAndRetrievalService::deletePacketStoreContent(Message& request) { void StorageAndRetrievalService::packetStoreContentSummaryReport(Message& request) { request.assertTC(ServiceType, MessageType::ReportContentSummaryOfPacketStores); - Message report(ServiceType, MessageType::PacketStoreContentSummaryReport, Message::TM, 1); + Message report = createTM(PacketStoreContentSummaryReport); uint16_t numOfPacketStores = request.readUint16(); if (numOfPacketStores == 0) { @@ -479,7 +479,7 @@ void StorageAndRetrievalService::abortByTimeRangeRetrieval(Message& request) { void StorageAndRetrievalService::packetStoresStatusReport(Message& request) { request.assertTC(ServiceType, MessageType::ReportStatusOfPacketStores); - Message report(ServiceType, MessageType::PacketStoresStatusReport, Message::TM, 1); + Message report = createTM(PacketStoresStatusReport); report.appendUint16(packetStores.size()); for (auto& packetStore : packetStores) { auto packetStoreId = packetStore.first; @@ -593,8 +593,8 @@ void StorageAndRetrievalService::deletePacketStores(Message& request) { void StorageAndRetrievalService::packetStoreConfigurationReport(Message& request) { request.assertTC(ServiceType, MessageType::ReportConfigurationOfPacketStores); + Message report = createTM(PacketStoreConfigurationReport); - Message report(ServiceType, MessageType::PacketStoreConfigurationReport, Message::TM, 1); report.appendUint16(packetStores.size()); for (auto& packetStore : packetStores) { auto packetStoreId = packetStore.first; diff --git a/src/Services/TestService.cpp b/src/Services/TestService.cpp index d85d0206..4e5622db 100644 --- a/src/Services/TestService.cpp +++ b/src/Services/TestService.cpp @@ -1,6 +1,7 @@ #include "ECSS_Configuration.hpp" #ifdef SERVICE_TEST +#include "ServicePool.hpp" #include "Services/TestService.hpp" void TestService::areYouAlive(Message& request) { diff --git a/src/Services/TimeBasedSchedulingService.cpp b/src/Services/TimeBasedSchedulingService.cpp index 967adcdd..50e0c391 100644 --- a/src/Services/TimeBasedSchedulingService.cpp +++ b/src/Services/TimeBasedSchedulingService.cpp @@ -9,7 +9,9 @@ TimeBasedSchedulingService::TimeBasedSchedulingService() { Time::CustomCUC_t TimeBasedSchedulingService::executeScheduledActivity(Time::CustomCUC_t currentTime) { if (currentTime >= scheduledActivities.front().requestReleaseTime && !scheduledActivities.empty()) { - MessageParser::execute(scheduledActivities.front().request); + if (scheduledActivities.front().requestID.applicationID == ApplicationId) { + MessageParser::execute(scheduledActivities.front().request); + } scheduledActivities.pop_front(); } diff --git a/test/Services/ParameterService.cpp b/test/Services/ParameterService.cpp index fc3a4803..fc80719b 100644 --- a/test/Services/ParameterService.cpp +++ b/test/Services/ParameterService.cpp @@ -13,7 +13,7 @@ static void resetParameterValues() { TEST_CASE("Parameter Report Subservice") { SECTION("All requested parameters invalid") { Message request = Message(ParameterService::ServiceType, ParameterService::MessageType::ReportParameterValues, - Message::TC, 1); + Message::TC, ApplicationId); request.appendUint16(3); request.appendUint16(54432); request.appendUint16(60000); diff --git a/test/Services/RequestVerificationService.cpp b/test/Services/RequestVerificationService.cpp index 8a46ee63..99e11ed9 100644 --- a/test/Services/RequestVerificationService.cpp +++ b/test/Services/RequestVerificationService.cpp @@ -15,7 +15,7 @@ TEST_CASE("TM[1,1]", "[service][st01]") { CHECK(response.serviceType == RequestVerificationService::ServiceType); CHECK(response.messageType == RequestVerificationService::MessageType::SuccessfulAcceptanceReport); CHECK(response.packetType == Message::TM); // packet type - CHECK(response.applicationId == 0); + CHECK(response.applicationId == ApplicationId); REQUIRE(response.dataSize == 4); // dataSize is the number of bytes of data array // Check for the value that is stored in <<data>> array(data-member of object response) CHECK(response.readEnumerated(3) == CCSDSPacketVersion); // packet version number @@ -36,7 +36,7 @@ TEST_CASE("TM[1,2]", "[service][st01]") { CHECK(response.serviceType == RequestVerificationService::ServiceType); CHECK(response.messageType == RequestVerificationService::MessageType::FailedAcceptanceReport); CHECK(response.packetType == Message::TM); // packet type - CHECK(response.applicationId == 0); + CHECK(response.applicationId == ApplicationId); REQUIRE(response.dataSize == 6); // dataSize is the number of bytes of data array // Check for the value that is stored in <<data>> array(data-member of object response) CHECK(response.readEnumerated(3) == CCSDSPacketVersion); // packet version number @@ -58,7 +58,7 @@ TEST_CASE("TM[1,3]", "[service][st01]") { CHECK(response.serviceType == RequestVerificationService::ServiceType); CHECK(response.messageType == RequestVerificationService::MessageType::SuccessfulStartOfExecution); CHECK(response.packetType == Message::TM); // packet type - CHECK(response.applicationId == 0); + CHECK(response.applicationId == ApplicationId); REQUIRE(response.dataSize == 4); // dataSize is the number of bytes of data array // Check for the value that is stored in <<data>> array(data-member of object response) CHECK(response.readEnumerated(3) == CCSDSPacketVersion); // packet version number @@ -79,7 +79,7 @@ TEST_CASE("TM[1,4]", "[service][st01]") { CHECK(response.serviceType == RequestVerificationService::ServiceType); CHECK(response.messageType == RequestVerificationService::MessageType::FailedStartOfExecution); CHECK(response.packetType == Message::TM); // packet type - CHECK(response.applicationId == 0); + CHECK(response.applicationId == ApplicationId); REQUIRE(response.dataSize == 6); // dataSize is the number of bytes of data array // Check for the value that is stored in <<data>> array(data-member of object response) CHECK(response.readEnumerated(3) == CCSDSPacketVersion); // packet version number @@ -101,7 +101,7 @@ TEST_CASE("TM[1,5]", "[service][st01]") { CHECK(response.serviceType == RequestVerificationService::ServiceType); CHECK(response.messageType == RequestVerificationService::MessageType::SuccessfulProgressOfExecution); CHECK(response.packetType == Message::TM); // packet type - CHECK(response.applicationId == 0); + CHECK(response.applicationId == ApplicationId); REQUIRE(response.dataSize == 5); // dataSize is the number of bytes of data array // Check for the value that is stored in <<data>> array(data-member of object response) CHECK(response.readEnumerated(3) == CCSDSPacketVersion); // packet version number @@ -123,7 +123,7 @@ TEST_CASE("TM[1,6]", "[service][st01]") { CHECK(response.serviceType == RequestVerificationService::ServiceType); CHECK(response.messageType == RequestVerificationService::MessageType::FailedProgressOfExecution); CHECK(response.packetType == Message::TM); // packet type - CHECK(response.applicationId == 0); + CHECK(response.applicationId == ApplicationId); REQUIRE(response.dataSize == 7); // dataSize is the number of bytes of data array // Check for the value that is stored in <<data>> array(data-member of object response) CHECK(response.readEnumerated(3) == CCSDSPacketVersion); // packet version number @@ -146,7 +146,7 @@ TEST_CASE("TM[1,7]", "[service][st01]") { CHECK(response.serviceType == RequestVerificationService::ServiceType); CHECK(response.messageType == RequestVerificationService::MessageType::SuccessfulCompletionOfExecution); CHECK(response.packetType == Message::TM); // packet type - CHECK(response.applicationId == 0); + CHECK(response.applicationId == ApplicationId); REQUIRE(response.dataSize == 4); // dataSize is the number of bytes of data array // Check for the value that is stored in <<data>> array(data-member of object response) CHECK(response.readEnumerated(3) == CCSDSPacketVersion); // packet version number @@ -166,7 +166,7 @@ TEST_CASE("TM[1,8]", "[service][st01]") { CHECK(response.serviceType == RequestVerificationService::ServiceType); CHECK(response.messageType == RequestVerificationService::MessageType::FailedCompletionOfExecution); CHECK(response.packetType == Message::TM); // packet type - CHECK(response.applicationId == 0); + CHECK(response.applicationId == ApplicationId); REQUIRE(response.dataSize == 6); // dataSize is the number of bytes of data array // Check for the value that is stored in <<data>> array(data-member of object response) CHECK(response.readEnumerated(3) == CCSDSPacketVersion); // packet version number @@ -188,7 +188,7 @@ TEST_CASE("TM[1,10]", "[service][st01]") { CHECK(response.serviceType == RequestVerificationService::ServiceType); CHECK(response.messageType == RequestVerificationService::MessageType::FailedRoutingReport); CHECK(response.packetType == Message::TM); // packet type - CHECK(response.applicationId == 0); + CHECK(response.applicationId == ApplicationId); REQUIRE(response.dataSize == 6); // dataSize is the number of bytes of data array // Check for the value that is stored in <<data>> array(data-member of object response) CHECK(response.readEnumerated(3) == CCSDSPacketVersion); // packet version number diff --git a/test/Services/TestService.cpp b/test/Services/TestService.cpp index 3a772b28..caee8703 100644 --- a/test/Services/TestService.cpp +++ b/test/Services/TestService.cpp @@ -27,7 +27,7 @@ TEST_CASE("TM[17,2]", "[service][st17]") { TEST_CASE("TC[17,3]", "[service][st17]") { Message receivedPacket = Message(TestService::ServiceType, TestService::MessageType::OnBoardConnectionTest, Message::TC, 1); - receivedPacket.appendEnum16(40); + receivedPacket.appendEnum16(ApplicationId); MessageParser::execute(receivedPacket); REQUIRE(ServiceTests::hasOneMessage()); @@ -35,7 +35,7 @@ TEST_CASE("TC[17,3]", "[service][st17]") { CHECK(response.serviceType == TestService::ServiceType); CHECK(response.messageType == TestService::MessageType::OnBoardConnectionTestReport); REQUIRE(response.dataSize == 2); - CHECK(response.readEnum16() == 40); + CHECK(response.readEnum16() == ApplicationId); } TEST_CASE("TM[17,4]", "[service][st17]") { -- GitLab