diff --git a/inc/ECSS_Definitions.hpp b/inc/ECSS_Definitions.hpp index 90eec5444a553b3ffb8781562fad03740c08f29e..eb2f737d61cdc9908902200278d251f14b740910 100644 --- a/inc/ECSS_Definitions.hpp +++ b/inc/ECSS_Definitions.hpp @@ -94,6 +94,12 @@ */ #define ECSS_TIME_MARGIN_FOR_ACTIVATION 60 +/** + * @brief Maximum size of an event's auxiliary data + * @see EventReportService + */ +#define ECSS_EVENT_DATA_AUXILIARY_MAX_SIZE 64 + /** * @brief Size of the multimap that holds every event-action definition * @see EventActionService diff --git a/inc/ErrorHandler.hpp b/inc/ErrorHandler.hpp index 238d685d6c92a345ec171e7b607c728022c15ba5..caeae9c80520866bd895f9e1e3db2bd4e4080204 100644 --- a/inc/ErrorHandler.hpp +++ b/inc/ErrorHandler.hpp @@ -229,11 +229,17 @@ public: * Reports a failure that occurred internally, not due to a failure of a received packet. * * Creates an error if \p condition is false. The created error is Internal. + * + * @param condition The condition to check. Throws an error if false. + * @param errorCode The error code that is assigned to this error. One of the \ref ErrorHandler enum values. + * @return Returns \p condition, i.e. true if the assertion is successful, false if not. */ - static void assertInternal(bool condition, InternalErrorType errorCode) { + static bool assertInternal(bool condition, InternalErrorType errorCode) { if (not condition) { reportInternalError(errorCode); } + + return condition; } /** @@ -242,12 +248,19 @@ public: * Reports a failure that occurred while processing a request, in any of the process phases. * * Creates an error if \p condition is false. The created error corresponds to a \p message. + * + * @param condition The condition to check. Throws an error if false. + * @param message The message to associate with this error + * @param errorCode The error code that is assigned to this error. One of the \ref ErrorHandler enum values. + * @return Returns \p condition, i.e. true if the assertion is successful, false if not. */ template <typename ErrorType> - static void assertRequest(bool condition, const Message& message, ErrorType errorCode) { + static bool assertRequest(bool condition, const Message& message, ErrorType errorCode) { if (not condition) { reportError(message, errorCode); } + + return condition; } /** diff --git a/inc/Helpers/TimeHelper.hpp b/inc/Helpers/TimeHelper.hpp index 526b80333fbc584e87edbd3115ca3cf413766030..027e078e817bf6748ac693821d7527a9e5c7c811 100644 --- a/inc/Helpers/TimeHelper.hpp +++ b/inc/Helpers/TimeHelper.hpp @@ -33,7 +33,7 @@ * decides what the time unit will be, so this is a subject for discussion. The recommended time unit from the * standard is the second and it is probably the best solution for accuracy. * - * @notes + * @note * The defined epoch for both time formats is 1 January 1958 00:00:00 * * Since CDS format is UTC-based, the leap second correction must be made. The leap seconds that @@ -56,7 +56,7 @@ public: /** * Convert UTC date to elapsed seconds since Unix epoch (1/1/1970 00:00:00). * - * This is a reimplemented mktime() of <ctime> library in an embedded systems way + * This is a reimplemented `mktime()` of the `<ctime>` library in an embedded compatible way * * @note * This function can convert UTC dates after 1 January 2019 to elapsed seconds since Unix epoch @@ -71,7 +71,7 @@ public: /** * Convert elapsed seconds since Unix epoch to UTC date. * - * This is a reimplemented gmtime() of <ctime> library in an embedded systems way + * This is a reimplemented `gmtime()` of the `<ctime>` library in an embedded compatible way * * @note * This function can convert elapsed seconds since Unix epoch to UTC dates after 1 January 2019 @@ -110,7 +110,7 @@ public: * * Converts a UTC date to CUC time format. * - * @notes + * @note * The T-field is specified for the seconds passed from the defined epoch 1 January 1958. We use 4 octets(32 * bits) for the time unit (seconds) because 32 bits for the seconds are enough to count 136 years! But if we use 24 * bits for the seconds then it will count 0,5 years and this isn't enough. Remember we can use only integers diff --git a/inc/Message.hpp b/inc/Message.hpp index b59938dda18b932830057e602fab0178eba81ea1..f94c31bea5cf52138caec588a6f2ec3803794459 100644 --- a/inc/Message.hpp +++ b/inc/Message.hpp @@ -33,7 +33,7 @@ public: /** * @brief Overload the equality operator to compare messages * @details Compare two @ref ::Message objects, based on their contents and type - * @param The message content to compare against + * @param msg The message content to compare against * @return The result of comparison */ bool operator==(const Message& msg) const { diff --git a/inc/MessageParser.hpp b/inc/MessageParser.hpp index 7bc486ef8da6fff253fdf4f02b69593ffafc6fe5..82517e8203cd2eb0735e3625c82ef97b9eb0646f 100644 --- a/inc/MessageParser.hpp +++ b/inc/MessageParser.hpp @@ -36,9 +36,7 @@ public: * This function takes as input TC packets and calls the proper services' functions that have been * implemented to handle TC packets. * - * @param Message Contains the necessary parameters to call the suitable subservice - * @todo Implement the execute() in the upcoming services or generally in the upcoming - * activities + * @param message Contains the necessary parameters to call the suitable subservice */ static void execute(Message& message); @@ -73,8 +71,8 @@ public: * @brief Converts a TC or TM message to a message string, appending just the ECSS header * @todo Add time reference, as soon as it is available and the format has been specified * @param message The Message object to be parsed to a String - * @param size The wanted size of the message (including the headers). Messages larger than \ref size display an - * error. Messages smaller than \ref size are padded with zeros. When `size = 0`, there is no size limit. + * @param size The wanted size of the message (including the headers). Messages larger than \p size display an + * error. Messages smaller than \p size are padded with zeros. When `size = 0`, there is no size limit. * @return A String class containing the parsed Message */ static String<CCSDS_MAX_MESSAGE_SIZE> composeECSS(const Message& message, uint16_t size = 0u); // Ignore-MISRA diff --git a/inc/Service.hpp b/inc/Service.hpp index e28620ffbd1c2c8d711bb52843c0ae7540ca6c34..53bf0bae49366814e9e8bff2a0d1436abbb877c8 100644 --- a/inc/Service.hpp +++ b/inc/Service.hpp @@ -36,7 +36,6 @@ protected: * 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 - * @todo Use the messageTypeCounter */ Message createTM(uint8_t messageType) { return Message(serviceType, messageType, Message::TM, 0); diff --git a/inc/Services/EventReportService.hpp b/inc/Services/EventReportService.hpp index f9b01634b7eafbbd630dddb2684bfee079a73bbd..69b80e80b504457b3e7f2ddb1cf76f16fb7ad174 100644 --- a/inc/Services/EventReportService.hpp +++ b/inc/Services/EventReportService.hpp @@ -102,9 +102,8 @@ public: * * @param eventID event definition ID * @param data the data of the report - * @param length the length of the data */ - void informativeEventReport(Event eventID, const String<64>& data); + void informativeEventReport(Event eventID, const String<ECSS_EVENT_DATA_AUXILIARY_MAX_SIZE>& data); /** * TM[5,2] low severiity anomaly report @@ -114,9 +113,8 @@ public: * * @param eventID event definition ID * @param data the data of the report - * @param length the length of the data */ - void lowSeverityAnomalyReport(Event eventID, const String<64>& data); + void lowSeverityAnomalyReport(Event eventID, const String<ECSS_EVENT_DATA_AUXILIARY_MAX_SIZE>& data); /** * TM[5,3] medium severity anomaly report @@ -126,9 +124,8 @@ public: * * @param eventID event definition ID * @param data the data of the report - * @param length the length of the data */ - void mediumSeverityAnomalyReport(Event eventID, const String<64>& data); + void mediumSeverityAnomalyReport(Event eventID, const String<ECSS_EVENT_DATA_AUXILIARY_MAX_SIZE>& data); /** * TM[5,4] high severity anomaly report @@ -138,9 +135,8 @@ public: * * @param eventID event definition ID * @param data the data of the report - * @param length the length of the data */ - void highSeverityAnomalyReport(Event eventID, const String<64>& data); + void highSeverityAnomalyReport(Event eventID, const String<ECSS_EVENT_DATA_AUXILIARY_MAX_SIZE>& data); /** * TC[5,5] request to enable report generation @@ -165,7 +161,6 @@ public: /** * TM[5,8] disabled event definitions report * Telemetry package of a report of the disabled event definitions - * @param message */ void listOfDisabledEventsReport(); @@ -182,7 +177,7 @@ public: * is the ground station. * * @note This function is called from the main execute() that is defined in the file MessageParser.hpp - * @param param Contains the necessary parameters to call the suitable subservice + * @param message Contains the necessary parameters to call the suitable subservice */ void execute(Message& message); }; diff --git a/inc/Services/FunctionManagementService.hpp b/inc/Services/FunctionManagementService.hpp index 401591ef7dd53445a460835a584c0cc5802ea6ea..36f68d84ece877d7977d6f704a73f67337702d21 100644 --- a/inc/Services/FunctionManagementService.hpp +++ b/inc/Services/FunctionManagementService.hpp @@ -46,6 +46,7 @@ * include(String<FUNC_NAME_LENGTH>("bar"), &bar); * include(String<FUNC_NAME_LENGTH>("baz"), &baz); * } + * @endcode */ typedef String<ECSS_FUNCTION_NAME_LENGTH> functionName; @@ -61,8 +62,6 @@ 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. - * - * @param None */ FunctionManagementService() = default; @@ -93,7 +92,7 @@ public: * is the ground station. * * @note This function is called from the main execute() that is defined in the file MessageParser.hpp - * @param param Contains the necessary parameters to call the suitable subservice + * @param message Contains the necessary parameters to call the suitable subservice */ void execute(Message& message); }; diff --git a/inc/Services/LargePacketTransferService.hpp b/inc/Services/LargePacketTransferService.hpp index 5b3b276cde7489fd483c60d5bde53b4f620a72a0..fe91522b0e50c5cc6007bdb0a247bb35ff584c7a 100644 --- a/inc/Services/LargePacketTransferService.hpp +++ b/inc/Services/LargePacketTransferService.hpp @@ -74,7 +74,7 @@ public: /** * Function that splits large messages - * @param Message that is exceeds the standards and has to be split down + * @param message that is exceeds the standards and has to be split down * @param largeMessageTransactionIdentifier that is a value we assign to this splitting of the large message */ void split(Message& message, uint16_t largeMessageTransactionIdentifier); diff --git a/inc/Services/MemoryManagementService.hpp b/inc/Services/MemoryManagementService.hpp index f5c1770e035621eb16cd8da5946d1745372f7208..9ae1de6e9bcd4a7aa8503c2a4475e4fe820f7085 100644 --- a/inc/Services/MemoryManagementService.hpp +++ b/inc/Services/MemoryManagementService.hpp @@ -80,7 +80,7 @@ public: * is the ground station. * * @note This function is called from the main execute() that is defined in the file MessageParser.hpp - * @param param Contains the necessary parameters to call the suitable subservice + * @param message Contains the necessary parameters to call the suitable subservice */ void execute(Message& message); diff --git a/inc/Services/TimeBasedSchedulingService.hpp b/inc/Services/TimeBasedSchedulingService.hpp index e3a6b7721a0e056fac509cb54a1db5c18dbcdbba..e748b25f3447d52f363ad08331f9748d0ec05448 100644 --- a/inc/Services/TimeBasedSchedulingService.hpp +++ b/inc/Services/TimeBasedSchedulingService.hpp @@ -59,14 +59,11 @@ private: * * @details The request identifier consists of the application process ID, the packet * sequence count and the source ID, all defined in the ECSS standard. - * @var applicationID Application process ID - * @var sequenceCount Packet sequence count - * @var sourceID Packet source ID */ struct RequestID { - uint16_t applicationID = 0; - uint16_t sequenceCount = 0; - uint8_t sourceID = 0; + uint16_t applicationID = 0; ///< Application process ID + uint16_t sequenceCount = 0; ///< Packet sequence count + uint8_t sourceID = 0; ///< Packet source ID bool operator!=(const RequestID& rightSide) const { return (sequenceCount != rightSide.sequenceCount) or (applicationID != rightSide.applicationID) or @@ -79,14 +76,11 @@ private: * * @details All scheduled activities must contain the request they exist for, their release * time and the corresponding request identifier. - * @var request Contains the received TC request - * @var requestID Contains the unique request identifier for that activity - * @var requestReleaseTime The absolute time is seconds of the request release */ struct ScheduledActivity { - Message request; // Hold the received command request - RequestID requestID; // Request ID, characteristic of the definition - uint32_t requestReleaseTime = 0; // Keep the command release time + Message request; ///< Hold the received command request + RequestID requestID; ///< Request ID, characteristic of the definition + uint32_t requestReleaseTime = 0; ///< Keep the command release time // todo: If we decide to use sub-schedules, the ID of that has to be defined // todo: If groups are used, then the group ID has to be defined here }; @@ -138,7 +132,7 @@ public: void enableScheduleExecution(Message& request); /** - * @breif TC[11,2] disable the time-based schedule execution function + * @brief TC[11,2] disable the time-based schedule execution function * * @details Disables the time-based command execution scheduling * @param request Provide the received message as a parameter diff --git a/inc/Services/TimeManagementService.hpp b/inc/Services/TimeManagementService.hpp index 22e2aefb4cbe59ce538d51ac1f0608ed15c930c8..54617aaf1aaf10ae8308741b2ff459f16ba38b20 100644 --- a/inc/Services/TimeManagementService.hpp +++ b/inc/Services/TimeManagementService.hpp @@ -8,7 +8,7 @@ * Implementation of the ST[09] time management. * * @ingroup Services - * @notes + * @note * There is a noticeable difference between setting the time using GPS and setting the time * using space packets from the ground segment. The GPS module sends the actual time of UTC (123519 * is 12:35:19 UTC), while space packets, for time configuration, sends the elapsed time units diff --git a/inc/etl/String.hpp b/inc/etl/String.hpp index 04112ef92d7ab6e6371e8b7e939619a4399c1f2e..7691f78323f636c5741a68b9cb2144e7c362fa86 100644 --- a/inc/etl/String.hpp +++ b/inc/etl/String.hpp @@ -63,7 +63,7 @@ public: * Append a specified number of bytes from a uint8_t array to the String * @details The array does NOT need to be null-terminated * @param data The characters to append - * @param n The number of characters that \ref data contains + * @param n The number of characters that \p data contains * @return This string */ String& append(const uint8_t* data, size_t n) { diff --git a/src/Services/EventReportService.cpp b/src/Services/EventReportService.cpp index baf2ba484347c417a6400cbf73f990baee8798bc..c805a5fcdfdbb5784ffe7af5e5745f75a706ec55 100644 --- a/src/Services/EventReportService.cpp +++ b/src/Services/EventReportService.cpp @@ -6,7 +6,7 @@ * @todo: Add message type in TCs * @todo: this code is error prone, depending on parameters given, add fail safes (probably?) */ -void EventReportService::informativeEventReport(Event eventID, const String<64>& data) { +void EventReportService::informativeEventReport(Event eventID, const String<ECSS_EVENT_DATA_AUXILIARY_MAX_SIZE>& data) { // TM[5,1] if (stateOfEvents[static_cast<uint16_t>(eventID)]) { Message report = createTM(1); @@ -19,7 +19,8 @@ void EventReportService::informativeEventReport(Event eventID, const String<64>& } } -void EventReportService::lowSeverityAnomalyReport(Event eventID, const String<64>& data) { +void +EventReportService::lowSeverityAnomalyReport(Event eventID, const String<ECSS_EVENT_DATA_AUXILIARY_MAX_SIZE>& data) { lowSeverityEventCount++; // TM[5,2] if (stateOfEvents[static_cast<uint16_t>(eventID)]) { @@ -35,7 +36,8 @@ void EventReportService::lowSeverityAnomalyReport(Event eventID, const String<64 } } -void EventReportService::mediumSeverityAnomalyReport(Event eventID, const String<64>& data) { +void +EventReportService::mediumSeverityAnomalyReport(Event eventID, const String<ECSS_EVENT_DATA_AUXILIARY_MAX_SIZE>& data) { mediumSeverityEventCount++; // TM[5,3] if (stateOfEvents[static_cast<uint16_t>(eventID)]) { @@ -51,7 +53,8 @@ void EventReportService::mediumSeverityAnomalyReport(Event eventID, const String } } -void EventReportService::highSeverityAnomalyReport(Event eventID, const String<64>& data) { +void +EventReportService::highSeverityAnomalyReport(Event eventID, const String<ECSS_EVENT_DATA_AUXILIARY_MAX_SIZE>& data) { highSeverityEventCount++; // TM[5,4] if (stateOfEvents[static_cast<uint16_t>(eventID)]) {