Skip to content
Snippets Groups Projects
Commit 6ea9cc3a authored by athatheocsd's avatar athatheocsd
Browse files

Probably basic function of [5,5]-[5,8] completed. I'll have to check when !(sleepy).

parent 1582db45
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@
#define ECSS_EVENTS_BITS 16
class EventReportService : public Service {
public:
private:
static const uint8_t numberOfEvents = 7;
std::bitset<numberOfEvents> stateOfEvents;
public:
......@@ -124,7 +124,7 @@ public:
/**
* TC[5,7] request to report the disabled event definitions
*
* Note: No arguments, according to the standard.
*/
void requestListOfDisabledEvents();
......
#include <Services/EventReportService.hpp>
#include "Services/EventReportService.hpp"
#include "Message.hpp"
/**
*
* @todo: this code is error prone, depending on parameters given, add fail safes
* @todo: this code is error prone, depending on parameters given, add fail safes (probably?)
*/
void EventReportService::informativeEventReport(Event eventID, const uint8_t *data,
uint8_t length) {
......@@ -55,15 +56,30 @@ void EventReportService::enableReportGeneration(uint8_t length, Event *eventID)
}
void EventReportService::disableReportGeneration(uint8_t length, Event *eventID) {
// TC[5,6]
for (uint8_t i = 0; i < length; i++) {
stateOfEvents[static_cast<uint8_t> (eventID[i])] = 0;
}
}
void EventReportService::requestListOfDisabledEvents() {
// TC[5,7]
// I think this is all that is needed here.
listOfDisabledEventsReport();
}
void EventReportService::listOfDisabledEventsReport() {
// TC[5,8]
Message report = createTM(8);
// Any chance we'll have more than uint8_t (>255 events) ? This will produce an error!
uint8_t numberOfDisabledEvents = stateOfEvents.size() - stateOfEvents.any();
report.appendByte(numberOfDisabledEvents);
for (uint8_t i = 0; i < numberOfDisabledEvents; i++) {
if (stateOfEvents[i] == 0) {
report.appendEnum8(i);
}
}
storeMessage(report);
}
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