From a02612e8ee3eb0a3667742a6a15b846aeb5a1257 Mon Sep 17 00:00:00 2001 From: athatheocsd <athatheo@csd.auth.gr> Date: Tue, 27 Nov 2018 04:58:04 +0200 Subject: [PATCH] Forgot to add my work --- inc/Services/EventReportService.hpp | 53 +++++++++++++++++++++++++++++ src/Services/EventReportService.cpp | 30 ++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 inc/Services/EventReportService.hpp create mode 100644 src/Services/EventReportService.cpp diff --git a/inc/Services/EventReportService.hpp b/inc/Services/EventReportService.hpp new file mode 100644 index 00000000..78bba12e --- /dev/null +++ b/inc/Services/EventReportService.hpp @@ -0,0 +1,53 @@ +// +// Created by athanasios on 27/11/2018. +// + +#ifndef ECSS_SERVICES_EVENTREPORTSERVICE_HPP +#define ECSS_SERVICES_EVENTREPORTSERVICE_HPP + +#include "Service.hpp" +/** + * Implementation of ST[05] event reporting service + * @todo add enum event definition id (and maybe some appending?) + */ +#define CSS_EVENTS_MAX_COUNT 16 +#define ECSS_EVENTS_BITS 16 +class EventReportService: public Service { +public: + EventReportService(){ + serviceType = 5; + } + /** + * TM[5,1] informative event report + * Send report to inform the respective recipients about an event + * + * Note: The parameters are defined by the standard, but the event definition id is missing! + */ + void informativeEventReport(const uint8_t *data, uint8_t length); + + /** + * TM[5,2] low severiity anomaly report + * Send report when there is an anomaly event of low severity to the respective recipients + * + * Note: The parameters are defined by the standard, but the event definition id is missing! + */ + void lowSeverityAnomalyReport(const uint8_t *data, uint8_t length); + + /** + * TM[5,3] medium severity anomaly report + * Send report when there is an anomaly event of medium severity to the respective recipients + * + * Note: The parameters are defined by the standard, but the event definition id is missing! + */ + void mediumSeverityAnomalyReport(const uint8_t *data, uint8_t length); + + /** + * TM[5,4] high severity anomaly report + * Send report when there is an anomaly event of hgih severity to the respective recipients + * + * Note: The parameters are defined by the standard, but the event definition id is missing! + */ + void highSeverityAnomalyReport(const uint8_t *data, uint8_t length); + +}; +#endif //ECSS_SERVICES_EVENTREPORTSERVICE_HPP diff --git a/src/Services/EventReportService.cpp b/src/Services/EventReportService.cpp new file mode 100644 index 00000000..c47e0395 --- /dev/null +++ b/src/Services/EventReportService.cpp @@ -0,0 +1,30 @@ +#include "Services/EventReportService.hpp" +#include "Message.hpp" + +void EventReportService::informativeEventReport(const uint8_t *data, uint8_t length){ + // TM[5,1] + Message report = createTM(1); + + storeMessage(report); +} + +void EventReportService::lowSeverityAnomalyReport(const uint8_t *data, uint8_t length){ + // TM[5,2] + Message report = createTM(2); + + storeMessage(report); +} + +void EventReportService::mediumSeverityAnomalyReport(const uint8_t *data, uint8_t length){ + // TM[5,3] + Message report = createTM(3); + + storeMessage(report); +} + +void EventReportService::highSeverityAnomalyReport(const uint8_t *data, uint8_t length){ + // TM[5,4] + Message report = createTM(4); + + storeMessage(report); +} -- GitLab