Skip to content
Snippets Groups Projects
Commit 98876dfa authored by athatheocsd's avatar athatheocsd
Browse files

Data are appended on message

parent fedaf5fb
No related branches found
No related tags found
No related merge requests found
#include "Services/EventReportService.hpp" #include "Services/EventReportService.hpp"
#include "Message.hpp" #include "Message.hpp"
void EventReportService::informativeEventReport(uint16_t eventID, const uint8_t *data, void EventReportService::informativeEventReport(uint16_t eventID, const uint8_t *data,
uint8_t length){ uint8_t length){
// TM[5,1] // TM[5,1]
Message report = createTM(1); Message report = createTM(1);
report.appendBits(16,eventID);
report.appendString(length,(char *)data);
storeMessage(report); storeMessage(report);
} }
...@@ -13,7 +15,8 @@ void EventReportService::lowSeverityAnomalyReport(uint16_t eventID, const uint8_ ...@@ -13,7 +15,8 @@ void EventReportService::lowSeverityAnomalyReport(uint16_t eventID, const uint8_
uint8_t length ){ uint8_t length ){
// TM[5,2] // TM[5,2]
Message report = createTM(2); Message report = createTM(2);
report.appendBits(16,eventID);
report.appendString(length,(char *)data);
storeMessage(report); storeMessage(report);
} }
...@@ -21,7 +24,8 @@ void EventReportService::mediumSeverityAnomalyReport(uint16_t eventID, const uin ...@@ -21,7 +24,8 @@ void EventReportService::mediumSeverityAnomalyReport(uint16_t eventID, const uin
uint8_t length){ uint8_t length){
// TM[5,3] // TM[5,3]
Message report = createTM(3); Message report = createTM(3);
report.appendBits(16,eventID);
report.appendString(length,(char *)data);
storeMessage(report); storeMessage(report);
} }
...@@ -29,6 +33,7 @@ void EventReportService::highSeverityAnomalyReport(uint16_t eventID, const uint8 ...@@ -29,6 +33,7 @@ void EventReportService::highSeverityAnomalyReport(uint16_t eventID, const uint8
uint8_t length){ uint8_t length){
// TM[5,4] // TM[5,4]
Message report = createTM(4); Message report = createTM(4);
report.appendBits(16,eventID);
report.appendString(length,(char *)data);
storeMessage(report); storeMessage(report);
} }
#include <iostream> #include <iostream>
#include <Services/TestService.hpp> #include <Services/TestService.hpp>
#include <Services/RequestVerificationService.hpp> #include <Services/RequestVerificationService.hpp>
#include <Services/EventReportService.hpp>
#include "Message.hpp" #include "Message.hpp"
int main() { int main() {
...@@ -38,5 +39,13 @@ int main() { ...@@ -38,5 +39,13 @@ int main() {
reqVerifService.failExecutionVerification(Message::TC, true, 2, 2, 10, 6); reqVerifService.failExecutionVerification(Message::TC, true, 2, 2, 10, 6);
reqVerifService.failRoutingVerification(Message::TC, true, 2, 2, 10, 7); reqVerifService.failRoutingVerification(Message::TC, true, 2, 2, 10, 7);
// ST[05] test [works]
char data[12] = "Hello World";
EventReportService eventReportService;
eventReportService.informativeEventReport(1,(const uint8_t *)data,11);
eventReportService.lowSeverityAnomalyReport(2,(const uint8_t *)data,11);
eventReportService.mediumSeverityAnomalyReport(3,(const uint8_t *)data,11);
eventReportService.highSeverityAnomalyReport(4,(const uint8_t *)data,11);
return 0; return 0;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment