Skip to content
Snippets Groups Projects
Unverified Commit bd8b1a3e authored by Dimitrios Stoupis's avatar Dimitrios Stoupis
Browse files

Renamed and added some definitions

parent ac4d3b79
No related branches found
No related tags found
No related merge requests found
......@@ -15,4 +15,15 @@
// 9.3.1a.1.e
#define ECSS_SEQUENCE_FLAGS 0x3
#define ECSS_MAX_REQUEST_COUNT 20 // todo: Needs to be defined
#define ECSS_TC_REQUEST_STRING_SIZE 64
#define ECSS_MAX_NUMBER_OF_TIME_SCHED_ACTIVITIES 10 // todo: Define the maximum number of activities
#define ECSS_TIME_MARGIN_FOR_ACTIVATION 60 // todo: Define the time margin for the command activation
#define ECSS_MAX_DELTA_OF_RELEASE_TIME 60 // todo: Define the maximum delta between the specified
// release time and the actual release time
#endif //ECSS_SERVICES_ECSS_DEFINITIONS_H
......@@ -48,11 +48,11 @@ public:
* this great analysis:
* stackoverflow.com/questions/15078638/can-i-turn-unsigned-char-into-char-and-vice-versa
*/
Message parseRequestTC(String<ECSS_EVENT_SERVICE_STRING_SIZE> data);
Message parseRequestTC(String<ECSS_TC_REQUEST_STRING_SIZE> data);
Message parseRequestTC(uint8_t* data);
String<ECSS_EVENT_SERVICE_STRING_SIZE> convertTCToStr(Message& message);
String<ECSS_TC_REQUEST_STRING_SIZE> convertTCToStr(Message& message);
private:
/**
......
#ifndef ECSS_SERVICES_EVENTACTIONSERVICE_HPP
#define ECSS_SERVICES_EVENTACTIONSERVICE_HPP
#define ECSS_EVENT_SERVICE_STRING_SIZE 64
#define ECSS_EVENT_ACTION_STRUCT_ARRAY_SIZE 256
......
......@@ -15,10 +15,6 @@
#define GROUPS_ENABLED 0
#define SUB_SCHEDULES_ENABLED 0
#define MAX_NUMBER_OF_ACTIVITIES 10 // todo: Define the maximum number of activities
#define TIME_MARGIN_FOR_ACTIVATION 60 // todo: Define the time margin for the command activation
#define MAX_DELTA_OF_RELEASE_TIME 60 // todo: Define the maximum delta between the specified
// release time and the actual release time
namespace unit_test {
struct Tester;
......@@ -55,7 +51,7 @@ private:
};
// Scheduled activity definitions
etl::vector<ScheduledActivity, MAX_NUMBER_OF_ACTIVITIES> scheduledActivities;
etl::vector<ScheduledActivity, ECSS_MAX_NUMBER_OF_TIME_SCHED_ACTIVITIES> scheduledActivities;
// Enable tester access to private members
friend struct ::unit_test::Tester;
......@@ -120,7 +116,7 @@ public:
* TM[11,10] response
* @param request Provide the received message as a parameter
*/
void detailReporActivitiesByID(Message &request);
void detailReportActivitiesByID(Message &request);
/**
* TC[11,12] summary-report activities identified by request identifier
......@@ -129,7 +125,7 @@ public:
* TM[11,13] response
* @param request Provide the received message as a parameter
*/
void summaryReporActivitiesByID(Message &request);
void summaryReportActivitiesByID(Message &request);
/**
* TC[11,5] delete time-based scheduled activities identified by a request identifier
......
......@@ -76,29 +76,29 @@ void MessageParser::parseTC(const uint8_t *data, uint16_t length, Message &messa
message.dataSize = length;
}
Message MessageParser::parseRequestTC(String<ECSS_EVENT_SERVICE_STRING_SIZE> data) {
Message MessageParser::parseRequestTC(String<ECSS_TC_REQUEST_STRING_SIZE> data) {
Message message;
auto *dataInt = reinterpret_cast<uint8_t *>(data.data());
message.packetType = Message::TC;
parseTC(dataInt, ECSS_EVENT_SERVICE_STRING_SIZE, message);
parseTC(dataInt, ECSS_TC_REQUEST_STRING_SIZE, message);
return message;
}
Message MessageParser::parseRequestTC(uint8_t* data) {
Message message;
message.packetType = Message::TC;
parseTC(data, ECSS_EVENT_SERVICE_STRING_SIZE, message);
parseTC(data, ECSS_TC_REQUEST_STRING_SIZE, message);
return message;
}
String<ECSS_EVENT_SERVICE_STRING_SIZE> MessageParser::convertTCToStr(Message &message) {
uint8_t tempString[ECSS_EVENT_SERVICE_STRING_SIZE] = {0};
String<ECSS_TC_REQUEST_STRING_SIZE> MessageParser::convertTCToStr(Message &message) {
uint8_t tempString[ECSS_TC_REQUEST_STRING_SIZE] = {0};
tempString[0] = ECSS_PUS_VERSION << 4; // Assign the pusVersion = 2
tempString[1] = message.serviceType;
tempString[2] = message.messageType;
memcpy(tempString + 5, message.data, ECSS_EVENT_SERVICE_STRING_SIZE - 5);
String<ECSS_EVENT_SERVICE_STRING_SIZE> dataString(tempString);
memcpy(tempString + 5, message.data, ECSS_TC_REQUEST_STRING_SIZE - 5);
String<ECSS_TC_REQUEST_STRING_SIZE> dataString(tempString);
return dataString;
}
......
......@@ -35,13 +35,13 @@ void EventActionService::addEventActionDefinitions(Message message) {
eventActionDefinitionArray[index].enabled = true;
eventActionDefinitionArray[index].applicationId = applicationID;
eventActionDefinitionArray[index].eventDefinitionID = eventDefinitionID;
if (message.dataSize - 4 > ECSS_EVENT_SERVICE_STRING_SIZE) {
if (message.dataSize - 4 > ECSS_TC_REQUEST_STRING_SIZE) {
ErrorHandler::reportInternalError(
ErrorHandler::InternalErrorType::MessageTooLarge);
} else {
char data[ECSS_EVENT_SERVICE_STRING_SIZE];
char data[ECSS_TC_REQUEST_STRING_SIZE];
message.readString(data, message.dataSize - 4);
eventActionDefinitionArray[index].request = String<ECSS_EVENT_SERVICE_STRING_SIZE>(
eventActionDefinitionArray[index].request = String<ECSS_TC_REQUEST_STRING_SIZE>(
data);
}
}
......
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