diff --git a/inc/Services/EventReportService.hpp b/inc/Services/EventReportService.hpp index f0040037ef42c943c45e10c4c13e7482f4de99d1..ff2ce884f3808343272b73290e34859a17a57c6f 100644 --- a/inc/Services/EventReportService.hpp +++ b/inc/Services/EventReportService.hpp @@ -20,22 +20,55 @@ public: serviceType = 5; } + /** + * Type of the information event + */ enum InformationEvent { - UnknownEvent = 0, + /** + * An unknown event occured + */ + InformativeUnknownEvent = 0, + /** + * Watchdogs have reset + */ WWDGReset = 1, + /** + * Dont + */ AssertionFail = 2, + /** + * Microcontroller has started + */ MCUStart = 3, }; + /** + * Type of the low severity anomaly event + */ enum LowSeverityAnomalyEvent { + /** + * An unknown anomaly of low severity anomalyhas occurred + */ LowSeverityUnknownEvent = 1, }; + /** + * Type of the medium severity anomaly event + */ enum MediumSeverityAnomalyEvent { + /** + * An unknown anomaly of medium severity has occurred + */ MediumSeverityUnknownEvent = 2, }; + /** + * Type of the high severity anomaly event + */ enum HighSeverityAnomalyEvent { + /** + * An unknown anomaly of high severity has occurred + */ HighSeverityUnknownEvent = 3, }; diff --git a/src/Services/EventReportService.cpp b/src/Services/EventReportService.cpp index 0a89f5c9765aa49e8932c0df9c1a4f1ed732a4ac..a695db26624424c39b5b202268fd136eceae5299 100644 --- a/src/Services/EventReportService.cpp +++ b/src/Services/EventReportService.cpp @@ -1,3 +1,6 @@ + +#include <Services/EventReportService.hpp> + #include "Services/EventReportService.hpp" #include "Message.hpp" @@ -44,3 +47,20 @@ EventReportService::highSeverityAnomalyReport(HighSeverityAnomalyEvent eventID, storeMessage(report); } + +void EventReportService::enableReportGeneration(uint8_t N) { + +} + +void EventReportService::disableReportGeneration(uint8_t N) { + +} + +void EventReportService::requestListOfDisabledEvents() { + +} + +void EventReportService::listOfDisabledEventsReport() { + +} + diff --git a/src/main.cpp b/src/main.cpp index d6457a5ca9f5446fbcd815a027404e2c8f917224..7263dd8dd5ba20d50619277af99cef855f934fcf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -68,13 +68,13 @@ int main() { rcvPack.appendEnum8(MemoryManagementService::MemoryID::RAM); // Memory ID rcvPack.appendUint16(3); // Iteration count rcvPack.appendUint64(reinterpret_cast<uint64_t >(string)); // Start address - rcvPack.appendUint16(sizeof(string)/ sizeof(string[0])); // Data read length + rcvPack.appendUint16(sizeof(string) / sizeof(string[0])); // Data read length rcvPack.appendUint64(reinterpret_cast<uint64_t >(anotherStr)); - rcvPack.appendUint16(sizeof(anotherStr)/ sizeof(anotherStr[0])); + rcvPack.appendUint16(sizeof(anotherStr) / sizeof(anotherStr[0])); rcvPack.appendUint64(reinterpret_cast<uint64_t >(yetAnotherStr)); - rcvPack.appendUint16(sizeof(yetAnotherStr)/ sizeof(yetAnotherStr[0])); + rcvPack.appendUint16(sizeof(yetAnotherStr) / sizeof(yetAnotherStr[0])); memMangService.rawDataMemorySubservice.dumpRawData(rcvPack); rcvPack = Message(6, 2, Message::TC, 1); @@ -87,7 +87,7 @@ int main() { rcvPack.appendUint64(reinterpret_cast<uint64_t >(pStr + 1)); // Start address rcvPack.appendOctetString(1, data); memMangService.rawDataMemorySubservice.loadRawData(rcvPack); - + // ST[01] test // parameters take random values and works as expected @@ -101,8 +101,8 @@ int main() { // ST[05] test [works] const unsigned char eventReportData[12] = "Hello World"; EventReportService eventReportService; - eventReportService.informativeEventReport(EventReportService::UnknownEvent, eventReportData, - 11); + eventReportService.informativeEventReport(EventReportService::InformativeUnknownEvent, + eventReportData, 11); eventReportService.lowSeverityAnomalyReport(EventReportService::LowSeverityUnknownEvent, eventReportData, 11); eventReportService.mediumSeverityAnomalyReport(EventReportService::MediumSeverityUnknownEvent, diff --git a/test/Services/EventReportService.cpp b/test/Services/EventReportService.cpp index bef6e18118e5fd46d977d6a4a8d6fc33af98589c..3d944e89bc2c616b14b0d4101c1e30f93a1f0c38 100644 --- a/test/Services/EventReportService.cpp +++ b/test/Services/EventReportService.cpp @@ -11,15 +11,15 @@ TEST_CASE("Informative Event Report TM[5,1]", "[service][st05]") { EventReportService eventReportService; const unsigned char eventReportData[] = "HelloWorld"; char checkString[255]; - eventReportService.informativeEventReport(EventReportService::UnknownEvent, eventReportData, - 10); + eventReportService.informativeEventReport(EventReportService::InformativeUnknownEvent, + eventReportData, 10); REQUIRE(ServiceTests::hasOneMessage()); Message report = ServiceTests::get(0); // Checks for the data-members of the report Message created CHECK(report.serviceType == 5); CHECK(report.messageType == 1); - CHECK(report.packetType == 0); // packet type(TM = 0, TC = 1) + CHECK(report.packetType == Message::TM); // packet type(TM = 0, TC = 1) REQUIRE(report.dataSize == 12); // Check for the value that is stored in <<data>> array(data-member of object response) CHECK(report.readEnum16() == 0); @@ -39,7 +39,7 @@ TEST_CASE("Loww Severity Anomaly Report TM[5,2]", "[service][st05]") { // Checks for the data-members of the report Message created CHECK(report.serviceType == 5); CHECK(report.messageType == 2); - CHECK(report.packetType == 0); // packet type(TM = 0, TC = 1) + CHECK(report.packetType == Message::TM); // packet type(TM = 0, TC = 1) REQUIRE(report.dataSize == 12); // Check for the value that is stored in <<data>> array(data-member of object response) CHECK(report.readEnum16() == 1); @@ -59,7 +59,7 @@ TEST_CASE("Medium Severity Anomaly Report TM[5,3]", "[service][st05]") { // Checks for the data-members of the report Message created CHECK(report.serviceType == 5); CHECK(report.messageType == 3); - CHECK(report.packetType == 0); // packet type(TM = 0, TC = 1) + CHECK(report.packetType == Message::TM); // packet type(TM = 0, TC = 1) REQUIRE(report.dataSize == 12); // Check for the value that is stored in <<data>> array(data-member of object response) CHECK(report.readEnum16() == 2); @@ -79,7 +79,7 @@ TEST_CASE("High Severity Anomaly Report TM[5,4]", "[service][st05]") { // Checks for the data-members of the report Message created CHECK(report.serviceType == 5); CHECK(report.messageType == 4); - CHECK(report.packetType == 0); // packet type(TM = 0, TC = 1) + CHECK(report.packetType == Message::TM); // packet type(TM = 0, TC = 1) REQUIRE(report.dataSize == 12); // Check for the value that is stored in <<data>> array(data-member of object response) CHECK(report.readEnum16() == 3);