Skip to content
Snippets Groups Projects
Commit 61c5514c authored by athatheocsd's avatar athatheocsd
Browse files

Updated MessageParser::execute function

Added test basics
parent 6b5ce761
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,8 @@ class Message;
*/
class Message {
public:
Message (){}
enum PacketType {
TM = 0, // Telemetry
TC = 1 // Telecommand
......
......@@ -37,6 +37,17 @@ public:
*/
Message parse(uint8_t * data, uint32_t length);
/**
* @todo: elaborate on this comment
* Create a message so that a string can be parsed
*/
Message parseTC(String<256> data, ){
Message message;
message.packetType = Message::TC;
parseTC(data, 15, message);
return message;
}
private:
/**
* Parse the ECSS Telecommand packet secondary header
......
......@@ -97,7 +97,7 @@ public:
* Custom function that is called right after an event takes place, to initiate
* the execution of the action
*/
void execute(Message &message);
void executeAction(Message &message);
/**
* Setter for event-action function status
......@@ -105,11 +105,6 @@ public:
void setEventActionFunctionStatus(EventActionFunctionStatus e) {
eventActionFunctionStatus = e;
}
/**
* The purpose of this instance is to access the execute function
*/
static EventActionService instance;
};
#endif //ECSS_SERVICES_EVENTACTIONSERVICE_HPP
......@@ -8,7 +8,6 @@
TestService TestService::instance;
RequestVerificationService RequestVerificationService::instance;
EventActionService EventActionService::instance;
void MessageParser::execute(Message &message) {
switch (message.serviceType) {
......@@ -18,8 +17,6 @@ void MessageParser::execute(Message &message) {
case 17:
TestService::instance.execute(message);
break;
case 19:
EventActionService::instance.execute(message);
default:
// cout is very bad for embedded systems
std::cout << "This service hasn't been implemented yet or it doesn't exist";
......
......@@ -170,7 +170,7 @@ void EventActionService::disableEventActionFunction(Message message) {
setEventActionFunctionStatus(EventActionFunctionStatus::disabledFunction);
}
}
// Should I use the name execute here instead of executeAction?
void EventActionService::execute(Message &message) {
// Custom function
if (eventActionFunctionStatus == enabledFunction) {
......
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